
    :root {
        --primary: #4F46E5;
        /* Indigo 600 */
        --primary-hover: #4338CA;
        --secondary: #10B981;
        /* Emerald 500 */
        --bg-dark: #0F172A;
        /* Slate 900 */
        --bg-panel: #1E293B;
        /* Slate 800 */
        --bg-main: #F8FAFC;
        /* Slate 50 */
        --text-main: #334155;
        /* Slate 700 */
        --text-light: #F8FAFC;
        --text-muted: #94A3B8;
        --accent: #F59E0B;
        /* Amber 500 */
        --danger: #EF4444;
        --radius: 12px;
        --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    }

    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        font-family: 'Inter', sans-serif;
    }

    body {
        background-color: var(--bg-main);
        color: var(--text-main);
        min-height: 100vh;
        overflow: auto;

        /* Anti-cheating: Prevent text selection globally */
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }

    /* Allow selection only inside inputs to allow typing */
    input,
    textarea {
        user-select: text;
        -webkit-user-select: text;
        -moz-user-select: text;
        -ms-user-select: text;
    }

    #app-container {
        display: flex;
        min-height: 100vh;
        flex-direction: row;
    }

    /* Sidebar */
    .sidebar {
        width: 280px;
        background-color: var(--bg-dark);
        color: var(--text-light);
        display: flex;
        flex-direction: column;
        padding: 24px 20px;
        transition: all 0.3s ease;
        /* Si se necesita que el sidebar se quede fijo mientras el resto scrollea: */
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
    }

    .logo {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 40px;
    }

    .logo i {
        font-size: 28px;
        color: var(--primary);
    }

    .logo h2 {
        font-size: 22px;
        font-weight: 800;
        letter-spacing: -0.5px;
    }

    .user-profile {
        display: flex;
        align-items: center;
        gap: 15px;
        padding: 15px;
        background-color: var(--bg-panel);
        border-radius: var(--radius);
        margin-bottom: 30px;
        min-width: 0; /* Allows shrinking within flex containers */
    }

    .avatar {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: var(--primary);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        flex-shrink: 0;
    }

    .user-info {
        display: flex;
        flex-direction: column;
        overflow: hidden;
        min-width: 0; /* Allows text truncation to work inside flex container */
    }

    .user-email {
        font-size: 13px;
        font-weight: 600;
        line-height: 1.2;
        word-break: break-word; /* Allows long names/emails to wrap to the next line */
        width: 100%;
    }

    .status {
        font-size: 12px;
        color: var(--text-muted);
        display: flex;
        align-items: center;
        gap: 5px;
    }

    .status i {
        color: var(--secondary);
        font-size: 8px;
    }

    .nav-section {
        margin-bottom: 30px;
    }

    .nav-section h3 {
        font-size: 12px;
        text-transform: uppercase;
        color: var(--text-muted);
        letter-spacing: 1px;
        margin-bottom: 15px;
    }

    .nav-section-mocktest h3 {
        color: #f59e0b;
    }

    .nav-section ul {
        list-style: none;
    }

    .nav-item {
        padding: 12px 15px;
        border-radius: var(--radius);
        margin-bottom: 8px;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 12px;
        font-weight: 500;
        transition: all 0.2s ease;
        color: var(--text-muted);
    }

    .nav-item:hover {
        background-color: rgba(255, 255, 255, 0.05);
        color: var(--text-light);
    }

    .nav-item.active {
        background-color: var(--primary);
        color: white;
        box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    }

    .mt-auto {
        margin-top: auto;
    }

    /* Sidebar Social Media */
    .sidebar-social {
        margin-top: auto;
        padding: 16px 20px 20px;
        border-top: 1px solid rgba(255,255,255,0.08);
    }

    .sidebar-social-label {
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: 1.5px;
        color: #64748b;
        margin-bottom: 12px;
        text-align: center;
        font-weight: 600;
    }

    .sidebar-social-icons {
        display: flex;
        justify-content: center;
        gap: 10px;
    }

    .social-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        color: #94a3b8;
        background: rgba(255,255,255,0.05);
        border: 1px solid rgba(255,255,255,0.08);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        text-decoration: none;
    }

    .social-icon:hover {
        transform: translateY(-3px);
    }

    .social-youtube:hover {
        color: #fff;
        background: #FF0000;
        border-color: #FF0000;
        box-shadow: 0 4px 15px rgba(255,0,0,0.35);
    }

    .social-facebook:hover {
        color: #fff;
        background: #1877F2;
        border-color: #1877F2;
        box-shadow: 0 4px 15px rgba(24,119,242,0.35);
    }

    .social-tiktok:hover {
        color: #fff;
        background: #010101;
        border-color: #25F4EE;
        box-shadow: 0 4px 15px rgba(37,244,238,0.3);
    }

    .social-whatsapp:hover {
        color: #fff;
        background: #25D366;
        border-color: #25D366;
        box-shadow: 0 4px 15px rgba(37,211,102,0.35);
    }

    /* Main Content */
    .main-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        padding: 40px;
        /* overflow-y: auto ya no es necesario aquí porque delega al scroll nativo del body */
    }

    header {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-bottom: 40px;
    }

    header h1 {
        font-size: 32px;
        font-weight: 800;
        color: var(--bg-dark);
        margin-bottom: 20px;
    }

    .level-selector {
        display: flex;
        gap: 15px;
        background: white;
        padding: 8px;
        border-radius: 50px;
        box-shadow: var(--shadow);
    }

    .level-btn {
        border: none;
        background: transparent;
        padding: 10px 24px;
        border-radius: 50px;
        font-size: 16px;
        font-weight: 600;
        color: var(--text-muted);
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .level-btn:hover {
        color: var(--primary);
        background: rgba(79, 70, 229, 0.1);
    }

    .level-btn.selected {
        background: var(--primary);
        color: white;
        box-shadow: 0 4px 10px rgba(79, 70, 229, 0.4);
    }

    /* Custom Alert */
    .custom-alert-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.6);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 9999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .custom-alert-overlay.show {
        opacity: 1;
        pointer-events: auto;
    }

    .custom-alert-box {
        background: white;
        padding: 30px;
        border-radius: var(--radius);
        max-width: 400px;
        width: 90%;
        text-align: center;
        box-shadow: var(--shadow-lg);
        transform: translateY(20px);
        transition: transform 0.3s ease;
    }

    .custom-alert-overlay.show .custom-alert-box {
        transform: translateY(0);
    }

    .custom-alert-icon {
        font-size: 40px;
        color: var(--accent);
        margin-bottom: 15px;
    }

    .custom-alert-title {
        font-size: 20px;
        font-weight: 700;
        color: var(--bg-dark);
        margin-bottom: 10px;
    }

    .custom-alert-message {
        font-size: 15px;
        color: var(--text-muted);
        margin-bottom: 25px;
        line-height: 1.5;
    }

    .custom-alert-btn {
        background: var(--primary);
        color: white;
        border: none;
        padding: 10px 30px;
        border-radius: 50px;
        font-weight: 600;
        font-size: 15px;
        cursor: pointer;
        transition: all 0.2s;
    }

    .custom-alert-btn:hover {
        background: var(--secondary);
    }

    /* Workspace */
    .workspace {
        flex: 1;
        background: white;
        border-radius: 20px;
        box-shadow: var(--shadow-lg);
        padding: 40px;
        position: relative;
        overflow: hidden;
        overflow-y: auto;
    }

    .welcome-banner {
        text-align: center;
        padding: 40px;
        animation: fadeIn 0.5s ease;
    }

    .welcome-banner h2 {
        font-size: 28px;
        color: var(--primary);
        margin-bottom: 10px;
    }

    /* Utility Classes */
    .hidden {
        display: none !important;
    }

    .mt-10 {
        margin-top: 10px;
    }

    .mt-20 {
        margin-top: 20px;
    }

    .mb-10 {
        margin-bottom: 10px;
    }

    .text-center {
        text-align: center;
    }

    /* Buttons & Inputs */
    .btn-sync {
        width: 100%;
        padding: 12px;
        background-color: white;
        color: var(--bg-dark);
        border: none;
        border-radius: var(--radius);
        font-weight: 600;
        cursor: pointer;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 10px;
        transition: 0.2s;
    }

    .btn-sync:hover {
        background-color: #e2e8f0;
    }

    .btn-primary {
        background: var(--primary);
        color: white;
        border: none;
        padding: 12px 24px;
        border-radius: var(--radius);
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
    }

    .btn-primary:hover {
        background: var(--primary-hover);
        transform: translateY(-2px);
    }

    .btn-secondary {
        background: var(--bg-panel);
        color: white;
        border: none;
        padding: 12px 24px;
        border-radius: var(--radius);
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
    }

    .btn-secondary:hover {
        background: var(--bg-dark);
    }

    .custom-select {
        width: 100%;
        padding: 12px;
        border: 1px solid #e2e8f0;
        border-radius: var(--radius);
        font-family: 'Inter', sans-serif;
        outline: none;
    }

    .custom-select:focus {
        border-color: var(--primary);
    }

    /* Exercise Cards */
    .exercise-card {
        background: var(--bg-main);
        border: 1px solid #e2e8f0;
        border-radius: var(--radius);
        padding: 20px;
        margin-bottom: 16px;
        animation: slideUp 0.4s ease forwards;
        opacity: 0;
        transform: translateY(20px);
    }

    .exercise-question {
        font-size: 15px;
        font-weight: 600;
        margin-bottom: 16px;
        color: var(--bg-dark);
    }

    .options-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .option-label {
        display: flex;
        align-items: center;
        padding: 12px 16px;
        background: white;
        border: 2px solid #e2e8f0;
        border-radius: var(--radius);
        cursor: pointer;
        transition: all 0.2s;
        font-weight: 500;
        font-size: 14px;
    }

    .option-label:hover {
        border-color: var(--primary);
        background: #eff6ff;
    }

    .option-label input[type="radio"] {
        margin-right: 15px;
        accent-color: var(--primary);
        width: 18px;
        height: 18px;
    }

    /* States */
    .option-label.correct {
        border-color: var(--secondary);
        background: #ecfdf5;
        color: #065f46;
    }

    .option-label.incorrect {
        border-color: var(--danger);
        background: #fef2f2;
        color: #991b1b;
    }

    /* Text Input Exercises */
    .text-input-container {
        margin-top: 15px;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .text-input-exercise {
        width: 100%;
        padding: 15px 20px;
        font-size: 16px;
        border: 2px solid #e2e8f0;
        border-radius: var(--radius);
        background: white;
        transition: all 0.2s;
        outline: none;
        color: var(--bg-dark);
        font-weight: 500;
        font-family: inherit;
    }

    .text-input-exercise:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    }

    .text-input-exercise::placeholder {
        color: var(--text-muted);
        font-weight: 400;
    }

    .text-input-exercise.correct-input {
        border-color: var(--secondary);
        background-color: #ecfdf5;
        color: #065f46;
    }

    .text-input-exercise.incorrect-input {
        border-color: var(--danger);
        background-color: #fef2f2;
        color: #991b1b;
    }

    .correct-answer-feedback {
        background: #f8fafc;
        border-left: 4px solid var(--accent);
        padding: 12px 16px;
        border-radius: 4px;
        font-size: 14px;
        color: var(--bg-dark);
        display: flex;
        align-items: center;
        gap: 8px;
        animation: slideUp 0.3s ease;
    }

    .correct-answer-feedback i {
        color: var(--accent);
    }

    /* Matching Selects */
    .custom-select {
        padding: 10px;
        border: 2px solid #e2e8f0;
        border-radius: var(--radius);
        font-family: inherit;
        font-size: 15px;
        color: var(--bg-dark);
        background-color: white;
        transition: all 0.2s;
        cursor: pointer;
        outline: none;
    }

    .custom-select:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    }

    .custom-select:disabled {
        background-color: #f8fafc;
        cursor: not-allowed;
    }

    /* Visual Matching (Click-to-Connect Lines) */
    .matching-visual {
        position: relative;
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 20px;
        padding: 10px 0;
        min-height: 80px;
    }

    .matching-visual svg.matching-lines {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;
        z-index: 1;
    }

    .matching-visual svg.matching-lines line {
        stroke-width: 2.5;
        stroke-linecap: round;
    }

    .matching-col {
        display: flex;
        flex-direction: column;
        gap: 12px;
        z-index: 2;
        flex: 1;
        max-width: 45%;
    }

    .matching-col.right-col {
        align-items: flex-end;
    }

    .match-item {
        padding: 12px 18px;
        background: white;
        border: 2px solid #e2e8f0;
        border-radius: var(--radius);
        cursor: pointer;
        font-weight: 600;
        font-size: 14px;
        color: var(--text-main);
        transition: all 0.25s ease;
        position: relative;
        text-align: center;
        min-width: 80px;
        line-height: 1.4;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    }

    .match-item:hover {
        border-color: var(--primary);
        transform: translateY(-1px);
        box-shadow: 0 4px 8px rgba(79, 70, 229, 0.15);
    }

    .match-item.selected {
        border-color: var(--primary);
        background: #eff6ff;
        box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
        transform: scale(1.03);
    }

    .match-item.connected {
        border-width: 2px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    }

    .match-item .match-dot {
        display: inline-block;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        margin-right: 8px;
        vertical-align: middle;
        background: transparent;
        border: 2px solid #cbd5e1;
        transition: all 0.2s;
    }

    .right-col .match-item .match-dot {
        margin-right: 0;
        margin-left: 8px;
    }

    .match-item.connected .match-dot {
        border-color: transparent;
    }

    .match-item.correct-match {
        border-color: var(--secondary) !important;
        background: #ecfdf5 !important;
    }

    .match-item.incorrect-match {
        border-color: var(--danger) !important;
        background: #fef2f2 !important;
    }

    .match-item.disabled {
        cursor: not-allowed;
        opacity: 0.85;
    }

    .match-item.disabled:hover {
        transform: none;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    }

    /* Inline Fill-in-the-Blanks */
    .inline-question {
        line-height: 2.2;
    }

    .inline-blank {
        display: inline-block;
        width: auto;
        min-width: 100px;
        max-width: 250px;
        border: none;
        border-bottom: 2px solid var(--primary);
        border-radius: 0;
        padding: 4px 8px;
        margin: 0 5px;
        text-align: center;
        font-size: inherit;
        font-weight: 600;
        font-family: inherit;
        color: var(--primary);
        background: #f8fafc;
        box-shadow: none;
        transition: all 0.2s;
    }

    .inline-blank:focus {
        outline: none;
        border-bottom: 2px solid var(--accent);
        background: #fff;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    }

    .inline-blank.correct-input {
        border-bottom-color: var(--secondary);
        background: #ecfdf5;
        color: #065f46;
    }

    .inline-blank.incorrect-input {
        border-bottom-color: var(--danger);
        background: #fef2f2;
        color: #991b1b;
    }

    /* Audio & Reading specific */
    .media-container {
        margin-bottom: 20px;
        background: white;
        padding: 15px;
        border-radius: var(--radius);
        box-shadow: var(--shadow);
    }

    .reading-text {
        line-height: 1.8;
        color: #475569;
        font-size: 15px;
        margin-bottom: 20px;
        padding: 20px;
        background: #f8fafc;
        border-left: 4px solid var(--primary);
        border-radius: 4px;
    }

    /* Result Card */
    .result-card {
        text-align: center;
        padding: 40px;
        animation: zoomIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    .score-ring {
        width: 150px;
        height: 150px;
        border-radius: 50%;
        background: conic-gradient(var(--secondary) 0%, transparent 0%);
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 30px auto;
        position: relative;
        box-shadow: inset 0 0 0 15px #f1f5f9;
    }

    .score-ring span {
        font-size: 36px;
        font-weight: 800;
        color: var(--bg-dark);
    }

    /* Loader */
    .loader {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 200px;
    }

    .spinner {
        width: 40px;
        height: 40px;
        border: 4px solid #e2e8f0;
        border-top-color: var(--primary);
        border-radius: 50%;
        animation: spin 1s linear infinite;
        margin-bottom: 15px;
    }

    /* Sets Selector */
    .sets-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
        margin-bottom: 30px;
        animation: fadeIn 0.4s ease;
    }

    .set-card {
        background: white;
        border: 2px solid #e2e8f0;
        border-radius: var(--radius);
        padding: 30px 20px;
        text-align: center;
        cursor: pointer;
        transition: all 0.3s ease;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        box-shadow: var(--shadow);
    }

    .set-card:hover {
        border-color: var(--primary);
        box-shadow: 0 10px 25px rgba(79, 70, 229, 0.15);
        transform: translateY(-5px);
    }

    .set-card i {
        font-size: 32px;
        color: var(--primary);
        margin-bottom: 15px;
    }

    .set-card .btn-assign-set i,
    .writing-set-card .btn-assign-set i {
        font-size: 11px;
        color: white;
        margin-bottom: 0;
        margin-right: 4px;
    }

    .set-card .btn-delete-set i,
    .writing-set-card .btn-delete-set i {
        font-size: 10px;
        color: inherit;
        margin: 0;
    }

    .set-card h4 {
        font-size: 18px;
        font-weight: 700;
        color: var(--bg-dark);
        margin-bottom: 5px;
    }

    .set-card p {
        font-size: 13px;
        color: var(--text-muted);
    }

    /* Animations */
    @keyframes spin {
        to {
            transform: rotate(360deg);
        }
    }

    @keyframes slideUp {
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }

    @keyframes zoomIn {
        from {
            opacity: 0;
            transform: scale(0.9);
        }

        to {
            opacity: 1;
            transform: scale(1);
        }
    }

    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Responsive */
    @media (max-width: 768px) {
        body {
            /* Enable native scroll on body to handle mobile address bar natively */
            height: auto;
            overflow: auto;
        }

        #app-container {
            flex-direction: column;
            height: auto;
            min-height: 100vh;
        }

        .sidebar {
            width: 100%;
            height: auto;
            position: sticky;
            top: 0;
            z-index: 1000;
            padding: 12px 16px 0 16px;
            flex-direction: column;
            align-items: center;
            border-bottom: none;
            overflow-y: visible;
            background: var(--bg-dark);
        }

        .logo {
            margin-bottom: 8px;
            gap: 8px;
        }

        .logo img {
            max-width: 220px !important;
            width: 85% !important;
        }

        .logo h2 {
            font-size: 18px;
        }

        .user-profile {
            display: none;
            /* Hide standard user profile to save space entirely */
        }

        .nav-section {
            width: 100%;
            margin-bottom: 0;
        }

        .nav-section h3 {
            display: none;
            /* Hide headers */
        }

        /* On mobile, hide the separate Books section - Books tab is injected into modes UL via JS */
        .nav-section-books {
            display: none;
        }

        /* On mobile, hide coming soon items in mock test */
        .nav-coming-soon {
            display: none !important;
        }

        .nav-section ul {
            display: flex;
            gap: 6px;
            justify-content: flex-start;
            overflow-x: auto;
            padding: 0 0 10px 0;
            /* Hide scrollbar for a cleaner look */
            scrollbar-width: none;
            -ms-overflow-style: none;
        }

        .nav-section ul::-webkit-scrollbar {
            display: none;
        }

        .nav-item {
            margin-bottom: 0;
            padding: 8px 14px;
            font-size: 13px;
            white-space: nowrap;
            flex-shrink: 0;
            border-radius: 50px;
            gap: 6px;
            /* Prevent button shrinking */
        }

        .nav-item i {
            font-size: 13px;
        }

        .nav-item.active {
            box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
        }

        /* Hide divider borders on mobile nav items */
        .nav-item[style*="border-top"] {
            border-top: none !important;
            margin-top: 0 !important;
            padding-top: 8px !important;
        }

        /* Join class section: hidden on mobile (pills injected into nav row instead) */
        #join-class-section {
            display: none !important;
        }

        /* Social media: hidden on mobile sidebar (it's a horizontal bar) */
        .sidebar-social {
            display: none;
        }

        /* Mobile pills injected into nav row */
        .mobile-course-pill,
        .mobile-join-pill {
            font-size: 11px !important;
            padding: 6px 10px !important;
        }

        .main-content {
            padding: 15px;
            overflow-y: visible;
            /* Let the body scroll */
        }

        header {
            margin-bottom: 20px;
        }

        header h1 {
            font-size: 22px;
            margin-bottom: 12px;
            text-align: center;
        }

        .level-selector {
            flex-wrap: wrap;
            justify-content: center;
            gap: 6px;
            padding: 8px;
            border-radius: 12px;
        }

        .level-btn {
            padding: 8px 16px;
            font-size: 14px;
            flex: 1 1 auto;
            text-align: center;
            max-width: calc(33% - 6px);
        }

        .workspace {
            padding: 20px 15px;
            border-radius: 16px;
        }

        .welcome-banner {
            padding: 10px 0 20px 0;
        }

        .welcome-banner h2 {
            font-size: 20px;
        }

        .sets-grid {
            grid-template-columns: 1fr 1fr;
            /* 2 columns for sets on mobile */
            gap: 12px;
        }

        .set-card {
            padding: 18px 12px;
        }

        .set-card i {
            font-size: 22px;
            margin-bottom: 8px;
        }

        .set-card .btn-delete-set i {
            font-size: 10px;
            margin: 0;
        }

        .set-card h4 {
            font-size: 15px;
        }

        .exercise-question {
            font-size: 16px;
            margin-bottom: 15px;
        }

        .options-grid {
            grid-template-columns: 1fr;
            gap: 12px;
        }

        .option-label {
            padding: 14px 15px;
            font-size: 15px;
            border-width: 2px;
        }

        .media-container {
            padding: 10px;
        }

        .reading-text {
            font-size: 14px;
            padding: 15px;
        }

        .text-input-exercise {
            padding: 12px 15px;
            font-size: 15px;
        }

        .text-input-exercise.inline-blank {
            width: 85px !important;
            min-width: 60px;
            padding: 2px 4px !important;
            margin: 0 2px;
            display: inline-block !important;
            vertical-align: baseline;
            font-size: 14px;
        }

        .score-ring {
            width: 120px;
            height: 120px;
            margin: 20px auto;
        }

        .score-ring span {
            font-size: 30px;
        }

        .btn-primary,
        .btn-secondary,
        .btn-sync {
            width: 100%;
            padding: 14px;
            font-size: 15px;
            justify-content: center;
        }

        .mt-auto {
            margin-top: 10px;
        }

        /* Matching visual mobile */
        .matching-visual {
            gap: 8px;
        }

        .matching-col {
            max-width: 48%;
            gap: 8px;
        }

        .match-item {
            padding: 10px 12px;
            font-size: 13px;
            min-width: 60px;
        }

        .match-item .match-dot {
            width: 8px;
            height: 8px;
            margin-right: 5px;
        }

        .right-col .match-item .match-dot {
            margin-left: 5px;
        }
    }

    /* Exercise Images - Responsive */
    .exercise-image {
        max-width: 100%;
        border-radius: 8px;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        display: block;
        margin: 0 auto;
    }

    .reading-image {
        display: block;
        margin: 0 auto;
    }

    /* Desktop: larger images */
    @media (min-width: 769px) {
        .exercise-image {
            max-height: 450px;
            width: auto;
        }

        .reading-image {
            max-height: 400px;
            max-width: 100%;
        }
    }

    /* Mobile: keep compact */
    @media (max-width: 768px) {
        .exercise-image {
            max-height: 400px;
            width: 100%;
            object-fit: contain;
        }

        .reading-image {
            max-height: 350px;
            width: 100%;
            object-fit: contain;
        }
    }

    /* ======== VOCABULARY GAMES ======== */
    .game-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; animation: fadeIn 0.4s ease; }
    .game-card { background: white; border: 2px solid #e2e8f0; border-radius: var(--radius); padding: 28px 20px; text-align: center; cursor: pointer; transition: all 0.3s ease; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: var(--shadow); position: relative; overflow: hidden; }
    .game-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--primary), var(--secondary)); transform: scaleX(0); transition: transform 0.3s ease; }
    .game-card:hover::before { transform: scaleX(1); }
    .game-card:hover { border-color: var(--primary); box-shadow: 0 10px 25px rgba(79,70,229,0.15); transform: translateY(-5px); }
    .game-card .game-icon { font-size: 36px; margin-bottom: 12px; transition: transform 0.3s ease; }
    .game-card:hover .game-icon { transform: scale(1.15); }
    .game-card h4 { font-size: 16px; font-weight: 700; color: var(--bg-dark); margin-bottom: 6px; }
    .game-card p { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
    .game-card.completed-game { border-color: #10B981; background: #ecfdf5; }
    .game-card.completed-game:hover { border-color: #059669; box-shadow: 0 10px 25px rgba(16,185,129,0.15); }
    .vocab-back-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 50px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--text-main); transition: all 0.2s; margin-bottom: 20px; }
    .vocab-back-btn:hover { background: #e2e8f0; transform: translateX(-2px); }

    /* Flashcards */
    .flashcard-container { display: flex; flex-direction: column; align-items: center; animation: fadeIn 0.4s ease; }
    .flashcard-progress { font-size: 14px; color: var(--text-muted); margin-bottom: 15px; font-weight: 500; }
    .flashcard-wrapper { perspective: 1000px; width: 340px; height: 380px; margin: 0 auto 25px auto; }
    .flashcard { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1); cursor: pointer; }
    .flashcard.flipped { transform: rotateY(180deg); }
    .flashcard-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; box-shadow: 0 8px 30px rgba(0,0,0,0.12); text-align: center; }
    .flashcard-front { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
    .flashcard-front .fc-word { font-size: 32px; font-weight: 800; letter-spacing: -0.5px; }
    .flashcard-front .fc-image { max-width: 200px; max-height: 200px; border-radius: 12px; object-fit: cover; box-shadow: 0 4px 15px rgba(0,0,0,0.2); }
    .flashcard-front .fc-tap-hint { margin-top: 20px; font-size: 13px; opacity: 0.7; }
    .flashcard-back { background: white; transform: rotateY(180deg); border: 2px solid #e2e8f0; }
    .flashcard-back .fc-word { font-size: 28px; font-weight: 800; color: var(--primary); margin-bottom: 12px; }
    .flashcard-back .fc-definition { font-size: 16px; color: var(--text-main); line-height: 1.5; margin-bottom: 15px; }
    .flashcard-back .fc-image { max-width: 160px; max-height: 160px; border-radius: 10px; object-fit: cover; }
    .flashcard-nav { display: flex; gap: 15px; margin-bottom: 15px; }
    .flashcard-nav button { padding: 10px 24px; border-radius: 50px; border: 2px solid #e2e8f0; background: white; font-weight: 600; cursor: pointer; transition: all 0.2s; font-size: 14px; }
    .flashcard-nav button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
    .flashcard-nav button:disabled { opacity: 0.4; cursor: not-allowed; }
    .flashcard-assess { display: flex; gap: 12px; }
    .flashcard-assess button { padding: 10px 20px; border-radius: var(--radius); border: none; font-weight: 600; cursor: pointer; transition: all 0.2s; font-size: 14px; }
    .fc-btn-know { background: var(--secondary); color: white; }
    .fc-btn-know:hover { background: #059669; transform: translateY(-2px); }
    .fc-btn-dont { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca !important; }
    .fc-btn-dont:hover { background: #fee2e2; }

    /* Matching Pictures */
    .match-pics-container { animation: fadeIn 0.4s ease; }
    .match-pics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 15px; margin-bottom: 25px; }
    .match-pics-card { background: white; border: 3px solid #e2e8f0; border-radius: var(--radius); padding: 10px; text-align: center; cursor: pointer; transition: all 0.3s ease; }
    .match-pics-card:hover { transform: translateY(-3px); box-shadow: 0 6px 15px rgba(0,0,0,0.1); }
    .match-pics-card.selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.2); transform: scale(1.03); }
    .match-pics-card.matched { border-color: var(--secondary); background: #ecfdf5; opacity: 0.7; pointer-events: none; }
    .match-pics-card.wrong { animation: shake 0.4s ease; border-color: var(--danger); }
    .match-pics-card img { width: 100%; height: 100px; object-fit: cover; border-radius: 8px; margin-bottom: 6px; }
    .match-pics-card .mp-label { font-weight: 600; font-size: 14px; color: var(--bg-dark); padding: 6px 4px; }
    .match-pics-score { text-align: center; font-size: 16px; font-weight: 600; color: var(--text-main); margin-bottom: 15px; }
    @keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }

    /* Drag Words */
    .word-bank { display: flex; flex-wrap: wrap; gap: 10px; padding: 20px; background: #f1f5f9; border-radius: var(--radius); border: 2px dashed #cbd5e1; margin-bottom: 25px; min-height: 55px; justify-content: center; }
    .word-chip { display: inline-flex; align-items: center; padding: 8px 16px; background: white; border: 2px solid var(--primary); border-radius: 50px; font-weight: 600; font-size: 14px; color: var(--primary); cursor: grab; transition: all 0.2s; user-select: none; -webkit-user-select: none; }
    .word-chip:hover { background: #eff6ff; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(79,70,229,0.15); }
    .word-chip:active { cursor: grabbing; }
    .word-chip.used { opacity: 0.35; pointer-events: none; border-style: dashed; }
    .drag-sentence { font-size: 17px; line-height: 2.4; padding: 15px 20px; background: white; border: 1px solid #e2e8f0; border-radius: var(--radius); margin-bottom: 15px; }
    .drag-blank { display: inline-block; min-width: 90px; padding: 4px 12px; border-bottom: 3px solid var(--primary); margin: 0 4px; text-align: center; font-weight: 600; color: var(--primary); cursor: pointer; transition: all 0.2s; background: #f8fafc; border-radius: 4px 4px 0 0; min-height: 28px; }
    .drag-blank:hover { background: #eff6ff; }
    .drag-blank.filled { background: #eff6ff; border-bottom-color: var(--secondary); color: var(--bg-dark); }
    .drag-blank.correct-blank { border-bottom-color: var(--secondary); background: #ecfdf5; color: #065f46; }
    .drag-blank.incorrect-blank { border-bottom-color: var(--danger); background: #fef2f2; color: #991b1b; }

    /* Word Ordering (In-Place Reorder) */
    .word-order-sentence { padding: 20px; background: white; border: 1px solid #e2e8f0; border-radius: var(--radius); margin-bottom: 12px; }
    .word-order-sentence .wo-label { font-size: 14px; color: var(--text-muted); margin-bottom: 12px; font-weight: 500; }
    .word-order-target { display: flex; flex-wrap: wrap; gap: 8px; min-height: 48px; padding: 12px; background: #f1f5f9; border: 2px dashed #cbd5e1; border-radius: var(--radius); margin-bottom: 12px; align-items: center; }
    .word-order-target.wo-reorder { border-style: solid; border-color: #e2e8f0; background: #fafbfd; }
    .wo-word { display: inline-flex; align-items: center; padding: 8px 14px; background: white; border: 2px solid #cbd5e1; border-radius: 8px; font-weight: 600; font-size: 15px; color: var(--bg-dark); cursor: pointer; transition: all 0.2s; user-select: none; -webkit-user-select: none; }
    .wo-word:hover { border-color: var(--primary); background: #eff6ff; transform: translateY(-1px); }
    .wo-word.placed { opacity: 0.3; pointer-events: none; }
    .wo-word.in-target { border-color: var(--primary); background: #eff6ff; color: var(--primary); }
    .wo-word.wo-floating { position: fixed; z-index: 9999; pointer-events: none; border-color: #7c3aed; background: #ede9fe; color: #5b21b6; box-shadow: 0 8px 24px rgba(124,58,237,0.3); transform: scale(1.08); opacity: 0.95; }
    .wo-word.wo-ghost { opacity: 0.25; border-style: dashed; }
    .wo-drop-zone { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 36px; border: 2px dashed #7c3aed; border-radius: 6px; cursor: pointer; color: #7c3aed; font-size: 14px; transition: all 0.2s; background: rgba(124,58,237,0.05); flex-shrink: 0; }
    .wo-drop-zone.wo-dz-hidden { display: none; }
    .wo-drop-zone:hover, .wo-drop-zone.wo-dz-hover { background: #ede9fe; border-color: #5b21b6; transform: scale(1.15); }
    .wo-word.wo-word-hover { border-color: #7c3aed; background: #ede9fe; transform: scale(1.05); box-shadow: 0 0 0 3px rgba(124,58,237,0.15); }
    .wo-word.correct-word { border-color: var(--secondary) !important; background: #ecfdf5 !important; color: #065f46 !important; }
    .wo-word.incorrect-word { border-color: var(--danger) !important; background: #fef2f2 !important; color: #991b1b !important; }

    /* Word Search */
    .wordsearch-container { animation: fadeIn 0.4s ease; display: flex; gap: 30px; align-items: flex-start; }
    .ws-grid-wrapper { flex: 0 0 auto; width: 100%; max-width: 420px; margin: 0 auto; }
    .ws-grid { display: grid; gap: 0; background: white; border: 2px solid #e2e8f0; border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow); width: 100%; }
    .ws-cell { width: 100%; height: auto; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; color: var(--bg-dark); cursor: pointer; transition: all 0.15s; text-transform: uppercase; user-select: none; -webkit-user-select: none; border-radius: 2px; }
    .ws-cell:hover { background: #eff6ff; }
    .ws-cell.selecting { background: rgba(79,70,229,0.15); color: var(--primary); }
    .ws-cell.found { background: var(--secondary); color: white; }
    .ws-wordlist { flex: 1; }
    .ws-wordlist h4 { font-size: 16px; font-weight: 700; color: var(--bg-dark); margin-bottom: 12px; }
    .ws-wordlist ul { list-style: none; padding: 0; }
    .ws-wordlist li { padding: 6px 10px; font-size: 15px; font-weight: 500; color: var(--text-main); border-radius: 6px; margin-bottom: 4px; transition: all 0.2s; }
    .ws-wordlist li.ws-found { text-decoration: line-through; color: var(--secondary); background: #ecfdf5; }

    /* Mobile: Vocabulary */
    @media (max-width: 768px) {
        .game-picker-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
        .game-card { padding: 20px 12px; }
        .game-card .game-icon { font-size: 28px; }
        .game-card h4 { font-size: 14px; }
        .flashcard-wrapper { width: 280px; height: 320px; }
        .flashcard-front .fc-word { font-size: 24px; }
        .flashcard-front .fc-image { max-width: 160px; max-height: 160px; }
        .match-pics-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
        .match-pics-card img { height: 120px; }
        .match-pics-card .mp-label { font-size: 15px; padding: 8px 4px; }
        .wordsearch-container { flex-direction: column; align-items: center; gap: 15px; width: 100%; }
        .ws-grid-wrapper { width: 100%; max-width: 100%; padding: 0 5px; }
        .ws-grid { touch-action: none; width: 100%; padding: 4px; }
        .ws-cell { font-size: 14px; }
        .ws-wordlist { width: 100%; }
        .ws-wordlist ul { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: center; }
        .ws-wordlist li { font-size: 13px; padding: 4px 8px; }
        .word-chip { padding: 6px 12px; font-size: 13px; }
        .wo-word { padding: 6px 10px; font-size: 13px; touch-action: none; }
        .word-order-target { touch-action: none; }
        .word-order-sentence { touch-action: none; }
        /* Word Order paginated on mobile */
        .wo-sentence-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 15px; gap: 10px; }
        .wo-sentence-nav button { padding: 10px 20px; border-radius: 50px; border: 2px solid #e2e8f0; background: white; font-weight: 600; cursor: pointer; transition: all 0.2s; font-size: 14px; }
        .wo-sentence-nav button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
        .wo-sentence-nav button:disabled { opacity: 0.4; cursor: not-allowed; }
        .wo-sentence-counter { font-size: 14px; font-weight: 600; color: var(--text-muted); }
        /* Match Pictures pagination */
        .mp-page-nav { display: flex; justify-content: center; align-items: center; gap: 15px; margin-top: 15px; }
        .mp-page-nav button { padding: 8px 18px; border-radius: 50px; border: 2px solid #e2e8f0; background: white; font-weight: 600; cursor: pointer; transition: all 0.2s; font-size: 13px; }
        .mp-page-nav button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
        .mp-page-nav button:disabled { opacity: 0.4; cursor: not-allowed; }
        .mp-page-counter { font-size: 13px; font-weight: 600; color: var(--text-muted); }
    }

    /* ======== WRITING MODE ======== */

    /* Locked set card */
    .set-card.writing-locked {
        opacity: 0.5;
        cursor: not-allowed;
        position: relative;
        filter: grayscale(0.4);
    }
    .set-card.writing-locked:hover {
        transform: none;
        box-shadow: var(--shadow);
        border-color: #e2e8f0;
    }
    .set-card.writing-locked i {
        color: var(--text-muted);
    }

    /* Completed set card */
    .set-card.writing-completed {
        border-color: #10B981;
        background: #ecfdf5;
        position: relative;
    }
    .set-card.writing-completed:hover {
        border-color: #059669;
        box-shadow: 0 10px 25px rgba(16,185,129,0.15);
    }
    .set-card.writing-completed i {
        color: #10B981;
    }

    /* Set badges (lock/check icons) */
    .writing-set-badge {
        position: absolute;
        top: 8px;
        right: 8px;
        width: 28px;
        height: 28px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
    }
    .writing-set-badge.locked {
        background: #94A3B8;
        color: white;
    }
    .writing-set-badge.completed {
        background: #10B981;
        color: white;
    }

    /* Pattern preview on set card */
    .writing-pattern-preview {
        font-size: 11px;
        color: var(--primary);
        background: rgba(79, 70, 229, 0.08);
        padding: 4px 10px;
        border-radius: 20px;
        margin-top: 6px;
        font-weight: 600;
        letter-spacing: 0.3px;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Writing progress bar */
    .writing-progress-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 14px;
        font-weight: 600;
        color: var(--text-main);
        margin-bottom: 8px;
    }
    .writing-progress-header span:first-child {
        color: var(--primary);
    }
    .writing-progress-bar-container {
        width: 100%;
        height: 8px;
        background: #e2e8f0;
        border-radius: 10px;
        overflow: hidden;
    }
    .writing-progress-bar-fill {
        height: 100%;
        background: linear-gradient(90deg, var(--primary), var(--secondary));
        border-radius: 10px;
        transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Writing set header */
    .writing-set-header {
        background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 50%, #6366F1 100%);
        border-radius: 16px;
        padding: 30px;
        margin-bottom: 25px;
        color: white;
        position: relative;
        overflow: hidden;
        animation: fadeIn 0.4s ease;
    }
    .writing-set-header::before {
        content: '';
        position: absolute;
        top: -50%;
        right: -20%;
        width: 300px;
        height: 300px;
        background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
        border-radius: 50%;
    }
    .writing-set-header-content {
        position: relative;
        z-index: 1;
    }
    .writing-set-header h2 {
        font-size: 24px;
        font-weight: 800;
        margin-bottom: 12px;
        display: flex;
        align-items: center;
        gap: 10px;
    }
    .writing-structure-pattern {
        display: inline-block;
        background: rgba(255, 255, 255, 0.2);
        backdrop-filter: blur(10px);
        padding: 10px 20px;
        border-radius: 10px;
        font-size: 18px;
        font-weight: 700;
        letter-spacing: 0.5px;
        margin-bottom: 10px;
        border: 1px solid rgba(255,255,255,0.25);
        font-family: 'Consolas', 'Monaco', monospace;
    }
    .writing-set-count {
        font-size: 14px;
        opacity: 1;
        color: white !important;
    }

    /* Writing image container */
    .writing-image-container {
        text-align: center;
        margin-bottom: 25px;
        animation: fadeIn 0.5s ease;
    }
    .writing-set-image {
        max-width: 100%;
        max-height: 300px;
        border-radius: 12px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.12);
        object-fit: cover;
    }

    /* Writing exercise card */
    .writing-exercise-card {
        display: flex;
        flex-direction: column;
        gap: 12px;
        position: relative;
    }
    .writing-exercise-number {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        background: var(--primary);
        color: white;
        border-radius: 50%;
        font-weight: 700;
        font-size: 14px;
        flex-shrink: 0;
    }
    .writing-exercise-prompt {
        font-size: 14px;
        font-weight: 600;
        color: var(--bg-dark);
        line-height: 1.5;
    }
    .writing-input-wrapper {
        margin-top: 4px;
    }

    /* Writing text input — larger for full sentences */
    .writing-input,
    .writing-textarea {
        width: 100%;
        padding: 16px 20px;
        font-size: 17px;
        border: 2px solid #e2e8f0;
        border-radius: var(--radius);
        background: white;
        transition: all 0.3s ease;
        outline: none;
        color: var(--bg-dark);
        font-weight: 500;
        font-family: inherit;
        letter-spacing: 0.2px;
    }
    .writing-textarea {
        resize: vertical;
        min-height: 150px;
        line-height: 1.6;
    }
    .writing-input:focus,
    .writing-textarea:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
        transform: translateY(-1px);
    }
    .writing-input::placeholder {
        color: var(--text-muted);
        font-weight: 400;
        font-style: italic;
    }
    .writing-input.correct-input {
        border-color: var(--secondary);
        background-color: #ecfdf5;
        color: #065f46;
    }
    .writing-input.incorrect-input {
        border-color: var(--danger);
        background-color: #fef2f2;
        color: #991b1b;
    }

    /* Writing success banner */
    .writing-set-success {
        text-align: center;
        padding: 30px;
        margin-top: 25px;
        background: white;
        border: 2px solid #a7f3d0;
        border-radius: 16px;
        animation: zoomIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    .writing-set-success h3 {
        font-size: 22px;
        color: #065f46;
        margin-bottom: 8px;
    }
    .writing-set-success p {
        font-size: 16px;
        color: #047857;
        margin-bottom: 5px;
    }
    .writing-success-icon {
        font-size: 48px;
        margin-bottom: 12px;
    }

    /* Mobile: Writing */
    @media (max-width: 768px) {
        .writing-set-header {
            padding: 20px;
            border-radius: 12px;
        }
        .writing-set-header h2 {
            font-size: 20px;
        }
        .writing-structure-pattern {
            font-size: 14px;
            padding: 8px 14px;
        }
        .writing-input {
            padding: 14px 16px;
            font-size: 15px;
        }
        .writing-exercise-prompt {
            font-size: 13px;
        }
        .writing-set-image {
            max-height: 200px;
        }
        .writing-set-success {
            padding: 20px;
        }
        .writing-set-success h3 {
            font-size: 18px;
        }
    }

    /* ===== SUBSET CARDS ===== */
    .subsets-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 16px;
        margin-bottom: 25px;
        animation: fadeIn 0.4s ease;
    }

    .subset-card {
        background: white;
        border: 2px solid #e2e8f0;
        border-radius: 14px;
        padding: 24px 16px;
        text-align: center;
        cursor: pointer;
        transition: all 0.3s ease;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        position: relative;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    }

    .subset-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 20px rgba(79, 70, 229, 0.12);
    }

    .subset-card h4 {
        font-size: 15px;
        font-weight: 700;
        color: var(--bg-dark);
        margin-bottom: 4px;
    }

    .subset-card p {
        font-size: 12px;
        color: var(--text-muted);
    }

    /* Subset number badge */
    .subset-number {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--primary), #7C3AED);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 800;
        font-size: 16px;
        margin-bottom: 10px;
        box-shadow: 0 3px 8px rgba(79, 70, 229, 0.25);
    }

    /* Subset states */
    .subset-unlocked {
        border-color: var(--primary);
        background: linear-gradient(to bottom, #f5f3ff, white);
    }

    .subset-unlocked:hover {
        border-color: var(--primary);
        box-shadow: 0 8px 24px rgba(79, 70, 229, 0.2);
    }

    .subset-completed {
        border-color: #a7f3d0;
        background: linear-gradient(to bottom, #ecfdf5, white);
    }

    .subset-completed .subset-number {
        background: linear-gradient(135deg, #10B981, #059669);
        box-shadow: 0 3px 8px rgba(16, 185, 129, 0.25);
    }

    .subset-completed:hover {
        border-color: #6ee7b7;
        box-shadow: 0 8px 24px rgba(16, 185, 129, 0.15);
    }

    .subset-locked {
        border-color: #e2e8f0;
        background: #f8fafc;
        cursor: not-allowed;
        opacity: 0.65;
    }

    .subset-locked:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    }

    .subset-locked .subset-number {
        background: #94A3B8;
        box-shadow: none;
    }

    /* Subset badge (top-right) */
    .subset-badge {
        position: absolute;
        top: 6px;
        right: 6px;
        width: 24px;
        height: 24px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 10px;
    }

    .subset-badge.locked {
        background: #94A3B8;
        color: white;
    }

    .subset-badge.completed {
        background: #10B981;
        color: white;
    }

    .subset-badge.current {
        background: var(--primary);
        color: white;
        animation: pulse 2s infinite;
    }

    @keyframes pulse {
        0%, 100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4); }
        50% { box-shadow: 0 0 0 8px rgba(79, 70, 229, 0); }
    }

    /* Mobile: Subsets */
    @media (max-width: 768px) {
        .subsets-grid {
            grid-template-columns: 1fr 1fr;
            gap: 12px;
        }
        .subset-card {
            padding: 18px 12px;
            border-radius: 12px;
        }
        .subset-card h4 {
            font-size: 13px;
        }
        .subset-number {
            width: 32px;
            height: 32px;
            font-size: 14px;
        }
    }

    /* ======== EXAM MODE STYLES ======== */
    .exam-header {
        background: linear-gradient(135deg, #4F46E5, #7C3AED);
        color: white;
        padding: 24px 28px;
        border-radius: var(--radius);
        margin-bottom: 24px;
        text-align: center;
        box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
    }
    .exam-header h2 {
        font-size: 24px;
        font-weight: 800;
        margin-bottom: 6px;
    }
    .exam-header p {
        font-size: 14px;
        opacity: 0.85;
    }
    .exam-section-header {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 14px 20px;
        background: linear-gradient(90deg, #f1f5f9, #e2e8f0);
        border-left: 4px solid var(--primary);
        border-radius: 0 var(--radius) var(--radius) 0;
        margin: 28px 0 16px 0;
        font-size: 18px;
        font-weight: 700;
        color: var(--bg-dark);
    }
    .exam-section-header i {
        font-size: 20px;
        color: var(--primary);
    }
    .exam-section-pts {
        margin-left: auto;
        font-size: 12px;
        font-weight: 500;
        color: var(--text-muted);
        background: white;
        padding: 4px 12px;
        border-radius: 20px;
    }
    .exam-breakdown-row {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 10px;
    }
    .exam-breakdown-label {
        min-width: 110px;
        font-size: 14px;
        font-weight: 600;
        color: var(--text-main);
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .exam-breakdown-bar-bg {
        flex: 1;
        height: 10px;
        background: #e2e8f0;
        border-radius: 5px;
        overflow: hidden;
    }
    .exam-breakdown-bar-fill {
        height: 100%;
        border-radius: 5px;
        transition: width 0.6s ease;
    }
    .exam-breakdown-score {
        min-width: 48px;
        text-align: right;
        font-size: 14px;
        font-weight: 700;
        color: var(--bg-dark);
    }

    /* ============================================ */
    /* SPEAKING MODULE STYLES                       */
    /* ============================================ */
    .speaking-record-area {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 15px;
        padding: 25px 15px;
    }

    .speaking-record-btn {
        width: 80px;
        height: 80px;
        border-radius: 50%;
        border: none;
        background: linear-gradient(135deg, #ef4444, #dc2626);
        color: white;
        font-size: 28px;
        cursor: pointer;
        position: relative;
        transition: all 0.3s ease;
        box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .speaking-record-btn:hover {
        transform: scale(1.08);
        box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
    }

    .speaking-record-btn.recording {
        background: linear-gradient(135deg, #dc2626, #b91c1c);
        animation: pulse-record 1.5s ease-in-out infinite;
    }

    .speaking-record-btn.recording::before {
        content: '';
        position: absolute;
        top: -6px;
        left: -6px;
        right: -6px;
        bottom: -6px;
        border-radius: 50%;
        border: 3px solid #ef4444;
        animation: pulse-ring 1.5s ease-out infinite;
    }

    .speaking-record-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        transform: none;
        box-shadow: none;
    }

    @keyframes pulse-record {
        0%, 100% { transform: scale(1); }
        50% { transform: scale(1.05); }
    }

    @keyframes pulse-ring {
        0% { transform: scale(1); opacity: 1; }
        100% { transform: scale(1.4); opacity: 0; }
    }

    .speaking-status {
        font-size: 14px;
        font-weight: 600;
        color: var(--text-muted);
        text-align: center;
        min-height: 20px;
        transition: color 0.3s;
    }

    .speaking-status.listening {
        color: #ef4444;
    }

    .speaking-status.done {
        color: #10b981;
    }

    .speaking-transcript {
        width: 100%;
        min-height: 100px;
        padding: 15px;
        border-radius: 10px;
        border: 2px solid #e2e8f0;
        font-size: 15px;
        line-height: 1.6;
        color: var(--text-main);
        background: #f8fafc;
        resize: vertical;
        outline: none;
        transition: border-color 0.3s;
    }

    .speaking-transcript:focus {
        border-color: var(--primary);
    }

    .speaking-transcript:disabled {
        background: #f1f5f9;
        color: #64748b;
        cursor: not-allowed;
    }

    .speaking-controls {
        display: flex;
        gap: 10px;
        justify-content: center;
        flex-wrap: wrap;
    }

    .speaking-btn-rerecord {
        padding: 10px 20px;
        border-radius: 8px;
        border: 2px solid #e2e8f0;
        background: white;
        color: var(--text-main);
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .speaking-btn-rerecord:hover {
        border-color: var(--primary);
        color: var(--primary);
    }

    .speaking-btn-rerecord:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

    .speaking-btn-submit {
        padding: 10px 20px;
        border-radius: 8px;
        border: none;
        background: linear-gradient(135deg, var(--primary), #6366f1);
        color: white;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .speaking-btn-submit:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    }

    .speaking-btn-submit:disabled {
        opacity: 0.4;
        cursor: not-allowed;
        transform: none;
        box-shadow: none;
    }

    .speaking-browser-warning {
        text-align: center;
        padding: 30px;
        background: #fef2f2;
        border: 1px solid #fecaca;
        border-radius: 12px;
        color: #991b1b;
    }

    .speaking-browser-warning i {
        font-size: 40px;
        margin-bottom: 10px;
        color: #ef4444;
    }

/* =========================
   GRAMMAR CUSTOM HTML TABLES
   ========================= */

.grammar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
}

.icon-circle {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: #5b4cf0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 22px;
}

.grammar-title h2 {
  font-size: 20px;
  margin: 0;
}

.grammar-title p {
  color: #64748b;
  margin-top: 3px;
  margin-bottom: 0;
  font-size: 13px;
}

.tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 15px;
}

.table-box {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  background: white;
}

.table-header {
  padding: 8px;
  text-align: center;
  color: white;
  font-weight: bold;
  font-size: 14px;
}

.table-header.blue {
  background: #1d4ed8;
}

.table-header.green {
  background: #16a34a;
}

.table-content {
  padding: 8px 10px;
}

.table-box .row {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}

.table-box .row:last-child {
  border-bottom: none;
}

.highlight {
  color: #2563eb;
  font-weight: bold;
}

.green-highlight {
  color: #16a34a;
  font-weight: bold;
}

.examples {
  margin-top: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 13px;
}

.examples strong {
  color: #0f172a;
}

@media(max-width: 768px) {
  .tables {
    grid-template-columns: 1fr;
  }
}


/* =========================
   PRE-READING VOCABULARY CARDS
   ========================= */

.pre-horizontal {
  width: 100%;
  margin-bottom: 20px;
}

.pre-horizontal h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 0.3rem 0;
  color: #2d3e2b;
  letter-spacing: -0.3px;
  border-left: 6px solid #f5b042;
  padding-left: 1rem;
}

.instruction-badge {
  background: #f8f4ec;
  display: inline-block;
  padding: 0.35rem 1.2rem;
  border-radius: 40px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #6a5a42;
  margin: 0.8rem 0 1.5rem 0;
  letter-spacing: -0.2px;
}

.vocab-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  justify-content: flex-start;
  align-items: stretch;
}

.vocab-card {
  flex: 1 1 180px;
  min-width: 160px;
  background: #fefcf8;
  border-radius: 1.25rem;
  border: 1px solid #ece4d7;
  padding: 1rem 0.9rem;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.vocab-card:hover {
  border-color: #f5d7a3;
  background: #fffcf5;
  transform: translateY(-2px);
}

.vocab-word {
  font-weight: 700;
  font-size: 1.15rem;
  color: #2c5430;
  margin-bottom: 0.5rem;
  border-bottom: 2px dotted #efdfc3;
  display: inline-block;
  padding-bottom: 0.2rem;
}

.vocab-def {
  font-size: 0.88rem;
  line-height: 1.45;
  color: #4a5b4a;
  margin-top: 0.3rem;
}

@media (max-width: 680px) {
  .pre-horizontal h2 {
    font-size: 1.4rem;
  }
  .vocab-card {
    flex: 1 1 140px;
    min-width: 140px;
    padding: 0.8rem;
  }
  .vocab-word {
    font-size: 1rem;
  }
  .vocab-def {
    font-size: 0.82rem;
  }
}

@media (max-width: 480px) {
  .vocab-grid {
    gap: 0.8rem;
  }
  .vocab-card {
    flex: 1 1 100%;
  }
}

/* ======== VOCABULARY REVAMP ======== */
/* Complete the Sentence (Drag Words) */
.dw-progress-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}
.dw-progress-bar-bg {
    flex: 1;
    height: 12px;
    background: #e2e8f0;
    border-radius: 10px;
    margin-left: 15px;
    overflow: hidden;
}
.dw-progress-bar-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.4s ease;
    border-radius: 10px;
}
.dw-sentence-large {
    font-size: 28px;
    line-height: 1.8;
    color: #1e293b;
    margin-bottom: 30px;
    font-weight: 500;
    text-align: center;
}
@media (max-width: 600px) {
    .dw-sentence-large { 
        font-size: 19px; 
        line-height: 1.6;
        margin-bottom: 20px;
    }
    .dw-blank {
        min-width: 90px;
        padding: 4px 10px;
        margin: 0 5px;
        min-height: 36px;
    }
    .word-chip {
        padding: 6px 14px;
        font-size: 14px;
    }
}
.dw-blank {
    display: inline-block;
    min-width: 120px;
    padding: 4px 16px;
    border: 2px dashed var(--primary);
    border-radius: 12px;
    margin: 0 8px;
    text-align: center;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s;
    background: #f8fafc;
    min-height: 44px;
    vertical-align: middle;
}
.dw-blank:hover {
    background: #eff6ff;
}
.dw-blank.filled {
    border-style: solid;
    background: var(--primary);
    color: white;
}
.dw-blank.correct {
    border-color: var(--secondary);
    background: var(--secondary);
    color: white;
}
.dw-blank.incorrect {
    border-color: var(--danger);
    background: var(--danger);
    color: white;
    animation: shake 0.4s ease;
}

/* Memory Game */
.memory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
    perspective: 1000px;
}
.memory-card {
    background: transparent;
    height: 180px;
    cursor: pointer;
    perspective: 1000px;
}
.memory-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
}
.memory-card.flipped .memory-card-inner {
    transform: rotateY(180deg);
}
.memory-card.matched .memory-card-inner {
    transform: rotateY(180deg);
}
.memory-card-front, .memory-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border: 2px solid #e2e8f0;
    background: white;
}
.memory-card-front {
    background: white;
}
.memory-card-front i {
    font-size: 40px;
    color: #f43f5e;
    margin-bottom: 8px;
}
.memory-card-front span {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}
.memory-card-back {
    transform: rotateY(180deg);
    background: white;
    padding: 5px;
}
.memory-card.matched .memory-card-back {
    border-color: var(--secondary);
    border-width: 3px;
}
.memory-card.wrong .memory-card-inner {
    animation: shake 0.4s ease;
}
.memory-card-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}
.memory-card-back .mp-label {
    font-size: 18px;
    font-weight: 700;
    color: var(--bg-dark);
    word-break: break-word;
}

/* Hero Banner Styles */
.new-hero-banner {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 16px;
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.2);
    margin-bottom: 25px;
    text-align: left;
    flex-wrap: wrap;
    gap: 20px;
}

.hero-content h2 {
    color: white !important;
    font-size: 26px !important;
    margin-bottom: 5px !important;
    font-weight: 700;
}

.hero-content p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    margin-bottom: 0;
}

.hero-stats {
    display: flex;
    gap: 12px;
}

.hero-stat-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 18px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.hero-stat-card .stat-icon {
    font-size: 20px;
}

.hero-stat-card .stat-info {
    display: flex;
    flex-direction: column;
}

.hero-stat-card .stat-value {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.1;
}

.hero-stat-card .stat-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .new-hero-banner {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    .hero-stats {
        justify-content: center;
        width: 100%;
    }
    .hero-content h2 {
        font-size: 22px !important;
    }
}

/* Mini Stats in Header */
.header-mini-stats {
    position: absolute;
    right: 20px;
    top: -5px;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    padding: 10px 15px;
    border-radius: 12px;
    display: flex;
    gap: 15px;
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    animation: fadeIn 0.3s ease;
    z-index: 10;
}

.mini-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.mini-stat-icon {
    font-size: 16px;
}

.mini-stat-text {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mini-stat-val {
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
}

.mini-stat-lbl {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
    margin-top: 2px;
}

@media (max-width: 900px) {
    .header-mini-stats {
        position: static;
        transform: none;
        margin-top: 15px;
        justify-content: center;
    }
}

/* Mobile Mini Stats in Sidebar */
.mobile-mini-stats {
    display: none; /* Hidden on desktop */
    background: rgba(139, 92, 246, 0.15); /* Translucent purple */
    border: 1px solid rgba(139, 92, 246, 0.3);
    padding: 8px 12px;
    border-radius: 12px;
    gap: 12px;
    color: white;
    align-items: center;
}

.sidebar-profile-row {
    width: 100%;
}

@media (max-width: 900px) {
    .sidebar-profile-row {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        margin-bottom: 10px;
    }
    .user-profile {
        flex: 1;
        min-width: 0; /* Allows shrinking */
        margin-bottom: 0;
        padding: 10px;
    }
    .user-profile .user-info {
        min-width: 0;
        flex: 1;
    }
    .mobile-mini-stats {
        flex-shrink: 0;
        padding: 6px 10px;
        gap: 8px;
    }
    .mobile-mini-stats:not(.hidden) {
        display: flex;
    }
    .header-mini-stats {
        display: none !important; /* Hide desktop version completely on mobile */
    }
}

/* ============================================================
   BOOKS SECTION
   ============================================================ */

.books-section-header {
    text-align: center;
    margin-bottom: 35px;
}

.books-section-header h2 {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 8px;
}

.books-section-header p {
    font-size: 15px;
    color: var(--text-muted);
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 1100px;
    margin: 0 auto;
}

.book-card {
    border-radius: 16px;
    overflow: hidden;
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: default;
    display: flex;
    flex-direction: column;
}

.book-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
}

/* Gradient Header */
.book-card-header {
    padding: 28px 24px;
    position: relative;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.book-card-header.gradient-a1 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.book-card-header.gradient-a2 {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}
.book-card-header.gradient-b1 {
    background: linear-gradient(135deg, #7f53ac 0%, #647dee 100%);
}
.book-card-header.gradient-b2 {
    background: linear-gradient(135deg, #f7971e 0%, #ffd200 100%);
}
.book-card-header.gradient-c1 {
    background: linear-gradient(135deg, #ee0979 0%, #ff6a00 100%);
}
.book-card-header.gradient-c2 {
    background: linear-gradient(135deg, #232526 0%, #414345 100%);
}

.book-level-badge {
    display: inline-block;
    padding: 5px 14px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 12px;
    font-weight: 700;
    border-radius: 20px;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    align-self: flex-start;
}

.book-level-code {
    font-size: 36px;
    font-weight: 800;
    color: white;
    line-height: 1;
    margin-bottom: 4px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.book-level-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
}

/* Card Body */
.book-card-body {
    padding: 22px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.book-card-body h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
}

.book-card-body .book-description {
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 16px;
    flex: 1;
}

.book-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
}

.book-units-count {
    font-size: 13px;
    font-weight: 600;
    color: #94a3b8;
}

.book-open-btn {
    padding: 8px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.book-open-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

/* Responsive */
@media (max-width: 900px) {
    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
    .book-card-header {
        min-height: 120px;
        padding: 22px 20px;
    }
    .book-level-code {
        font-size: 30px;
    }
}

@media (max-width: 560px) {
    .books-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .books-section-header h2 {
        font-size: 22px;
    }
}

/* ==========================================
   STUDENT DASHBOARD - PROGRESS STATS
   ========================================== */

.sd-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.sd-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.sd-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.sd-card-full {
    grid-column: 1 / -1;
}

.sd-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sd-card-title i {
    color: #6366f1;
}

/* Overall Progress */
.sd-overall-progress {
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    color: white;
    grid-column: 1 / -1;
}

.sd-overall-progress .sd-card-title {
    color: white;
}

.sd-overall-progress .sd-card-title i {
    color: #a5b4fc;
}

.sd-overall-bar-container {
    width: 100%;
    height: 20px;
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 12px;
}

.sd-overall-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #818cf8, #6366f1, #4f46e5);
    border-radius: 10px;
    transition: width 1s ease;
}

.sd-overall-pct {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 4px;
}

.sd-overall-level {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(255,255,255,0.15);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-top: 8px;
}

/* Skills Progress */
.sd-skill-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.sd-skill-row:last-child {
    margin-bottom: 0;
}

.sd-skill-label {
    width: 90px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    flex-shrink: 0;
}

.sd-skill-bar-container {
    flex: 1;
    height: 12px;
    background: #f1f5f9;
    border-radius: 6px;
    overflow: hidden;
}

.sd-skill-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 1s ease;
}

.sd-skill-pct {
    width: 40px;
    text-align: right;
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
}

/* Accuracy Cards */
.sd-accuracy-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.sd-accuracy-item {
    text-align: center;
    padding: 14px 8px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.sd-accuracy-value {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 4px;
}

.sd-accuracy-label {
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
}

.sd-accuracy-overall {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 1px solid #bbf7d0;
    padding: 20px;
}

.sd-accuracy-overall .sd-accuracy-value {
    font-size: 42px;
    color: #16a34a;
}

/* Completed Lessons */
.sd-lessons-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.sd-lesson-item {
    text-align: center;
    padding: 14px 8px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.sd-lesson-count {
    font-size: 20px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 4px;
}

.sd-lesson-label {
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
}

.sd-lesson-bar {
    width: 80%;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    margin: 8px auto 0;
    overflow: hidden;
}

.sd-lesson-bar-fill {
    height: 100%;
    border-radius: 2px;
}

/* XP Progress */
.sd-xp-today {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.sd-xp-today-value {
    font-size: 28px;
    font-weight: 800;
    color: #eab308;
    white-space: nowrap;
}

.sd-xp-today-bar {
    flex: 1;
    height: 14px;
    background: #fef9c3;
    border-radius: 7px;
    overflow: hidden;
}

.sd-xp-today-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #facc15, #eab308);
    border-radius: 7px;
    transition: width 1s ease;
}

.sd-xp-week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    align-items: end;
}

.sd-xp-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.sd-xp-day-bar {
    width: 100%;
    min-height: 4px;
    max-height: 80px;
    background: linear-gradient(180deg, #818cf8, #6366f1);
    border-radius: 4px 4px 0 0;
    transition: height 0.5s ease;
}

.sd-xp-day-label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
}

.sd-xp-day-value {
    font-size: 11px;
    font-weight: 700;
    color: #475569;
}

/* Recent Activity in dashboard */
.sd-recent-card {
    background: white;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

/* Course Details Modal */
.course-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.course-modal-content {
    background: #f8fafc;
    width: 95%;
    max-width: 700px;
    max-height: 85vh;
    border-radius: 20px;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.course-modal-header {
    background: linear-gradient(135deg, #059669, #10b981);
    padding: 24px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1;
}

.course-modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.course-modal-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.course-modal-close:hover {
    background: rgba(255,255,255,0.35);
}

.course-modal-body {
    padding: 24px;
}

.course-modal-tabs {
    display: flex;
    gap: 4px;
    background: #e2e8f0;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 20px;
}

.course-modal-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.course-modal-tab.active {
    background: white;
    color: #1e293b;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* Gradebook Table */
.gradebook-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}

.gradebook-table thead th {
    background: #f1f5f9;
    padding: 12px 16px;
    text-align: left;
    font-weight: 700;
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e2e8f0;
}

.gradebook-table thead th:first-child {
    border-radius: 8px 0 0 0;
}

.gradebook-table thead th:last-child {
    border-radius: 0 8px 0 0;
}

.gradebook-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.gradebook-table tbody tr:hover {
    background: #f8fafc;
}

.gradebook-score {
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    display: inline-block;
    font-size: 13px;
}

.gradebook-score.high {
    background: #dcfce7;
    color: #16a34a;
}

.gradebook-score.medium {
    background: #fef9c3;
    color: #ca8a04;
}

.gradebook-score.low {
    background: #fee2e2;
    color: #dc2626;
}

/* Responsive */
@media (max-width: 768px) {
    .sd-stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .sd-accuracy-grid,
    .sd-lessons-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sd-accuracy-overall {
        grid-column: 1 / -1;
    }
    
    .sd-xp-today {
        flex-direction: column;
        gap: 10px;
    }
    
    .sd-overall-pct {
        font-size: 28px;
    }
    
    .course-modal-content {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .gradebook-table {
        font-size: 12px;
    }
    
    .gradebook-table thead th,
    .gradebook-table tbody td {
        padding: 10px 8px;
    }
}

/* ==========================================
   NOTIFICATION BELL & UPCOMING TASKS PANEL
   ========================================== */

/* Notification Bell */
.notif-bell {
    position: relative;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notif-bell:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.1);
}

.notif-bell i {
    font-size: 20px;
    color: #64748b;
    transition: color 0.2s;
}

.notif-bell:hover i {
    color: #6366f1;
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    animation: notifPulse 2s ease-in-out infinite;
}

@keyframes notifPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.notif-badge.no-urgent {
    background: #6366f1;
    animation: none;
}

/* Notification Dropdown */
.notif-dropdown {
    display: none;
    position: absolute;
    top: 45px;
    right: 0;
    width: 380px;
    max-height: 420px;
    overflow-y: auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
    z-index: 1000;
    animation: notifSlideDown 0.25s ease;
}

.notif-dropdown.show {
    display: block;
}

@keyframes notifSlideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.notif-dropdown-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notif-dropdown-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
}

.notif-dropdown-body {
    padding: 8px;
}

.notif-dropdown-empty {
    text-align: center;
    padding: 30px 20px;
    color: #94a3b8;
}

.notif-dropdown-empty i {
    font-size: 32px;
    margin-bottom: 10px;
    display: block;
    color: #cbd5e1;
}

/* Notification Task Row */
.notif-task-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
}

.notif-task-row:hover {
    background: #f8fafc;
}

.notif-task-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.notif-task-info {
    flex: 1;
    min-width: 0;
}

.notif-task-title {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-task-meta {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

.notif-task-due {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.notif-task-due.overdue {
    background: #fef2f2;
    color: #dc2626;
}

.notif-task-due.due-soon {
    background: #fffbeb;
    color: #d97706;
}

.notif-task-due.upcoming {
    background: #eff6ff;
    color: #2563eb;
}

.notif-task-due.new-task {
    background: #f0fdf4;
    color: #16a34a;
}

/* Upcoming Tasks Panel (Home Page) */
.upcoming-tasks-panel {
    background: white;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    margin-top: 20px;
    overflow: hidden;
    animation: fadeSlideUp 0.4s ease;
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.upcoming-tasks-header {
    padding: 18px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.upcoming-tasks-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.upcoming-tasks-header h3 i {
    color: #6366f1;
}

.upcoming-tasks-count {
    background: #6366f1;
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
}

.upcoming-tasks-body {
    padding: 8px 16px 16px;
}

.upcoming-task-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
    margin-bottom: 8px;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    cursor: default;
}

.upcoming-task-card:last-child {
    margin-bottom: 0;
}

.upcoming-task-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    border-color: #e2e8f0;
}

.upcoming-task-card.urgency-overdue {
    border-left: 4px solid #ef4444;
}

.upcoming-task-card.urgency-due-soon {
    border-left: 4px solid #f59e0b;
}

.upcoming-task-card.urgency-upcoming {
    border-left: 4px solid #3b82f6;
}

.upcoming-task-card.urgency-new {
    border-left: 4px solid #10b981;
}

.upcoming-task-icon-lg {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.upcoming-task-details {
    flex: 1;
    min-width: 0;
}

.upcoming-task-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.upcoming-task-mode {
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.upcoming-task-mode .level-tag {
    background: #eff6ff;
    color: #3b82f6;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
}

.upcoming-task-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.upcoming-task-due-label {
    font-size: 12px;
    font-weight: 600;
}

.upcoming-task-due-label.overdue { color: #ef4444; }
.upcoming-task-due-label.due-soon { color: #d97706; }
.upcoming-task-due-label.upcoming { color: #3b82f6; }
.upcoming-task-due-label.new-task { color: #10b981; }

.upcoming-task-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    color: white;
}

.upcoming-task-btn:hover {
    transform: scale(1.05);
}

.upcoming-task-btn.btn-overdue {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.upcoming-task-btn.btn-due-soon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.upcoming-task-btn.btn-upcoming {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.upcoming-task-btn.btn-new {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.upcoming-tasks-empty {
    text-align: center;
    padding: 30px 20px;
    color: #94a3b8;
}

.upcoming-tasks-empty i {
    font-size: 36px;
    margin-bottom: 10px;
    display: block;
    color: #10b981;
}

.upcoming-tasks-empty p {
    font-size: 14px;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .notif-dropdown {
        width: calc(100vw - 30px);
        right: -60px;
    }
    
    .upcoming-task-card {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .upcoming-task-right {
        flex-direction: row;
        width: 100%;
        justify-content: space-between;
        align-items: center;
    }
}