:root {
            /* Light Theme Variables */
            --bg-body-1: #F0F4F8;
            --bg-body-2: #D9E2EC;
            --bg-sidebar-1: rgba(255, 255, 255, 0.95);
            --bg-sidebar-2: rgba(240, 244, 248, 0.95);
            --color-text: #102A43;
            --color-text-muted: #4A5568;
            --color-heading: #0F2942;
            --bg-card: #FFFFFF;
            --border-card: rgba(217, 226, 236, 0.8);
            --bg-code: #F8FAFC;
            --border-code: #D9E2EC;
            --bg-input: #FFFFFF;
            --color-input: #102A43;
            --border-input: #BCCCDC;
            --bg-stat-box: rgba(255, 255, 255, 0.55);
            --border-stat-box: rgba(217, 226, 236, 0.8);
            --bg-check-normal: #F8FAFC;
            --border-check-normal: #D9E2EC;
            --color-text-link: #1976D2;
            --color-text-link-hover: #1565C0;
            --blob-opacity: 0.16;

            --bg-auth-overlay: rgba(240, 244, 248, 0.45);
            --bg-auth-card: rgba(255, 255, 255, 0.85);
            --border-auth-card: rgba(16, 42, 67, 0.08);
            --color-auth-text: #102A43;
            --color-auth-text-muted: #4A5568;
            --bg-auth-input: #FFFFFF;
            --border-auth-input: #BCCCDC;
            --color-auth-label: #4A5568;
            --border-auth-btn-secondary: rgba(16, 42, 67, 0.15);
            --color-auth-btn-secondary: #102A43;
            --bg-auth-btn-secondary-hover: rgba(16, 42, 67, 0.05);

            --bg-archive-item: #FFFFFF;
            --bg-archive-item-hover: rgba(49, 130, 206, 0.08);
            --bg-archive-item-active: rgba(49, 130, 206, 0.15);
            --bg-sidebar-card: #FFFFFF;
        }

        [data-theme="dark"] {
            /* Dark Theme Variables */
            --bg-body-1: #0F172A;
            --bg-body-2: #1E293B;
            --bg-sidebar-1: rgba(15, 23, 42, 0.85);
            --bg-sidebar-2: rgba(30, 41, 59, 0.85);
            --color-text: #E2E8F0;
            --color-text-muted: #94A3B8;
            --color-heading: #F8FAFC;
            --bg-card: #1E293B;
            --border-card: rgba(148, 163, 184, 0.1);
            --bg-code: #1E293B;
            --border-code: #334155;
            --bg-input: #0F172A;
            --color-input: #F8FAFC;
            --border-input: #334155;
            --bg-stat-box: rgba(15, 23, 42, 0.55);
            --border-stat-box: rgba(51, 65, 85, 0.8);
            --bg-check-normal: rgba(30, 41, 59, 0.5);
            --border-check-normal: #334155;
            --color-text-link: #63B3ED;
            --color-text-link-hover: #90CDF4;
            --blob-opacity: 0.12;

            --bg-auth-overlay: rgba(15, 23, 42, 0.6);
            --bg-auth-card: rgba(30, 41, 59, 0.7);
            --border-auth-card: rgba(255, 255, 255, 0.1);
            --color-auth-text: #F8FAFC;
            --color-auth-text-muted: #94A3B8;
            --bg-auth-input: rgba(15, 23, 42, 0.6);
            --border-auth-input: rgba(148, 163, 184, 0.2);
            --color-auth-label: #CBD5E1;
            --border-auth-btn-secondary: rgba(255, 255, 255, 0.15);
            --color-auth-btn-secondary: #E2E8F0;
            --bg-auth-btn-secondary-hover: rgba(255, 255, 255, 0.05);

            --bg-archive-item: rgba(30, 41, 59, 0.4);
            --bg-archive-item-hover: rgba(49, 130, 206, 0.15);
            --bg-archive-item-active: rgba(49, 130, 206, 0.25);
            --bg-sidebar-card: rgba(30, 41, 59, 0.4);
        }

*, *::before, *::after {
            box-sizing: border-box;
        }

        html, body {
            min-height: 100vh;
            max-width: 100%;
            overflow-x: clip;
        }

        body {
            font-family: "Golos Text", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            color: var(--color-text);
            background-color: var(--bg-body-1);
            background: linear-gradient(135deg, var(--bg-body-1) 0%, var(--bg-body-2) 100%) no-repeat fixed;
            background-size: cover;
            text-rendering: optimizeLegibility;
            -webkit-font-smoothing: antialiased;
            margin: 0;
            padding: 0;
            display: flex;
            min-height: 100vh;
            scroll-behavior: smooth;
            overflow-x: clip;
            transition: color 0.3s ease, background-color 0.3s ease;
        }

        img {
            max-width: 100%;
            height: auto;
        }

        .task-desc img {
            content-visibility: auto;
        }

        /* Glassmorphic Animated Background Blobs */
        .bg-blob {
            position: fixed;
            border-radius: 50%;
            filter: blur(120px);
            opacity: var(--blob-opacity);
            z-index: -1;
            pointer-events: none;
            transition: opacity 0.3s ease, background 0.8s ease;
        }
        .blob-1 {
            width: 450px;
            height: 450px;
            background: radial-gradient(circle, #3182CE 0%, #63B3ED 100%);
            top: -10%;
            left: 20%;
            animation: floatBlob1 22s infinite ease-in-out alternate;
        }
        .blob-2 {
            width: 550px;
            height: 550px;
            background: radial-gradient(circle, #4A5568 0%, #CBD5E0 100%);
            bottom: -10%;
            right: 5%;
            animation: floatBlob2 28s infinite ease-in-out alternate;
        }
        .blob-3 {
            width: 380px;
            height: 380px;
            background: radial-gradient(circle, #319795 0%, #4FD1C5 100%);
            top: 35%;
            right: 30%;
            animation: floatBlob3 20s infinite ease-in-out alternate;
        }

        @keyframes floatBlob1 {
            0% { transform: translate(0, 0) scale(1); }
            50% { transform: translate(120px, 90px) scale(1.25); }
            100% { transform: translate(-60px, 140px) scale(0.9); }
        }
        @keyframes floatBlob2 {
            0% { transform: translate(0, 0) scale(1); }
            50% { transform: translate(-140px, -80px) scale(0.85); }
            100% { transform: translate(90px, -180px) scale(1.2); }
        }
        @keyframes floatBlob3 {
            0% { transform: translate(0, 0) scale(1); }
            50% { transform: translate(80px, -110px) scale(1.15); }
            100% { transform: translate(-100px, 60px) scale(0.95); }
        }

        /* Sidebar Toggle Floating Button */
        .sidebar-toggle {
            position: fixed;
            top: 20px;
            right: 20px;
            width: 45px;
            height: 45px;
            background-color: var(--color-text-link);
            color: white;
            border: none;
            border-radius: 50%;
            cursor: pointer;
            z-index: 101;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
            transition: all 0.2s ease, background-color 0.3s ease;
        }
        .sidebar-toggle:hover {
            background-color: var(--color-text-link-hover);
            transform: scale(1.05);
        }
        .sidebar-toggle:active {
            transform: scale(0.95);
        }
        .toggle-icon {
            font-size: 20px;
            font-weight: bold;
            line-height: 1;
        }

        /* Dark overlay for mobile sidebar */
        .sidebar-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(15, 23, 42, 0.4);
            backdrop-filter: blur(4px);
            z-index: 99;
            opacity: 0;
            transition: opacity 0.3s ease;
            pointer-events: none;
        }
        body.sidebar-open .sidebar-overlay {
            display: block;
            opacity: 1;
            pointer-events: auto;
        }

        .sidebar {
            position: fixed;
            width: 340px;
            height: 100vh;
            top: 0;
            left: 0;
            background: linear-gradient(180deg, var(--bg-sidebar-1) 0%, var(--bg-sidebar-2) 100%);
            backdrop-filter: blur(15px);
            -webkit-backdrop-filter: blur(15px);
            color: var(--color-text);
            padding: 16px 14px;
            box-sizing: border-box;
            border-right: 3px solid var(--color-text-link);
            display: flex;
            flex-direction: column;
            justify-content: flex-start;
            align-items: center;
            z-index: 100;
            text-align: center;
            box-shadow: 4px 0 15px rgba(16, 42, 67, 0.05);
            overflow-y: auto;
            overflow-x: hidden;
            overscroll-behavior: contain;
            scrollbar-width: none;
            -ms-overflow-style: none;
            transform: translateX(0);
            transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s ease, border-color 0.3s ease;
        }
        .sidebar::-webkit-scrollbar {
            display: none;
            width: 0;
            height: 0;
        }
        body.sidebar-collapsed .sidebar {
            transform: translateX(-340px);
        }
        
        .sidebar-top {
            width: 100%;
        }
        .sidebar-badge {
            background: linear-gradient(135deg, var(--color-text-link), #805AD5);
            color: white;
            font-size: 9.5px;
            font-weight: 800;
            padding: 4px 10px;
            border-radius: 20px;
            text-transform: uppercase;
            letter-spacing: 2px;
            display: inline-block;
            margin-bottom: 10px;
            box-shadow: 0 2px 8px rgba(25, 118, 210, 0.25);
            transition: background-color 0.3s ease;
        }
        .sidebar-section {
            width: 100%;
            margin-bottom: 5px;
        }
        .sidebar-section-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 11px;
            background: var(--bg-stat-box);
            border: 1.5px solid var(--border-stat-box);
            border-radius: 8px;
            cursor: pointer;
            font-size: 12px;
            font-weight: 700;
            color: var(--color-text);
            transition: all 0.2s ease;
            user-select: none;
        }
        .sidebar-section-header:hover {
            background: var(--border-stat-box);
            transform: translateX(2px);
        }
        .section-chevron {
            font-size: 10px;
            opacity: 0.5;
            transition: transform 0.25s ease;
        }
        .sidebar-section.collapsed .section-chevron {
            transform: rotate(-90deg);
        }
        .sidebar-section-body {
            padding: 8px 2px 4px 2px;
            max-height: 500px;
            overflow: hidden;
            transition: max-height 0.3s ease, opacity 0.25s ease, padding 0.3s ease;
            opacity: 1;
        }
        .sidebar-section.collapsed .sidebar-section-body {
            max-height: 0;
            opacity: 0;
            padding: 0 2px;
        }
        .sidebar-title {
            font-size: 20px;
            font-weight: 900;
            text-transform: uppercase;
            letter-spacing: 1px;
            margin: 0 0 2px 0;
            color: var(--color-heading);
            line-height: 1.15;
            transition: color 0.3s ease;
        }
        .sidebar-subtitle {
            font-size: 12px;
            font-weight: 700;
            text-transform: uppercase;
            color: var(--color-text-link);
            margin: 0 0 20px 0;
            letter-spacing: 0.5px;
            line-height: 1.4;
            transition: color 0.3s ease;
        }
        .sidebar-stats {
            background: var(--bg-stat-box);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            border-radius: 12px;
            padding: 15px;
            border: 1.5px solid var(--border-stat-box);
            text-align: left;
            width: 100%;
            box-sizing: border-box;
            margin-bottom: 15px;
            box-shadow: 0 2px 4px rgba(16, 42, 67, 0.01);
            transition: background 0.3s ease, border-color 0.3s ease;
        }
        .stat-row {
            display: flex;
            justify-content: space-between;
            margin-bottom: 8px;
            font-size: 14px;
            color: var(--color-text-muted);
            transition: color 0.3s ease;
        }
        .stat-row:last-child {
            margin-bottom: 0;
        }
        .stat-row span.val {
            font-weight: 700;
            color: var(--color-text-link);
            transition: color 0.3s ease;
        }
        .progress-bar-container {
            width: 100%;
            height: 8px;
            background: var(--border-code);
            border-radius: 10px;
            overflow: hidden;
            margin-top: 10px;
            transition: background 0.3s ease;
        }
        .progress-bar-fill {
            height: 100%;
            width: 0%;
            background: var(--color-text-link);
            transition: width 0.3s ease, background-color 0.3s ease;
            box-shadow: 0 0 8px rgba(25, 118, 210, 0.3);
        }
        
        .btn-generate {
            background-color: var(--color-text-link);
            color: white;
            border: none;
            padding: 12px 20px;
            font-size: 16px;
            font-weight: 800;
            border-radius: 12px;
            cursor: pointer;
            width: 100%;
            text-transform: none;
            box-shadow: 0 4px 6px rgba(25, 118, 210, 0.15);
            transition: all 0.25s ease;
            margin-top: 5px;
            animation: subtlePulse 2.5s infinite ease-in-out;
        }
        .btn-generate:hover {
            background-color: var(--color-text-link-hover);
            animation: none;
            transform: translateY(-2px) scale(1.02);
            box-shadow: 0 6px 20px rgba(25, 118, 210, 0.35);
        }
        .btn-generate:active {
            transform: translateY(0) scale(0.98);
        }
        .sidebar-qr-container {
            width: 100%;
            margin-top: 20px;
        }
        .sidebar-qr {
            width: 100px;
            height: 100px;
            background: white;
            border-radius: 10px;
            border: 3px solid var(--color-text-link);
            padding: 6px;
            margin: 10px auto;
            box-shadow: 0 2px 8px rgba(0,0,0,0.05);
            display: block;
            transition: transform 0.25s ease, border-color 0.3s ease;
        }
        .sidebar-qr:hover {
            transform: scale(1.05);
        }
        .sidebar-qr-link {
            color: var(--color-text-link);
            font-size: 11px;
            font-weight: 700;
            text-decoration: underline;
            transition: color 0.3s ease;
        }
        .sidebar-qr-link:hover {
            color: var(--color-heading);
        }
        
        /* Layout Container Split Screen */
        .main-content {
            margin-left: 340px;
            width: calc(100% - 340px);
            max-width: calc(100% - 340px);
            min-width: 0;
            padding: 40px 35px;
            padding-top: 60px;
            flex-grow: 1;
            box-sizing: border-box;
            transition: margin-left 0.3s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s cubic-bezier(0.16, 1, 0.3, 1), max-width 0.3s cubic-bezier(0.16, 1, 0.3, 1), padding 0.3s ease;
        }
        body.sidebar-collapsed .main-content {
            margin-left: 60px;
            width: calc(100% - 60px);
            max-width: calc(100% - 60px);
        }

        .app-container {
            display: flex;
            gap: 30px;
            align-items: flex-start;
            width: 100%;
            box-sizing: border-box;
        }
        .tasks-column {
            flex: 1;
            min-width: 0;
            box-sizing: border-box;
        }
        
        /* Compiler column sticky sidebar */
        .compiler-column {
            display: none;
            width: 610px;
            flex-shrink: 0;
            position: -webkit-sticky;
            position: sticky;
            top: 75px;
            align-self: flex-start !important;
            z-index: 90;
            box-sizing: border-box;
            flex-direction: column;
            gap: 20px;
        }
        body.variant-generated .compiler-column,
        body.catalog-active .compiler-column {
            display: flex;
        }

        /* Direct Edge Resizing Visual Indicator on compiler-column */
        .compiler-column {
            transition: border-color 0.15s ease;
        }
        .compiler-column.resizing-width {
            border-left: 3px solid #3182CE !important;
        }
        .compiler-column.resizing-height {
            border-bottom: 3px solid #3182CE !important;
        }
        .compiler-column.resizing-both {
            border-left: 3px solid #3182CE !important;
            border-bottom: 3px solid #3182CE !important;
        }

        /* Flexible inner expansion when compiler-column is height-resized */
        #python-sandbox-wrapper {
            height: 100%;
            display: flex;
            flex-direction: column;
        }
        #python-sandbox-wrapper .compiler-card {
            height: 100%;
            display: flex;
            flex-direction: column;
            box-sizing: border-box;
            overflow: hidden;
        }
        #main-sandbox-content-python,
        #main-sandbox-content-calc,
        #main-sandbox-content-paint {
            flex: 1;
            display: flex;
            flex-direction: column;
            min-height: 0;
            overflow-y: auto;
        }
        #monaco-editor {
            flex: 1;
            min-height: 220px;
            height: 100% !important;
        }

        body.exam-mode {
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
        }
        body.exam-mode input,
        body.exam-mode textarea {
            -webkit-user-select: text;
            -moz-user-select: text;
            -ms-user-select: text;
            user-select: text;
        }

        /* Task Database Sidebar Catalog styles */
        .sidebar-catalog-section {
            margin-bottom: 20px;
            border-top: 1px solid var(--border-card);
            padding-top: 15px;
        }
        .sidebar-catalog-title {
            border-bottom: 1px solid var(--border-card);
            padding-bottom: 8px;
            margin-bottom: 12px;
            font-size: 16px;
            font-weight: 700;
            color: var(--color-heading);
            text-align: left;
        }
        details.sidebar-section summary::-webkit-details-marker { display: none; }
        details.sidebar-section summary { list-style: none; cursor: pointer; user-select: none; }
        details.sidebar-section[open] > summary .arrow { transform: rotate(90deg); display: inline-block; }
        .sidebar-catalog-selects {
            display: flex;
            gap: 6px;
        }
        .sidebar-catalog-select {
            flex: 1.2;
            padding: 9px 11px;
            border-radius: 8px;
            background: var(--bg-input);
            border: 1.5px solid var(--border-input);
            color: var(--color-text);
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
            outline: none;
            transition: border-color 0.2s ease;
        }
        .sidebar-catalog-select:focus {
            border-color: var(--color-text-link);
        }
        .sidebar-catalog-combo {
            display: flex;
            gap: 6px;
            align-items: center;
        }
        .sidebar-catalog-btn {
            width: 100%;
            margin-top: 5px;
            padding: 10px;
            font-size: 15px;
            font-weight: 700;
            border-radius: 8px;
            color: white;
            background-color: var(--color-text-link);
            border: 1.5px solid var(--color-text-link);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        .sidebar-catalog-btn:hover {
            opacity: 0.9;
            transform: translateY(-0.5px);
        }

        /* Shimmering KIMScanner Gradient Button */
        @keyframes kimShimmer {
            0% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
            100% { background-position: 0% 50%; }
        }
        .sidebar-kimscanner-btn {
            display: flex;
            align-items: center;
            justify-content: space-between;
            width: 100%;
            padding: 11px 15px;
            margin-top: 10px;
            border-radius: 10px;
            background: linear-gradient(135deg, #0284c7, #38bdf8, #6366f1, #0ea5e9);
            background-size: 250% 250%;
            animation: kimShimmer 5s ease infinite;
            color: #ffffff !important;
            text-decoration: none !important;
            font-weight: 800;
            font-size: 16px;
            box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
            border: 1px solid rgba(255, 255, 255, 0.35);
            cursor: pointer;
            box-sizing: border-box;
            transition: transform 0.2s ease, box-shadow 0.2s ease;
        }
        .sidebar-kimscanner-btn:hover {
            transform: translateY(-1.5px);
            box-shadow: 0 6px 20px rgba(14, 165, 233, 0.55);
        }
        .sidebar-kimscanner-btn .kimscanner-badge {
            background: rgba(255, 255, 255, 0.25);
            padding: 2px 6px;
            border-radius: 6px;
            font-size: 10px;
            font-weight: 900;
            letter-spacing: 0.5px;
            text-transform: uppercase;
        }

        /* Task Card Star Button styles */
        .task-favorite-btn {
            padding: 4px 8px;
            font-size: 15px;
            border-radius: 6px;
            border: 1px solid var(--border-input);
            background: transparent;
            cursor: pointer;
            transition: all 0.2s ease;
            display: inline-flex;
            align-items: center;
            color: var(--color-text-muted);
        }
        .task-favorite-btn:hover {
            border-color: var(--color-text-link);
            background: var(--bg-code);
        }
        .task-favorite-btn.active {
            color: #FFD700 !important;
            border-color: rgba(255, 215, 0, 0.3);
        }

        /* Favorites Card & Gamification Cards (no left accent stick) */
        .favorites-card,
        .student-gamification-grid .card,
        #student-achievements-card,
        #student-leaderboard-card {
            border-left: 1px solid var(--border-card) !important;
            animation-delay: 0.08s;
        }

        .header-box {
            text-align: center;
            margin-bottom: 40px;
            padding: 25px;
            background: linear-gradient(135deg, var(--color-text-link) 0%, #475569 100%);
            color: white;
            border-radius: 12px;
            box-shadow: 0 4px 15px rgba(25, 118, 210, 0.15);
            animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
            transition: background 0.3s ease;
        }
        .header-box h1 {
            margin: 0;
            font-size: 28px;
            font-weight: 700;
        }
        .header-box p {
            margin: 10px 0 0 0;
            opacity: 0.9;
            font-size: 16px;
        }
        .card {
            background: var(--bg-card);
            border-radius: 10px;
            box-shadow: 0 4px 15px rgba(16, 42, 67, 0.03);
            border: 1px solid var(--border-card);
            padding: 28px;
            margin-bottom: 30px;
            border-left: 6px solid var(--color-text-link);
            position: relative;
            opacity: 1;
            transform: translateY(0);
            transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, background 0.2s ease;
            box-sizing: border-box;
            width: 100%;
        }
        .card:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 24px rgba(16, 42, 67, 0.08);
            background: rgba(255, 255, 255, 0.92);
        }
        [data-theme="dark"] .card:hover {
            background: rgba(30, 41, 59, 0.9);
        }
        .card h3 {
            margin-top: 0;
            color: var(--color-heading);
            border-bottom: 1.5px solid var(--border-card);
            padding-bottom: 10px;
            font-size: 18px;
            transition: color 0.3s ease, border-color 0.3s ease;
        }
        pre, code, tt {
            background-color: var(--bg-code);
            padding: 2px 6px;
            border-radius: 4px;
            border: 1px solid var(--border-code);
            font-family: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
            font-size: 13.5px;
            transition: background-color 0.3s ease, border-color 0.3s ease;
        }
        pre {
            padding: 14px;
            overflow-x: auto;
            display: block;
            border: 1px solid var(--border-code);
            line-height: 1.4;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin: 20px 0;
            font-size: 14px;
        }
        th, td {
            border: 1px solid var(--border-code);
            padding: 12px;
            vertical-align: top;
            transition: border-color 0.3s ease;
        }
        th {
            background-color: var(--bg-code);
            color: var(--color-heading);
            font-weight: 700;
            transition: background-color 0.3s ease, color 0.3s ease;
        }
        table.code th {
            background-color: var(--bg-code);
        }
        table.code td.pre {
            font-family: monospace;
            white-space: pre-wrap;
        }
        table.varanswer {
            width: 100%;
            border-collapse: collapse;
            box-shadow: 0 4px 6px rgba(0,0,0,0.02);
            border-radius: 8px;
            overflow: hidden;
        }
        table.varanswer th {
            background-color: var(--color-text-link);
            color: white;
            font-weight: 600;
            transition: background-color 0.3s ease;
        }
        table.varanswer td {
            text-align: center;
        }
        a {
            color: var(--color-text-link);
            text-decoration: none;
            font-weight: 600;
            transition: color 0.3s ease;
        }
        a:hover {
            color: var(--color-text-link-hover);
            text-decoration: underline;
        }
        img {
            max-width: 100% !important;
            height: auto !important;
            box-sizing: border-box !important;
            margin: 20px 0;
            border: 1.5px solid var(--border-code);
            border-radius: 8px;
            padding: 6px;
            background: white;
            box-shadow: 0 2px 4px rgba(0,0,0,0.02);
            transition: border-color 0.3s ease;
        }

        #student-page-view,
        #student-profile-details,
        #student-variant-tasks-container,
        .card,
        .header-box {
            max-width: 100% !important;
            box-sizing: border-box !important;
            overflow-wrap: break-word;
        }
        .task-files {
            background-color: #EBF8FF;
            border: 1px solid #BEE3F8;
            color: #1976D2;
            padding: 10px 16px;
            border-radius: 8px;
            margin-bottom: 20px;
            display: inline-block;
            font-size: 13.5px;
            transition: all 0.25s ease;
        }
        [data-theme="dark"] .task-files {
            background-color: rgba(99, 179, 237, 0.15);
            border-color: rgba(99, 179, 237, 0.3);
            color: #90CDF4;
        }
        .task-files:hover {
            background-color: #E2F4FF;
            transform: translateX(3px);
        }
        [data-theme="dark"] .task-files:hover {
            background-color: rgba(99, 179, 237, 0.25);
        }
        .task-files a {
            color: inherit;
            text-decoration: underline;
        }
        .overview-table {
            background: var(--bg-card);
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 2px 4px rgba(0,0,0,0.01);
            border: 1px solid var(--border-code);
            transition: background 0.3s ease, border-color 0.3s ease;
        }
        .overview-table th {
            background-color: var(--color-text-link);
            color: white;
            transition: background-color 0.3s ease;
        }
        
        /* Interactive Input Panel */
        .check-container {
            margin-top: 20px;
            padding: 15px;
            background: var(--bg-check-normal);
            border: 1.5px solid var(--border-check-normal);
            border-radius: 8px;
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 12px;
            transition: all 0.3s ease;
        }
        .check-container.correct {
            border-color: #48BB78;
            background-color: rgba(72, 187, 120, 0.1);
            box-shadow: 0 0 10px rgba(72, 187, 120, 0.15);
        }
        .check-container.incorrect {
            border-color: #F56565;
            background-color: rgba(245, 101, 101, 0.1);
            box-shadow: 0 0 10px rgba(245, 101, 101, 0.15);
        }
        .ans-input {
            padding: 8px 12px;
            border: 1.5px solid var(--border-input);
            border-radius: 6px;
            font-size: 14px;
            outline: none;
            width: 180px;
            font-family: inherit;
            background: var(--bg-input);
            color: var(--color-input);
            transition: all 0.25s ease;
        }
        .ans-input:focus {
            border-color: var(--color-text-link);
            box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
        }
        .correct .ans-input {
            border-color: #48BB78;
        }
        .incorrect .ans-input {
            border-color: #F56565;
        }
        .btn-check {
            background-color: var(--color-text-link);
            color: white;
            border: none;
            padding: 8px 16px;
            font-size: 14px;
            font-weight: 700;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        .btn-check:hover {
            background-color: var(--color-text-link-hover);
            transform: translateY(-1px);
            box-shadow: 0 4px 8px rgba(25, 118, 210, 0.2);
        }
        .btn-check:active {
            transform: translateY(0) scale(0.96);
        }
        .status-badge {
            font-weight: 800;
            font-size: 14px;
            animation: fadeInUp 0.3s ease;
        }
        .status-badge.ok {
            color: #38A169;
        }
        .status-badge.err {
            color: #E53E3E;
        }
        .reveal-link {
            font-size: 13px;
            color: var(--color-text-muted);
            text-decoration: underline;
            cursor: pointer;
            margin-left: auto;
            user-select: none;
            transition: color 0.2s ease;
        }
        .reveal-link:hover {
            color: var(--color-text-link);
        }
        .ai-link {
            color: var(--color-text-link);
            font-weight: bold;
        }
        .ai-link:hover {
            color: var(--color-text-link-hover);
        }
        .answer-key-box {
            font-size: 13.5px;
            color: var(--color-text-muted);
            width: 100%;
            margin-top: 10px;
            border-top: 1px dashed var(--border-code);
            padding-top: 10px;
            animation: fadeInUp 0.3s ease;
        }
        .answer-key-box b {
            color: var(--color-text);
            font-family: monospace;
            font-size: 14.5px;
        }
        
        /* Compiler UI styles */
        .templates-row {
            display: flex;
            flex-direction: column;
            gap: 12px;
            box-sizing: border-box;
        }
        details.templates-dropdown {
            background: var(--bg-code);
            border: 1px solid var(--border-card);
            border-radius: 8px;
            overflow: hidden;
            box-sizing: border-box;
            transition: all 0.3s ease;
            margin-bottom: 16px;
            width: 100%;
        }
        details.templates-dropdown[open] {
            border-color: var(--color-text-link);
            box-shadow: 0 4px 12px rgba(25, 118, 210, 0.08);
            background: var(--bg-code);
        }
        summary.templates-dropdown-summary {
            padding: 10px 14px;
            font-size: 13px;
            font-weight: 700;
            color: var(--color-text);
            cursor: pointer;
            user-select: none;
            display: flex;
            justify-content: space-between;
            align-items: center;
            outline: none;
            list-style: none;
            transition: background-color 0.25s ease;
        }
        summary.templates-dropdown-summary::-webkit-details-marker {
            display: none;
        }
        summary.templates-dropdown-summary:hover {
            background-color: var(--border-card);
        }
        summary.templates-dropdown-summary::after {
            content: "▾";
            font-size: 14px;
            color: var(--color-text-muted);
            transition: transform 0.2s ease;
        }
        details.templates-dropdown[open] summary.templates-dropdown-summary::after {
            transform: rotate(180deg);
        }
        .template-category {
            background: var(--bg-card);
            border: 1px solid var(--border-card);
            border-radius: 8px;
            padding: 12px;
            box-sizing: border-box;
            transition: border-color 0.3s ease, background-color 0.3s ease;
        }
        .template-category-title {
            font-size: 11px;
            font-weight: 800;
            color: var(--color-text-muted);
            text-transform: uppercase;
            letter-spacing: 0.8px;
            margin-bottom: 10px;
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .template-buttons {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }
        .btn-tmpl {
            background: var(--bg-code);
            border: 1px solid var(--border-input);
            color: var(--color-text);
            padding: 8px 12px;
            font-size: 12px;
            font-weight: 600;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.2s ease;
            user-select: none;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
        }
        .btn-tmpl:hover {
            background: var(--color-text-link);
            color: white;
            border-color: var(--color-text-link);
            transform: translateY(-1px);
            box-shadow: 0 4px 8px rgba(25, 118, 210, 0.15);
        }
        .terminal-console {
            background: #020617;
            border-top: 1.5px solid #1E293B;
            height: 160px;
            overflow-y: auto;
            font-family: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
            font-size: 12.5px;
            padding: 16px 12px 10px 12px;
            box-sizing: border-box;
            color: #48BB78;
            white-space: pre-wrap;
            word-break: break-all;
            line-height: 1.4;
        }
        .btn-run {
            background-color: #38A169;
            color: white;
            border: none;
            padding: 10px 16px;
            font-size: 13px;
            font-weight: 800;
            border-radius: 6px;
            cursor: pointer;
            flex-grow: 2;
            transition: all 0.2s ease;
        }
        .btn-run:hover {
            background-color: #2F855A;
            box-shadow: 0 4px 10px rgba(56, 161, 105, 0.2);
        }
        .btn-save-py {
            background-color: var(--color-text-link);
            color: white;
            border: none;
            padding: 10px 16px;
            font-size: 13px;
            font-weight: 700;
            border-radius: 6px;
            cursor: pointer;
            flex-grow: 1.2;
            transition: all 0.2s ease;
        }
        .btn-save-py:hover {
            background-color: var(--color-text-link-hover);
            box-shadow: 0 4px 10px rgba(25, 118, 210, 0.2);
        }
        .btn-clear-console {
            background-color: var(--border-code);
            color: var(--color-text);
            border: 1px solid var(--border-code);
            padding: 10px 16px;
            font-size: 13px;
            font-weight: 700;
            border-radius: 6px;
            cursor: pointer;
            flex-grow: 1;
            transition: all 0.2s ease;
        }
        .btn-clear-console:hover {
            background-color: var(--bg-code);
        }

        /* Exam Mode: hide templates, AI chat, catalog, sidebar extras */
        body.exam-mode .page-footer,
        body.exam-mode .templates-dropdown,
        body.exam-mode .sidebar-catalog-section,
        body.exam-mode .sidebar-qr-container,
        body.exam-mode .sidebar-badge,
        body.exam-mode .task-favorite-btn,
        body.exam-mode .btn-save-py,
        body.exam-mode #variant-live-score-card {
            display: none !important;
        }
        body.exam-mode .card .reveal-link,
        body.exam-mode .card a[onclick*="revealAnswer"] {
            display: none !important;
        }
        body.exam-mode .btn-generate {
            animation: none !important;
        }
        body.exam-mode .header-box {
            background: linear-gradient(135deg, #E53E3E 0%, #DD6B20 100%) !important;
        }
        body.exam-mode.retake-mode .header-box {
            background: repeating-linear-gradient(135deg, #9B2C2C, #9B2C2C 16px, #C53030 16px, #C53030 32px) !important;
            border-bottom: 2px solid #E53E3E !important;
        }
        body.exam-mode .header-box.exam-header-box {
            display: block !important;
        }

        /* Exam-mode notification banner */
        .exam-notification {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 999;
            background: linear-gradient(135deg, #E53E3E, #DD6B20);
            color: white;
            text-align: center;
            padding: 8px 20px;
            font-size: 13px;
            font-weight: 700;
            box-shadow: 0 4px 20px rgba(229,62,62,0.3);
        }
        body.exam-mode.retake-mode .exam-notification {
            background: repeating-linear-gradient(45deg, #8C1D1D, #8C1D1D 14px, #C53030 14px, #C53030 28px) !important;
            box-shadow: 0 4px 20px rgba(197, 48, 48, 0.45) !important;
            color: #FFFFFF !important;
            border-bottom: 1px solid rgba(255,255,255,0.2) !important;
        }
        body.exam-mode.retake-mode .check-container {
            border: 2px dashed #C53030 !important;
            background: repeating-linear-gradient(45deg, rgba(197,48,48,0.06), rgba(197,48,48,0.06) 12px, rgba(255,255,255,0.02) 12px, rgba(255,255,255,0.02) 24px) !important;
        }
        body.exam-mode.retake-mode button[onclick*="submitExam"],
        body.exam-mode.retake-mode .btn-finish-exam {
            background: repeating-linear-gradient(45deg, #C53030, #C53030 14px, #DD6B20 14px, #DD6B20 28px) !important;
            color: #FFFFFF !important;
            box-shadow: 0 4px 16px rgba(197, 48, 48, 0.45) !important;
        }
        body.exam-mode .exam-notification {
            display: block;
        }
        body.exam-mode {
            padding-top: 40px;
        }
        body.exam-mode .sidebar-toggle {
            display: none;
        }
        body.exam-mode .sidebar {
            transform: translateX(-340px) !important;
        }
        body.exam-mode .sidebar-overlay {
            display: none !important;
        }
        body.exam-mode .main-content {
            margin-left: 60px !important;
            width: calc(100% - 60px) !important;
            max-width: calc(100% - 60px) !important;
        }

        body.exam-mode #sidebar-avatar {
            pointer-events: none;
            opacity: 0.4;
        }
        body.exam-mode .archive-item {
            pointer-events: none;
            opacity: 0.5;
        }
        #exam-timer {
            transition: color 0.5s ease;
        }
        #exam-timer.urgent {
            color: #E53E3E;
            animation: pulse 1s infinite;
        }

        /* Hide Scrollbars ("Листалки") on terminal, templates, sidebar & compiler container */
        .terminal-console::-webkit-scrollbar,
        .templates-row::-webkit-scrollbar,
        .compiler-column::-webkit-scrollbar,
        .sidebar::-webkit-scrollbar {
            display: none;
        }
        .terminal-console,
        .templates-row,
        .compiler-column,
        .sidebar {
            -ms-overflow-style: none;  /* IE and Edge */
            scrollbar-width: none;  /* Firefox */
        }

        /* Dropdown style for answers */
        details.answers-dropdown {
            margin-top: 50px;
            background: var(--bg-code);
            border: 2px dashed var(--color-text-link);
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 4px 10px rgba(0,0,0,0.02);
            color: var(--color-heading);
            opacity: 0;
            animation: fadeInUp 0.5s ease forwards;
            transition: all 0.25s ease;
        }
        details.answers-dropdown:hover {
            box-shadow: 0 8px 20px rgba(25, 118, 210, 0.08);
            background: var(--bg-card);
        }
        details.answers-dropdown summary {
            font-weight: 800;
            font-size: 18px;
            color: var(--color-heading);
            cursor: pointer;
            outline: none;
            user-select: none;
        }
        details.answers-dropdown summary:hover {
            color: var(--color-text-link);
        }
        details.answers-dropdown[open] {
            border-style: solid;
            background: var(--bg-card);
        }
        details.answers-dropdown[open] summary {
            border-bottom: 1.5px solid var(--border-code);
            padding-bottom: 10px;
            margin-bottom: 15px;
        }

        /* Smooth & Subtle Animations */
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
        @keyframes popIn {
            from { opacity: 0; transform: scale(0.96) translateY(6px); }
            to { opacity: 1; transform: scale(1) translateY(0); }
        }
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(8px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        @keyframes viewEnter {
            from {
                opacity: 0.7;
                transform: translateY(4px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        @keyframes tabEnter {
            0% {
                opacity: 0.15;
                transform: translateY(10px);
            }
            100% {
                opacity: 1;
                transform: translateY(0);
            }
        }
        .tab-anim-enter, .teacher-tab-content {
            animation: tabEnter 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }
        #content-container > div {
            animation: viewEnter 0.22s cubic-bezier(0.16, 1, 0.3, 1);
        }
        .works-bar-pill, .btn-class, .class-chip, .teacher-class-pill, .tab-btn, .nav-tab, .sidebar-exam-tab, .btn-auth-primary, .btn-auth-secondary, .btn-generate, .btn-theme, .btn-tutorials-nav {
            transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
        }
        /* Fluid accordion detail animations */
        details.card[open] > div, details.sidebar-section[open] > div {
            animation: tabEnter 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }
        #dashboard-heatmap, #dashboard-metrics, #dashboard-charts, #student-stats-results, #class-management-content > div, #student-list-content > div {
            animation: tabEnter 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }
        #student-action-menu-modal > div, #retake-overlay > div, .sp-animate-in, .stat-card-lg {
            animation: popIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }
        .assignment-card, tr, td, button, select, input {
            transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
        }
        @keyframes subtlePulse {
            0% {
                box-shadow: 0 4px 6px rgba(25, 118, 210, 0.15);
                transform: scale(1);
            }
            50% {
                box-shadow: 0 4px 20px rgba(25, 118, 210, 0.4);
                transform: scale(1.02);
            }
            100% {
                box-shadow: 0 4px 6px rgba(25, 118, 210, 0.15);
                transform: scale(1);
            }
        }

        /* Responsive Breakpoints */
        @media (max-width: 1250px) {
            .compiler-column {
                width: 500px;
            }
        }
        @media (max-width: 1100px) {
            .app-container {
                flex-direction: column;
                width: 100%;
            }
            .tasks-column {
                width: 100% !important;
                margin: 0 !important;
            }
            .compiler-column {
                width: 100% !important;
                position: relative;
                top: 0;
                z-index: 10;
                margin-top: 30px;
                max-height: none;
                overflow-y: visible;
                display: none;
            }
            body.variant-generated .compiler-column,
            body.catalog-active .compiler-column {
                display: flex;
            }
        }

        @media (max-width: 850px) {
            body {
                flex-direction: column;
                padding-top: env(safe-area-inset-top, 0px);
                padding-bottom: env(safe-area-inset-bottom, 0px);
            }
            .sidebar-toggle {
                top: max(12px, env(safe-area-inset-top, 12px));
                left: max(12px, env(safe-area-inset-left, 12px));
                width: 44px;
                height: 44px;
                box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
                z-index: 105;
                touch-action: manipulation;
            }
            .sidebar {
                position: fixed;
                width: min(320px, 86vw);
                height: 100vh;
                height: 100dvh;
                border-right: 2px solid var(--border-card);
                border-bottom: none;
                padding: 16px 14px;
                padding-top: max(68px, calc(env(safe-area-inset-top, 0px) + 56px));
                padding-bottom: max(20px, env(safe-area-inset-bottom, 20px));
                transform: translateX(-100%);
                will-change: transform;
                transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
                z-index: 102;
                box-shadow: 6px 0 25px rgba(0, 0, 0, 0.35);
                box-sizing: border-box;
            }
            body.sidebar-open .sidebar {
                transform: translateX(0);
            }
            .sidebar-overlay {
                backdrop-filter: blur(8px);
                -webkit-backdrop-filter: blur(8px);
                background: rgba(10, 15, 29, 0.65);
            }
            .main-content {
                margin-left: 0 !important;
                padding: 12px 10px;
                padding-top: max(64px, calc(env(safe-area-inset-top, 0px) + 52px));
                padding-bottom: max(24px, env(safe-area-inset-bottom, 24px));
                width: 100% !important;
                max-width: 100% !important;
                min-width: 0 !important;
                box-sizing: border-box;
            }
            .header-box {
                padding: 14px 12px;
                margin-bottom: 14px;
                border-radius: 14px;
            }
            .header-box h1 {
                font-size: 19px;
            }
            .header-box p {
                font-size: 13px;
            }
            .card {
                padding: 14px 12px;
                margin-bottom: 14px;
                border-radius: 14px;
            }
            .check-container {
                flex-direction: column;
                align-items: stretch;
                gap: 10px;
            }
            .ans-input {
                width: 100%;
                font-size: 16px !important;
                min-height: 44px;
                box-sizing: border-box;
                touch-action: manipulation;
            }
            .btn-check {
                width: 100%;
                font-size: 15px;
                min-height: 44px;
                padding: 12px;
                border-radius: 10px;
                touch-action: manipulation;
            }
            .reveal-link {
                margin-left: 0;
                text-align: center;
                margin-top: 6px;
                min-height: 38px;
                display: inline-flex;
                align-items: center;
                justify-content: center;
            }
            .overview-table-wrapper, .varanswer-wrapper, .task-desc-table-wrapper, .table-shell {
                overflow-x: auto !important;
                width: 100%;
                margin: 12px 0;
                -webkit-overflow-scrolling: touch;
                border-radius: 10px;
            }
            table {
                margin: 0;
            }
            .control-work-wrapper {
                flex-direction: column;
                gap: 12px;
            }
            .control-work-sidebar {
                width: 100%;
                position: sticky;
                top: max(10px, env(safe-area-inset-top, 10px));
                z-index: 30;
                max-height: none;
                padding: 10px;
                border-radius: 14px;
                background: var(--bg-card);
                backdrop-filter: blur(12px);
                -webkit-backdrop-filter: blur(12px);
                box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
                border: 1px solid var(--border-card);
                box-sizing: border-box;
            }
            .task-circles-grid {
                display: flex !important;
                overflow-x: auto !important;
                -webkit-overflow-scrolling: touch !important;
                scroll-snap-type: x mandatory;
                padding: 4px 2px;
                gap: 8px;
                scrollbar-width: thin;
            }
            .task-circles-grid::-webkit-scrollbar {
                height: 4px;
            }
            .task-circle-btn {
                flex: 0 0 42px;
                min-width: 42px;
                height: 42px;
                font-size: 14px;
                font-weight: 700;
                border-radius: 10px;
                scroll-snap-align: center;
                touch-action: manipulation;
            }
            .control-work-nav-bar {
                flex-wrap: wrap;
                gap: 8px;
                position: sticky;
                bottom: max(10px, env(safe-area-inset-bottom, 10px));
                z-index: 25;
                background: var(--bg-card);
                backdrop-filter: blur(12px);
                -webkit-backdrop-filter: blur(12px);
                border: 1px solid var(--border-card);
                border-radius: 14px;
                padding: 8px 10px;
                box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.12);
            }
            .control-work-nav-btn {
                flex: 1;
                min-height: 44px;
                justify-content: center;
                padding: 10px 12px;
                font-size: 14px;
                touch-action: manipulation;
            }
            .task-files {
                padding: 10px 12px;
                font-size: 13px;
                word-break: break-word;
            }
            input, select, textarea {
                font-size: 16px !important;
            }
            .btn-generate, .btn-tutorials-nav, .sidebar-catalog-select {
                min-height: 44px;
                touch-action: manipulation;
            }
        }

        /* Bottom sheet presentation for modals on screens <= 600px */
        @media (max-width: 600px) {
            #custom-modal-backdrop,
            .modal-overlay,
            #kimscanner-modal,
            #class-modal-overlay,
            .auth-overlay {
                align-items: flex-end !important;
                padding: 0 !important;
            }
            .custom-modal-card,
            .modal-card,
            .auth-card,
            #kimscanner-modal > div,
            #class-modal-overlay > div {
                width: 100% !important;
                max-width: 100% !important;
                border-bottom-left-radius: 0 !important;
                border-bottom-right-radius: 0 !important;
                border-top-left-radius: 22px !important;
                border-top-right-radius: 22px !important;
                max-height: 88vh !important;
                max-height: 88dvh !important;
                overflow-y: auto !important;
                padding: 22px 16px max(24px, env(safe-area-inset-bottom, 24px)) 16px !important;
                margin: 0 !important;
                box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5) !important;
                animation: mobileSheetSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
            }
            @keyframes mobileSheetSlideUp {
                from { transform: translateY(100%); opacity: 0; }
                to { transform: translateY(0); opacity: 1; }
            }
        }

        .task-desc table {
            display: block;
            width: 100% !important;
            max-width: 100% !important;
            overflow-x: auto !important;
            -webkit-overflow-scrolling: touch;
            margin: 10px 0;
            border-radius: 8px;
        }
        
        /* Auth Overlay & Card Styling */
        .auth-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            width: 100%;
            height: 100%;
            background: var(--bg-auth-overlay);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 9999;
            box-sizing: border-box;
            padding: 20px;
            overflow-y: auto;
            transition: opacity 0.3s ease, visibility 0.3s ease;
        }
        .auth-card {
            background: var(--bg-auth-card);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border: 1px solid var(--border-auth-card);
            border-radius: 16px;
            width: 100%;
            max-width: 420px;
            padding: 40px 30px;
            box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
            box-sizing: border-box;
            color: var(--color-auth-text);
            animation: scaleIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }
        @keyframes scaleIn {
            from {
                opacity: 0;
                transform: scale(0.95) translateY(10px);
            }
            to {
                opacity: 1;
                transform: scale(1) translateY(0);
            }
        }
        .auth-header {
            text-align: center;
            margin-bottom: 30px;
        }
        .auth-header h2 {
            margin: 0;
            font-size: 26px;
            font-weight: 800;
            background: linear-gradient(135deg, #38BDF8 0%, #C084FC 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            letter-spacing: 0.5px;
        }
        .auth-header p {
            margin: 8px 0 0 0;
            font-size: 13px;
            color: var(--color-auth-text-muted);
        }
        .auth-input-group {
            margin-bottom: 20px;
            display: flex;
            flex-direction: column;
            gap: 6px;
        }
        .auth-input-group label {
            font-size: 11px;
            font-weight: 700;
            color: var(--color-auth-label);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            text-align: left;
        }
        .auth-input-group input {
            background: var(--bg-auth-input);
            border: 1.5px solid var(--border-auth-input);
            border-radius: 8px;
            padding: 12px 14px;
            font-size: 14px;
            color: var(--color-auth-text);
            outline: none;
            transition: border-color 0.25s ease, box-shadow 0.25s ease;
        }
        .auth-input-group input:focus {
            border-color: #38BDF8;
            box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
        }
        .auth-error-msg {
            color: #F87171;
            font-size: 13px;
            margin-bottom: 15px;
            min-height: 18px;
            text-align: center;
            font-weight: 600;
        }
        .btn-auth-primary {
            width: 100%;
            background: linear-gradient(135deg, #38BDF8 0%, #C084FC 100%);
            border: none;
            border-radius: 8px;
            color: #FFFFFF;
            padding: 12px;
            font-size: 15px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.25s ease;
            box-shadow: 0 4px 15px rgba(192, 132, 252, 0.25);
        }
        .btn-auth-primary:hover {
            transform: translateY(-1px);
            box-shadow: 0 6px 20px rgba(192, 132, 252, 0.35);
        }
        .auth-divider {
            display: flex;
            align-items: center;
            text-align: center;
            margin: 20px 0;
            color: var(--color-auth-text-muted);
        }
        .auth-divider::before, .auth-divider::after {
            content: '';
            flex: 1;
            border-bottom: 1px solid var(--border-auth-card);
        }
        .auth-divider:not(:empty)::before {
            margin-right: .25em;
        }
        .auth-divider:not(:empty)::after {
            margin-left: .25em;
        }
        .auth-divider span {
            font-size: 12px;
            text-transform: uppercase;
            letter-spacing: 1px;
            color: var(--color-auth-text-muted);
        }
        .btn-auth-secondary {
            width: 100%;
            background: transparent;
            border: 1.5px solid var(--border-auth-btn-secondary);
            border-radius: 8px;
            color: var(--color-auth-btn-secondary);
            padding: 11px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.25s ease;
        }
        .btn-auth-secondary:hover {
            background: var(--bg-auth-btn-secondary-hover);
            border-color: var(--border-auth-btn-secondary);
            color: var(--color-auth-text);
        }
        .auth-card a {
            color: #38BDF8;
            text-decoration: none;
            font-weight: 600;
            transition: color 0.2s ease;
        }
        .auth-card a:hover {
            color: #C084FC;
        }

        /* Archive Items Sidebar List */
        .archive-item {
            display: flex;
            align-items: center;
            gap: 10px;
            background: var(--bg-archive-item);
            border: 1px solid var(--border-card);
            border-radius: 8px;
            padding: 10px 12px;
            margin-bottom: 8px;
            cursor: pointer;
            transition: all 0.25s ease;
            text-align: left;
        }
        .archive-item:hover {
            background: var(--bg-archive-item-hover);
            border-color: var(--color-text-link);
            transform: translateX(3px);
            box-shadow: 0 4px 12px rgba(49, 130, 206, 0.1);
        }
        .archive-item.active-archive-link {
            background: var(--bg-archive-item-active);
            border-color: var(--color-text-link);
            box-shadow: 0 0 10px rgba(49, 130, 206, 0.2);
            position: relative;
        }
        .archive-item.active-archive-link::before {
            content: '';
            position: absolute;
            left: 0;
            top: 25%;
            height: 50%;
            width: 3px;
            background: var(--color-text-link);
            border-radius: 0 4px 4px 0;
        }
        .archive-item-icon {
            font-size: 14px;
        }
        .archive-item-title {
            font-size: 12.5px;
            font-weight: 600;
            color: var(--color-text);
        }

/* ==========================================
   Control Work / Exam Layout & Task Circles
   ========================================== */
.control-work-wrapper {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    width: 100%;
    margin-top: 10px;
}

@media (max-width: 900px) {
    .control-work-wrapper {
        flex-direction: column;
        gap: 16px;
    }
}

.control-work-sidebar {
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-card);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    z-index: 10;
}

@media (max-width: 900px) {
    .control-work-sidebar {
        width: 100%;
        position: static;
        max-height: none;
    }
}

.control-work-sidebar-header {
    text-align: center;
    border-bottom: 1.5px solid var(--border-card);
    padding-bottom: 12px;
}

.control-work-sidebar-title {
    font-size: 17px;
    font-weight: 900;
    color: var(--color-heading);
    margin: 0 0 4px 0;
}

.control-work-sidebar-sub {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--color-text-link);
}

.task-circles-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    width: 100%;
    padding: 4px 0;
}

@media (max-width: 900px) {
    .task-circles-grid {
        grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
    }
}

.task-circle-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid var(--border-input);
    background: var(--bg-input);
    color: var(--color-text);
    font-weight: 800;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    user-select: none;
    margin: 0 auto;
}

.task-circle-btn:hover {
    transform: translateY(-2px) scale(1.06);
    border-color: var(--color-text-link);
    box-shadow: 0 4px 12px rgba(49, 130, 206, 0.25);
}

.task-circle-btn.active {
    border-color: #805AD5;
    background: linear-gradient(135deg, rgba(128, 90, 213, 0.15), rgba(49, 130, 206, 0.15));
    color: #805AD5;
    box-shadow: 0 0 0 3px rgba(128, 90, 213, 0.25), 0 4px 12px rgba(128, 90, 213, 0.2);
    transform: scale(1.08);
    z-index: 2;
}

.task-circle-btn.answered {
    background: linear-gradient(135deg, #38A169 0%, #2F855A 100%);
    border-color: #38A169;
    color: white;
    box-shadow: 0 3px 10px rgba(56, 161, 105, 0.3);
}

.task-circle-btn.answered.active {
    border-color: #C084FC;
    box-shadow: 0 0 0 3px rgba(192, 132, 252, 0.4), 0 4px 14px rgba(56, 161, 105, 0.4);
}

.control-work-finish-btn {
    width: 100%;
    background: linear-gradient(135deg, #E53E3E 0%, #C53030 100%);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-size: 14.5px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(229, 62, 62, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: auto;
}

.control-work-finish-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(229, 62, 62, 0.45);
    background: linear-gradient(135deg, #F56565 0%, #C53030 100%);
}

.control-work-main {
    flex: 1;
    min-width: 0;
    width: 100%;
}

.control-work-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1.5px solid var(--border-card);
}

.control-work-nav-btn {
    background: var(--bg-input);
    border: 1.5px solid var(--border-input);
    color: var(--color-text);
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-work-nav-btn:hover:not(:disabled) {
    border-color: var(--color-text-link);
    color: var(--color-text-link);
    background: var(--bg-card);
    transform: translateY(-1px);
}

.control-work-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Utility classes extracted from repeated inline styles in teacher.js ── */
.c-error   { color: #E53E3E; }
.c-success { color: #38A169; }
.c-muted   { color: var(--color-text-muted); }
.c-text    { color: var(--color-text); }
.c-success-sm { color: #38A169; font-size: 14px; }

.auth-box   { background: var(--bg-input); border-radius: 10px; padding: 14px; text-align: center; border: 1px solid var(--border-card); }
.stat-card  { padding: 8px; border: 1px solid rgba(255,255,255,0.2); }
.section-label { font-size: 16px; color: var(--color-text-muted); font-weight: 700; text-transform: uppercase; }
.empty-state   { text-align: center; padding: 20px; color: var(--color-text-muted); }
.chip-ghost    { padding: 4px 6px; border: 1px solid var(--border-input); }
.empty-state-lg { padding: 30px; text-align: center; color: var(--color-text-muted); font-size: 16px; }
.stat-box { background: var(--bg-input); border: 1px solid var(--border-card); border-radius: 12px; padding: 12px 10px; text-align: center; }
.title-row { font-weight: 700; font-size: 15px; color: var(--color-text); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.table-shell { max-height: none; width: 100%; overflow-x: auto; overflow-y: visible; border: 1.5px solid var(--border-card); border-radius: 12px; background: var(--bg-card); box-shadow: 0 4px 15px rgba(0,0,0,0.04); box-sizing: border-box; }
.full-table { width: 100%; border-collapse: collapse; font-size: 16px; box-sizing: border-box; }
.full-table-2 { width: 100%; border-collapse: collapse; font-size: 16px; }
.sticky-head { position: sticky; top: 0; background: var(--bg-code); color: var(--color-heading); z-index: 5; }
[data-theme="dark"] .sticky-head { background: #1E293B; color: #F8FAFC; }
:root:not([data-theme="dark"]) .sticky-head { background: #E2E8F0; color: #0F2942; }
.stat-cell { background: var(--bg-input); border: 1px solid rgba(128,128,128,0.15); padding: 10px; border-radius: 8px; text-align: center; }
.metric-lg { font-size: 26px; font-weight: 700; color: var(--color-heading); }
.text-xs   { font-size: 15px; font-weight: 500; color: var(--color-text-muted); }
.stat-card-lg { background: var(--bg-input); border-radius: 14px; padding: 18px 16px; text-align: center; border: 1px solid var(--border-card); }
.label-xs  { font-size: 14px; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.pad-8     { padding: 8px; }
.text-md-muted { font-size: 17px; color: var(--color-text-muted); }

/* Student Action Modal Buttons */
.btn-student-action {
    background: var(--bg-card);
    border: 1.5px solid var(--border-input);
    color: var(--color-text);
    padding: 13px 18px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.18s ease;
}
.btn-student-action:hover {
    background: linear-gradient(135deg, #3182CE 0%, #2B6CB0 100%) !important;
    color: #ffffff !important;
    border-color: #3182CE !important;
    box-shadow: 0 4px 14px rgba(49, 130, 206, 0.35) !important;
    transform: translateY(-1px);
}

/* Compact Neat Back Arrow Buttons */
.btn-back-arrow,
.btn-back-arrow-light {
    width: 38px;
    height: 38px;
    min-width: 38px;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    cursor: pointer;
    outline: none;
    line-height: 1;
    font-size: 19px;
    font-weight: 800;
    user-select: none;
    transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.btn-back-arrow {
    border: 1.5px solid var(--border-input);
    background: var(--bg-card);
    color: var(--color-text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.btn-back-arrow:hover {
    background: var(--bg-input);
    border-color: var(--color-text-link, #3182CE);
    color: var(--color-text-link, #3182CE);
    transform: translateX(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.09);
}
.btn-back-arrow:active {
    transform: translateX(-1px) scale(0.96);
}

.btn-back-arrow-light {
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.btn-back-arrow-light:hover {
    background: rgba(255, 255, 255, 0.32);
    border-color: rgba(255, 255, 255, 0.6);
    color: #ffffff;
    transform: translateX(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}
.btn-back-arrow-light:active {
    transform: translateX(-1px) scale(0.96);
    background: rgba(255, 255, 255, 0.4);
}

/* Subtle SVG and Table Row Micro-Interactions */
svg circle {
    transition: transform 0.2s ease;
}

.table-shell table tbody tr {
    transition: background-color 0.15s ease, filter 0.15s ease;
}

.table-shell table tbody tr:hover {
    filter: brightness(1.03);
}

/* ==========================================================================
   Tutorials & Knowledge Base UI Enhancements
   ========================================================================== */
.btn-tutorials-nav {
    width: 100%;
    background: linear-gradient(135deg, var(--color-text-link) 0%, #C084FC 100%);
    border: none;
    color: #FFFFFF;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(49, 130, 206, 0.25);
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-tutorials-nav:hover {
    background: linear-gradient(135deg, var(--color-text-link-hover) 0%, #A855F7 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(49, 130, 206, 0.38);
    color: #FFFFFF;
}

.btn-tutorials-nav:active {
    transform: translateY(0) scale(0.98);
}

.btn-tutorials-nav .badge-new {
    background: rgba(255, 255, 255, 0.25);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.45);
    font-size: 10px;
    font-weight: 900;
    padding: 3px 8px;
    border-radius: 8px;
    letter-spacing: 0.5px;
}

.tutorial-code-box {
    background: var(--bg-card);
    border: 1.5px solid var(--border-card);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.tutorial-code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-input);
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-card);
}

.tutorial-code-pre {
    margin: 0;
    padding: 16px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13.5px;
    color: var(--color-text);
    background: var(--bg-card);
    line-height: 1.55;
    white-space: pre-wrap;
}

.teacher-assignments-scroll-container {
    position: relative;
    max-height: 570px;
    overflow-y: auto;
    padding: 4px 6px 20px 2px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-card) transparent;
    -webkit-mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
    transition: -webkit-mask-image 0.2s ease, mask-image 0.2s ease;
}

.teacher-assignments-scroll-container:hover {
    -webkit-mask-image: none;
    mask-image: none;
}

.teacher-assignments-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.class-chip, .btn-class, .teacher-class-pill {
    padding: 9px 18px !important;
    border-radius: 9px !important;
    font-size: 16.5px !important;
    font-weight: 700 !important;
}

@media (max-width: 1200px) {
    .teacher-assignments-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 860px) {
    .teacher-assignments-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .teacher-assignments-grid {
        grid-template-columns: 1fr;
    }
}

/* Skill Radar Compact Task Chips & Hover Popovers */
.skill-task-chip {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    text-align: center;
}

.skill-task-chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    z-index: 20;
}

.skill-task-popover {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 250px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-card);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    z-index: 100;
    pointer-events: auto;
    text-align: left;
}

.skill-task-popover::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: var(--border-card) transparent transparent transparent;
}

.skill-task-chip:hover .skill-task-popover,
.skill-task-chip:focus-within .skill-task-popover {
    display: block;
    animation: fadeInPopover 0.15s ease-out;
}

@keyframes fadeInPopover {
    from { opacity: 0; transform: translate(-50%, 4px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* Student Gamification */
.student-gamification-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 0;
}

.student-gamification-grid.single-col {
    grid-template-columns: 1fr;
}

@media (max-width: 960px) {
    .student-gamification-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
}

.achievement-grid-preview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 14px;
}

.student-gamification-grid.single-col .achievement-grid-preview {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    max-width: 900px;
}

@media (max-width: 600px) {
    .achievement-grid-preview,
    .student-gamification-grid.single-col .achievement-grid-preview {
        grid-template-columns: repeat(2, 1fr);
    }
}

.achievement-item-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 6px;
    border-radius: 12px;
    transition: all 0.15s ease;
    user-select: none;
    min-width: 0;
}

.achievement-item-preview.unlocked {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(217, 119, 6, 0.08));
    border: 1.5px solid rgba(245, 158, 11, 0.45);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.1);
}

.achievement-item-preview.unlocked:hover {
    transform: translateY(-2px);
    border-color: #F59E0B;
}

.achievement-item-preview.locked {
    background: var(--bg-input);
    border: 1.5px dashed var(--border-input);
    opacity: 0.6;
    filter: grayscale(0.85);
}

.achievement-item-preview .preview-icon {
    font-size: 30px;
    margin-bottom: 6px;
    line-height: 1;
}

.achievement-item-preview .preview-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--color-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    line-height: 1.25;
}

.achievement-item-preview .preview-status {
    font-size: 12.5px;
    margin-top: 4px;
    line-height: 1.15;
}

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.achievement-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 14px 10px;
    border-radius: 14px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    user-select: none;
}

.achievement-item.unlocked {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(217, 119, 6, 0.08));
    border: 1.5px solid rgba(245, 158, 11, 0.4);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.12);
}

.achievement-item.unlocked:hover {
    transform: translateY(-3px) scale(1.03);
    border-color: #F59E0B;
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.28);
}

.achievement-item.locked {
    background: var(--bg-input);
    border: 1.5px dashed var(--border-input);
    opacity: 0.6;
    filter: grayscale(0.85);
}

.achievement-item.locked:hover {
    opacity: 0.85;
    filter: grayscale(0.3);
    transform: translateY(-2px);
}

.achievement-icon {
    font-size: 32px;
    margin-bottom: 8px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.achievement-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--color-heading);
    margin-bottom: 4px;
    line-height: 1.3;
}

.achievement-desc {
    font-size: 11px;
    color: var(--color-text-muted);
    line-height: 1.25;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 4px;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-card);
    transition: transform 0.15s ease, background 0.15s ease;
}

.leaderboard-row:hover {
    background: var(--bg-card-hover, var(--bg-input));
    transform: translateX(3px);
}

.leaderboard-row.rank-1 {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(217, 119, 6, 0.15));
    border: 1.5px solid #F59E0B;
    box-shadow: 0 3px 12px rgba(245, 158, 11, 0.2);
}

.leaderboard-row.rank-2 {
    background: linear-gradient(135deg, rgba(203, 213, 225, 0.22), rgba(148, 163, 184, 0.15));
    border: 1.5px solid #94A3B8;
}

.leaderboard-row.rank-3 {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.18), rgba(180, 83, 9, 0.12));
    border: 1.5px solid #D97706;
}

.leaderboard-row.current-user {
    border: 2px solid var(--color-text-link, #3182CE);
    background: linear-gradient(135deg, rgba(49, 130, 206, 0.18), rgba(99, 179, 237, 0.1));
}

.leaderboard-rank-badge {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 14px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
}

/* Achievement Toast & Celebration */
#achievement-toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    pointer-events: none;
    max-width: 90vw;
    width: 440px;
}

.achievement-toast {
    pointer-events: auto;
    position: relative;
    width: 100%;
    background: linear-gradient(135deg, #1E293B, #0F172A);
    border: 2px solid #F59E0B;
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45), 0 0 24px rgba(245, 158, 11, 0.35);
    cursor: pointer;
    overflow: hidden;
    animation: toastBounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.achievement-toast:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.55), 0 0 32px rgba(245, 158, 11, 0.55);
}

.achievement-toast-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: skewX(-25deg);
    animation: toastShine 2.5s infinite;
}

.achievement-toast-icon {
    font-size: 38px;
    line-height: 1;
    flex-shrink: 0;
    filter: drop-shadow(0 4px 10px rgba(245, 158, 11, 0.5));
    animation: iconPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.achievement-toast-body {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.achievement-toast-header {
    font-size: 12px;
    font-weight: 800;
    color: #F59E0B;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 2px;
}

.achievement-toast-title {
    font-size: 16px;
    font-weight: 800;
    color: #FFFFFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.achievement-toast-desc {
    font-size: 13px;
    color: #CBD5E1;
    margin-top: 2px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.achievement-toast-close {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #94A3B8;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.achievement-toast-close:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #FFFFFF;
}

@keyframes toastBounceIn {
    0% {
        opacity: 0;
        transform: translateY(-50px) scale(0.85);
    }
    70% {
        transform: translateY(6px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastShine {
    0% { left: -100%; }
    40%, 100% { left: 150%; }
}

@keyframes iconPop {
    0% { transform: scale(0.5) rotate(-15deg); }
    70% { transform: scale(1.2) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* Custom Modern Toasts */
#sk-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 90vw;
    width: 380px;
}

.sk-toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 18px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    animation: skToastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    transition: all 0.25s ease;
}

.sk-toast.sk-toast-info { border-left: 4px solid #38BDF8; }
.sk-toast.sk-toast-success { border-left: 4px solid #10B981; }
.sk-toast.sk-toast-warning { border-left: 4px solid #F59E0B; }
.sk-toast.sk-toast-error { border-left: 4px solid #EF4444; }

@keyframes skToastSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Sidebar Exam Mode Switcher Tabs */
.sidebar-exam-switcher {
    display: flex;
    gap: 6px;
    background: var(--bg-input);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--border-card);
    margin-bottom: 14px;
}

.sidebar-exam-tab {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 800;
    border: none;
    cursor: pointer;
    background: transparent;
    color: var(--color-text-muted);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.sidebar-exam-tab.active-ege {
    background: var(--color-text-link);
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(49, 130, 206, 0.3);
}

.sidebar-exam-tab.active-oge {
    background: #10B981;
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.3);
}

/* KIMScanner Modal */
.kimscan-result-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-text-link) !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.btn-kimscan-solve:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
    box-shadow: 0 4px 14px rgba(49, 130, 206, 0.35);
}

#kimscan-dropzone:hover {
    background: rgba(56, 189, 248, 0.04) !important;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Sidebar Brand Animated Gradient */
.sidebar-brand-box {
    text-align: center;
    padding: 0 4px;
    margin-bottom: 20px;
    background: transparent;
    border: none;
    box-shadow: none;
    position: relative;
    user-select: none;
}

.sidebar-brand-title {
    margin: 0;
    font-size: 32px;
    font-weight: 900;
    letter-spacing: 0.5px;
    display: inline-block;
    cursor: pointer;
    background: linear-gradient(135deg, var(--color-text-link) 0%, #C084FC 46%, #FFFFFF 50%, #C084FC 54%, var(--color-text-link) 100%);
    background-size: 300% 100%;
    background-position: 0% 50%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: smartkimRareShine 10s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-brand-title:hover {
    transform: scale(1.03);
}

.sidebar-brand-title:active {
    transform: scale(0.97);
}

.sidebar-brand-subtitle {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text-muted);
    opacity: 0.75;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    margin-top: 3px;
}

@keyframes smartkimRareShine {
    0%, 75% {
        background-position: 0% 50%;
    }
    88%, 100% {
        background-position: 100% 50%;
    }
/* Reduce CPU and GPU work on constrained devices detected by the app. */
.lite-device *,
.lite-device *::before,
.lite-device *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
}

.lite-device .bg-blob,
.lite-device .sidebar-kimscanner-btn,
.lite-device .exam-notification,
.lite-device .sidebar-qr {
    animation: none !important;
    filter: none !important;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
