        :root {
            --font-vietnamese: "Segoe UI", Arial, Tahoma, "Helvetica Neue", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
            --bg-primary: #F8FAFC;
            --bg-secondary: #FFFFFF;
            --text-primary: #0F172A;
            --text-secondary: #475569;
            --border-soft: rgba(15, 23, 42, 0.06);
        }

        html:not(.dark) {
            color-scheme: light !important;
            forced-color-adjust: none !important;
        }

        html.dark {
            color-scheme: dark !important;
            forced-color-adjust: none !important;
            --bg-primary: #0B0F19;
            --bg-secondary: #0F172A;
            --text-primary: #F8FAFC;
            --text-secondary: #94A3B8;
            --border-soft: rgba(255, 255, 255, 0.08);
        }

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

        #credential_picker_container {
            z-index: 99999999 !important;
        }

        /* Glassmorphism background effect */
        .hw-glass {
            background: var(--bg-secondary) !important;
            border: 1px solid var(--border-soft) !important;
            box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06) !important;
        }

        /* =========================================================
           THEME SWITCHER CONTROLS (DESKTOP & MOBILE PORTRAIT)
           ========================================================= */
        .hw-theme-toggle-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 32px !important;
            height: 32px !important;
            min-width: 32px !important;
            min-height: 32px !important;
            max-width: 32px !important;
            max-height: 32px !important;
            padding: 0 !important;
            aspect-ratio: 1 / 1;
            border-radius: 10px;
            border: 1px solid #e2e8f0;
            background-color: #f8fafc;
            color: #475569;
            cursor: pointer;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            flex-shrink: 0;
            box-sizing: border-box !important;
        }
        .hw-theme-toggle-btn:hover {
            background-color: #e2e8f0;
            color: #0f172a;
            transform: scale(1.05);
        }
        .hw-theme-toggle-btn:active {
            transform: scale(0.95);
        }
        html.dark .hw-theme-toggle-btn {
            background-color: #1e293b;
            border-color: #334155;
            color: #fbbf24;
            box-shadow: 0 0 10px rgba(251, 191, 36, 0.2);
        }
        html.dark .hw-theme-toggle-btn:hover {
            background-color: #334155;
            color: #fef08a;
        }

        /* Mobile Bottom Floating Smart Pill (Màn hình dọc - Vị trí dưới cùng tối ưu thao tác ngón cái) */
        #mobile-top-theme-toggle,
        .hw-mobile-theme-pill {
            position: fixed;
            bottom: calc(64px + 14px + env(safe-area-inset-bottom, 0px));
            right: 14px;
            z-index: 9999995 !important;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 38px !important;
            height: 38px !important;
            min-width: 38px !important;
            min-height: 38px !important;
            max-width: 38px !important;
            max-height: 38px !important;
            padding: 0 !important;
            aspect-ratio: 1 / 1;
            border-radius: 9999px !important;
            flex: 0 0 38px !important;
            box-sizing: border-box !important;
            border: 1.5px solid rgba(226, 232, 240, 0.9);
            background: rgba(255, 255, 255, 0.94);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            box-shadow: 0 4px 16px rgba(15, 23, 42, 0.14), 0 1px 3px rgba(15, 23, 42, 0.08);
            color: #334155;
            cursor: pointer;
            transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.18s ease, background 0.18s ease;
            touch-action: manipulation;
            -webkit-tap-highlight-color: transparent;
        }
        .hw-mobile-theme-pill:active {
            transform: scale(0.90);
        }
        html.dark .hw-mobile-theme-pill {
            border-color: rgba(51, 65, 85, 0.9);
            background: rgba(15, 23, 42, 0.94);
            color: #fbbf24;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.55), 0 0 14px rgba(251, 191, 36, 0.3);
        }

        /* Trường hợp trang không có bottom navigation bar */
        body:not(:has(#hw-mobile-bottom-nav:not([style*="display: none"]))) .hw-mobile-theme-pill {
            bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        }

        /* Hiển thị nổi bật trên tất cả các lớp của phòng đấu trí (#pvp-live-room) */
        body:has(#pvp-live-room) #mobile-top-theme-toggle,
        body:has(#pvp-live-room) .hw-mobile-theme-pill,
        body.pvp-room-active #mobile-top-theme-toggle,
        body.pvp-room-active .hw-mobile-theme-pill,
        #pvp-live-room ~ #mobile-top-theme-toggle,
        #pvp-live-room ~ .hw-mobile-theme-pill {
            z-index: 9999995 !important;
            display: inline-flex !important;
            bottom: calc(52px + env(safe-area-inset-bottom, 0px)) !important;
            right: 12px !important;
        }

        /* Khi nút chuyển xuống dưới, header v2 không cần padding thụt lề */
        @media (max-width: 767px) {
            .v2-header-row {
                padding-right: 0px !important;
            }
        }

        /* V2 Toolbar Theme Chip (Ảnh 1) */
        .v2-theme-chip {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            cursor: pointer;
            user-select: none;
            transition: all 0.18s ease;
        }
        .v2-theme-chip:active {
            transform: scale(0.95);
        }
        html.dark .v2-theme-chip {
            background-color: #1e293b !important;
            border-color: #334155 !important;
            color: #e2e8f0 !important;
        }
        html.dark .v2-theme-chip:hover {
            background-color: #334155 !important;
            border-color: #475569 !important;
        }

        /* ===== GLOBAL LIGHT-THEME FIX: Scoped to apply ONLY when NOT in dark mode ===== */
        /* Dark backgrounds → clean white/light */
        html:not(.dark) [class*="hw-bg-slate-900"],
        html:not(.dark) [class*="hw-bg-slate-950"],
        html[data-theme="light"] [class*="hw-bg-slate-900"],
        html[data-theme="light"] [class*="hw-bg-slate-950"] {
            background-color: #ffffff !important;
            background: #ffffff !important;
        }

        /* Secondary slate-800 containers → clean neutral light gray */
        html:not(.dark) [class*="hw-bg-slate-800"],
        html[data-theme="light"] [class*="hw-bg-slate-800"] {
            background-color: #f8fafc !important;
            background: #f8fafc !important;
            border-color: #e2e8f0 !important;
            color: #334155 !important;
        }

        /* Subtle progress bar tracks: keep visible light gray */
        html:not(.dark) [class*="hw-h-2"][class*="hw-bg-slate-950"],
        html[data-theme="light"] [class*="hw-h-2"][class*="hw-bg-slate-950"] {
            background-color: #e2e8f0 !important;
            background: #e2e8f0 !important;
        }

        /* Dark borders → subtle light borders */
        html:not(.dark) [class*="hw-border-slate-800"],
        html:not(.dark) [class*="hw-border-slate-700"],
        html[data-theme="light"] [class*="hw-border-slate-800"],
        html[data-theme="light"] [class*="hw-border-slate-700"] {
            border-color: #e2e8f0 !important;
        }

        /* Dark text colors → readable dark text */
        html:not(.dark) [class*="hw-text-slate-200"],
        html:not(.dark) [class*="hw-text-slate-100"],
        html:not(.dark) [class*="hw-text-slate-300"],
        html[data-theme="light"] [class*="hw-text-slate-200"],
        html[data-theme="light"] [class*="hw-text-slate-100"],
        html[data-theme="light"] [class*="hw-text-slate-300"] {
            color: #334155 !important;
        }

        html:not(.dark) [class*="hw-text-slate-350"],
        html[data-theme="light"] [class*="hw-text-slate-350"] {
            color: #475569 !important;
        }

        /* Input fields: clean white bg with subtle border */
        html:not(.dark) input[class*="hw-bg-slate-950"],
        html:not(.dark) input[class*="hw-bg-slate-900"],
        html:not(.dark) textarea[class*="hw-bg-slate-950"],
        html:not(.dark) textarea[class*="hw-bg-slate-900"],
        html:not(.dark) select[class*="hw-bg-slate-950"],
        html:not(.dark) select[class*="hw-bg-slate-900"] {
            background-color: #f8fafc !important;
            background: #f8fafc !important;
            border-color: #e2e8f0 !important;
            color: #1e293b !important;
        }

        html:not(.dark) input[class*="hw-bg-slate-950"]:focus,
        html:not(.dark) input[class*="hw-bg-slate-900"]:focus,
        html:not(.dark) textarea[class*="hw-bg-slate-950"]:focus,
        html:not(.dark) textarea[class*="hw-bg-slate-900"]:focus {
            border-color: #6366f1 !important;
            box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
        }

        /* Flashcard faces: keep clean white bg */
        html:not(.dark) .hw-card-front,
        html:not(.dark) .hw-card-back {
            background: #ffffff !important;
            border-color: #e2e8f0 !important;
            color: #1e293b !important;
        }

        /* =========================================================
           SMART WEAKER WORDS WIDGET (UNIFIED & PREMIUM DESIGN)
           ========================================================= */
        .hw-weaker-widget {
            position: relative;
            overflow: hidden;
            border-radius: 20px !important;
            transition: all 0.25s ease;
        }

        /* Ambient glow line at the top */
        .hw-weaker-widget::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 2px;
            background: linear-gradient(90deg, #f43f5e, #fb7185, #f59e0b);
            opacity: 0.9;
            z-index: 2;
        }

        /* Dark mode container */
        html.dark .hw-weaker-widget {
            background: linear-gradient(155deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.88)) !important;
            border: 1px solid rgba(244, 63, 94, 0.22) !important;
            box-shadow: 0 10px 32px -5px rgba(0, 0, 0, 0.45), 0 0 20px -8px rgba(244, 63, 94, 0.18) !important;
        }

        /* Light mode container */
        html:not(.dark) .hw-weaker-widget {
            background: #ffffff !important;
            border: 1px solid #fecdd3 !important;
            box-shadow: 0 12px 28px -6px rgba(244, 63, 94, 0.1), 0 4px 12px rgba(0, 0, 0, 0.03) !important;
        }

        /* Widget header kicker */
        .hw-weaker-widget .hw-library-card-kicker {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            font-size: 9px;
            font-weight: 900;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            padding: 2.5px 8px;
            border-radius: 6px;
            margin-bottom: 6px;
            width: fit-content;
        }

        html.dark .hw-weaker-widget .hw-library-card-kicker {
            background: rgba(244, 63, 94, 0.16) !important;
            color: #fb7185 !important;
            border: 1px solid rgba(244, 63, 94, 0.3) !important;
        }

        html:not(.dark) .hw-weaker-widget .hw-library-card-kicker {
            background: #fff1f2 !important;
            color: #e11d48 !important;
            border: 1px solid #fecdd3 !important;
        }

        /* Widget title */
        .hw-weaker-widget .hw-library-card-heading h3 {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 6px;
            font-size: 14.5px;
            font-weight: 850;
            letter-spacing: -0.01em;
            margin: 0;
        }

        html.dark .hw-weaker-widget .hw-library-card-heading h3 {
            color: #f8fafc !important;
        }

        html:not(.dark) .hw-weaker-widget .hw-library-card-heading h3 {
            color: #0f172a !important;
        }

        .hw-weaker-widget .hw-library-card-heading h3 i {
            color: #f43f5e;
            filter: drop-shadow(0 2px 6px rgba(244, 63, 94, 0.4));
        }

        /* Count pill badge (FIX: Works consistently in both Dark & Light modes) */
        .hw-weaker-count-pill:not(.hw-hidden) {
            min-width: 20px;
            height: 20px;
            padding: 0 6px;
            border-radius: 9999px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, #f43f5e, #fb7185) !important;
            color: #ffffff !important;
            border: 1px solid rgba(255, 255, 255, 0.35) !important;
            box-shadow: 0 2px 8px rgba(244, 63, 94, 0.45) !important;
            font-size: 10px !important;
            font-weight: 900 !important;
            line-height: 1 !important;
            vertical-align: middle;
            margin-left: 2px;
        }

        /* Practice Action Button (FIX: High-impact CTA) */
        .hw-weaker-practice-pill:not(.hw-hidden) {
            min-height: 2rem;
            padding: 0.35rem 0.85rem;
            border-radius: 9999px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 0.45rem;
            background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
            color: #ffffff !important;
            border: 1px solid rgba(255, 255, 255, 0.22) !important;
            box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35) !important;
            font-size: 0.72rem;
            font-weight: 850;
            white-space: nowrap;
            cursor: pointer;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .hw-weaker-practice-pill:hover {
            transform: translateY(-1.5px);
            box-shadow: 0 6px 18px rgba(99, 102, 241, 0.5) !important;
            filter: brightness(1.1);
        }

        .hw-weaker-practice-pill:active {
            transform: scale(0.96);
        }

        /* Scrollable list */
        .hw-weaker-list-smart {
            list-style: none;
            padding: 0;
            margin: 12px 0 0 0;
            display: flex;
            flex-direction: column;
            gap: 9px;
            max-height: 230px;
            overflow-y: auto !important;
            overscroll-behavior: contain;
            padding-right: 2px;
            transition: max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1);
            -webkit-overflow-scrolling: touch;
        }

        /* Expanded list state when user clicks Xem them */
        .hw-weaker-list-smart.is-expanded {
            max-height: 420px !important;
        }

        .hw-weaker-list-smart::-webkit-scrollbar {
            width: 5px;
        }

        html.dark .hw-weaker-list-smart::-webkit-scrollbar-thumb {
            background: rgba(244, 63, 94, 0.45);
            border-radius: 9999px;
        }

        html:not(.dark) .hw-weaker-list-smart::-webkit-scrollbar-thumb {
            background: rgba(244, 63, 94, 0.3);
            border-radius: 9999px;
        }

        /* Individual Card Item - CRITICAL: flex-shrink: 0 to prevent squishing */
        .hw-weaker-item {
            display: flex !important;
            flex-direction: column !important;
            flex-shrink: 0 !important;
            flex-grow: 0 !important;
            width: 100% !important;
            box-sizing: border-box !important;
            border-radius: 14px !important;
            padding: 10px 12px !important;
            min-height: 56px !important;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
            position: relative;
            overflow: visible !important;
        }

        html.dark .hw-weaker-item {
            background: rgba(15, 23, 42, 0.7) !important;
            border: 1px solid rgba(255, 255, 255, 0.08) !important;
            box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
        }

        html.dark .hw-weaker-item:hover {
            background: rgba(30, 41, 59, 0.85) !important;
            border-color: rgba(244, 63, 94, 0.3) !important;
            transform: translateY(-1px);
        }

        html:not(.dark) .hw-weaker-item {
            background: #ffffff !important;
            border: 1px solid #f1f5f9 !important;
            box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04) !important;
        }

        html:not(.dark) .hw-weaker-item:hover {
            border-color: #fed7aa !important;
            transform: translateY(-1px);
            box-shadow: 0 6px 18px rgba(15, 23, 42, 0.07) !important;
        }

        /* Audio pronunciation button */
        .hw-weaker-audio-btn {
            width: 34px;
            height: 34px;
            border-radius: 10px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 11px;
            cursor: pointer;
            transition: all 0.18s ease;
            flex-shrink: 0;
            border: 1px solid transparent;
        }

        html.dark .hw-weaker-audio-btn {
            background: rgba(99, 102, 241, 0.15);
            color: #818cf8;
            border-color: rgba(99, 102, 241, 0.28);
        }

        html.dark .hw-weaker-audio-btn:hover {
            background: rgba(99, 102, 241, 0.32);
            color: #ffffff;
            transform: scale(1.07);
        }

        html:not(.dark) .hw-weaker-audio-btn {
            background: #eef2ff;
            color: #4f46e5;
            border-color: #c7d2fe;
        }

        html:not(.dark) .hw-weaker-audio-btn:hover {
            background: #e0e7ff;
            color: #3730a3;
            transform: scale(1.07);
        }

        /* Word line & text */
        .hw-weaker-word-line {
            min-width: 0;
            flex: 1;
        }

        .hw-weaker-word-text {
            font-size: 13.5px;
            font-weight: 850;
            letter-spacing: -0.01em;
            line-height: 1.25;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        html.dark .hw-weaker-word-text {
            color: #f8fafc !important;
        }

        html:not(.dark) .hw-weaker-word-text {
            color: #0f172a !important;
        }

        /* Vietnamese meaning */
        .hw-weaker-meaning-text {
            font-size: 10.5px;
            font-weight: 600;
            line-height: 1.3;
            max-width: 100%;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            margin-top: 1px;
        }

        html.dark .hw-weaker-meaning-text {
            color: #94a3b8;
        }

        html:not(.dark) .hw-weaker-meaning-text {
            color: #64748b;
        }

        /* Meta subtext (time ago, fails) */
        .hw-weaker-meta-text {
            font-size: 9.5px;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 4px;
            margin-top: 2px;
        }

        html.dark .hw-weaker-meta-text {
            color: #64748b;
        }

        html:not(.dark) .hw-weaker-meta-text {
            color: #94a3b8;
        }

        /* Severity tags */
        .hw-weaker-tag {
            font-size: 9px;
            font-weight: 850;
            padding: 1.5px 6px;
            border-radius: 5px;
            white-space: nowrap;
            line-height: 1.2;
            letter-spacing: 0.02em;
        }

        .hw-weaker-tag.is-critical {
            background: rgba(244, 63, 94, 0.18);
            color: #fb7185;
            border: 1px solid rgba(244, 63, 94, 0.35);
        }

        .hw-weaker-tag.is-warning {
            background: rgba(245, 158, 11, 0.18);
            color: #fbbf24;
            border: 1px solid rgba(245, 158, 11, 0.35);
        }

        .hw-weaker-tag.is-notice {
            background: rgba(99, 102, 241, 0.18);
            color: #a5b4fc;
            border: 1px solid rgba(99, 102, 241, 0.35);
        }

        /* Score Pill (FIX: Works consistently in both Dark & Light modes) */
        .hw-weaker-score-pill {
            min-width: 44px;
            min-height: 32px;
            padding: 3px 6px;
            border-radius: 9px;
            display: inline-flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            font-weight: 900;
            line-height: 1;
            white-space: nowrap;
            flex-shrink: 0;
            font-size: 11.5px;
        }

        html.dark .hw-weaker-score-pill {
            background: rgba(244, 63, 94, 0.15) !important;
            border: 1px solid rgba(244, 63, 94, 0.32) !important;
            color: #fb7185 !important;
            box-shadow: 0 2px 8px rgba(244, 63, 94, 0.15);
        }

        html:not(.dark) .hw-weaker-score-pill {
            background: #fff1f2 !important;
            border: 1px solid #fecdd3 !important;
            color: #e11d48 !important;
            box-shadow: 0 2px 8px rgba(244, 63, 94, 0.08);
        }

        .hw-weaker-score-sub {
            font-size: 7.5px;
            font-weight: 800;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            opacity: 0.75;
            margin-top: 1.5px;
        }

        /* Progress Bar (FIX: Full styling in both Dark & Light modes) */
        .hw-weaker-progress {
            height: 5px;
            border-radius: 9999px;
            overflow: hidden;
            width: 100%;
            margin-top: 8px;
            flex-shrink: 0 !important;
        }

        html.dark .hw-weaker-progress {
            background: rgba(255, 255, 255, 0.08) !important;
        }

        html:not(.dark) .hw-weaker-progress {
            background: #e2e8f0 !important;
        }

        .hw-weaker-progress-fill {
            height: 100%;
            border-radius: inherit;
            transition: width 0.3s ease;
        }

        /* Empty state styling */
        .hw-weaker-empty-state {
            padding: 18px 12px;
            text-align: center;
            border-radius: 14px;
        }

        html.dark .hw-weaker-empty-state {
            background: rgba(15, 23, 42, 0.5);
            border: 1px dashed rgba(255, 255, 255, 0.1);
        }

        html:not(.dark) .hw-weaker-empty-state {
            background: #f8fafc;
            border: 1px dashed #e2e8f0;
        }

        .hw-weaker-empty-icon {
            font-size: 24px;
            color: #f59e0b;
            margin-bottom: 6px;
            filter: drop-shadow(0 2px 8px rgba(245, 158, 11, 0.3));
        }

        .hw-weaker-empty-title {
            font-size: 12px;
            font-weight: 800;
        }

        html.dark .hw-weaker-empty-title { color: #f8fafc; }
        html:not(.dark) .hw-weaker-empty-title { color: #0f172a; }

        .hw-weaker-empty-desc {
            font-size: 10px;
            font-weight: 500;
            margin-top: 2px;
        }

        html.dark .hw-weaker-empty-desc { color: #94a3b8; }
        html:not(.dark) .hw-weaker-empty-desc { color: #64748b; }

        /* Expand / Collapse Button */
        .hw-library-expand-row button#hw-weaker-expand-btn {
            padding: 6px 14px;
            border-radius: 9999px;
            font-size: 10.5px;
            font-weight: 800;
            display: inline-flex;
            align-items: center;
            gap: 5px;
            cursor: pointer;
            transition: all 0.2s ease;
            border: 1px solid transparent;
        }

        html.dark .hw-library-expand-row button#hw-weaker-expand-btn {
            background: rgba(255, 255, 255, 0.05);
            color: #a5b4fc;
            border-color: rgba(255, 255, 255, 0.08);
        }

        html.dark .hw-library-expand-row button#hw-weaker-expand-btn:hover {
            background: rgba(99, 102, 241, 0.18);
            border-color: rgba(99, 102, 241, 0.35);
            color: #ffffff;
            transform: translateY(-1px);
        }

        html:not(.dark) .hw-library-expand-row button#hw-weaker-expand-btn {
            background: #f1f5f9;
            color: #4f46e5;
            border-color: #e2e8f0;
        }

        html:not(.dark) .hw-library-expand-row button#hw-weaker-expand-btn:hover {
            background: #e0e7ff;
            color: #3730a3;
            transform: translateY(-1px);
        }

        html:not(.dark) [class*="hw-bg-slate-900\/50"],
        html:not(.dark) [class*="hw-bg-slate-900\/30"],
        html:not(.dark) [class*="hw-bg-slate-900\/40"],
        html:not(.dark) [class*="hw-bg-slate-900\/60"],
        html:not(.dark) [class*="hw-bg-slate-950\/40"],
        html:not(.dark) [class*="hw-bg-slate-950\/60"] {
            background-color: #f1f5f9 !important;
            background: #f1f5f9 !important;
        }

        /* Fix progress bar backgrounds */
        html:not(.dark) .hw-bg-slate-800 {
            background-color: #e2e8f0 !important;
        }

        /* Backdrop overlays: keep semi-transparent */
        html:not(.dark) [class*="hw-bg-slate-900\/90"] {
            background-color: rgba(255, 255, 255, 0.95) !important;
            background: rgba(255, 255, 255, 0.95) !important;
        }

        /* Image placeholder: light gray bg */
        html:not(.dark) #hw-add-image-placeholder {
            background-color: #f1f5f9 !important;
            background: #f1f5f9 !important;
            border-color: #cbd5e1 !important;
        }

        /* Drop zone: light dashed border */
        html:not(.dark) #hw-drop-zone {
            border-color: #cbd5e1 !important;
            background-color: #f8fafc !important;
            background: #f8fafc !important;
        }

        html:not(.dark) #hw-drop-zone:hover {
            border-color: #6366f1 !important;
            background-color: #eef2ff !important;
            background: #eef2ff !important;
        }

        /* Indigo dark backgrounds → indigo light */
        html:not(.dark) [class*="hw-bg-indigo-950"] {
            background-color: #eef2ff !important;
            background: #eef2ff !important;
        }

        html:not(.dark) [class*="hw-text-indigo-400"] {
            color: #4f46e5 !important;
        }

        /* Sky dark backgrounds for TTS buttons */
        html:not(.dark) [class*="hw-bg-sky-950"] {
            background-color: #e0f2fe !important;
            background: #e0f2fe !important;
        }

        html:not(.dark) [class*="hw-text-sky-400"] {
            color: #0284c7 !important;
        }

        html:not(.dark) [class*="hw-border-sky-800"] {
            border-color: #7dd3fc !important;
        }

        /* Rose/amber text: keep vibrant for light bg */
        html:not(.dark) [class*="hw-text-rose-400"] {
            color: #e11d48 !important;
        }

        html:not(.dark) [class*="hw-text-amber-400"] {
            color: #d97706 !important;
        }

        html:not(.dark) [class*="hw-text-yellow-400"] {
            color: #ca8a04 !important;
        }

        /* Mobile bottom nav */
        html:not(.dark) #hw-app-layout > nav,
        html:not(.dark) [class*="hw-backdrop-blur"] {
            background-color: rgba(255, 255, 255, 0.95) !important;
            background: rgba(255, 255, 255, 0.95) !important;
            border-color: #e2e8f0 !important;
        }

        /* Keep interview/self-intro study blocks clean in the light mobile UI. */
        html:not(.dark) #v2-view-interview [class*="hw-bg-slate-900"],
        html:not(.dark) #v2-view-interview [class*="hw-bg-slate-950"] {
            background: #ffffff !important;
            background-color: #ffffff !important;
            border-color: #d1fae5 !important;
            color: #334155 !important;
        }

        html:not(.dark) #v2-view-interview [class*="hw-border-slate-800"],
        html:not(.dark) #v2-view-interview [class*="hw-border-slate-850"] {
            border-color: #d1fae5 !important;
        }

        html:not(.dark) #v2-view-interview #prompter-full-text-view {
            background: #ffffff !important;
            background-color: #ffffff !important;
            border-color: #d1fae5 !important;
            color: #334155 !important;
        }

        html:not(.dark) #v2-view-interview .interview-copy-btn,
        html:not(.dark) #v2-view-interview button[onclick="copyPrompterText()"] {
            background: #ffffff !important;
            background-color: #ffffff !important;
            border-color: #bbf7d0 !important;
            color: #047857 !important;
            box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
        }

        html:not(.dark) #v2-view-interview .interview-copy-btn:hover,
        html:not(.dark) #v2-view-interview .interview-copy-btn:focus-visible,
        html:not(.dark) #v2-view-interview button[onclick="copyPrompterText()"]:hover,
        html:not(.dark) #v2-view-interview button[onclick="copyPrompterText()"]:focus-visible {
            background: #ecfdf5 !important;
            background-color: #ecfdf5 !important;
            border-color: #86efac !important;
            color: #065f46 !important;
            box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12) !important;
        }

        html:not(.dark) #v2-view-interview .interview-copy-btn:active,
        html:not(.dark) #v2-view-interview button[onclick="copyPrompterText()"]:active {
            background: #d1fae5 !important;
            background-color: #d1fae5 !important;
        }

        html:not(.dark) #v2-view-interview .interview-copy-btn *,
        html:not(.dark) #v2-view-interview button[onclick="copyPrompterText()"] * {
            color: inherit !important;
        }

        /* V2 Home Module Launcher Cards & Notice Banner (Light mode base) */
        .v2-module-card {
            background-color: rgba(255, 255, 255, 0.95);
            border-color: rgba(226, 232, 240, 0.85);
            transition: all 0.2s ease;
        }
        .v2-module-rose:hover { background-color: rgba(255, 241, 242, 0.6); border-color: #fda4af; }
        .v2-module-sky:hover { background-color: rgba(240, 249, 255, 0.6); border-color: #7dd3fc; }
        .v2-module-emerald:hover { background-color: rgba(236, 253, 245, 0.6); border-color: #6ee7b7; }
        .v2-module-amber:hover { background-color: rgba(254, 252, 232, 0.6); border-color: #fcd34d; }
        .v2-module-indigo:hover { background-color: rgba(238, 242, 255, 0.6); border-color: #a5b4fc; }
        .v2-module-violet:hover { background-color: rgba(245, 243, 255, 0.7); border-color: #c4b5fd; }

        .v2-module-icon-rose { background-color: #ffe4e6; color: #e11d48; border: 1px solid #fecdd3; }
        .v2-module-icon-sky { background-color: #e0f2fe; color: #0284c7; border: 1px solid #bae6fd; }
        .v2-module-icon-emerald { background-color: #d1fae5; color: #059669; border: 1px solid #a7f3d0; }
        .v2-module-icon-amber { background-color: #fef3c7; color: #d97706; border: 1px solid #fde68a; }
        .v2-module-icon-indigo { background-color: #e0e7ff; color: #4f46e5; border: 1px solid #c7d2fe; }
        .v2-module-icon-violet { background-color: #ede9fe; color: #7c3aed; border: 1px solid #ddd6fe; }

        .v2-module-badge-rose { background-color: #fff1f2; color: #be123c; border-color: #ffe4e6; }
        .v2-module-badge-sky { background-color: #f0f9ff; color: #0369a1; border-color: #e0f2fe; }
        .v2-module-badge-emerald { background-color: #ecfdf5; color: #047857; border-color: #d1fae5; }
        .v2-module-badge-amber { background-color: #fffbeb; color: #b45309; border-color: #fef3c7; }
        .v2-module-badge-indigo { background-color: #eef2ff; color: #4338ca; border-color: #e0e7ff; }
        .v2-module-badge-violet { background-color: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }

        .v2-assistant-icon { background-color: #e0e7ff; color: #4f46e5; border: 1px solid #c7d2fe; }
        .v2-notice-banner { background-color: rgba(248, 250, 252, 0.85); border-color: rgba(226, 232, 240, 0.85); }
        .v2-notice-icon { background-color: #fef3c7; color: #d97706; border: 1px solid #fde68a; }

        /* =========================================================
           GLOBAL DARK THEME OVERRIDES (HIGH CONTRAST & HARMONIOUS)
           ========================================================= */
        html.dark body,
        html.dark #hw-app-layout,
        html.dark #hw-app-layout > main,
        html.dark #hw-app-layout > main > .hw-flex-1,
        html.dark #hw-app-layout section,
        html.dark #hw-app-layout .hw-tab-view {
            background: #0b0f19 !important;
            background-color: #0b0f19 !important;
            color: #f8fafc !important;
        }

        /* Generic Slate & White utility overrides in Dark Mode */
        html.dark #hw-app-layout main .hw-bg-white,
        html.dark #hw-app-layout main .hw-bg-white\/90,
        html.dark #hw-app-layout main .hw-bg-white\/80 {
            background-color: #0f172a !important;
            border-color: rgba(255, 255, 255, 0.08) !important;
        }

        html.dark #hw-app-layout main .hw-bg-slate-50,
        html.dark #hw-app-layout main .hw-bg-slate-50\/80 {
            background-color: #131b2e !important;
            border-color: rgba(255, 255, 255, 0.08) !important;
        }

        /* Generic Slate 100/200 dark mode override - fixes light grey rectangles in dark mode */
        html.dark #hw-app-layout main .hw-bg-slate-100,
        html.dark #hw-app-layout main .hw-bg-slate-100\/80,
        html.dark #hw-app-layout main .hw-bg-slate-200,
        html.dark #hw-app-layout main [class*="hw-bg-slate-100"],
        html.dark #hw-app-layout main [class*="hw-bg-slate-200"],
        html.dark [class*="hw-classroom-page"] [class*="hw-bg-slate-100"],
        html.dark #student-classroom-container [class*="hw-bg-slate-100"],
        html[data-theme="dark"] #student-classroom-container [class*="hw-bg-slate-100"],
        .dark #student-classroom-container [class*="hw-bg-slate-100"] {
            background-color: #1e293b !important;
            border-color: rgba(255, 255, 255, 0.08) !important;
            color: #cbd5e1 !important;
        }

        /* Classroom Banner & Assignment Card Dark Mode */
        :is(html.dark, html[data-theme="dark"], .dark) .hw-classroom-banner {
            background: linear-gradient(135deg, rgba(30, 27, 75, 0.7) 0%, rgba(15, 23, 42, 0.95) 100%) !important;
            border: 1px solid rgba(99, 102, 241, 0.3) !important;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
        }
        :is(html.dark, html[data-theme="dark"], .dark) .hw-classroom-banner h2 {
            color: #ffffff !important;
        }
        :is(html.dark, html[data-theme="dark"], .dark) .hw-classroom-banner p {
            color: #94a3b8 !important;
        }
        :is(html.dark, html[data-theme="dark"], .dark) .hw-classroom-banner b,
        :is(html.dark, html[data-theme="dark"], .dark) .hw-classroom-banner button {
            color: #818cf8 !important;
        }
        :is(html.dark, html[data-theme="dark"], .dark) .hw-code-pill {
            background-color: rgba(30, 27, 75, 0.6) !important;
            border-color: rgba(99, 102, 241, 0.4) !important;
            color: #a5b4fc !important;
        }
        :is(html.dark, html[data-theme="dark"], .dark) .hw-assignment-card {
            background-color: #0f172a !important;
            border: 1px solid rgba(255, 255, 255, 0.08) !important;
            box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
        }
        :is(html.dark, html[data-theme="dark"], .dark) .hw-assignment-card h3,
        :is(html.dark, html[data-theme="dark"], .dark) .hw-assignment-card h4 {
            color: #f8fafc !important;
        }
        :is(html.dark, html[data-theme="dark"], .dark) .hw-assignment-source-badge {
            background-color: #1e293b !important;
            color: #cbd5e1 !important;
            border: 1px solid #334155 !important;
        }

        html.dark #hw-app-layout main .hw-text-slate-900,
        html.dark #hw-app-layout main .hw-text-slate-800,
        html.dark #hw-app-layout main .hw-text-slate-700 {
            color: #f8fafc !important;
        }

        html.dark #hw-app-layout main .hw-text-slate-600,
        html.dark #hw-app-layout main .hw-text-slate-500 {
            color: #94a3b8 !important;
        }

        html.dark #hw-app-layout main .hw-text-slate-400 {
            color: #64748b !important;
        }

        html.dark #hw-app-layout main .hw-border-slate-100,
        html.dark #hw-app-layout main .hw-border-slate-200,
        html.dark #hw-app-layout main .hw-border-slate-200\/70,
        html.dark #hw-app-layout main .hw-border-slate-200\/80,
        html.dark #hw-app-layout main .hw-border-slate-200\/90,
        html.dark #hw-app-layout main .hw-border-slate-300 {
            border-color: rgba(255, 255, 255, 0.08) !important;
        }

        /* V2 Home Module Launcher Cards & Notice Banner (Dark mode) */
        html.dark .v2-module-card {
            background-color: #0f172a !important;
            border-color: rgba(255, 255, 255, 0.08) !important;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
        }
        html.dark .v2-module-rose:hover { background-color: rgba(244, 63, 94, 0.08) !important; border-color: rgba(244, 63, 94, 0.45) !important; }
        html.dark .v2-module-sky:hover { background-color: rgba(14, 165, 233, 0.08) !important; border-color: rgba(14, 165, 233, 0.45) !important; }
        html.dark .v2-module-emerald:hover { background-color: rgba(16, 185, 129, 0.08) !important; border-color: rgba(16, 185, 129, 0.45) !important; }
        html.dark .v2-module-amber:hover { background-color: rgba(245, 158, 11, 0.08) !important; border-color: rgba(245, 158, 11, 0.45) !important; }
        html.dark .v2-module-indigo:hover { background-color: rgba(99, 102, 241, 0.08) !important; border-color: rgba(99, 102, 241, 0.45) !important; }
        html.dark .v2-module-violet:hover { background-color: rgba(139, 92, 246, 0.08) !important; border-color: rgba(139, 92, 246, 0.45) !important; }

        html.dark .v2-module-icon-rose {
            background: rgba(244, 63, 94, 0.16) !important;
            background-color: rgba(244, 63, 94, 0.16) !important;
            color: #fb7185 !important;
            border: 1px solid rgba(244, 63, 94, 0.35) !important;
            box-shadow: 0 0 10px rgba(244, 63, 94, 0.12) !important;
        }
        html.dark .v2-module-icon-sky {
            background: rgba(14, 165, 233, 0.16) !important;
            background-color: rgba(14, 165, 233, 0.16) !important;
            color: #38bdf8 !important;
            border: 1px solid rgba(14, 165, 233, 0.35) !important;
            box-shadow: 0 0 10px rgba(14, 165, 233, 0.12) !important;
        }
        html.dark .v2-module-icon-emerald {
            background: rgba(16, 185, 129, 0.16) !important;
            background-color: rgba(16, 185, 129, 0.16) !important;
            color: #34d399 !important;
            border: 1px solid rgba(16, 185, 129, 0.35) !important;
            box-shadow: 0 0 10px rgba(16, 185, 129, 0.12) !important;
        }
        html.dark .v2-module-icon-amber {
            background: rgba(245, 158, 11, 0.16) !important;
            background-color: rgba(245, 158, 11, 0.16) !important;
            color: #fbbf24 !important;
            border: 1px solid rgba(245, 158, 11, 0.35) !important;
            box-shadow: 0 0 10px rgba(245, 158, 11, 0.12) !important;
        }
        html.dark .v2-module-icon-indigo {
            background: rgba(99, 102, 241, 0.16) !important;
            background-color: rgba(99, 102, 241, 0.16) !important;
            color: #818cf8 !important;
            border: 1px solid rgba(99, 102, 241, 0.35) !important;
            box-shadow: 0 0 10px rgba(99, 102, 241, 0.12) !important;
        }
        html.dark .v2-module-icon-violet {
            background: rgba(139, 92, 246, 0.16) !important;
            background-color: rgba(139, 92, 246, 0.16) !important;
            color: #a78bfa !important;
            border: 1px solid rgba(139, 92, 246, 0.35) !important;
            box-shadow: 0 0 10px rgba(139, 92, 246, 0.12) !important;
        }

        html.dark .v2-module-badge-rose {
            background-color: rgba(244, 63, 94, 0.14) !important;
            color: #fb7185 !important;
            border-color: rgba(244, 63, 94, 0.28) !important;
        }
        html.dark .v2-module-badge-sky {
            background-color: rgba(14, 165, 233, 0.14) !important;
            color: #38bdf8 !important;
            border-color: rgba(14, 165, 233, 0.28) !important;
        }
        html.dark .v2-module-badge-emerald {
            background-color: rgba(16, 185, 129, 0.14) !important;
            color: #34d399 !important;
            border-color: rgba(16, 185, 129, 0.28) !important;
        }
        html.dark .v2-module-badge-amber {
            background-color: rgba(245, 158, 11, 0.14) !important;
            color: #fbbf24 !important;
            border-color: rgba(245, 158, 11, 0.28) !important;
        }
        html.dark .v2-module-badge-indigo {
            background-color: rgba(99, 102, 241, 0.14) !important;
            color: #818cf8 !important;
            border-color: rgba(99, 102, 241, 0.28) !important;
        }
        html.dark .v2-module-badge-violet {
            background-color: rgba(139, 92, 246, 0.14) !important;
            color: #a78bfa !important;
            border-color: rgba(139, 92, 246, 0.28) !important;
        }

        html.dark .v2-assistant-icon {
            background: rgba(99, 102, 241, 0.18) !important;
            background-color: rgba(99, 102, 241, 0.18) !important;
            color: #818cf8 !important;
            border: 1px solid rgba(99, 102, 241, 0.35) !important;
            box-shadow: 0 0 10px rgba(99, 102, 241, 0.15) !important;
        }

        html.dark .v2-notice-banner {
            background-color: #131b2e !important;
            border-color: rgba(255, 255, 255, 0.08) !important;
        }
        html.dark .v2-notice-banner h4 {
            color: #f8fafc !important;
        }
        html.dark .v2-notice-banner p {
            color: #cbd5e1 !important;
        }
        html.dark .v2-notice-icon {
            background: rgba(245, 158, 11, 0.18) !important;
            background-color: rgba(245, 158, 11, 0.18) !important;
            color: #fbbf24 !important;
            border: 1px solid rgba(245, 158, 11, 0.35) !important;
            box-shadow: 0 0 10px rgba(245, 158, 11, 0.15) !important;
        }

        /* =========================================================
           V2 SKILLS VIDEO COCKPIT - ACTIVE SELECTION & CONTRAST
           ========================================================= */
        /* Chapter timeline active button */
        .v2-skill-chapter-active,
        html.dark .v2-skill-chapter-active {
            background: #d97706 !important;
            background-color: #d97706 !important;
            color: #ffffff !important;
            border-color: #f59e0b !important;
            box-shadow: 0 4px 14px rgba(217, 119, 6, 0.4) !important;
            transform: translateY(-1px);
        }
        .v2-skill-chapter-active *,
        html.dark .v2-skill-chapter-active * {
            color: #ffffff !important;
        }

        /* Task card active state */
        html:not(.dark) .v2-skill-task-active {
            background-color: rgba(254, 243, 199, 0.65) !important;
            border: 2px solid #f59e0b !important;
            box-shadow: 0 4px 16px rgba(245, 158, 11, 0.16) !important;
        }
        html.dark .v2-skill-task-active {
            background: rgba(245, 158, 11, 0.18) !important;
            background-color: rgba(245, 158, 11, 0.18) !important;
            border: 2px solid #f59e0b !important;
            box-shadow: 0 4px 16px rgba(245, 158, 11, 0.28) !important;
        }
        html.dark .v2-skill-task-active span {
            color: #fef3c7 !important;
        }
        html.dark .v2-skill-task-active div {
            color: #fde68a !important;
        }

        /* Task "Xem mẫu" active button */
        .v2-skill-demo-active,
        html.dark .v2-skill-demo-active {
            background: #f59e0b !important;
            background-color: #f59e0b !important;
            color: #ffffff !important;
            border-color: #d97706 !important;
            box-shadow: 0 4px 14px rgba(245, 158, 11, 0.45) !important;
            transform: scale(1.02);
        }
        .v2-skill-demo-active *,
        html.dark .v2-skill-demo-active * {
            color: #ffffff !important;
        }

        /* Inactive buttons in dark mode */
        html.dark .v2-skill-chapter-btn:not(.v2-skill-chapter-active) {
            background-color: #1e293b !important;
            border-color: #334155 !important;
            color: #94a3b8 !important;
        }
        html.dark .v2-skill-chapter-btn:not(.v2-skill-chapter-active):hover {
            background-color: #334155 !important;
            color: #f8fafc !important;
        }
        html.dark .v2-skill-demo-btn:not(.v2-skill-demo-active) {
            background-color: #1e293b !important;
            border-color: #334155 !important;
            color: #94a3b8 !important;
        }
        html.dark .v2-skill-demo-btn:not(.v2-skill-demo-active):hover {
            background-color: #334155 !important;
            color: #f8fafc !important;
        }

        /* Industry Pills */
        .v2-industry-pill-active,
        html.dark .v2-industry-pill-active {
            background: #f59e0b !important;
            background-color: #f59e0b !important;
            color: #ffffff !important;
            box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4) !important;
        }
        html.dark .v2-industry-pill:not(.v2-industry-pill-active) {
            background-color: #1e293b !important;
            border-color: #334155 !important;
            color: #94a3b8 !important;
        }

        /* V2 Interview Video Banner & Controls (Light & Dark Theme) */
        .v2-interview-banner {
            background: linear-gradient(135deg, rgba(238, 242, 255, 0.95), rgba(240, 249, 255, 0.95));
            border-color: rgba(199, 210, 254, 0.8) !important;
        }
        html.dark .v2-interview-banner {
            background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%) !important;
            border-color: rgba(99, 102, 241, 0.35) !important;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
        }
        html.dark .v2-banner-title {
            color: #f8fafc !important;
        }
        html.dark .v2-banner-subtitle {
            color: #94a3b8 !important;
        }
        .v2-interview-controls {
            background: #f8fafc;
            border-color: #e2e8f0;
        }
        html.dark .v2-interview-controls {
            background: #131b2e !important;
            border-color: rgba(255, 255, 255, 0.08) !important;
        }

        /* Prevent dirty/milky light gradients in dark mode */
        html.dark #hw-app-layout main .hw-from-indigo-50\/90,
        html.dark #hw-app-layout main .hw-from-indigo-50,
        html.dark #hw-app-layout main .hw-to-sky-50\/90,
        html.dark #hw-app-layout main .hw-to-sky-50 {
            --tw-gradient-from: #0f172a !important;
            --tw-gradient-to: #1e1b4b !important;
            --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
            border-color: rgba(99, 102, 241, 0.35) !important;
        }

        /* Scoped badge pills and icon containers in dark mode */
        html.dark #hw-app-layout main .hw-bg-rose-50,
        html.dark #hw-app-layout main .hw-bg-rose-50\/80,
        html.dark #hw-app-layout main .hw-bg-rose-100,
        html.dark #hw-app-layout main .hw-bg-rose-100\/80,
        html.dark #hw-app-layout main .hw-bg-rose-200 {
            background-color: rgba(244, 63, 94, 0.16) !important;
            border-color: rgba(244, 63, 94, 0.35) !important;
            color: #fb7185 !important;
        }
        html.dark #hw-app-layout main .hw-bg-sky-50,
        html.dark #hw-app-layout main .hw-bg-sky-50\/80,
        html.dark #hw-app-layout main .hw-bg-sky-100,
        html.dark #hw-app-layout main .hw-bg-sky-100\/80,
        html.dark #hw-app-layout main .hw-bg-sky-200,
        html.dark #hw-app-layout main .hw-bg-blue-50,
        html.dark #hw-app-layout main .hw-bg-blue-100,
        html.dark #hw-app-layout main .hw-bg-blue-100\/80 {
            background-color: rgba(14, 165, 233, 0.16) !important;
            border-color: rgba(14, 165, 233, 0.35) !important;
            color: #38bdf8 !important;
        }
        html.dark #hw-app-layout main .hw-bg-emerald-50,
        html.dark #hw-app-layout main .hw-bg-emerald-50\/80,
        html.dark #hw-app-layout main .hw-bg-emerald-100,
        html.dark #hw-app-layout main .hw-bg-emerald-100\/80,
        html.dark #hw-app-layout main .hw-bg-emerald-200,
        html.dark #hw-app-layout main .hw-bg-green-50,
        html.dark #hw-app-layout main .hw-bg-green-100,
        html.dark #hw-app-layout main .hw-bg-green-100\/80,
        html.dark #hw-app-layout main .hw-bg-teal-50,
        html.dark #hw-app-layout main .hw-bg-teal-100,
        html.dark #hw-app-layout main .hw-bg-teal-100\/80 {
            background-color: rgba(16, 185, 129, 0.16) !important;
            border-color: rgba(16, 185, 129, 0.35) !important;
            color: #34d399 !important;
        }
        html.dark #hw-app-layout main .hw-bg-amber-50,
        html.dark #hw-app-layout main .hw-bg-amber-50\/40,
        html.dark #hw-app-layout main .hw-bg-amber-50\/50,
        html.dark #hw-app-layout main .hw-bg-amber-50\/60,
        html.dark #hw-app-layout main .hw-bg-amber-50\/80,
        html.dark #hw-app-layout main .hw-bg-amber-100,
        html.dark #hw-app-layout main .hw-bg-amber-100\/80,
        html.dark #hw-app-layout main .hw-bg-amber-200,
        html.dark #hw-app-layout main .hw-bg-yellow-50,
        html.dark #hw-app-layout main .hw-bg-yellow-100,
        html.dark #hw-app-layout main .hw-bg-yellow-100\/80 {
            background-color: rgba(245, 158, 11, 0.16) !important;
            border-color: rgba(245, 158, 11, 0.35) !important;
            color: #fbbf24 !important;
        }
        html.dark #hw-app-layout main .hw-bg-indigo-50,
        html.dark #hw-app-layout main .hw-bg-indigo-50\/80,
        html.dark #hw-app-layout main .hw-bg-indigo-100,
        html.dark #hw-app-layout main .hw-bg-indigo-100\/80,
        html.dark #hw-app-layout main .hw-bg-indigo-200,
        html.dark #hw-app-layout main .hw-bg-purple-50,
        html.dark #hw-app-layout main .hw-bg-purple-100,
        html.dark #hw-app-layout main .hw-bg-purple-100\/80,
        html.dark #hw-app-layout main .hw-bg-violet-50,
        html.dark #hw-app-layout main .hw-bg-violet-100,
        html.dark #hw-app-layout main .hw-bg-violet-100\/80 {
            background-color: rgba(99, 102, 241, 0.16) !important;
            border-color: rgba(99, 102, 241, 0.35) !important;
            color: #818cf8 !important;
        }

        /* Profile VIP Row & Profile Page in Dark Mode (No more dirty grey background) */
        html.dark #hw-profile-vip-row {
            border-color: rgba(255, 255, 255, 0.08) !important;
            transition: all 0.2s ease !important;
        }
        html.dark #hw-profile-vip-row.hw-bg-amber-50\/40,
        html.dark #hw-profile-vip-row[class*="amber"],
        html.dark .v2-profile-vip-active {
            background: rgba(245, 158, 11, 0.12) !important;
            background-color: rgba(245, 158, 11, 0.12) !important;
            border-bottom: 1px solid rgba(245, 158, 11, 0.22) !important;
        }
        html.dark #hw-profile-vip-row.hw-bg-sky-50\/50,
        html.dark #hw-profile-vip-row[class*="sky"],
        html.dark .v2-profile-vip-lifetime {
            background: rgba(14, 165, 233, 0.12) !important;
            background-color: rgba(14, 165, 233, 0.12) !important;
            border-bottom: 1px solid rgba(14, 165, 233, 0.22) !important;
        }
        html.dark #hw-profile-vip-row.hw-bg-slate-50\/50,
        html.dark .v2-profile-vip-standard {
            background: rgba(255, 255, 255, 0.03) !important;
            background-color: rgba(255, 255, 255, 0.03) !important;
            border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        }

        html.dark #hw-profile-vip-row #hw-profile-vip-icon-wrapper.hw-bg-amber-100,
        html.dark #hw-profile-vip-row #hw-profile-vip-icon-wrapper[class*="amber"],
        html.dark .v2-vip-icon-active {
            background: rgba(245, 158, 11, 0.2) !important;
            background-color: rgba(245, 158, 11, 0.2) !important;
            color: #fbbf24 !important;
            border: 1px solid rgba(245, 158, 11, 0.4) !important;
            box-shadow: 0 0 12px rgba(245, 158, 11, 0.2) !important;
        }
        html.dark #hw-profile-vip-row #hw-profile-vip-icon-wrapper.hw-bg-sky-100,
        html.dark #hw-profile-vip-row #hw-profile-vip-icon-wrapper[class*="sky"],
        html.dark .v2-vip-icon-lifetime {
            background: rgba(14, 165, 233, 0.2) !important;
            background-color: rgba(14, 165, 233, 0.2) !important;
            color: #38bdf8 !important;
            border: 1px solid rgba(14, 165, 233, 0.4) !important;
            box-shadow: 0 0 12px rgba(14, 165, 233, 0.2) !important;
        }
        html.dark #hw-profile-vip-row #hw-profile-vip-icon-wrapper.hw-bg-slate-100,
        html.dark .v2-vip-icon-standard {
            background: rgba(255, 255, 255, 0.06) !important;
            background-color: rgba(255, 255, 255, 0.06) !important;
            color: #94a3b8 !important;
            border: 1px solid rgba(255, 255, 255, 0.1) !important;
        }

        html.dark #hw-profile-vip-title.hw-text-amber-900,
        html.dark #hw-profile-vip-row #hw-profile-vip-title {
            color: #fde68a !important;
        }
        html.dark #hw-profile-vip-title.hw-text-sky-900 {
            color: #e0f2fe !important;
        }
        html.dark #hw-profile-vip-expiration.hw-text-amber-600,
        html.dark #hw-profile-vip-row #hw-profile-vip-expiration {
            color: #fcd34d !important;
        }
        html.dark #hw-profile-vip-expiration.hw-text-sky-600 {
            color: #7dd3fc !important;
        }

        html.dark #hw-profile-vip-badge-tag {
            background: rgba(245, 158, 11, 0.2) !important;
            background-color: rgba(245, 158, 11, 0.2) !important;
            color: #fef08a !important;
            border: 1px solid rgba(245, 158, 11, 0.4) !important;
        }
        html.dark #hw-profile-vip-badge-tag.hw-text-sky-700,
        html.dark #hw-profile-vip-badge-tag[class*="sky"] {
            background: rgba(14, 165, 233, 0.2) !important;
            background-color: rgba(14, 165, 233, 0.2) !important;
            color: #e0f2fe !important;
            border: 1px solid rgba(14, 165, 233, 0.4) !important;
        }

        /* Profile Info Card & child elements in dark mode */
        html.dark #view-profile #hw-profile-info-card,
        html.dark .hw-profile-page #hw-profile-info-card,
        html.dark #view-profile .hw-bg-white,
        html.dark .hw-profile-page .hw-bg-white {
            background-color: #0f172a !important;
            border-color: rgba(255, 255, 255, 0.08) !important;
        }
        html.dark #view-profile .hw-border-emerald-100 {
            border-color: rgba(255, 255, 255, 0.08) !important;
        }
        html.dark #view-profile .hw-border-slate-100,
        html.dark #view-profile .hw-border-slate-200 {
            border-color: rgba(255, 255, 255, 0.07) !important;
        }
        html.dark #view-profile #hw-profile-avatar-wrapper {
            background: rgba(16, 185, 129, 0.18) !important;
            background-color: rgba(16, 185, 129, 0.18) !important;
            border-color: rgba(16, 185, 129, 0.35) !important;
            color: #6ee7b7 !important;
        }
        html.dark #view-profile button.hw-bg-white:hover {
            background-color: rgba(255, 255, 255, 0.04) !important;
        }
        html.dark #view-profile button.hover\:hw-bg-emerald-50\/60:hover {
            background-color: rgba(16, 185, 129, 0.08) !important;
        }
        html.dark #view-profile input {
            background-color: #1e293b !important;
            border-color: rgba(255, 255, 255, 0.12) !important;
            color: #f8fafc !important;
        }

        /* Border overrides for colored badges and icons */
        html.dark #hw-app-layout main .hw-border-rose-100,
        html.dark #hw-app-layout main .hw-border-rose-200,
        html.dark #hw-app-layout main .hw-border-rose-300 {
            border-color: rgba(244, 63, 94, 0.3) !important;
        }
        html.dark #hw-app-layout main .hw-border-sky-100,
        html.dark #hw-app-layout main .hw-border-sky-200,
        html.dark #hw-app-layout main .hw-border-sky-300 {
            border-color: rgba(14, 165, 233, 0.3) !important;
        }
        html.dark #hw-app-layout main .hw-border-emerald-100,
        html.dark #hw-app-layout main .hw-border-emerald-200,
        html.dark #hw-app-layout main .hw-border-emerald-300 {
            border-color: rgba(16, 185, 129, 0.3) !important;
        }
        html.dark #hw-app-layout main .hw-border-amber-100,
        html.dark #hw-app-layout main .hw-border-amber-200,
        html.dark #hw-app-layout main .hw-border-amber-300 {
            border-color: rgba(245, 158, 11, 0.3) !important;
        }
        html.dark #hw-app-layout main .hw-border-indigo-100,
        html.dark #hw-app-layout main .hw-border-indigo-200,
        html.dark #hw-app-layout main .hw-border-indigo-300 {
            border-color: rgba(99, 102, 241, 0.3) !important;
        }

        html.dark #hw-app-layout main .hw-text-rose-700,
        html.dark #hw-app-layout main .hw-text-rose-600 {
            color: #fb7185 !important;
        }
        html.dark #hw-app-layout main .hw-text-sky-700,
        html.dark #hw-app-layout main .hw-text-sky-600 {
            color: #7dd3fc !important;
        }
        html.dark #hw-app-layout main .hw-text-emerald-700,
        html.dark #hw-app-layout main .hw-text-emerald-600 {
            color: #6ee7b7 !important;
        }
        html.dark #hw-app-layout main .hw-text-amber-700,
        html.dark #hw-app-layout main .hw-text-amber-600 {
            color: #fde68a !important;
        }
        html.dark #hw-app-layout main .hw-text-indigo-700,
        html.dark #hw-app-layout main .hw-text-indigo-600 {
            color: #a5b4fc !important;
        }
        /* Universal Dark Sidebar & Layout (Đồng màu toàn diện) */
        html.dark aside,
        html.dark #hw-app-layout aside,
        html.dark #hw-app-layout > aside,
        html.dark body #hw-app-layout > aside,
        html.dark body:not(.hw-game-core-active) #hw-app-layout > aside {
            background-color: #0f172a !important;
            background: #0f172a !important;
            border-color: #1e293b !important;
            border-right: 1px solid #1e293b !important;
            color: #f8fafc !important;
        }
        html.dark aside h1,
        html.dark #hw-app-layout > aside h1 {
            color: #f8fafc !important;
        }
        html.dark aside p,
        html.dark #hw-app-layout > aside p {
            color: #818cf8 !important;
        }
        html.dark .hw-sidebar-nav-label {
            color: #64748b !important;
        }
        html.dark #hw-desktop-sidebar-nav {
            background: transparent !important;
        }
        html.dark .hw-tab-btn {
            color: #94a3b8 !important;
        }
        html.dark .hw-tab-btn:hover {
            background-color: rgba(30, 41, 59, 0.6) !important;
            color: #f8fafc !important;
        }
        html.dark .hw-tab-btn.is-active,
        html.dark .hw-tab-btn.active,
        html.dark .hw-tab-btn.router-link-active {
            background-color: rgba(99, 102, 241, 0.18) !important;
            color: #818cf8 !important;
        }
        /* Light Mode Sidebar Navigation & Active Tabs */
        html:not(.dark) #hw-desktop-sidebar-nav,
        html[data-theme="light"] #hw-desktop-sidebar-nav {
            background: transparent !important;
        }
        html:not(.dark) .hw-tab-btn,
        html[data-theme="light"] .hw-tab-btn {
            color: #475569 !important;
        }
        html:not(.dark) .hw-tab-btn:hover,
        html[data-theme="light"] .hw-tab-btn:hover {
            background-color: #f1f5f9 !important;
            color: #0f172a !important;
        }
        html:not(.dark) .hw-tab-btn.is-active,
        html:not(.dark) .hw-tab-btn.active,
        html:not(.dark) .hw-tab-btn.router-link-active,
        html[data-theme="light"] .hw-tab-btn.is-active,
        html[data-theme="light"] .hw-tab-btn.active,
        html[data-theme="light"] .hw-tab-btn.router-link-active {
            background-color: #e0e7ff !important;
            color: #4338ca !important;
            font-weight: 700 !important;
        }
        html:not(.dark) #hw-desktop-sidebar-nav .hw-sidebar-group-toggle,
        html[data-theme="light"] #hw-desktop-sidebar-nav .hw-sidebar-group-toggle {
            background-color: transparent !important;
            color: #334155 !important;
            border-color: #e2e8f0 !important;
        }
        html:not(.dark) #hw-desktop-sidebar-nav .hw-sidebar-group-toggle:hover,
        html[data-theme="light"] #hw-desktop-sidebar-nav .hw-sidebar-group-toggle:hover {
            background-color: #f1f5f9 !important;
            color: #0f172a !important;
        }
        html.dark #hw-desktop-sidebar-nav .hw-sidebar-group-toggle {
            background-color: transparent !important;
            color: #cbd5e1 !important;
            border-color: #1e293b !important;
        }
        html.dark #hw-desktop-sidebar-nav .hw-sidebar-group-toggle:hover {
            background-color: rgba(30, 41, 59, 0.6) !important;
            color: #f8fafc !important;
        }
        html.dark #sidebar-auth-container {
            background-color: #0f172a !important;
            background: #0f172a !important;
            border-top: 1px solid #1e293b !important;
        }
        html.dark #sidebar-auth-btn.hw-sidebar-auth-button {
            background-color: rgba(30, 41, 59, 0.8) !important;
            background: rgba(30, 41, 59, 0.8) !important;
            border-color: #334155 !important;
            color: #cbd5e1 !important;
            box-shadow: none !important;
        }
        html.dark #sidebar-auth-btn.hw-sidebar-auth-button.is-logout,
        html.dark #sidebar-auth-btn.hw-sidebar-auth-button[data-auth-state="logout"],
        html.dark .hw-sidebar-auth-button.is-logout {
            background-color: rgba(239, 68, 68, 0.12) !important;
            border-color: rgba(239, 68, 68, 0.35) !important;
            color: #fca5a5 !important;
        }
        html.dark #sidebar-auth-btn.hw-sidebar-auth-button.is-logout:hover,
        html.dark #sidebar-auth-btn.hw-sidebar-auth-button[data-auth-state="logout"]:hover,
        html.dark .hw-sidebar-auth-button.is-logout:hover {
            background-color: rgba(239, 68, 68, 0.22) !important;
            border-color: rgba(239, 68, 68, 0.55) !important;
            color: #ffffff !important;
        }
        /* Light Mode Sidebar Auth Container */
        html:not(.dark) #sidebar-auth-container,
        html[data-theme="light"] #sidebar-auth-container {
            background-color: #ffffff !important;
            background: #ffffff !important;
            border-top: 1px solid #e2e8f0 !important;
        }
        html:not(.dark) #sidebar-auth-btn.hw-sidebar-auth-button,
        html[data-theme="light"] #sidebar-auth-btn.hw-sidebar-auth-button {
            background-color: #f8fafc !important;
            background: #f8fafc !important;
            border-color: #cbd5e1 !important;
            color: #334155 !important;
        }
        html:not(.dark) #sidebar-auth-btn.hw-sidebar-auth-button.is-logout,
        html:not(.dark) #sidebar-auth-btn.hw-sidebar-auth-button[data-auth-state="logout"],
        html:not(.dark) .hw-sidebar-auth-button.is-logout,
        html[data-theme="light"] #sidebar-auth-btn.hw-sidebar-auth-button.is-logout {
            background-color: #fef2f2 !important;
            border-color: #fca5a5 !important;
            color: #b91c1c !important;
        }

        /* Top HUD Bar Dark Mode Overrides (Đồng màu HUD) */
        html.dark #unified-hud-wrapper,
        html.dark body #hw-app-layout #unified-hud-wrapper,
        html.dark body.skin-tutien #hw-app-layout #unified-hud-wrapper,
        html.dark html.anki-mode-off body #hw-app-layout #unified-hud-wrapper {
            background-color: #0f172a !important;
            background: #0f172a !important;
            border: 1px solid var(--hw-hud-rank-border, #1e293b) !important;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
            color: #f8fafc !important;
        }
        html.dark body #hw-app-layout #unified-hud-wrapper::before {
            display: none !important;
        }
        html.dark #unified-hud-wrapper .rpg-top-bar,
        html.dark body #hw-app-layout #unified-hud-wrapper .rpg-top-bar,
        html.dark body.skin-tutien #hw-app-layout #unified-hud-wrapper .rpg-top-bar {
            background: #131b2e !important;
            border-bottom: 1px solid #1e293b !important;
            border-top-left-radius: 15px !important;
            border-top-right-radius: 15px !important;
            color: #cbd5e1 !important;
        }
        html.dark #unified-hud-wrapper .tutien-hud,
        html.dark body #hw-app-layout #unified-hud-wrapper .tutien-hud,
        html.dark body.skin-tutien #hw-app-layout #unified-hud-wrapper .tutien-hud {
            background-color: transparent !important;
            background: transparent !important;
            color: #f8fafc !important;
        }
        html.dark body #hw-app-layout #unified-hud-wrapper .avatar-cultivation {
            background-color: #1e293b !important;
            border: 2px solid var(--hw-hud-rank-border, #6366f1) !important;
            border-color: var(--hw-hud-rank-border, #6366f1) !important;
            box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4) !important;
            color: #818cf8 !important;
        }
        html.dark body #hw-app-layout #unified-hud-wrapper .avatar-cultivation .lvl-badge {
            border: 1px solid var(--hw-hud-rank-border, #ffd700) !important;
            color: var(--hw-hud-rank-border, #ffd700) !important;
            background: rgba(11, 20, 36, 0.95) !important;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.7) !important;
        }
        html.dark #unified-hud-wrapper #user-rank-name,
        html.dark #unified-hud-wrapper .cultivator-name,
        html.dark #unified-hud-wrapper .hud-player-name-text {
            color: #f8fafc !important;
        }
        html.dark #unified-hud-wrapper .exp-text {
            color: #cbd5e1 !important;
        }
        html.dark #unified-hud-wrapper .exp-bar-bg {
            background: #1e293b !important;
            border-color: #334155 !important;
        }
        html.dark body #hw-app-layout #unified-hud-wrapper .exp-stats-group,
        html.dark body #hw-app-layout #unified-hud-wrapper .gold-stats-group {
            background: #1e293b !important;
            border-color: #334155 !important;
            color: #cbd5e1 !important;
        }
        html.dark body #hw-app-layout #unified-hud-wrapper #exp-num {
            color: #cbd5e1 !important;
        }
        html.dark body #hw-app-layout #unified-hud-wrapper .gold-stats-group,
        html.dark body #hw-app-layout #unified-hud-wrapper #hud-copper-num {
            color: #f59e0b !important;
        }

        /* Library & Dashboard Dark Mode (Đồng màu Thư viện) */
        html.dark .hw-library-stat {
            background-color: #0f172a !important;
            background: #0f172a !important;
            border-color: #1e293b !important;
            box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
        }
        html.dark .hw-library-stat strong {
            color: #f8fafc !important;
        }
        html.dark .hw-library-stat span:not(.hw-library-stat-icon) {
            color: #94a3b8 !important;
        }
        html.dark .hw-library-panel,
        html.dark .hw-library-detail-card,
        html.dark .hw-library-community {
            background-color: #0f172a !important;
            background: #0f172a !important;
            border-color: #1e293b !important;
            box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
        }
        html.dark .hw-library-section-heading h3,
        html.dark .hw-library-card-heading h3,
        html.dark .hw-library-community h3 {
            color: #f8fafc !important;
        }
        html.dark .hw-library-section-heading p,
        html.dark .hw-library-community p {
            color: #94a3b8 !important;
        }
        html.dark .hw-library-shortcut {
            background-color: #1e293b !important;
            background: #1e293b !important;
            border-color: #334155 !important;
        }
        html.dark .hw-library-shortcut:hover {
            background-color: #334155 !important;
            border-color: #475569 !important;
        }
        html.dark .hw-library-shortcut-copy strong {
            color: #f8fafc !important;
        }
        html.dark .hw-library-shortcut-copy small {
            color: #94a3b8 !important;
        }
        html.dark .hw-library-community-action {
            background-color: #1e293b !important;
            border-color: #334155 !important;
            color: #cbd5e1 !important;
        }
        html.dark .hw-library-community-action:hover {
            background-color: #334155 !important;
            color: #ffffff !important;
        }
        html.dark .hw-library-community-action.is-primary {
            background-color: #4f46e5 !important;
            border-color: #6366f1 !important;
            color: #ffffff !important;
        }

        /* Dark Mode Glassmorphism & Containers */
        html.dark .hw-glass {
            background: #0f172a !important;
            border: 1px solid #1e293b !important;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
        }
        html.dark .hw-card-front,
        html.dark .hw-card-back {
            background: #0f172a !important;
            border-color: #1e293b !important;
            color: #f8fafc !important;
        }

        /* Inputs in dark mode */
        html.dark input,
        html.dark textarea,
        html.dark select {
            background-color: #0f172a !important;
            border-color: #334155 !important;
            color: #f8fafc !important;
        }
        html.dark input:focus,
        html.dark textarea:focus,
        html.dark select:focus {
            border-color: #818cf8 !important;
            box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2) !important;
        }

        /* Mobile Bottom Nav in Dark Mode */
        html.dark #hw-mobile-bottom-nav {
            background: rgba(15, 23, 42, 0.95) !important;
            border-top: 1px solid #1e293b !important;
        }
        html.dark #hw-mobile-bottom-nav a,
        html.dark #hw-mobile-bottom-nav button {
            color: #94a3b8 !important;
        }
        html.dark #hw-mobile-bottom-nav a:hover,
        html.dark #hw-mobile-bottom-nav button:hover {
            color: #f8fafc !important;
        }
        html.dark #hw-mobile-more-nav {
            background: #0f172a !important;
            border: 1px solid #1e293b !important;
            box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.6) !important;
        }
        html.dark .hw-mobile-more-heading {
            border-bottom: 1px solid #1e293b !important;
            color: #f8fafc !important;
        }
        html.dark .hw-mobile-more-heading strong {
            color: #f8fafc !important;
        }
        html.dark .hw-mobile-more-heading span {
            color: #94a3b8 !important;
        }
        html.dark .hw-mobile-more-close,
        html.dark #hw-mobile-bottom-nav .hw-mobile-more-close {
            background: #1e293b !important;
            border: 1px solid rgba(255, 255, 255, 0.12) !important;
            color: #94a3b8 !important;
        }
        html.dark .hw-mobile-more-close:hover,
        html.dark #hw-mobile-bottom-nav .hw-mobile-more-close:hover {
            background: #334155 !important;
            color: #ffffff !important;
        }
        html.dark .hw-mobile-more-grid .hw-tab-btn,
        html.dark #hw-mobile-bottom-nav .hw-mobile-more-grid .hw-tab-btn {
            background: #1e293b !important;
            border: 1px solid rgba(255, 255, 255, 0.08) !important;
            border-left: 1px solid rgba(255, 255, 255, 0.08) !important;
            color: #cbd5e1 !important;
        }
        html.dark .hw-mobile-more-grid .hw-tab-btn:hover,
        html.dark #hw-mobile-bottom-nav .hw-mobile-more-grid .hw-tab-btn:hover {
            background: #27354a !important;
            color: #ffffff !important;
        }
        html.dark .hw-mobile-more-grid .hw-tab-btn.active,
        html.dark #hw-mobile-bottom-nav .hw-mobile-more-grid .hw-tab-btn.active {
            background: rgba(99, 102, 241, 0.22) !important;
            border-color: rgba(99, 102, 241, 0.5) !important;
            color: #a5b4fc !important;
        }

        /* Vòng 2 Specific Modern Styling - Dual Light & Dark Mode */
        .v2-header-row {
            background: rgba(255, 255, 255, 0.95);
            border: 1px solid #e2e8f0;
            border-radius: 1rem;
            box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
            transition: all 0.2s ease;
        }
        .v2-header-row h2 {
            color: #0f172a !important;
        }
        .v2-header-row p {
            color: #475569 !important;
        }
        html.dark .v2-header-row {
            background: rgba(15, 23, 42, 0.85) !important;
            border-color: rgba(51, 65, 85, 0.85) !important;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
        }
        html.dark .v2-header-row h2 {
            color: #f8fafc !important;
        }
        html.dark .v2-header-row p {
            color: #cbd5e1 !important;
        }

        /* Sub-tab Navigation Pill Track (Ảnh 1 fix) */
        .v2-sub-nav-container {
            display: flex;
            align-items: center;
            gap: 0.375rem;
            padding: 0.375rem 0.5rem;
            background: #f1f5f9;
            border: 1px solid #e2e8f0;
            border-radius: 1rem;
            overflow-x: auto;
            scrollbar-width: none;
        }
        .v2-sub-nav-container::-webkit-scrollbar {
            display: none;
        }
        .v2-sub-btn {
            display: inline-flex;
            align-items: center;
            gap: 0.4rem;
            padding: 0.5rem 0.875rem;
            border-radius: 0.75rem;
            font-size: 0.8125rem;
            font-weight: 600;
            color: #475569 !important;
            background: transparent;
            border: 1px solid transparent;
            white-space: nowrap;
            cursor: pointer;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        }
        .v2-sub-btn:hover {
            color: #0f172a !important;
            background: rgba(255, 255, 255, 0.85);
        }
        .v2-sub-btn.v2-sub-active {
            color: #4338ca !important;
            background: #ffffff !important;
            font-weight: 700 !important;
            border-color: rgba(203, 213, 225, 0.9) !important;
            box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04) !important;
        }
        .v2-sub-btn.v2-sub-active i {
            color: #4f46e5 !important;
        }

        html.dark .v2-sub-nav-container {
            background: rgba(15, 23, 42, 0.9) !important;
            border-color: rgba(51, 65, 85, 0.8) !important;
            box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25) !important;
        }
        html.dark .v2-sub-btn {
            color: #cbd5e1 !important;
            background: transparent !important;
            border-color: transparent !important;
        }
        html.dark .v2-sub-btn:hover {
            color: #f8fafc !important;
            background: rgba(51, 65, 85, 0.6) !important;
        }
        html.dark .v2-sub-btn.v2-sub-active {
            color: #e0e7ff !important;
            background: #312e81 !important;
            border-color: #6366f1 !important;
            font-weight: 700 !important;
            box-shadow: 0 0 14px rgba(99, 102, 241, 0.35) !important;
        }
        html.dark .v2-sub-btn.v2-sub-active i {
            color: #a5b4fc !important;
        }

        /* 5 Module Launcher Cards Dual Mode */
        .v2-module-card {
            background-color: #ffffff;
            border: 1px solid #e2e8f0;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        }
        .v2-module-card:hover {
            background-color: #f8fafc;
            border-color: #cbd5e1;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
        }
        .v2-module-card h4 {
            color: #0f172a !important;
        }
        .v2-module-card p {
            color: #64748b !important;
        }
        html.dark .v2-module-card {
            background-color: #0f172a !important;
            border-color: #1e293b !important;
        }
        html.dark .v2-module-card:hover {
            background-color: #1e293b !important;
            border-color: #334155 !important;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35) !important;
        }
        html.dark .v2-module-card h4 {
            color: #f8fafc !important;
        }
        html.dark .v2-module-card p {
            color: #cbd5e1 !important;
        }

        /* V2 Skills Video Enhancements (Official HRD Korea Integration) */
        .v2-chapter-pill {
            display: inline-flex;
            align-items: center;
            padding: 0.35rem 0.65rem;
            font-size: 0.72rem;
            font-weight: 700;
            border-radius: 9999px;
            background: #f1f5f9;
            color: #334155;
            border: 1px solid #cbd5e1;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            cursor: pointer;
            text-align: left;
        }
        .v2-chapter-pill:hover {
            background: #e0e7ff;
            color: #4338ca;
            border-color: #a5b4fc;
            transform: translateY(-1px);
        }
        .v2-chapter-pill.v2-chapter-active {
            background: #4f46e5 !important;
            color: #ffffff !important;
            border-color: #4338ca !important;
            box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
        }
        html.dark .v2-chapter-pill {
            background: #1e293b;
            color: #e2e8f0;
            border-color: #334155;
        }
        html.dark .v2-chapter-pill:hover {
            background: #312e81;
            color: #c7d2fe;
            border-color: #6366f1;
        }
        html.dark .v2-chapter-pill.v2-chapter-active {
            background: #6366f1 !important;
            color: #ffffff !important;
            border-color: #818cf8 !important;
            box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
        }

        .v2-btn-task-video {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            padding: 0.3rem 0.6rem;
            font-size: 0.7rem;
            font-weight: 700;
            border-radius: 0.5rem;
            background: #fffbeb;
            color: #b45309;
            border: 1px solid #fde68a;
            transition: all 0.2s ease;
            cursor: pointer;
            white-space: nowrap;
        }
        .v2-btn-task-video:hover {
            background: #fef3c7;
            color: #92400e;
            border-color: #f59e0b;
            transform: scale(1.03);
        }
        html.dark .v2-btn-task-video {
            background: rgba(245, 158, 11, 0.15);
            color: #fbbf24;
            border-color: rgba(245, 158, 11, 0.35);
        }
        html.dark .v2-btn-task-video:hover {
            background: rgba(245, 158, 11, 0.25);
            color: #fde68a;
            border-color: #f59e0b;
        }

        .v2-btn-video-full {
            display: inline-flex;
            align-items: center;
            padding: 0.35rem 0.75rem;
            font-size: 0.72rem;
            font-weight: 700;
            border-radius: 9999px;
            background: #eef2ff;
            color: #4f46e5;
            border: 1px solid #c7d2fe;
            transition: all 0.2s ease;
            cursor: pointer;
        }
        .v2-btn-video-full:hover {
            background: #e0e7ff;
            color: #3730a3;
            border-color: #818cf8;
            transform: translateY(-1px);
        }
        html.dark .v2-btn-video-full {
            background: rgba(99, 102, 241, 0.15);
            color: #a5b4fc;
            border-color: rgba(99, 102, 241, 0.35);
        }
        html.dark .v2-btn-video-full:hover {
            background: rgba(99, 102, 241, 0.28);
            color: #e0e7ff;
            border-color: #818cf8;
        }

        .v2-acc-video-btn {
            display: flex;
            align-items: center;
            justify-content: space-between;
            width: 100%;
            text-align: left;
            background: #f8fafc;
            border: 1px solid #e2e8f0;
            border-radius: 0.75rem;
            padding: 0.55rem 0.85rem;
            font-size: 0.75rem;
            font-weight: 700;
            color: #334155;
            transition: all 0.2s ease;
            cursor: pointer;
        }
        .v2-acc-video-btn:hover {
            background: #f1f5f9;
            color: #0f172a;
            border-color: #cbd5e1;
            transform: translateX(2px);
        }
        html.dark .v2-acc-video-btn {
            background: #1e293b;
            border-color: #334155;
            color: #e2e8f0;
        }
        html.dark .v2-acc-video-btn:hover {
            background: #283548;
            color: #ffffff;
            border-color: #475569;
        }

        html.dark .v2-study-mode-bar {
            background-color: #0f172a !important;
            border: 1px solid #1e293b !important;
        }
        html.dark .v2-setting-chip,
        html[data-theme="dark"] .v2-setting-chip,
        .dark .v2-setting-chip,
        html.anki-mode-on .v2-setting-chip {
            background-color: #1e293b !important;
            border-color: #334155 !important;
            color: #cbd5e1 !important;
        }
        html.dark .v2-setting-chip:hover,
        html[data-theme="dark"] .v2-setting-chip:hover,
        .dark .v2-setting-chip:hover,
        html.anki-mode-on .v2-setting-chip:hover {
            background-color: #334155 !important;
            color: #f8fafc !important;
        }
        html.dark .v2-setting-chip:has(input:checked),
        html[data-theme="dark"] .v2-setting-chip:has(input:checked),
        .dark .v2-setting-chip:has(input:checked),
        html.anki-mode-on .v2-setting-chip:has(input:checked) {
            background-color: #312e81 !important;
            border-color: #6366f1 !important;
            color: #e0e7ff !important;
        }
        html.dark .v2-setting-chip:has(input#v2-toggle-wakelock:checked),
        html[data-theme="dark"] .v2-setting-chip:has(input#v2-toggle-wakelock:checked),
        .dark .v2-setting-chip:has(input#v2-toggle-wakelock:checked),
        html.anki-mode-on .v2-setting-chip:has(input#v2-toggle-wakelock:checked) {
            background: rgba(245, 158, 11, 0.22) !important;
            background-color: rgba(245, 158, 11, 0.22) !important;
            border-color: rgba(245, 158, 11, 0.5) !important;
            color: #fde68a !important;
        }
        html.dark .v2-cat-btn-compact.v2-cat-btn-inactive {
            background-color: #1e293b !important;
            border-color: #334155 !important;
            color: #cbd5e1 !important;
        }
        html.dark .v2-cat-btn-compact.v2-cat-btn-inactive:hover {
            background-color: #334155 !important;
            color: #f8fafc !important;
        }
        html.dark .v2-cat-btn-compact.v2-cat-btn-active {
            background-color: #312e81 !important;
            border-color: #6366f1 !important;
            color: #e0e7ff !important;
            box-shadow: 0 0 12px rgba(99, 102, 241, 0.35) !important;
        }
        html.dark .v2-study-tool-btn {
            background-color: #1e293b !important;
            border-color: #334155 !important;
            color: #e2e8f0 !important;
        }
        html.dark .v2-study-tool-btn:hover {
            background-color: #334155 !important;
            color: #ffffff !important;
        }

        /* Question & Answer Card in V2 (Ảnh 1) */
        html.dark .hw-bg-slate-950\/40 {
            background-color: #111827 !important;
            border-color: #1e293b !important;
        }
        html.dark #scenarios-player-q-korean,
        html.dark .v2-question-text {
            color: #38bdf8 !important; /* Crystal clear cyan question */
            text-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
        }
        html.dark #scenarios-player-q-viet,
        html.dark .v2-vietnamese-text {
            color: #94a3b8 !important; /* Soft high contrast Vietnamese */
        }
        html.dark #scenarios-player-a-korean,
        html.dark .v2-answer-ko-text {
            color: #e0e7ff !important; /* High contrast bright answer */
        }
        html.dark #scenarios-player-a-viet,
        html.dark .v2-answer-vi-text {
            color: #cbd5e1 !important;
        }
        html.dark .v2-player-control-btn {
            background-color: #1e293b !important;
            border-color: #334155 !important;
            color: #cbd5e1 !important;
        }
        html.dark .v2-player-control-btn:hover {
            background-color: #334155 !important;
            color: #f8fafc !important;
        }
        html.dark .v2-player-q-item {
            background-color: #111827 !important;
            border-color: #1e293b !important;
            color: #cbd5e1 !important;
        }
        html.dark .v2-player-q-item:hover {
            background-color: #1e293b !important;
        }
        html.dark .v2-player-q-item.rules-q-active {
            background-color: #1e1b4b !important;
            border-color: #4f46e5 !important;
            color: #e0e7ff !important;
        }
        html.dark .v2-header-icon-btn,
        html[data-theme="dark"] .v2-header-icon-btn,
        .dark .v2-header-icon-btn,
        html.anki-mode-on .v2-header-icon-btn,
        html.dark .v2-header-pill-btn,
        html[data-theme="dark"] .v2-header-pill-btn,
        .dark .v2-header-pill-btn,
        html.anki-mode-on .v2-header-pill-btn {
            border-color: #334155 !important;
        }
        html.dark .v2-header-icon-btn.hw-bg-rose-50,
        html[data-theme="dark"] .v2-header-icon-btn.hw-bg-rose-50,
        .dark .v2-header-icon-btn.hw-bg-rose-50,
        html.anki-mode-on .v2-header-icon-btn.hw-bg-rose-50 {
            background-color: rgba(244, 63, 94, 0.15) !important;
            border-color: rgba(244, 63, 94, 0.35) !important;
            color: #fb7185 !important;
        }
        html.dark .v2-header-icon-btn.hw-bg-sky-50,
        html[data-theme="dark"] .v2-header-icon-btn.hw-bg-sky-50,
        .dark .v2-header-icon-btn.hw-bg-sky-50,
        html.anki-mode-on .v2-header-icon-btn.hw-bg-sky-50 {
            background-color: rgba(14, 165, 233, 0.15) !important;
            border-color: rgba(56, 189, 248, 0.35) !important;
            color: #38bdf8 !important;
        }
        html.dark .v2-header-icon-btn.hw-bg-teal-50,
        html[data-theme="dark"] .v2-header-icon-btn.hw-bg-teal-50,
        .dark .v2-header-icon-btn.hw-bg-teal-50,
        html.anki-mode-on .v2-header-icon-btn.hw-bg-teal-50 {
            background-color: rgba(20, 184, 166, 0.15) !important;
            border-color: rgba(45, 212, 191, 0.35) !important;
            color: #2dd4bf !important;
        }
        html.dark .v2-header-pill-btn.hw-bg-emerald-50,
        html[data-theme="dark"] .v2-header-pill-btn.hw-bg-emerald-50,
        .dark .v2-header-pill-btn.hw-bg-emerald-50,
        html.anki-mode-on .v2-header-pill-btn.hw-bg-emerald-50 {
            background-color: rgba(16, 185, 129, 0.15) !important;
            border-color: rgba(52, 211, 153, 0.35) !important;
            color: #34d399 !important;
        }
        html.dark .v2-header-pill-btn.hw-bg-indigo-50,
        html[data-theme="dark"] .v2-header-pill-btn.hw-bg-indigo-50,
        .dark .v2-header-pill-btn.hw-bg-indigo-50,
        html.anki-mode-on .v2-header-pill-btn.hw-bg-indigo-50 {
            background-color: rgba(99, 102, 241, 0.15) !important;
            border-color: rgba(129, 140, 248, 0.35) !important;
            color: #a5b4fc !important;
        }
        html.dark #scenarios-player-info-panel,
        html.dark .v2-answer-info-card,
        html[data-theme="dark"] #scenarios-player-info-panel,
        html[data-theme="dark"] .v2-answer-info-card,
        .dark #scenarios-player-info-panel,
        .dark .v2-answer-info-card,
        html.anki-mode-on #scenarios-player-info-panel,
        html.anki-mode-on .v2-answer-info-card {
            background-color: #111827 !important;
            border-color: #1e293b !important;
        }
        html.dark .hw-border-slate-100,
        html[data-theme="dark"] .hw-border-slate-100,
        .dark .hw-border-slate-100,
        html.anki-mode-on .hw-border-slate-100,
        html.dark .hw-border-slate-200,
        html[data-theme="dark"] .hw-border-slate-200,
        .dark .hw-border-slate-200,
        html.anki-mode-on .hw-border-slate-200,
        html.dark .v2-answer-action-divider,
        html[data-theme="dark"] .v2-answer-action-divider,
        .dark .v2-answer-action-divider,
        html.anki-mode-on .v2-answer-action-divider {
            border-color: rgba(255, 255, 255, 0.08) !important;
        }
        html.dark .v2-answer-tag,
        html[data-theme="dark"] .v2-answer-tag,
        .dark .v2-answer-tag,
        html.anki-mode-on .v2-answer-tag {
            background-color: rgba(99, 102, 241, 0.16) !important;
            border: 1px solid rgba(129, 140, 248, 0.35) !important;
            color: #a5b4fc !important;
        }
        html.dark .v2-panel-custom-badge,
        html[data-theme="dark"] .v2-panel-custom-badge,
        .dark .v2-panel-custom-badge,
        html.anki-mode-on .v2-panel-custom-badge {
            background-color: rgba(16, 185, 129, 0.16) !important;
            border: 1px solid rgba(52, 211, 153, 0.35) !important;
            color: #34d399 !important;
        }
        html.dark .v2-mic-pill-btn {
            background-color: rgba(244, 63, 94, 0.15) !important;
            border-color: rgba(244, 63, 94, 0.35) !important;
            color: #fb7185 !important;
        }
        html.dark .v2-mic-pill-btn:hover {
            background-color: rgba(244, 63, 94, 0.25) !important;
            border-color: rgba(244, 63, 94, 0.5) !important;
            color: #fda4af !important;
        }
        html.dark .v2-answer-action-divider {
            border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
        }
        html.dark .hw-border-soft {
            border-color: rgba(255, 255, 255, 0.08) !important;
        }
        html.dark .hw-bg-soft {
            background-color: rgba(15, 23, 42, 0.6) !important;
        }
        html.dark .hw-bg-surface {
            background-color: rgba(11, 15, 25, 0.8) !important;
        }
        html.dark .hw-border-slate-100 {
            border-color: rgba(255, 255, 255, 0.08) !important;
        }
        html.dark .hw-border-slate-200 {
            border-color: rgba(255, 255, 255, 0.12) !important;
        }
        html.dark div[id$="-player-mic-feedback"],
        html.dark #scenarios-player-mic-feedback {
            color: #94a3b8 !important;
        }
        html.dark .v2-scenarios-wave-bar {
            background-color: #818cf8 !important;
            box-shadow: 0 0 8px rgba(129, 140, 248, 0.4);
        }
        html.dark #scenarios-player-keywords-container span {
            color: #fbbf24 !important;
        }
        html.dark .v2-keyword-token {
            background-color: rgba(245, 158, 11, 0.15) !important;
            border: 1px solid rgba(245, 158, 11, 0.4) !important;
            color: #fbbf24 !important;
        }
        html.dark .v2-memory-actionbar,
        html[data-theme="dark"] .v2-memory-actionbar,
        .dark .v2-memory-actionbar {
            border-top-color: rgba(255, 255, 255, 0.08) !important;
        }
        html.dark .v2-memory-heading,
        html[data-theme="dark"] .v2-memory-heading,
        .dark .v2-memory-heading {
            color: #94a3b8 !important;
        }
        html.dark .v2-memory-segmented-bar,
        html[data-theme="dark"] .v2-memory-segmented-bar,
        .dark .v2-memory-segmented-bar {
            background: #0f172a !important;
            background-color: #0f172a !important;
            border: 1px solid #1e293b !important;
            border-color: #1e293b !important;
            box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4) !important;
        }
        html.dark .v2-memory-action-rose,
        html.dark .v2-quick-memory-action-rose,
        html.dark .v2-memory-action[data-status="unlearned"],
        html.dark .v2-memory-action[data-status="due"] {
            color: #fb7185 !important;
            background: rgba(225, 29, 72, 0.12) !important;
            border: 1px solid rgba(225, 29, 72, 0.28) !important;
        }
        html.dark .v2-memory-action-amber,
        html.dark .v2-quick-memory-action-amber,
        html.dark .v2-memory-action[data-status="learning"] {
            color: #fbbf24 !important;
            background: rgba(245, 158, 11, 0.12) !important;
            border: 1px solid rgba(245, 158, 11, 0.28) !important;
        }
        html.dark .v2-memory-action-emerald,
        html.dark .v2-quick-memory-action-emerald,
        html.dark .v2-memory-action[data-status="mastered"] {
            color: #34d399 !important;
            background: rgba(16, 185, 129, 0.12) !important;
            border: 1px solid rgba(16, 185, 129, 0.28) !important;
        }
        html.dark .v2-memory-action-rose.is-active,
        html.dark .v2-quick-memory-action-rose.is-active {
            color: #fff !important;
            background: #e11d48 !important;
            border-color: #e11d48 !important;
            box-shadow: 0 2px 10px rgba(225, 29, 72, 0.45) !important;
        }
        html.dark .v2-memory-action-amber.is-active,
        html.dark .v2-quick-memory-action-amber.is-active {
            color: #fff !important;
            background: #d97706 !important;
            border-color: #d97706 !important;
            box-shadow: 0 2px 10px rgba(217, 119, 6, 0.45) !important;
        }
        html.dark .v2-memory-action-emerald.is-active,
        html.dark .v2-quick-memory-action-emerald.is-active {
            color: #fff !important;
            background: #059669 !important;
            border-color: #059669 !important;
            box-shadow: 0 2px 10px rgba(5, 150, 105, 0.45) !important;
        }
        html.dark .v2-mic-pill-btn {
            background-color: #1e293b !important;
            border-color: #334155 !important;
            color: #f43f5e !important;
        }
        html.dark .v2-mic-pill-btn:hover {
            background-color: #334155 !important;
        }

        /* =====================================================================
           ROUND 2 INTERVIEW (PHỎNG VẤN VÒNG 2) - HIGH CONTRAST DARK MODE (Ảnh 1 & 2)
           ===================================================================== */
        html.dark #v2-view-interview .hw-glass,
        html.dark #v2-view-interview div.hw-glass {
            background-color: #0f172a !important;
            background: #0f172a !important;
            border-color: #1e293b !important;
            color: #f8fafc !important;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45) !important;
        }

        html.dark #v2-view-interview .hw-bg-white,
        html.dark #v2-view-interview [class*="hw-bg-white"] {
            background-color: #131b2e !important;
            border-color: #1e293b !important;
            color: #f8fafc !important;
        }

        html.dark #v2-view-interview [class*="hw-bg-slate-950"],
        html.dark #v2-view-interview [class*="hw-bg-slate-900"] {
            background-color: #0b0f19 !important;
            border-color: #1e293b !important;
            color: #f8fafc !important;
        }

        html.dark #v2-view-interview .hw-bg-surface {
            background-color: #0b0f19 !important;
            border-color: #1e293b !important;
        }

        html.dark #v2-view-interview [class*="hw-border-emerald-100"],
        html.dark #v2-view-interview [class*="hw-border-emerald-200"],
        html.dark #v2-view-interview [class*="hw-border-soft"],
        html.dark #v2-view-interview [class*="hw-border-slate-800"],
        html.dark #v2-view-interview [class*="hw-border-slate-100"],
        html.dark #v2-view-interview [class*="hw-border-slate-200"] {
            border-color: #1e293b !important;
        }

        html.dark #v2-view-interview .v2-template-btn-active {
            background-color: #312e81 !important;
            border-color: #6366f1 !important;
            color: #e0e7ff !important;
            box-shadow: 0 0 12px rgba(99, 102, 241, 0.35) !important;
        }

        html.dark #v2-view-interview .v2-template-btn-inactive {
            background-color: #1e293b !important;
            border-color: #334155 !important;
            color: #94a3b8 !important;
        }

        html.dark #v2-view-interview .v2-template-btn-inactive:hover {
            background-color: #334155 !important;
            color: #f8fafc !important;
        }

        html.dark #v2-view-interview input[data-intro-key],
        html.dark #v2-view-interview input[type="text"].hw-bg-white,
        html.dark #v2-view-interview input.hw-bg-white {
            background-color: #0b0f19 !important;
            border-color: #334155 !important;
            color: #f8fafc !important;
        }

        html.dark #v2-view-interview input[data-intro-key]:focus,
        html.dark #v2-view-interview input[type="text"].hw-bg-white:focus {
            border-color: #10b981 !important;
            box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25) !important;
        }

        html.dark #v2-view-interview label {
            color: #94a3b8 !important;
        }

        html.dark #v2-view-interview #self-intro-ai-feedback {
            background-color: rgba(16, 185, 129, 0.15) !important;
            border-color: rgba(16, 185, 129, 0.3) !important;
            color: #6ee7b7 !important;
        }

        html.dark #v2-view-interview #prompter-speech-panel {
            background-color: #131b2e !important;
            border-color: #1e293b !important;
        }

        html.dark #v2-view-interview #prompter-speech-panel .hw-bg-emerald-50 {
            background-color: rgba(16, 185, 129, 0.12) !important;
            border-color: rgba(16, 185, 129, 0.25) !important;
        }

        html.dark #v2-view-interview #prompter-speech-panel .hw-bg-slate-50 {
            background-color: #0b0f19 !important;
            border-color: #1e293b !important;
        }

        html.dark #v2-view-interview #prompter-score-value {
            color: #34d399 !important;
        }

        html.dark #v2-view-interview #prompter-score-label {
            color: #94a3b8 !important;
        }

        html.dark #v2-view-interview #prompter-record-status {
            color: #f1f5f9 !important;
        }

        html.dark #v2-view-interview #prompter-transcript-preview {
            color: #94a3b8 !important;
        }

        html.dark #v2-view-interview #prompter-replay-btn {
            background-color: #1e293b !important;
            border-color: #334155 !important;
            color: #e2e8f0 !important;
        }

        html.dark #v2-view-interview #prompter-rescore-btn {
            background-color: rgba(99, 102, 241, 0.2) !important;
            border-color: rgba(99, 102, 241, 0.4) !important;
            color: #a5b4fc !important;
        }

        html.dark #v2-view-interview #prompter-full-text-view {
            background-color: #0b0f19 !important;
            background: #0b0f19 !important;
            border-color: #1e293b !important;
            color: #f8fafc !important;
            box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6) !important;
        }

        html.dark #v2-view-interview .self-intro-sentence-row {
            border-color: transparent !important;
            color: #f8fafc !important;
        }

        html.dark #v2-view-interview .self-intro-sentence-row:hover {
            background-color: rgba(16, 185, 129, 0.12) !important;
            border-color: rgba(16, 185, 129, 0.25) !important;
        }

        html.dark #v2-view-interview .self-intro-sentence-row.hw-bg-emerald-100\/90 {
            background-color: rgba(16, 185, 129, 0.25) !important;
            border-color: #10b981 !important;
        }

        html.dark #v2-view-interview .self-intro-sentence-content {
            color: #f8fafc !important;
        }

        html.dark #v2-view-interview .self-intro-sentence-row span.hw-rounded-full {
            background-color: #1e293b !important;
            color: #94a3b8 !important;
            border: 1px solid rgba(255, 255, 255, 0.08) !important;
        }

        html.dark #v2-view-interview .self-intro-sentence-speaker {
            background-color: rgba(16, 185, 129, 0.18) !important;
            border-color: rgba(16, 185, 129, 0.35) !important;
            color: #6ee7b7 !important;
        }

        html.dark #v2-view-interview .self-intro-sentence-speaker:hover {
            background-color: #059669 !important;
            color: #ffffff !important;
        }

        html.dark #v2-view-interview .interview-copy-btn,
        html.dark #v2-view-interview button[onclick="copyPrompterText()"] {
            background: #1e293b !important;
            background-color: #1e293b !important;
            border-color: rgba(16, 185, 129, 0.35) !important;
            color: #6ee7b7 !important;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
        }

        html.dark #v2-view-interview .interview-copy-btn:hover,
        html.dark #v2-view-interview button[onclick="copyPrompterText()"]:hover {
            background: rgba(16, 185, 129, 0.2) !important;
            background-color: rgba(16, 185, 129, 0.2) !important;
            border-color: #10b981 !important;
            color: #a7f3d0 !important;
        }

        html.dark #v2-view-interview h4[id$="-q-korean"],
        html.dark #v2-view-interview .v2-question-text,
        html.dark #basic-player-q-korean,
        html.dark #commands-player-q-korean,
        html.dark #units-player-q-korean,
        html.dark #scenarios-player-q-korean,
        html.dark #rules-player-q-korean,
        html.dark #action-instructions-player-q-korean,
        html.dark #calc-player-q-korean {
            color: #38bdf8 !important;
            text-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
        }

        html.dark #v2-view-interview p[id$="-q-viet"],
        html.dark #v2-view-interview .v2-vietnamese-text,
        html.dark #basic-player-q-viet,
        html.dark #commands-player-q-viet,
        html.dark #units-player-q-viet,
        html.dark #scenarios-player-q-viet,
        html.dark #rules-player-q-viet,
        html.dark #action-instructions-player-q-viet,
        html.dark #calc-player-q-viet {
            color: #94a3b8 !important;
        }

        html.dark #v2-view-interview p[id$="-a-korean"],
        html.dark #v2-view-interview .v2-answer-ko-text,
        html.dark #basic-player-a-korean,
        html.dark #commands-player-a-korean,
        html.dark #units-player-a-korean,
        html.dark #scenarios-player-a-korean,
        html.dark #rules-player-a-korean,
        html.dark #action-instructions-player-a-korean,
        html.dark #calc-player-a-korean {
            color: #e0e7ff !important;
        }

        html.dark #v2-view-interview p[id$="-a-viet"],
        html.dark #v2-view-interview .v2-answer-vi-text,
        html.dark #basic-player-a-viet,
        html.dark #commands-player-a-viet,
        html.dark #units-player-a-viet,
        html.dark #scenarios-player-a-viet,
        html.dark #rules-player-a-viet,
        html.dark #action-instructions-player-a-viet,
        html.dark #calc-player-a-viet {
            color: #cbd5e1 !important;
        }

        html.dark #v2-view-interview .v2-player-control-btn,
        html.dark #v2-view-interview button.hw-bg-white {
            background-color: #1e293b !important;
            border-color: #334155 !important;
            color: #cbd5e1 !important;
        }

        html.dark #v2-view-interview .v2-player-control-btn:hover,
        html.dark #v2-view-interview button.hw-bg-white:hover {
            background-color: #334155 !important;
            color: #f8fafc !important;
        }

        html.dark #v2-view-interview .v2-answer-info-card {
            background-color: #131b2e !important;
            border-color: #1e293b !important;
        }

        html.dark #v2-view-interview .v2-answer-tag {
            color: #a5b4fc !important;
        }

        html.dark #v2-view-interview .v2-player-q-item {
            background-color: #111827 !important;
            border-color: #1e293b !important;
            color: #cbd5e1 !important;
        }

        html.dark #v2-view-interview .v2-player-q-item:hover {
            background-color: #1e293b !important;
        }

        html.dark #v2-view-interview .v2-q-idx-badge {
            background-color: #1e293b !important;
            color: #94a3b8 !important;
            border: 1px solid #334155 !important;
        }

        html.dark #v2-view-interview .v2-ko-text {
            color: #f8fafc !important;
        }

        html.dark #v2-view-interview .v2-vi-text {
            color: #94a3b8 !important;
        }

        /* Vòng 2 Home Cockpit & 5 Feature Cards (Đồng màu Vòng 2 Home) */
        html.dark #v2-smart-dashboard .hw-glass {
            background-color: #0f172a !important;
            background: #0f172a !important;
            border-color: #1e293b !important;
        }
        html.dark #v2-smart-dashboard h3 {
            color: #f8fafc !important;
        }
        html.dark #v2-smart-dashboard .md\:hw-col-span-7 {
            background-color: #131b2e !important;
            background: #131b2e !important;
            border-color: #1e293b !important;
        }
        html.dark #v2-smart-dashboard circle[stroke="#e2e8f0"] {
            stroke: #1e293b !important;
        }
        html.dark #v2-smart-dashboard .hw-bg-slate-50 {
            background-color: #1e293b !important;
            border-color: #334155 !important;
        }
        html.dark #v2-smart-dashboard button:not([class*="hw-bg-gradient-to-r"]) {
            background-color: #1e293b !important;
            border-color: #334155 !important;
            color: #cbd5e1 !important;
        }
        html.dark #v2-smart-dashboard button:not([class*="hw-bg-gradient-to-r"]):hover {
            background-color: #334155 !important;
            color: #f8fafc !important;
        }
        html.dark #v2-smart-dashboard button[class*="hw-bg-gradient-to-r"] {
            color: #ffffff !important;
        }
        html.dark #v2-smart-dashboard .hw-bg-emerald-50\/80 {
            background-color: rgba(6, 78, 59, 0.35) !important;
            border-color: rgba(16, 185, 129, 0.4) !important;
        }
        html.dark #v2-smart-dashboard .hw-bg-emerald-50\/80 .hw-text-emerald-700 {
            color: #6ee7b7 !important;
        }
        html.dark #v2-smart-dashboard .hw-bg-emerald-50\/80 .hw-text-emerald-600 {
            color: #34d399 !important;
        }
        html.dark #v2-smart-dashboard .hw-bg-rose-50\/80 {
            background-color: rgba(136, 19, 55, 0.35) !important;
            border-color: rgba(244, 63, 94, 0.4) !important;
        }
        html.dark #v2-smart-dashboard .hw-bg-rose-50\/80 .hw-text-rose-700 {
            color: #fda4af !important;
        }
        html.dark #v2-smart-dashboard .hw-bg-rose-50\/80 .hw-text-rose-600 {
            color: #fb7185 !important;
        }
        html.dark #v2-smart-dashboard .hw-bg-slate-50 .hw-text-slate-600 {
            color: #94a3b8 !important;
        }
        html.dark #v2-smart-dashboard .hw-bg-slate-50 .hw-text-slate-700 {
            color: #f1f5f9 !important;
        }
        html.dark .v2-module-card {
            background-color: #0f172a !important;
            border-color: #1e293b !important;
        }
        html.dark .v2-module-card:hover {
            border-color: #334155 !important;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35) !important;
        }
        html.dark .v2-module-card h4 {
            color: #f8fafc !important;
        }
        html.dark .v2-module-card p {
            color: #cbd5e1 !important;
        }
        html.dark .v2-module-rose:hover {
            background-color: rgba(225, 29, 72, 0.14) !important;
            border-color: rgba(244, 63, 94, 0.5) !important;
        }
        html.dark .v2-module-sky:hover {
            background-color: rgba(2, 132, 199, 0.14) !important;
            border-color: rgba(56, 189, 248, 0.5) !important;
        }
        html.dark .v2-module-emerald:hover {
            background-color: rgba(5, 150, 105, 0.14) !important;
            border-color: rgba(52, 211, 153, 0.5) !important;
        }
        html.dark .v2-module-amber:hover {
            background-color: rgba(217, 119, 6, 0.14) !important;
            border-color: rgba(251, 191, 36, 0.5) !important;
        }
        html.dark .v2-module-indigo:hover {
            background-color: rgba(79, 70, 229, 0.14) !important;
            border-color: rgba(129, 140, 248, 0.5) !important;
        }
        html.dark .v2-module-violet:hover {
            background-color: rgba(124, 58, 237, 0.14) !important;
            border-color: rgba(167, 139, 250, 0.5) !important;
        }
        html.dark #scenarios-player-card,
        html.dark .v2-card,
        html.dark #view-interview-player .hw-bg-white,
        html.dark #v2-view-interview [class*="hw-bg-white"] {
            background-color: #0f172a !important;
            background: #0f172a !important;
            border-color: #1e293b !important;
            color: #f8fafc !important;
        }
        html.dark #v2-view-home [class*="hw-bg-amber-50"] {
            background-color: rgba(245, 158, 11, 0.08) !important;
            border-color: rgba(245, 158, 11, 0.25) !important;
            color: #fde68a !important;
        }

        /* Fix warning box text readability in dark mode (skin-tutien) */
        .skin-tutien .payment-warning-text {
            color: #fcd34d !important;
            /* amber-300 */
        }

        #view-payment #payment-active-container {
            background: #ffffff !important;
            border-color: #edf2f7 !important;
            box-shadow: 0 18px 52px rgba(15, 23, 42, 0.08) !important;
        }

        #view-payment .payment-qr-card,
        #view-payment .payment-info-panel {
            background: #ffffff !important;
            border-color: #e5e7eb !important;
            box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06) !important;
        }

        #view-payment .payment-qr-frame {
            width: min(252px, 76vw);
            aspect-ratio: 791 / 1024;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 4px;
            background: #ffffff;
            border: 1px solid #eef2f7;
            border-radius: 18px;
            overflow: hidden;
        }

        #view-payment #pay-qr-img {
            width: 100% !important;
            height: 100% !important;
            max-width: none !important;
            display: block;
            object-fit: contain !important;
            background: #ffffff !important;
            border-radius: 12px;
        }

        #view-payment #pay-qr-img.qr-loading {
            opacity: 0.45;
            filter: saturate(0.8);
        }

        #view-payment .payment-download-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            min-height: 36px;
            margin-top: 12px;
            padding: 8px 14px;
            border: 1px solid #c7d2fe;
            border-radius: 12px;
            background: #eef2ff;
            color: #4f46e5;
            font-size: 12px;
            font-weight: 800;
            transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
        }

        #view-payment .payment-download-btn:hover:not(:disabled),
        #view-payment .payment-download-btn:focus-visible:not(:disabled) {
            background: #e0e7ff;
            box-shadow: 0 8px 20px rgba(79, 70, 229, 0.16);
            transform: translateY(-1px);
        }

        #view-payment .payment-download-btn:disabled {
            cursor: not-allowed;
            opacity: 0.55;
            transform: none;
            box-shadow: none;
        }

        #view-payment .payment-status-row {
            align-items: center;
            flex-wrap: wrap;
            row-gap: 8px;
        }

        #view-payment .payment-spinner {
            position: relative;
            width: 18px;
            height: 18px;
            min-width: 18px;
            flex: 0 0 18px;
            box-sizing: border-box;
            border-radius: 9999px;
        }

        #view-payment .payment-spinner::before {
            content: "";
            position: absolute;
            inset: 0;
            box-sizing: border-box;
            border: 3px solid rgba(99, 102, 241, 0.16);
            border-top-color: #6366f1;
            border-right-color: #10b981;
            border-radius: inherit;
            animation: paymentSpin 0.72s linear infinite;
            transform-origin: 50% 50%;
        }

        @keyframes paymentSpin {
            to {
                transform: rotate(360deg);
            }
        }

        @media (max-width: 768px) {
            #view-payment .payment-qr-frame {
                width: min(244px, 80vw);
            }
        }

        /* Card flip: opacity only. Scaling/3D layers repaint large card content
           on lower-end mobile GPUs and make text appear to jump. */
        #hw-flashcard {
            transition: opacity 110ms ease-out, transform 110ms ease-out;
            will-change: transform, opacity;
            -webkit-perspective: 1000px;
            perspective: 1000px;
            -webkit-transform-style: preserve-3d;
            transform-style: preserve-3d;
            transform: translateZ(0);
            -webkit-transform: translateZ(0);
        }

        #hw-btn-not-known,
        #hw-btn-known,
        #hw-flashcard-prev,
        #hw-flashcard-next,
        #hw-flashcard-direction,
        #hw-flashcard-autoflip,
        #hw-flashcard-shuffle,
        #hw-flashcard-bookmark,
        #hw-flashcard {
            touch-action: manipulation !important;
            -webkit-tap-highlight-color: transparent !important;
            user-select: none !important;
            -webkit-user-select: none !important;
        }

        .hw-lesson-vocab-mastered-badge {
            display: inline-flex;
            align-items: center;
            gap: 3px;
            padding: 2px 7px;
            font-size: 0.68rem;
            font-weight: 700;
            border-radius: 9999px;
            background: #ecfdf5;
            color: #059669;
            border: 1px solid #a7f3d0;
        }

        .hw-lesson-vocab-lapse-badge {
            display: inline-flex;
            align-items: center;
            gap: 3px;
            padding: 2px 7px;
            font-size: 0.68rem;
            font-weight: 700;
            border-radius: 9999px;
            background: #fff7ed;
            color: #c2410c;
            border: 1px solid #fed7aa;
        }

        #hw-flashcard .hw-card-front,
        #hw-flashcard .hw-card-back {
            transform: none !important;
            will-change: opacity;
            backface-visibility: hidden !important;
            -webkit-backface-visibility: hidden !important;
        }

        #hw-flashcard .hw-card-front {
            opacity: 1 !important;
            visibility: visible !important;
            pointer-events: auto !important;
            transition: opacity 100ms ease-out 20ms, visibility 0s linear 0s !important;
        }

        #hw-flashcard .hw-card-back {
            opacity: 0 !important;
            visibility: hidden !important;
            pointer-events: none !important;
            transition: opacity 80ms ease-in, visibility 0s linear 80ms !important;
        }

        #hw-flashcard.hw-flipped .hw-card-front {
            opacity: 0 !important;
            visibility: hidden !important;
            pointer-events: none !important;
            transition: opacity 80ms ease-in, visibility 0s linear 80ms !important;
        }

        #hw-flashcard.hw-flipped .hw-card-back {
            opacity: 1 !important;
            visibility: visible !important;
            pointer-events: auto !important;
            transition: opacity 100ms ease-out 20ms, visibility 0s linear 0s !important;
        }

        #hw-flashcard.hw-card-advancing {
            opacity: 0 !important;
            transition: opacity 60ms ease-out !important;
        }

        #hw-flashcard.hw-card-advancing .hw-card-front,
        #hw-flashcard.hw-card-advancing .hw-card-back {
            opacity: 0 !important;
            visibility: hidden !important;
            pointer-events: none !important;
            transition: none !important;
        }

        @media (prefers-reduced-motion: reduce) {
            #hw-flashcard .hw-card-front,
            #hw-flashcard .hw-card-back {
                transition: none !important;
                will-change: auto;
            }
        }

        /* Active Navigation Tab Style */
        .hw-tab-btn.active {
            background: rgba(99, 102, 241, 0.08) !important;
            color: #6366F1 !important;
            border-left: 3px solid #6366F1;
        }

        /* Flashcard Slide Transitions (Right-to-Left & Left-to-Right) */
        #view-review #hw-step-1-card,
        #hw-step-1-card {
            -webkit-perspective: 1200px;
            perspective: 1200px;
            overflow: visible;
            position: relative;
        }

        /* UNIFIED CARD TRANSITION — Smooth Fade + Scale (Anki-style) */
        #view-review #hw-flashcard.hw-card-slide-out-left,
        #hw-flashcard.hw-card-slide-out-left,
        #view-review #hw-flashcard.hw-card-slide-out-right,
        #hw-flashcard.hw-card-slide-out-right {
            -webkit-transform: translate3d(0, 0, 0) scale(0.92) !important;
            transform: translate3d(0, 0, 0) scale(0.92) !important;
            opacity: 0 !important;
            -webkit-transition: -webkit-transform 80ms cubic-bezier(0.4, 0, 1, 1), opacity 70ms ease-in !important;
            transition: transform 80ms cubic-bezier(0.4, 0, 1, 1), opacity 70ms ease-in !important;
            pointer-events: none !important;
        }

        #view-review #hw-flashcard.hw-card-slide-in-right-prep,
        #hw-flashcard.hw-card-slide-in-right-prep,
        #view-review #hw-flashcard.hw-card-slide-in-left-prep,
        #hw-flashcard.hw-card-slide-in-left-prep {
            -webkit-transform: translate3d(0, 8px, 0) scale(1.02) !important;
            transform: translate3d(0, 8px, 0) scale(1.02) !important;
            opacity: 0 !important;
            -webkit-transition: none !important;
            transition: none !important;
            pointer-events: none !important;
        }

        #view-review #hw-flashcard.hw-card-slide-in-right,
        #hw-flashcard.hw-card-slide-in-right,
        #view-review #hw-flashcard.hw-card-slide-in-left,
        #hw-flashcard.hw-card-slide-in-left {
            -webkit-transform: translate3d(0, 0, 0) scale(1) !important;
            transform: translate3d(0, 0, 0) scale(1) !important;
            opacity: 1 !important;
            -webkit-transition: -webkit-transform 180ms cubic-bezier(0.16, 1, 0.3, 1), opacity 160ms ease-out !important;
            transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1), opacity 160ms ease-out !important;
            pointer-events: auto !important;
        }

        /* Mastery Reward & Micro-interactions */
        #hw-btn-known {
            transition: transform 120ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 180ms ease-out, background-color 150ms ease-out !important;
            position: relative;
            overflow: hidden;
        }

        #hw-btn-known:active,
        #hw-btn-known.hw-btn-known-active {
            transform: scale(0.95) !important;
            box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.35), 0 8px 20px rgba(34, 197, 94, 0.25) !important;
        }

        .hw-mastery-aura {
            position: absolute;
            inset: -2px;
            border-radius: 24px;
            pointer-events: none;
            border: 2px solid rgba(34, 197, 94, 0.7);
            box-shadow: 0 0 25px rgba(34, 197, 94, 0.35), inset 0 0 15px rgba(34, 197, 94, 0.15);
            opacity: 0;
            z-index: 10;
            animation: hwMasteryAuraPulse 400ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }

        @keyframes hwMasteryAuraPulse {
            0% {
                opacity: 0;
                transform: scale(0.98);
            }
            35% {
                opacity: 1;
                transform: scale(1.01);
            }
            100% {
                opacity: 0;
                transform: scale(1.02);
            }
        }

        .hw-mastery-feedback-float {
            position: absolute;
            top: 14px;
            right: 18px;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 5px 12px;
            border-radius: 9999px;
            font-size: 12px;
            font-weight: 750;
            color: #15803d;
            background: rgba(240, 253, 244, 0.96);
            border: 1px solid rgba(187, 247, 208, 0.95);
            box-shadow: 0 6px 18px rgba(34, 197, 94, 0.22);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            pointer-events: none;
            z-index: 40;
            animation: hwMasteryFloatPop 550ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }

        @keyframes hwMasteryFloatPop {
            0% {
                opacity: 0;
                transform: translate3d(0, 8px, 0) scale(0.85);
            }
            25% {
                opacity: 1;
                transform: translate3d(0, -2px, 0) scale(1.04);
            }
            70% {
                opacity: 1;
                transform: translate3d(0, -5px, 0) scale(1);
            }
            100% {
                opacity: 0;
                transform: translate3d(0, -16px, 0) scale(0.92);
            }
        }

        @media (prefers-reduced-motion: reduce) {
            #hw-flashcard.hw-card-slide-out-left,
            #hw-flashcard.hw-card-slide-in-right-prep,
            #hw-flashcard.hw-card-slide-in-right,
            #hw-flashcard.hw-card-slide-out-right,
            #hw-flashcard.hw-card-slide-in-left-prep,
            #hw-flashcard.hw-card-slide-in-left {
                transform: none !important;
                transition: opacity 60ms ease-out !important;
            }
            .hw-mastery-feedback-float,
            .hw-mastery-aura {
                animation: none !important;
                display: none !important;
            }
        }

        .hw-tab-btn {
            border-left: 3px solid transparent;
        }

        /* Reset anchor-based nav links to look like buttons */
        a.hw-tab-btn,
        a.hw-tab-btn:visited,
        a.hw-tab-btn:hover,
        a.hw-tab-btn:active {
            text-decoration: none;
            color: inherit;
            -webkit-user-drag: none;
            cursor: pointer;
        }

        /* Custom Scrollbar for modern feel */
        ::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }

        ::-webkit-scrollbar-track {
            background: rgba(15, 23, 42, 0.02);
        }

        ::-webkit-scrollbar-thumb {
            background: rgba(99, 102, 241, 0.2);
            border-radius: 4px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: rgba(99, 102, 241, 0.4);
        }

        /* Global overrides for dynamically generated game modals */
        #unified-modal,
        #inv-modal,
        #shop-modal,
        #tft-modal,
        #ladder-modal,
        #meridian-modal,
        #chat-modal,
        #challenge-modal {
            background: var(--game-overlay, rgba(15, 23, 42, 0.45)) !important;
            backdrop-filter: blur(6px) !important;
            -webkit-backdrop-filter: blur(6px) !important;
        }

        #unified-modal .modal-content,
        #inv-modal .modal-content,
        #shop-modal .modal-content,
        #tft-modal .modal-content,
        #ladder-modal .modal-content,
        #meridian-modal .modal-content,
        #chat-modal .modal-content,
        #challenge-modal .modal-content {
            background: var(--game-surface, #ffffff) !important;
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
            border: 1px solid var(--game-border-strong, #cbd5e1) !important;
            border-radius: 20px !important;
            box-shadow: var(--game-shadow-lg, 0 20px 50px rgba(15, 23, 42, 0.16)) !important;
            color: var(--game-text, #0f172a) !important;
            font-family: var(--font-vietnamese) !important;
        }

        #unified-modal button,
        #inv-modal button,
        #shop-modal button,
        #tft-modal button,
        #ladder-modal button,
        #meridian-modal button,
        #chat-modal button {
            border-radius: 12px !important;
            font-family: var(--font-vietnamese) !important;
            transition: transform 0.2s, opacity 0.2s !important;
        }

        #unified-modal button:hover,
        #inv-modal button:hover,
        #shop-modal button:hover,
        #tft-modal button:hover,
        #ladder-modal button:hover,
        #meridian-modal button:hover,
        #chat-modal button:hover {
            transform: translateY(-1px) !important;
            box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05) !important;
        }

        /* MOBILE 9:16 OPTIMIZATION */
        @media (max-width: 768px) {

            .hw-flex-1.hw-p-4,
            .hw-flex-1.md\:hw-p-6 {
                padding: 10px !important;
            }

            .hw-tab-view {
                gap: 8px !important;
            }

            .hw-glass,
            .hw-bg-gradient-to-r:not(.hw-h-full):not([id*="progress-bar"]) {
                padding: 12px !important;
                border-radius: 16px !important;
            }

            /* Bottom nav bar height max 64px */
            #hw-app-layout>nav {
                height: 64px !important;
                background: var(--bg-secondary) !important;
                backdrop-filter: none !important;
                -webkit-backdrop-filter: none !important;
                border-top: 1px solid var(--border-soft) !important;
                padding: 0 10px !important;
                gap: 8px !important;
                display: flex !important;
                align-items: center !important;
                justify-content: space-around !important;
            }

            #hw-app-layout>nav .hw-tab-btn {
                display: flex !important;
                flex-direction: column !important;
                align-items: center !important;
                justify-content: center !important;
                width: 60px !important;
                height: 48px !important;
                padding: 10px 12px !important;
                gap: 4px !important;
                border-radius: 14px !important;
                border: 1px solid var(--border-soft) !important;
                background: var(--bg-primary) !important;
                backdrop-filter: none !important;
                -webkit-backdrop-filter: none !important;
                color: var(--text-secondary) !important;
                text-transform: none !important;
                letter-spacing: normal !important;
                box-shadow: none !important;
                transition: transform 0.2s !important;
                will-change: transform;
            }

            #hw-app-layout>nav .hw-tab-btn:hover {
                transform: translateY(-2px) !important;
                color: var(--text-primary) !important;
                border-color: var(--border-strong) !important;
            }

            #hw-app-layout>nav .hw-tab-btn:active {
                transform: scale(0.96) !important;
            }

            #hw-app-layout>nav .hw-tab-btn.active {
                background: var(--primary-soft) !important;
                border: 1px solid rgba(99, 102, 241, 0.2) !important;
                color: var(--primary) !important;
                transform: translateY(-2px) !important;
                box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1) !important;
            }

            #hw-app-layout>nav .hw-tab-btn > i {
                font-size: 18px !important;
                margin: 0 !important;
                padding: 0 !important;
            }

            #hw-app-layout>nav .hw-tab-btn span {
                display: block !important;
                font-size: 10px !important;
                font-weight: 600 !important;
                line-height: 1.1 !important;
                letter-spacing: normal !important;
                margin-top: 0 !important;
            }

            /* Flashcard hero size */
            #view-review #hw-flashcard {
                /* Keep SRS ratings above the fixed mobile navigation. The
                   back face can scroll when a lookup result is long. */
                height: clamp(270px, 40vh, 320px) !important;
                min-height: 270px !important;
            }

            .hw-card-face {
                padding: 14px !important;
            }

            #view-review #hw-flashcard .hw-card-back {
                justify-content: flex-start !important;
            }

            #view-review #hw-flashcard .hw-card-back > .hw-flex-1 {
                flex: 0 1 auto !important;
            }

            #view-review #hw-flashcard .hw-card-back > .hw-text-center {
                margin-top: 10px !important;
            }

            #hw-card-word {
                font-size: 2.25rem !important;
            }

            body.hw-mode-review header {
                display: none !important;
            }

            body.hw-mode-review #hw-mobile-fab-container {
                display: none !important;
            }

            #view-review #hw-mode-btn-smart,
            #view-review #hw-mode-btn-anki {
                min-height: 32px !important;
                padding: 6px 10px !important;
                border-radius: 12px !important;
                font-size: 11px !important;
                line-height: 1.1 !important;
                white-space: nowrap !important;
            }

            #view-review #hw-rating-buttons {
                gap: 6px !important;
                grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
            }

            #view-review #hw-rating-buttons .hw-btn-rating {
                min-height: 44px !important;
                padding: 6px 3px !important;
                border-radius: 12px !important;
                gap: 1px !important;
                line-height: 1.05 !important;
            }

            #view-review #hw-rating-buttons .hw-btn-rating .hw-text-sm {
                font-size: 11px !important;
                line-height: 1.05 !important;
            }

            #view-review #hw-rating-buttons .hw-btn-rating .hw-text-\[9px\] {
                font-size: 8px !important;
                line-height: 1.05 !important;
                margin-top: 0 !important;
            }

            #view-review #hw-smart-step1-buttons {
                gap: 8px !important;
                grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
            }

            #view-review #hw-smart-step1-buttons .hw-btn-hero {
                min-height: 44px !important;
                padding: 8px 8px !important;
                border-radius: 14px !important;
                font-size: 11px !important;
                line-height: 1.15 !important;
                white-space: normal !important;
            }

            #view-review .hw-quiz-btn {
                min-height: 42px !important;
                padding: 8px 10px !important;
                border-radius: 12px !important;
                font-size: 12px !important;
            }

            .hw-weaker-widget {
                padding: 14px !important;
            }

            .hw-weaker-list-smart {
                max-height: 230px;
                gap: 8px;
            }

            .hw-weaker-list-smart.is-expanded {
                max-height: 420px !important;
            }

            .hw-weaker-item {
                padding: 10px !important;
                flex-shrink: 0 !important;
                min-height: 54px !important;
            }

            .hw-weaker-count-pill:not(.hw-hidden) {
                min-width: 20px;
                height: 20px;
                font-size: 10px;
            }

            .hw-weaker-practice-pill:not(.hw-hidden) {
                min-height: 1.9rem;
                padding: 0.32rem 0.72rem;
                font-size: 0.68rem;
            }
        }

        /* FAB Action Buttons */
        #hw-mobile-fab-container {
            bottom: 5.5rem !important;
            right: 1rem !important;
            z-index: 99999 !important;
        }

        #hw-mobile-fab-menu {
            gap: 10px !important;
            margin-bottom: 10px !important;
        }

        #hw-mobile-fab-container .hw-fab-btn {
            width: 42px !important;
            height: 42px !important;
            border-radius: 14px !important;
            background: var(--bg-secondary) !important;
            border: 1px solid var(--border-soft) !important;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05) !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            transition: transform 0.2s, opacity 0.2s !important;
            will-change: transform, opacity;
            cursor: pointer !important;
            transform-origin: center !important;
        }

        #hw-mobile-fab-container .hw-fab-btn i {
            font-size: 16px !important;
            opacity: 0.9 !important;
        }

        #hw-mobile-fab-container .hw-fab-btn:hover {
            transform: translateY(-2px) scale(1.04) !important;
            border-color: var(--border-strong) !important;
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08) !important;
        }

        #hw-mobile-fab-container .hw-fab-btn:active {
            transform: scale(0.95) !important;
        }

        #hw-mobile-fab-container #hw-mobile-fab-trigger.menu-active {
            border-color: rgba(99, 102, 241, 0.4) !important;
            box-shadow: 0 0 14px rgba(99, 102, 241, 0.15) !important;
        }

        #hw-mobile-fab-container .hw-fab-btn-priority-top {
            opacity: 1 !important;
            color: var(--primary) !important;
        }

        #hw-mobile-fab-container .hw-fab-btn-priority-top.hw-shop-btn {
            color: var(--warning) !important;
            border-color: rgba(245, 158, 11, 0.2) !important;
            box-shadow: 0 4px 18px rgba(245, 158, 11, 0.05) !important;
        }

        #hw-mobile-fab-container .hw-fab-btn-priority-secondary {
            opacity: 0.85 !important;
            color: #0ea5e9 !important;
        }

        #hw-mobile-fab-container .hw-fab-btn-priority-low {
            opacity: 0.7 !important;
            color: var(--text-secondary) !important;
        }

        .hw-rotate-135 {
            transform: rotate(135deg) !important;
        }

/* =====================================================================
   LIBRARY HOME — responsive learning hub
   ===================================================================== */
.hw-library-home {
    width: min(1440px, 100%);
    margin: 0 auto;
    display: grid;
    gap: 18px;
    padding-bottom: 18px;
}

.hw-library-home button {
    -webkit-tap-highlight-color: transparent;
}

.hw-library-home button:focus-visible {
    outline: 3px solid rgba(99, 102, 241, 0.24);
    outline-offset: 2px;
}

.hw-library-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 480px);
    align-items: center;
    gap: 24px;
    min-height: 150px;
    padding: 22px 26px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 24px;
    background:
        radial-gradient(circle at 82% 18%, rgba(129, 140, 248, 0.5), transparent 27%),
        radial-gradient(circle at 8% 110%, rgba(14, 165, 233, 0.28), transparent 35%),
        linear-gradient(135deg, #172554 0%, #312e81 46%, #4338ca 100%);
    box-shadow: 0 24px 54px rgba(49, 46, 129, 0.2);
    color: #fff;
}

.hw-library-hero::before,
.hw-library-hero::after {
    content: "";
    position: absolute;
    z-index: -1;
    border-radius: 999px;
    pointer-events: none;
}

.hw-library-hero::before {
    width: 220px;
    height: 220px;
    right: -70px;
    top: -105px;
    border: 38px solid rgba(255, 255, 255, 0.07);
}

.hw-library-hero::after {
    width: 110px;
    height: 110px;
    left: 46%;
    bottom: -74px;
    background: rgba(255, 255, 255, 0.06);
}

.hw-library-eyebrow {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
    padding: 5px 9px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: #e0e7ff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.hw-library-hero-copy h2 {
    max-width: 700px;
    margin: 0;
    color: #fff !important;
    font-size: clamp(25px, 2.4vw, 34px);
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: -0.035em;
}

.hw-library-hero-copy p {
    max-width: 680px;
    margin: 8px 0 0;
    color: rgba(238, 242, 255, 0.82) !important;
    font-size: 11.5px;
    line-height: 1.45;
}

.hw-library-hero-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 8px;
}

.hw-library-primary-action,
.hw-library-secondary-action {
    border: 0;
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.hw-library-primary-action {
    width: 100%;
    min-height: 60px;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 16px;
    background: #fff;
    color: #1e1b4b;
    text-align: left;
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.2);
}

.hw-library-action-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    box-shadow: 0 9px 18px rgba(79, 70, 229, 0.27);
}

.hw-library-primary-action strong,
.hw-library-primary-action small {
    display: block;
}

.hw-library-primary-action strong {
    color: #1e1b4b;
    font-size: 13px;
    font-weight: 900;
}

.hw-library-primary-action small {
    margin-top: 3px;
    color: #64748b;
    font-size: 10px;
    font-weight: 650;
}

.hw-library-primary-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 40px rgba(15, 23, 42, 0.25);
}

.hw-library-secondary-action {
    min-height: 60px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 0 15px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 10px;
    font-weight: 850;
    white-space: nowrap;
}

.hw-library-secondary-action:hover {
    background: rgba(255, 255, 255, 0.17);
}

.hw-library-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    background: transparent !important;
}

.hw-library-stat {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 17px 18px;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.055);
}

.hw-library-stat-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    font-size: 17px;
}

.hw-library-stat.is-streak .hw-library-stat-icon { color: #e11d48; background: #fff1f2; }
.hw-library-stat.is-today .hw-library-stat-icon { color: #059669; background: #ecfdf5; }
.hw-library-stat.is-total .hw-library-stat-icon { color: #4f46e5; background: #eef2ff; }

.hw-library-stat div {
    min-width: 0;
}

.hw-library-stat strong,
.hw-library-stat span:not(.hw-library-stat-icon) {
    display: block;
}

.hw-library-stat strong {
    color: #0f172a;
    font-size: 24px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.025em;
}

.hw-library-stat span:not(.hw-library-stat-icon) {
    margin-top: 5px;
    color: #64748b;
    font-size: 11px;
    font-weight: 750;
}

/* =========================================================================
   DASHBOARD QUICK ATTENDANCE WIDGET (KHUNG ẢNH 1)
   ========================================================================= */

.hw-library-quick-att-wrap {
    margin-top: 10px;
    margin-bottom: 2px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.hw-quick-att-dashboard-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
    transition: all 0.25s ease;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

html.dark .hw-quick-att-dashboard-card {
    background-color: #0f172a !important;
    background: #0f172a !important;
    border-color: #1e293b !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
}

.hw-quick-att-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.hw-quick-att-icon-wrap {
    flex-shrink: 0;
}

.hw-quick-att-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
    flex-shrink: 0;
}

.hw-quick-att-icon.is-done {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.hw-quick-att-content {
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.hw-quick-att-header-line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.hw-quick-att-title {
    font-size: 13px;
    font-weight: 850;
    color: #0f172a;
    white-space: nowrap;
}
html.dark .hw-quick-att-title {
    color: #f8fafc !important;
}

.hw-quick-att-date-pill {
    font-size: 10.5px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 6px;
    background: #fef3c7;
    color: #92400e;
    white-space: nowrap;
}
html.dark .hw-quick-att-date-pill {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

.hw-quick-att-date-pill.is-done {
    background: #d1fae5;
    color: #065f46;
}
html.dark .hw-quick-att-date-pill.is-done {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

.hw-quick-att-details {
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #64748b;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
html.dark .hw-quick-att-details {
    color: #94a3b8 !important;
}

.hw-quick-att-place {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

.hw-quick-att-dot {
    opacity: 0.6;
    flex-shrink: 0;
}

.hw-quick-att-time,
.hw-quick-att-rate {
    flex-shrink: 0;
    white-space: nowrap;
}

.hw-quick-att-action-wrap {
    flex-shrink: 0;
}

.hw-quick-att-submit-btn {
    padding: 8px 14px;
    font-size: 11.5px;
    font-weight: 850;
    border-radius: 12px;
    border: none;
    color: #ffffff;
    background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.hw-quick-att-submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(245, 158, 11, 0.4);
}

.hw-quick-att-submit-btn:active:not(:disabled) {
    transform: scale(0.97);
}

.hw-quick-att-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.hw-quick-att-view-btn {
    padding: 7px 12px;
    font-size: 11px;
    font-weight: 750;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: transparent;
    color: #059669;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    transition: all 0.2s ease;
}
html.dark .hw-quick-att-view-btn {
    border-color: #334155;
    color: #34d399;
}

.hw-quick-att-dashboard-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 15px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}
html.dark .hw-quick-att-dashboard-banner {
    background: #0f172a;
    border-color: #334155;
}

.hw-quick-att-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.hw-quick-att-info strong {
    display: block;
    font-size: 12.5px;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
html.dark .hw-quick-att-info strong {
    color: #f8fafc;
}

.hw-quick-att-info small {
    display: block;
    font-size: 10.5px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
html.dark .hw-quick-att-info small {
    color: #94a3b8;
}

.hw-quick-att-btn {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 800;
    border-radius: 10px;
    background: #2563eb;
    color: #ffffff;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

/* SMART RESPONSIVE MOBILE OPTIMIZATION (< 640px) */
@media (max-width: 640px) {
    .hw-quick-att-dashboard-card {
        flex-direction: column;
        align-items: stretch;
        padding: 11px 13px;
        gap: 10px;
        border-radius: 16px;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .hw-quick-att-main {
        width: 100%;
        gap: 10px;
        min-width: 0;
    }

    .hw-quick-att-icon {
        width: 34px;
        height: 34px;
        font-size: 13.5px;
        border-radius: 10px;
    }

    .hw-quick-att-header-line {
        justify-content: space-between;
        gap: 6px;
        width: 100%;
    }

    .hw-quick-att-title {
        font-size: 12px;
    }

    .hw-quick-att-date-pill {
        font-size: 9.5px;
        padding: 2px 6px;
    }

    .hw-quick-att-details {
        font-size: 10.5px;
        margin-top: 3px;
        gap: 5px;
        flex-wrap: wrap;
        white-space: normal;
        line-height: 1.4;
    }

    .hw-quick-att-place {
        max-width: 130px;
    }

    .hw-quick-att-action-wrap {
        width: 100%;
        margin-top: 2px;
    }

    .hw-quick-att-view-btn,
    .hw-quick-att-submit-btn {
        width: 100%;
        justify-content: center;
        padding: 8px 12px;
        font-size: 11px;
        border-radius: 10px;
        box-sizing: border-box;
    }

    .hw-quick-att-dashboard-banner {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 11px 13px;
    }

    .hw-quick-att-info small {
        white-space: normal;
    }

    .hw-quick-att-btn {
        width: 100%;
        text-align: center;
        padding: 8px 12px;
        box-sizing: border-box;
    }
}

.hw-library-panel,
.hw-library-detail-card {
    padding: clamp(18px, 2.2vw, 28px);
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    background: #fff !important;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.055);
}

.hw-library-section-heading,
.hw-library-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.hw-library-section-heading {
    margin-bottom: 18px;
}

.hw-library-section-kicker,
.hw-library-card-kicker {
    display: block;
    margin-bottom: 5px;
    color: #6366f1;
    font-size: 9px;
    font-weight: 950;
    letter-spacing: 0.16em;
}

.hw-library-section-heading h3,
.hw-library-card-heading h3,
.hw-library-community h3 {
    margin: 0;
    color: #0f172a;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.hw-library-section-heading h3 {
    font-size: 21px;
}

.hw-library-section-heading p,
.hw-library-community p {
    margin: 5px 0 0;
    color: #64748b;
    font-size: 11px;
    line-height: 1.45;
}

.hw-library-text-link {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 12px;
    border: 1px solid #e0e7ff;
    border-radius: 11px;
    background: #eef2ff;
    color: #4f46e5;
    font-size: 11px;
    font-weight: 850;
}

.hw-library-shortcut-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: 11px;
}

.hw-library-shortcut {
    --shortcut-color: #4f46e5;
    --shortcut-soft: #eef2ff;
    position: relative;
    min-width: 0;
    min-height: 94px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 14px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 17px;
    background: #fff;
    color: #0f172a;
    text-align: left;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.035);
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.hw-library-shortcut::after {
    content: "";
    position: absolute;
    width: 70px;
    height: 70px;
    right: -48px;
    bottom: -52px;
    border-radius: 999px;
    background: var(--shortcut-soft);
    opacity: 0.8;
}

.hw-library-shortcut:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--shortcut-color) 32%, #e2e8f0);
    box-shadow: 0 13px 24px rgba(15, 23, 42, 0.08);
}

.hw-library-shortcut.is-violet { --shortcut-color: #7c3aed; --shortcut-soft: #f5f3ff; }
.hw-library-shortcut.is-emerald { --shortcut-color: #059669; --shortcut-soft: #ecfdf5; }
.hw-library-shortcut.is-fuchsia { --shortcut-color: #c026d3; --shortcut-soft: #fdf4ff; }
.hw-library-shortcut.is-sky { --shortcut-color: #0284c7; --shortcut-soft: #f0f9ff; }
.hw-library-shortcut.is-cyan { --shortcut-color: #0891b2; --shortcut-soft: #ecfeff; }
.hw-library-shortcut.is-blue { --shortcut-color: #2563eb; --shortcut-soft: #eff6ff; }
.hw-library-shortcut.is-amber { --shortcut-color: #d97706; --shortcut-soft: #fffbeb; }
.hw-library-shortcut.is-orange { --shortcut-color: #ea580c; --shortcut-soft: #fff7ed; }
.hw-library-shortcut.is-rose { --shortcut-color: #e11d48; --shortcut-soft: #fff1f2; }
.hw-library-shortcut.is-teal { --shortcut-color: #0d9488; --shortcut-soft: #f0fdfa; }

.hw-library-shortcut-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: var(--shortcut-soft);
    color: var(--shortcut-color);
    font-size: 17px;
}

.hw-library-shortcut-copy {
    min-width: 0;
}

.hw-library-shortcut-copy strong,
.hw-library-shortcut-copy small {
    display: block;
}

.hw-library-shortcut-copy strong {
    color: #1e293b;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.25;
}

.hw-library-shortcut-copy small {
    margin-top: 4px;
    color: #64748b;
    font-size: 9.5px;
    font-weight: 600;
    line-height: 1.42;
}

.hw-library-shortcut-arrow {
    position: relative;
    z-index: 1;
    color: #cbd5e1;
    font-size: 10px;
}

.hw-library-shortcut-tag {
    position: absolute;
    top: 8px;
    right: 9px;
    z-index: 2;
    padding: 3px 6px;
    border-radius: 999px;
    background: var(--shortcut-soft);
    color: var(--shortcut-color);
    font-size: 7px;
    font-weight: 950;
    letter-spacing: 0.02em;
}

.hw-library-shortcut.is-loading-module {
    opacity: 0.85;
    position: relative;
    pointer-events: none;
}

.hw-library-shortcut.is-loading-module .hw-library-shortcut-icon i {
    animation: hw-spin 0.75s linear infinite;
}

.hw-tab-btn.is-loading-module i,
.mobile-tab-btn.is-loading-module i {
    animation: hw-spin 0.75s linear infinite;
}

@keyframes hw-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}


.hw-library-community {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 17px 19px;
    border: 1px solid #e0e7ff;
    border-radius: 20px;
    background: linear-gradient(100deg, #eef2ff, #fff 55%, #f5f3ff) !important;
}

.hw-library-community-copy {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.hw-library-community-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: #4f46e5;
    color: #fff;
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.18);
}

.hw-library-community h3 {
    font-size: 14px;
}

.hw-library-community-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hw-library-community-actions button {
    min-height: 39px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    color: #475569;
    font-size: 10px;
    font-weight: 850;
    white-space: nowrap;
}

.hw-library-community-actions button:first-child {
    border-color: #4f46e5;
    background: #4f46e5;
    color: #fff;
}

.hw-library-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: 16px;
}

.hw-library-card-heading {
    margin-bottom: 14px;
}

.hw-library-card-heading h3 {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #334155;
    font-size: 13px;
}

.hw-library-card-heading h3 > i {
    color: #f59e0b;
}

.hw-library-reward-pill {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border: 1px solid #d1fae5;
    border-radius: 999px;
    background: #ecfdf5;
    color: #047857;
    font-size: 9px;
    font-weight: 900;
    white-space: nowrap;
}

.hw-library-quest-list {
    max-height: 390px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 3px;
    scrollbar-width: thin;
    scrollbar-color: #c7d2fe transparent;
}

.hw-library-quest-list::-webkit-scrollbar { width: 5px; }
.hw-library-quest-list::-webkit-scrollbar-thumb { border-radius: 999px; background: #c7d2fe; }

.hw-library-loading {
    padding: 24px 12px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 650;
    text-align: center;
}

.hw-library-expand-row {
    margin-top: 10px;
    text-align: center;
}

.hw-library-expand-row button {
    padding: 7px 10px;
    border: 0;
    background: transparent;
    color: #4f46e5;
    font-size: 10px;
    font-weight: 850;
}

@media (max-width: 1120px) {
    .hw-library-hero {
        grid-template-columns: minmax(0, 1fr) minmax(290px, 330px);
        gap: 16px;
        padding: 20px 22px;
    }

    .hw-library-hero-copy h2 {
        font-size: 27px;
    }

    .hw-library-hero-copy p {
        display: none;
    }

    .hw-library-shortcut-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .hw-library-community {
        align-items: flex-start;
        flex-direction: column;
    }

    .hw-library-community-actions {
        width: 100%;
    }

    .hw-library-community-actions button {
        flex: 1 1 0;
    }
}

@media (min-width: 769px) and (max-width: 820px) {
    .hw-library-hero {
        grid-template-columns: minmax(0, 1fr) minmax(220px, 240px);
        gap: 12px;
        padding: 18px 20px;
    }

    .hw-library-hero-actions {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .hw-library-secondary-action {
        min-height: 34px;
        padding: 0 12px;
    }

    .hw-library-primary-action small {
        display: none;
    }

    .hw-library-shortcut-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hw-library-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .hw-library-home {
        gap: 12px !important;
        padding-bottom: 10px;
    }

    .hw-library-hero {
        grid-template-columns: 1fr;
        gap: 12px;
        min-height: 0;
        padding: 17px 16px !important;
        border-radius: 19px !important;
    }

    .hw-library-hero::before {
        width: 150px;
        height: 150px;
        right: -54px;
        top: -77px;
        border-width: 28px;
    }

    .hw-library-eyebrow {
        margin-bottom: 7px;
        padding: 5px 8px;
        font-size: 8px;
    }

    .hw-library-hero-copy h2 {
        font-size: 22px;
    }

    .hw-library-hero-copy p {
        display: none;
    }

    .hw-library-hero-actions {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
    }

    .hw-library-primary-action {
        min-height: 54px;
        grid-template-columns: 34px minmax(0, 1fr) auto;
        gap: 9px;
        padding: 8px 10px;
        border-radius: 14px;
    }

    .hw-library-action-icon {
        width: 34px;
        height: 34px;
        border-radius: 11px;
    }

    .hw-library-primary-action strong { font-size: 11px; }
    .hw-library-primary-action small { display: none; }

    .hw-library-secondary-action {
        min-height: 54px;
        padding: 0 12px;
        border-radius: 14px;
        font-size: 9px;
    }

    .hw-library-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 7px;
    }

    .hw-library-stat {
        min-height: 78px;
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
        padding: 11px 10px;
        border-radius: 15px;
    }

    .hw-library-stat-icon {
        width: 32px;
        height: 32px;
        flex-basis: 32px;
        border-radius: 10px;
        font-size: 13px;
    }

    .hw-library-stat strong { font-size: 18px; }
    .hw-library-stat span:not(.hw-library-stat-icon) {
        margin-top: 3px;
        font-size: 8.5px;
        line-height: 1.2;
    }

    .hw-library-panel,
    .hw-library-detail-card {
        padding: 12px !important;
        border-radius: 17px !important;
    }

    .hw-library-section-heading {
        align-items: flex-end;
        margin-bottom: 13px;
    }

    .hw-library-section-heading h3 { font-size: 18px; }
    .hw-library-section-heading p { font-size: 9.5px; }
    .hw-library-text-link {
        padding: 7px 8px;
        font-size: 9px;
    }

    .hw-library-shortcut-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .hw-library-shortcut {
        min-height: 86px;
        align-content: center;
        grid-template-columns: 36px minmax(0, 1fr);
        gap: 8px;
        padding: 8px;
        border-radius: 14px;
    }

    .hw-library-shortcut-icon {
        width: 36px;
        height: 36px;
        border-radius: 11px;
        font-size: 14px;
    }

    .hw-library-shortcut-copy strong { font-size: 11px; }
    .hw-library-shortcut-copy small { font-size: 8.5px; line-height: 1.35; }
    .hw-library-shortcut-arrow { display: none; }
    .hw-library-shortcut-tag { top: 7px; right: 7px; }

    .hw-library-community {
        gap: 13px;
        padding: 15px !important;
        border-radius: 19px !important;
    }

    .hw-library-community-icon {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
        border-radius: 12px;
    }

    .hw-library-community h3 { font-size: 12px; }
    .hw-library-community p { font-size: 9px; }

    .hw-library-community-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .hw-library-community-actions button {
        min-height: 38px;
        padding: 8px;
        font-size: 9.5px;
    }

    .hw-library-detail-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .hw-library-card-heading h3 { font-size: 12px; }
    .hw-library-quest-list { max-height: none; overflow: visible; padding-right: 0; }
}

@media (max-width: 380px) {
    .hw-library-section-heading p,
    .hw-library-text-link {
        display: none;
    }

    .hw-library-shortcut {
        min-height: 106px;
    }

    .hw-library-secondary-label {
        display: none;
    }

    .hw-library-secondary-action {
        width: 54px;
        padding: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hw-library-home button {
        transition: none !important;
    }
}

/* Compact five-item mobile navigation with an accessible overflow sheet. */
.hw-mobile-more-nav[hidden] {
    display: none !important;
}

@media (max-width: 768px) {
    #hw-mobile-bottom-nav {
        height: calc(66px + env(safe-area-inset-bottom, 0px)) !important;
        justify-content: space-around !important;
        gap: 4px !important;
        overflow: visible !important;
        padding: 7px 8px max(7px, env(safe-area-inset-bottom, 0px)) !important;
        background: rgba(255, 255, 255, 0.97) !important;
        border-top-color: #e2e8f0 !important;
        box-shadow: 0 -12px 30px rgba(15, 23, 42, 0.09) !important;
    }

    #hw-mobile-bottom-nav > .hw-tab-btn {
        min-width: 0 !important;
        width: auto !important;
        max-width: 80px;
        height: 50px !important;
        flex: 1 1 0 !important;
        padding: 6px 4px !important;
        border: 1px solid transparent !important;
        border-radius: 13px !important;
        background: transparent !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 2px !important;
    }

    #hw-mobile-bottom-nav > .hw-tab-btn.active,
    #hw-mobile-bottom-nav > .hw-tab-btn.is-open {
        border: 1px solid rgba(79, 70, 229, 0.25) !important;
        background: #eef2ff !important;
        color: #4f46e5 !important;
        box-shadow: 0 0 10px rgba(79, 70, 229, 0.1) !important;
        transform: none !important;
    }

    #hw-mobile-bottom-nav > .hw-tab-btn > i,
    #hw-mobile-bottom-nav > .hw-tab-btn .hw-tab-icon-wrap i {
        font-size: 18px !important;
        line-height: 1 !important;
    }

    #hw-mobile-bottom-nav > .hw-tab-btn .hw-tab-icon-wrap {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 26px !important;
        height: 20px !important;
        min-height: 20px !important;
        position: relative !important;
        font-size: 18px !important;
        line-height: 1 !important;
    }

    #hw-mobile-bottom-nav > .hw-tab-btn .hw-tab-label,
    #hw-mobile-bottom-nav > .hw-tab-btn > span:not(.hw-tab-icon-wrap) {
        font-size: 9px !important;
        font-weight: 750 !important;
        line-height: 1.15 !important;
        white-space: nowrap !important;
        text-align: center !important;
    }

    .hw-mobile-more-nav {
        position: absolute;
        left: 10px;
        right: 10px;
        bottom: calc(100% + 9px);
        z-index: 2;
        display: block;
        padding: 15px;
        border: 1px solid #e2e8f0;
        border-radius: 21px;
        background: rgba(255, 255, 255, 0.99) !important;
        box-shadow: 0 24px 58px rgba(15, 23, 42, 0.2);
    }

    .hw-mobile-more-heading {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 12px;
    }

    .hw-mobile-more-heading strong,
    .hw-mobile-more-heading span {
        display: block;
    }

    .hw-mobile-more-heading strong {
        color: #0f172a;
        font-size: 14px;
        font-weight: 900;
    }

    .hw-mobile-more-heading span {
        margin-top: 2px;
        color: #64748b;
        font-size: 9px;
        font-weight: 650;
    }

    #hw-mobile-bottom-nav .hw-mobile-more-close {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 11px !important;
        background: #f8fafc !important;
        color: #64748b !important;
    }

    .hw-mobile-more-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    #hw-mobile-bottom-nav .hw-mobile-more-grid .hw-tab-btn {
        min-width: 0 !important;
        width: 100% !important;
        height: 74px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-direction: column !important;
        gap: 7px !important;
        padding: 9px 5px !important;
        border: 1px solid #e2e8f0 !important;
        border-left: 1px solid #e2e8f0 !important;
        border-radius: 14px !important;
        background: #f8fafc !important;
        color: #475569 !important;
        box-shadow: none !important;
        transform: none !important;
    }

    #hw-mobile-bottom-nav .hw-mobile-more-grid .hw-tab-btn.active {
        border-color: #c7d2fe !important;
        background: #eef2ff !important;
        color: #4f46e5 !important;
    }

    #hw-mobile-bottom-nav .hw-mobile-more-grid .hw-tab-btn > i {
        margin: 0 !important;
        color: currentColor !important;
        font-size: 18px !important;
    }

    #hw-mobile-bottom-nav .hw-mobile-more-grid .hw-tab-btn span {
        display: block !important;
        margin: 0 !important;
        color: currentColor !important;
        font-size: 9px !important;
        font-weight: 800 !important;
    }

    /* Mobile Bottom Navigation & More Modal Dark Mode Overrides */
    html.dark #hw-mobile-bottom-nav {
        background: rgba(15, 23, 42, 0.96) !important;
        border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
        box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.6) !important;
    }

    html.dark #hw-mobile-bottom-nav > .hw-tab-btn {
        color: #94a3b8 !important;
        background: transparent !important;
    }

    html.dark #hw-mobile-bottom-nav > .hw-tab-btn:hover {
        color: #f8fafc !important;
    }

    html.dark #hw-mobile-bottom-nav > .hw-tab-btn.active,
    html.dark #hw-mobile-bottom-nav > .hw-tab-btn.is-open {
        background: rgba(99, 102, 241, 0.18) !important;
        color: #818cf8 !important;
        border: 1px solid rgba(99, 102, 241, 0.35) !important;
        box-shadow: 0 0 14px rgba(99, 102, 241, 0.15) !important;
    }

    html.dark .hw-mobile-more-nav,
    html.dark #hw-mobile-more-nav,
    html.dark #hw-mobile-bottom-nav .hw-mobile-more-nav {
        background: #0f172a !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        box-shadow: 0 24px 58px rgba(0, 0, 0, 0.8) !important;
    }

    html.dark .hw-mobile-more-heading,
    html.dark #hw-mobile-bottom-nav .hw-mobile-more-heading {
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    }

    html.dark .hw-mobile-more-heading strong,
    html.dark #hw-mobile-bottom-nav .hw-mobile-more-heading strong {
        color: #f8fafc !important;
    }

    html.dark .hw-mobile-more-heading span,
    html.dark #hw-mobile-bottom-nav .hw-mobile-more-heading span {
        color: #94a3b8 !important;
    }

    html.dark #hw-mobile-bottom-nav .hw-mobile-more-close {
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        background: #1e293b !important;
        color: #94a3b8 !important;
        transition: all 0.2s ease !important;
    }

    html.dark #hw-mobile-bottom-nav .hw-mobile-more-close:hover {
        background: #334155 !important;
        color: #ffffff !important;
        border-color: rgba(255, 255, 255, 0.25) !important;
    }

    html.dark #hw-mobile-bottom-nav .hw-mobile-more-grid .hw-tab-btn {
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        border-left: 1px solid rgba(255, 255, 255, 0.08) !important;
        background: #1e293b !important;
        color: #cbd5e1 !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
        transition: all 0.18s ease !important;
    }

    html.dark #hw-mobile-bottom-nav .hw-mobile-more-grid .hw-tab-btn:hover {
        background: #27354a !important;
        border-color: rgba(255, 255, 255, 0.18) !important;
        border-left-color: rgba(255, 255, 255, 0.18) !important;
        color: #ffffff !important;
        transform: translateY(-1px) !important;
    }

    html.dark #hw-mobile-bottom-nav .hw-mobile-more-grid .hw-tab-btn.active {
        background: rgba(99, 102, 241, 0.22) !important;
        border-color: rgba(99, 102, 241, 0.5) !important;
        border-left-color: rgba(99, 102, 241, 0.5) !important;
        color: #a5b4fc !important;
        box-shadow: 0 0 16px rgba(99, 102, 241, 0.2) !important;
    }

    html.dark #hw-mobile-bottom-nav .hw-mobile-more-grid .hw-tab-btn > i {
        color: currentColor !important;
    }

    html.dark #hw-mobile-bottom-nav .hw-mobile-more-grid .hw-tab-btn span {
        color: currentColor !important;
    }
}

/* Desktop sidebar: essential destinations stay visible; secondary tools use
   an accordion that remembers the learner's last open group. */
@media (min-width: 768px) {
    html:not(.anki-mode-active),
    body:not(.hw-game-core-active) {
        height: 100vh !important;
        height: 100svh !important;
        overflow: hidden !important;
    }

    body:not(.hw-game-core-active) #hw-app-layout {
        height: 100vh !important;
        height: 100svh !important;
        max-height: 100vh !important;
        max-height: 100svh !important;
        overflow: hidden !important;
    }

    body:not(.hw-game-core-active) #hw-app-layout > aside {
        position: sticky !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        height: 100svh !important;
        max-height: 100vh !important;
        max-height: 100svh !important;
        min-height: 0 !important;
        flex: 0 0 16rem !important;
        width: 16rem !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    html:not(.dark) body:not(.hw-game-core-active) #hw-app-layout > aside {
        background-color: #ffffff !important;
        border-right: 1px solid #e2e8f0 !important;
    }

    html.dark body:not(.hw-game-core-active) #hw-app-layout > aside,
    html.dark #hw-app-layout > aside,
    html.dark aside[class*="hw-bg-white"] {
        background-color: #0f172a !important;
        background: #0f172a !important;
        border-right: 1px solid #1e293b !important;
    }

    html.dark body:not(.hw-game-core-active) #hw-app-layout > aside h1 {
        color: #f8fafc !important;
    }

    html.dark body:not(.hw-game-core-active) #hw-app-layout > aside .hw-sidebar-nav-label {
        color: #64748b !important;
    }

    html.dark body:not(.hw-game-core-active) #hw-app-layout > aside .hw-tab-btn {
        color: #94a3b8 !important;
    }

    html.dark body:not(.hw-game-core-active) #hw-app-layout > aside .hw-tab-btn:hover {
        background-color: rgba(30, 41, 59, 0.7) !important;
        color: #f8fafc !important;
    }

    html.dark body:not(.hw-game-core-active) #hw-app-layout > aside .hw-tab-btn.active,
    html.dark body:not(.hw-game-core-active) #hw-app-layout > aside .hw-tab-btn.is-active,
    html.dark body:not(.hw-game-core-active) #hw-app-layout > aside .hw-tab-btn.router-link-active {
        background-color: rgba(99, 102, 241, 0.2) !important;
        color: #818cf8 !important;
    }

    html.dark body:not(.hw-game-core-active) #hw-app-layout > aside .hw-sidebar-group-toggle {
        border-color: #1e293b !important;
        background-color: rgba(15, 23, 42, 0.75) !important;
        color: #cbd5e1 !important;
    }

    html.dark body:not(.hw-game-core-active) #hw-app-layout > aside .hw-sidebar-group-toggle:hover,
    html.dark body:not(.hw-game-core-active) #hw-app-layout > aside .hw-sidebar-group-toggle.is-open,
    html.dark body:not(.hw-game-core-active) #hw-app-layout > aside .hw-sidebar-group-toggle.has-active {
        border-color: #4338ca !important;
        background-color: rgba(49, 46, 129, 0.35) !important;
        color: #a5b4fc !important;
    }

    html.dark body:not(.hw-game-core-active) #hw-app-layout > aside .hw-sidebar-group-meta small {
        background-color: #1e293b !important;
        color: #94a3b8 !important;
    }

    html.dark body:not(.hw-game-core-active) #hw-app-layout > aside #tab-btn-settings {
        border-top-color: #1e293b !important;
    }

    body:not(.hw-game-core-active) #hw-app-layout > main {
        flex: 1 1 0% !important;
        min-width: 0 !important;
        height: 100vh !important;
        height: 100svh !important;
        max-height: 100vh !important;
        max-height: 100svh !important;
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
    }

    #hw-app-layout > aside > div:first-child {
        margin-bottom: 18px !important;
    }

    #hw-desktop-sidebar-nav {
        min-height: 0;
        display: flex;
        flex-direction: column;
        gap: 4px;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding-right: 2px;
        scrollbar-width: thin;
        scrollbar-color: #cbd5e1 transparent;
    }

    #hw-desktop-sidebar-nav > * {
        margin-top: 0 !important;
    }

    #hw-desktop-sidebar-nav::-webkit-scrollbar { width: 4px; }
    #hw-desktop-sidebar-nav::-webkit-scrollbar-thumb { border-radius: 999px; background: #cbd5e1; }

    #hw-sidebar-top-actions {
        order: 0;
        margin-bottom: 8px;
    }

    .hw-sidebar-nav-label {
        order: 1;
        display: block;
        padding: 0 12px 5px;
        color: #94a3b8;
        font-size: 8px;
        font-weight: 950;
        letter-spacing: 0.16em;
    }

    #tab-btn-dashboard { order: 10; }
    #tab-btn-reference { order: 20; }
    #hw-sidebar-tools-toggle { order: 40; }
    #tab-btn-shadowing { order: 50; }
    #tab-btn-alphabet-tab { order: 51; }
    #tab-btn-add-vocab { order: 52; }
    #tab-btn-analytics { order: 54; }
    #hw-sidebar-exams-toggle { order: 60; }
    /* Keep the two EPS mock stages in their real exam order. */
    #tab-btn-eps-exam { order: 70; }
    #tab-btn-skills-test { order: 71; }
    #tab-btn-topik-exam { order: 72; }
    #tab-btn-rpg { order: 80; }
    #tab-btn-attendance { order: 85; }
    #tab-btn-payment { order: 90; }
    #tab-btn-settings { order: 99; margin-top: auto !important; }

    .hw-sidebar-group-toggle {
        width: 100%;
        min-height: 42px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 9px 11px;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        background: #f8fafc;
        color: #475569;
        font-size: 11px;
        font-weight: 850;
        text-align: left;
        transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
    }

    .hw-sidebar-group-toggle > span:first-child,
    .hw-sidebar-group-meta {
        display: inline-flex;
        align-items: center;
    }

    .hw-sidebar-group-toggle > span:first-child {
        min-width: 0;
        gap: 10px;
    }

    .hw-sidebar-group-toggle > span:first-child > i {
        width: 19px;
        color: #64748b;
        text-align: center;
    }

    .hw-sidebar-group-meta {
        flex: 0 0 auto;
        gap: 7px;
    }

    .hw-sidebar-group-meta small {
        min-width: 20px;
        height: 20px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0 5px;
        border-radius: 999px;
        background: #e2e8f0;
        color: #64748b;
        font-size: 8px;
        font-weight: 900;
    }

    .hw-sidebar-group-meta > i {
        color: #94a3b8;
        font-size: 9px;
        transition: transform 150ms ease;
    }

    .hw-sidebar-group-toggle:hover,
    .hw-sidebar-group-toggle.is-open,
    .hw-sidebar-group-toggle.has-active {
        border-color: #c7d2fe;
        background: #eef2ff;
        color: #4f46e5;
    }

    .hw-sidebar-group-toggle.is-open .hw-sidebar-group-meta > i {
        transform: rotate(180deg);
    }

    .hw-sidebar-group-toggle.is-open .hw-sidebar-group-meta small,
    .hw-sidebar-group-toggle.has-active .hw-sidebar-group-meta small {
        background: #fff;
        color: #4f46e5;
    }

    #hw-desktop-sidebar-nav .hw-sidebar-group-item {
        min-height: 40px;
        padding: 9px 11px 9px 22px !important;
        font-size: 11px !important;
        border-radius: 11px !important;
    }

    #hw-desktop-sidebar-nav .hw-sidebar-group-item[hidden] {
        display: none !important;
    }

    #hw-desktop-sidebar-nav .hw-sidebar-group-item::before {
        content: "";
        width: 4px;
        height: 4px;
        flex: 0 0 4px;
        margin-right: -5px;
        border-radius: 999px;
        background: #cbd5e1;
    }

    #hw-desktop-sidebar-nav .hw-sidebar-group-item.active::before {
        background: #6366f1;
        box-shadow: 0 0 0 3px #e0e7ff;
    }

    #tab-btn-rpg {
        margin-top: 4px !important;
        border: 1px solid transparent;
    }

    #tab-btn-settings,
    #tab-btn-payment {
        min-height: 40px;
        padding-top: 9px !important;
        padding-bottom: 9px !important;
        font-size: 11px !important;
    }

    #tab-btn-settings {
        border-top: 1px solid #e2e8f0;
        border-radius: 12px !important;
        padding-top: 9px !important;
    }
}

/* Keep quick access on phones, but remove the large duplicate panel from desktop. */
.hw-library-shortcuts-mobile-only {
    display: none !important;
}

@media (max-width: 768px) {
    .hw-library-shortcuts-mobile-only {
        display: block !important;
    }
}

/* Gold Crown Icon Only (No Background Fill) */
.hw-vip-feature-badge {
    margin-left: auto !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.hw-vip-feature-badge i {
    font-size: 14px !important;
    color: #f59e0b !important;
    filter: drop-shadow(0 1px 3px rgba(245, 158, 11, 0.45)) !important;
}

#hw-profile-vip-icon-wrapper {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35) !important;
}

/* Persistent account action at the bottom of the desktop sidebar. */
#sidebar-auth-container {
    flex: 0 0 auto;
    position: relative;
    z-index: 12;
    margin-top: 10px;
    padding: 12px 0 2px;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
}

#sidebar-auth-btn.hw-sidebar-auth-button {
    width: 100% !important;
    min-height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    padding: 6px 12px !important;
    border: 1px solid !important;
    border-radius: 9px !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    font-size: 12px !important;
    font-weight: 750 !important;
    line-height: 1.2 !important;
    text-shadow: none !important;
    filter: none !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05) !important;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease !important;
}

#sidebar-auth-btn.hw-sidebar-auth-button.is-logout,
#sidebar-auth-btn.hw-sidebar-auth-button[data-auth-state="logout"] {
    border-color: #fecaca !important;
    background: #fff1f2 !important;
    color: #be123c !important;
}

#sidebar-auth-btn.hw-sidebar-auth-button.is-logout:hover,
#sidebar-auth-btn.hw-sidebar-auth-button[data-auth-state="logout"]:hover {
    border-color: #f87171 !important;
    background: #fee2e2 !important;
    color: #b91c1c !important;
    transform: translateY(-1px) !important;
}

#sidebar-auth-btn.hw-sidebar-auth-button.is-login,
#sidebar-auth-btn.hw-sidebar-auth-button[data-auth-state="login"] {
    border-color: #a7f3d0 !important;
    background: #ecfdf5 !important;
    color: #047857 !important;
}

#sidebar-auth-btn.hw-sidebar-auth-button.is-login:hover,
#sidebar-auth-btn.hw-sidebar-auth-button[data-auth-state="login"]:hover {
    border-color: #6ee7b7 !important;
    background: #d1fae5 !important;
    color: #065f46 !important;
    transform: translateY(-1px) !important;
}

#sidebar-auth-btn.hw-sidebar-auth-button:focus-visible {
    outline: 2px solid rgba(99, 102, 241, 0.35) !important;
    outline-offset: 2px !important;
}

#sidebar-auth-btn.hw-sidebar-auth-button i,
#sidebar-auth-btn.hw-sidebar-auth-button span {
    color: inherit !important;
    opacity: 1 !important;
    visibility: visible !important;
}

html.dark #sidebar-auth-container {
    background: #0f172a !important;
    background-color: #0f172a !important;
    border-top: 1px solid #1e293b !important;
}

html.dark #sidebar-auth-btn.hw-sidebar-auth-button {
    background: rgba(30, 41, 59, 0.8) !important;
    background-color: rgba(30, 41, 59, 0.8) !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
    box-shadow: none !important;
}

html.dark #sidebar-auth-btn.hw-sidebar-auth-button.is-logout,
html.dark #sidebar-auth-btn.hw-sidebar-auth-button[data-auth-state="logout"] {
    border-color: rgba(239, 68, 68, 0.35) !important;
    background: rgba(239, 68, 68, 0.12) !important;
    background-color: rgba(239, 68, 68, 0.12) !important;
    color: #fca5a5 !important;
}

html.dark #sidebar-auth-btn.hw-sidebar-auth-button.is-logout:hover,
html.dark #sidebar-auth-btn.hw-sidebar-auth-button[data-auth-state="logout"]:hover {
    border-color: rgba(239, 68, 68, 0.55) !important;
    background: rgba(239, 68, 68, 0.22) !important;
    background-color: rgba(239, 68, 68, 0.22) !important;
    color: #ffffff !important;
}

html.dark #sidebar-auth-btn.hw-sidebar-auth-button.is-login,
html.dark #sidebar-auth-btn.hw-sidebar-auth-button[data-auth-state="login"] {
    border-color: rgba(16, 185, 129, 0.35) !important;
    background: rgba(16, 185, 129, 0.12) !important;
    background-color: rgba(16, 185, 129, 0.12) !important;
    color: #6ee7b7 !important;
}

html.dark #sidebar-auth-btn.hw-sidebar-auth-button.is-login:hover,
html.dark #sidebar-auth-btn.hw-sidebar-auth-button[data-auth-state="login"]:hover {
    border-color: rgba(16, 185, 129, 0.5) !important;
    background: rgba(16, 185, 129, 0.22) !important;
    background-color: rgba(16, 185, 129, 0.22) !important;
    color: #a7f3d0 !important;
}

@media (min-width: 768px) {
    body:not(.hw-game-core-active) #hw-app-layout > aside {
        height: 100svh;
        max-height: 100svh;
        min-height: 0;
        overflow: hidden;
    }

    #hw-desktop-sidebar-nav {
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding-right: 4px;
        scrollbar-width: thin;
        scrollbar-color: #cbd5e1 transparent;
    }
}

/* #expedition-modal uses unified Light/Dark theme tokens in game-design-system.css & cultivation_gameplay.css */

/* ==========================================================================
   Practice & Flashcard Dark Mode Theme
   ========================================================================== */
html.dark #view-review #hw-flashcard .hw-card-face,
html.dark #view-review .hw-card-face {
    background: #0f172a !important;
    border-color: #1e293b !important;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.45) !important;
}

html.dark #view-review .hw-study-card-face-label {
    color: #64748b !important;
}

html.dark #view-review #hw-card-word {
    color: #f8fafc !important;
}

html.dark #view-review .hw-study-card-flip-hint {
    color: #64748b !important;
}

html.dark #view-review .hw-study-card-flip-hint kbd {
    background: #1e293b !important;
    color: #cbd5e1 !important;
    border-color: #334155 !important;
}

html.dark #view-review .hw-flashcard-navigation.hw-flashcard-action-dock {
    background: #0f172a !important;
    border-color: #1e293b !important;
}

html.dark #view-review .hw-flashcard-action-btn-secondary {
    background: #1e293b !important;
    color: #cbd5e1 !important;
    border-color: #334155 !important;
}

html.dark #view-review .hw-flashcard-action-btn-secondary:hover {
    background: #334155 !important;
    color: #ffffff !important;
}

html.dark #view-review .hw-current-lesson-vocabulary {
    background: #0f172a !important;
    border-color: #1e293b !important;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35) !important;
}

html.dark #view-review .hw-current-lesson-header h2 {
    color: #f8fafc !important;
}

html.dark #view-review .hw-current-lesson-header p {
    color: #94a3b8 !important;
}

html.dark #view-review .hw-current-lesson-search {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}

html.dark #view-review .hw-current-lesson-search input {
    color: #f8fafc !important;
    background: transparent !important;
}

html.dark #view-review .hw-current-lesson-search input::placeholder {
    color: #64748b !important;
}

html.dark #view-review .hw-current-lesson-vocab-item {
    background: #131d31 !important;
    border-color: #1e293b !important;
}

html.dark #view-review .hw-current-lesson-vocab-item:hover {
    border-color: #6366f1 !important;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45) !important;
}

html.dark #view-review .hw-current-lesson-vocab-item.is-active {
    border-color: #818cf8 !important;
    background: #1e293b !important;
}

html.dark #view-review .hw-current-lesson-vocab-number {
    color: #64748b !important;
}

html.dark #view-review .hw-current-lesson-vocab-now {
    background: rgba(99, 102, 241, 0.2) !important;
    color: #a5b4fc !important;
}

html.dark #view-review .hw-current-lesson-vocab-word {
    color: #f8fafc !important;
}

html.dark #view-review .hw-current-lesson-vocab-definition {
    color: #60a5fa !important;
}

html.dark #view-review .hw-current-lesson-vocab-example {
    background: rgba(16, 185, 129, 0.1) !important;
    border-top-color: #1e293b !important;
    color: #94a3b8 !important;
}

html.dark #view-review .hw-current-lesson-vocab-example small {
    color: #64748b !important;
}

html.dark #view-review .hw-current-lesson-vocab-audio {
    background: #1e293b !important;
    color: #94a3b8 !important;
    border-color: #334155 !important;
}

html.dark #view-review .hw-current-lesson-vocab-audio:hover {
    background: #334155 !important;
    color: #60a5fa !important;
}

html.dark #view-review .hw-card-back {
    background: #0f172a !important;
    border-color: #1e293b !important;
}

html.dark #view-review #hw-card-meaning {
    color: #e2e8f0 !important;
}

html.dark #view-review #hw-card-example {
    color: #cbd5e1 !important;
}

html.dark #view-review #hw-card-example-translation {
    color: #94a3b8 !important;
}

html.dark #view-review .hw-review-mode-panel {
    background: #0f172a !important;
    border-color: #1e293b !important;
}

html.dark #view-review .hw-review-mode-title {
    color: #f8fafc !important;
}

html.dark #view-review .hw-practice-mode-button {
    background: #1e293b !important;
    color: #cbd5e1 !important;
    border-color: #334155 !important;
}

html.dark #view-review .hw-practice-mode-button.is-active {
    background: #4f46e5 !important;
    color: #ffffff !important;
}

html.dark #view-review .hw-flashcard-tool {
    background: #1e293b !important;
    color: #cbd5e1 !important;
    border-color: #334155 !important;
}

html.dark #view-review .hw-flashcard-position {
    background: #1e293b !important;
    color: #cbd5e1 !important;
    border-color: #334155 !important;
}

/* =====================================================================
   VIP UI Modal Dark Mode Overrides (Image 3)
   ===================================================================== */
html.dark .vip-ui-overlay {
    background: rgba(11, 15, 25, 0.85) !important;
}

html.dark .vip-ui-lock-content {
    background: #0f172a !important;
    background-color: #0f172a !important;
    border: 1px solid rgba(245, 158, 11, 0.35) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6) !important;
    color: #f8fafc !important;
}

html.dark .vip-ui-lock-title {
    color: #f8fafc !important;
}

html.dark .vip-ui-lock-benefits,
html.dark .vip-ui-lock-benefits li {
    color: #cbd5e1 !important;
}

html.dark .vip-ui-button-cancel {
    background: #1e293b !important;
    background-color: #1e293b !important;
    color: #cbd5e1 !important;
    border-color: #334155 !important;
}

html.dark .vip-ui-button-cancel:hover {
    background: #334155 !important;
    background-color: #334155 !important;
    color: #f8fafc !important;
}

/* =====================================================================
   Tools, Signs, Safety Flashcard Panels & Switchers (Images 1 & 2)
   ===================================================================== */
html.dark #v2-tools-answer-panel,
html.dark #v2-signs-answer-panel,
html.dark #v2-safety-answer-panel {
    background-color: #131b2e !important;
    background: #131b2e !important;
    border-color: #1e293b !important;
    color: #f8fafc !important;
}

html.dark #v2-tools-answer-panel .hw-bg-white,
html.dark #v2-signs-answer-panel .hw-bg-white,
html.dark #v2-safety-answer-panel .hw-bg-white {
    background-color: #0b0f19 !important;
    border-color: #1e293b !important;
}

html.dark #v2-tools-answer-panel .hw-bg-slate-50,
html.dark #v2-signs-answer-panel .hw-bg-slate-50,
html.dark #v2-safety-answer-panel .hw-bg-slate-50 {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

html.dark #v2-tools-answer-panel .hw-bg-indigo-50,
html.dark #v2-signs-answer-panel .hw-bg-indigo-50,
html.dark #v2-safety-answer-panel .hw-bg-indigo-50 {
    background-color: rgba(99, 102, 241, 0.2) !important;
    color: #a5b4fc !important;
    border-color: rgba(99, 102, 241, 0.35) !important;
}

html.dark #v2-tools-answer-panel .hw-bg-rose-50,
html.dark #v2-signs-answer-panel .hw-bg-rose-50,
html.dark #v2-safety-answer-panel .hw-bg-rose-50 {
    background-color: rgba(244, 63, 94, 0.2) !important;
    color: #fda4af !important;
    border-color: rgba(244, 63, 94, 0.35) !important;
}

html.dark #v2-tools-answer-panel .hw-bg-emerald-50\/50,
html.dark #v2-signs-answer-panel .hw-bg-emerald-50\/50,
html.dark #v2-safety-answer-panel .hw-bg-emerald-50\/50 {
    background-color: rgba(16, 185, 129, 0.12) !important;
    border-color: rgba(16, 185, 129, 0.25) !important;
}

html.dark #v2-tools-answer-panel .hw-bg-blue-50\/40,
html.dark #v2-tools-answer-panel .hw-bg-blue-50\/50,
html.dark #v2-signs-answer-panel .hw-bg-blue-50\/40,
html.dark #v2-signs-answer-panel .hw-bg-blue-50\/50,
html.dark #v2-safety-answer-panel .hw-bg-blue-50\/40,
html.dark #v2-safety-answer-panel .hw-bg-blue-50\/50 {
    background-color: rgba(59, 130, 246, 0.12) !important;
    border-color: rgba(59, 130, 246, 0.25) !important;
}

html.dark #v2-tools-answer-panel .hw-bg-purple-50\/40,
html.dark #v2-signs-answer-panel .hw-bg-purple-50\/40,
html.dark #v2-safety-answer-panel .hw-bg-purple-50\/40 {
    background-color: rgba(168, 85, 247, 0.12) !important;
    border-color: rgba(168, 85, 247, 0.25) !important;
}

html.dark #tools-smart-subpills,
html.dark #signs-smart-subpills,
html.dark #safety-smart-subpills {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

html.dark #tools-smart-subpills button,
html.dark #signs-smart-subpills button,
html.dark #safety-smart-subpills button {
    color: #94a3b8 !important;
}

html.dark #tools-smart-subpills button.hw-bg-white,
html.dark #signs-smart-subpills button.hw-bg-white,
html.dark #safety-smart-subpills button.hw-bg-white {
    background-color: #312e81 !important;
    color: #e0e7ff !important;
    border-color: #6366f1 !important;
}

html.dark button[onclick*="switchToolsSubTab"],
html.dark button[onclick*="switchSignsSubTab"],
html.dark button[onclick*="switchSafetySubTab"] {
    border-color: #1e293b !important;
    color: #94a3b8 !important;
}

html.dark button[onclick*="switchToolsSubTab"]:hover,
html.dark button[onclick*="switchSignsSubTab"]:hover,
html.dark button[onclick*="switchSafetySubTab"]:hover {
    background-color: #1e293b !important;
    color: #f8fafc !important;
}

html.dark button[onclick*="switchToolsSubTab"].hw-bg-amber-100,
html.dark button[onclick*="switchSignsSubTab"].hw-bg-amber-100,
html.dark button[onclick*="switchSafetySubTab"].hw-bg-amber-100 {
    background-color: rgba(245, 158, 11, 0.2) !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
    color: #fbbf24 !important;
}

html.dark button[onclick*="switchToolsPlayMode"].hw-text-amber-700,
html.dark button[onclick*="switchSignsPlayMode"].hw-text-amber-700,
html.dark button[onclick*="switchSafetyPlayMode"].hw-text-amber-700 {
    color: #fbbf24 !important;
}

html.dark #v2-view-interview .hw-bg-slate-100,
html.dark .hw-bg-slate-100.hw-rounded-xl {
    background-color: #1e293b !important;
    border: 1px solid #334155 !important;
}

html.dark #v2-view-interview .hw-bg-slate-100 button,
html.dark .hw-bg-slate-100.hw-rounded-xl button {
    color: #94a3b8 !important;
}

html.dark #v2-view-interview .hw-bg-slate-100 button:hover,
html.dark .hw-bg-slate-100.hw-rounded-xl button:hover {
    color: #f8fafc !important;
}

html.dark #v2-view-interview .hw-bg-slate-100 button.hw-bg-white,
html.dark .hw-bg-slate-100.hw-rounded-xl button.hw-bg-white {
    background-color: #312e81 !important;
    color: #e0e7ff !important;
    border-color: #6366f1 !important;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3) !important;
}

html.dark button[onclick*="toggleSignsLayoutMode"],
html.dark button[onclick*="toggleSafetyLayoutMode"],
html.dark button[onclick*="toggleToolsLayoutMode"] {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}

html.dark .v2-tool-grid-item,
html.dark .v2-sign-grid-item,
html.dark .v2-safety-grid-item {
    background-color: #111827 !important;
    border-color: #1e293b !important;
    color: #f8fafc !important;
}

html.dark .v2-tool-grid-item .hw-bg-white,
html.dark .v2-sign-grid-item .hw-bg-white,
html.dark .v2-safety-grid-item .hw-bg-white {
    background-color: #0b0f19 !important;
    border-color: #1e293b !important;
}

html.dark .v2-tool-grid-item.v2-grid-item-active,
html.dark .v2-sign-grid-item.v2-grid-item-active,
html.dark .v2-safety-grid-item.v2-grid-item-active {
    border-color: #6366f1 !important;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.4) !important;
    background-color: #1e1e38 !important;
}

/* =====================================================================
   Round 2 Question Items & Action Instructions (Image 4)
   ===================================================================== */
html:not(.dark) .v2-player-q-item {
    background-color: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
}

html.dark .v2-player-q-item {
    background-color: #111827 !important;
    border: 1px solid #1e293b !important;
    color: #f8fafc !important;
}

html.dark .v2-player-q-item:hover {
    border-color: #4f46e5 !important;
    background-color: #1e293b !important;
}

html.dark .v2-player-q-item.basic-q-active,
html.dark .v2-player-q-item.commands-q-active,
html.dark .v2-player-q-item.units-q-active,
html.dark .v2-player-q-item.calc-q-active,
html.dark .calc-q-active,
html.dark .v2-player-q-item.scenarios-q-active,
html.dark .v2-player-q-item.rules-q-active,
html.dark .v2-player-q-item.action-instructions-q-active {
    background: linear-gradient(135deg, rgba(49, 46, 129, 0.55) 0%, rgba(30, 27, 75, 0.75) 100%) !important;
    border-color: #6366f1 !important;
    box-shadow: 0 0 14px rgba(99, 102, 241, 0.35) !important;
}

html.dark .v2-player-q-item .v2-ko-text {
    color: #f8fafc !important;
}

html.dark .v2-player-q-item .v2-vi-text {
    color: #94a3b8 !important;
}

html.dark #action-instructions-player-info-panel {
    background-color: #0f172a !important;
    border-color: #1e293b !important;
}

html.dark #action-instructions-player-info-panel .hw-bg-slate-50\/80 {
    background-color: #131b2e !important;
    border-color: #1e293b !important;
}

html.dark #action-instructions-player-action {
    color: #f8fafc !important;
}

html.dark #action-instructions-player-info-panel .v2-answer-tag {
    background-color: rgba(245, 158, 11, 0.18) !important;
    border-color: rgba(245, 158, 11, 0.35) !important;
    color: #fbbf24 !important;
}

html.dark #action-instructions-player-mic-btn {
    background-color: rgba(245, 158, 11, 0.18) !important;
    border-color: rgba(245, 158, 11, 0.35) !important;
    color: #fbbf24 !important;
}

html.dark #action-instructions-player-mic-feedback {
    color: #94a3b8 !important;
}

/* =====================================================================
   TOPIK II Offline Exam - Dark Mode Overrides (Image 5)
   ===================================================================== */
html.dark #view-topik-exam {
    --topik-ink: #f8fafc;
    --topik-muted: #94a3b8;
    --topik-line: #1e293b;
    --topik-soft: #131b2e;
    --topik-blue: #3b82f6;
    --topik-blue-dark: #60a5fa;
    --topik-mint: #064e3b;
    --topik-violet: #3b0764;
    color: #f8fafc !important;
}

html.dark #view-topik-exam .topik-library-hero {
    background: linear-gradient(135deg, #1e3a8a 0%, #172554 100%) !important;
    border: 1px solid #1e40af !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

html.dark #view-topik-exam .topik-library-hero p {
    color: rgba(255, 255, 255, 0.85) !important;
}

html.dark #view-topik-exam .topik-filter {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #cbd5e1 !important;
}

html.dark #view-topik-exam .topik-filter:hover:not(:disabled) {
    background: #334155 !important;
    color: #f8fafc !important;
    border-color: #475569 !important;
}

html.dark #view-topik-exam .topik-filter b {
    background: #0f172a !important;
    color: #94a3b8 !important;
}

html.dark #view-topik-exam .topik-filter-active {
    background: #2563eb !important;
    border-color: #3b82f6 !important;
    color: #ffffff !important;
}

html.dark #view-topik-exam .topik-filter-active b {
    background: #1e40af !important;
    color: #ffffff !important;
}

html.dark #view-topik-exam .topik-history-chip {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #38bdf8 !important;
}

html.dark #view-topik-exam .topik-history-static {
    background: rgba(16, 185, 129, 0.15) !important;
    border: 1px solid rgba(16, 185, 129, 0.35) !important;
    color: #34d399 !important;
}

html.dark #view-topik-exam .topik-exam-card {
    background: #0f172a !important;
    border: 1px solid #1e293b !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45) !important;
    color: #f8fafc !important;
}

html.dark #view-topik-exam .topik-exam-card-featured {
    border-top: 4px solid #3b82f6 !important;
}

html.dark #view-topik-exam .topik-exam-card h2 {
    color: #f8fafc !important;
}

html.dark #view-topik-exam .topik-exam-card>p {
    color: #94a3b8 !important;
}

html.dark #view-topik-exam .topik-card-stats>div,
html.dark #view-topik-exam .topik-detail-stats>div {
    background: #131b2e !important;
    border: 1px solid #1e293b !important;
}

html.dark #view-topik-exam .topik-card-stats b,
html.dark #view-topik-exam .topik-detail-stats b {
    color: #f8fafc !important;
}

html.dark #view-topik-exam .topik-card-stats small,
html.dark #view-topik-exam .topik-detail-stats small {
    color: #94a3b8 !important;
}

html.dark #view-topik-exam .topik-card-stats i,
html.dark #view-topik-exam .topik-detail-stats i {
    color: #60a5fa !important;
}

html.dark #view-topik-exam .topik-card-last-result {
    background: #131b2e !important;
    border: 1px solid #1e293b !important;
}

html.dark #view-topik-exam .topik-card-last-result>span {
    color: #94a3b8 !important;
}

html.dark #view-topik-exam .topik-card-last-result>b {
    color: #60a5fa !important;
}

html.dark #view-topik-exam .topik-card-last-result>small {
    color: #64748b !important;
}

html.dark #view-topik-exam .topik-btn-secondary {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #cbd5e1 !important;
}

html.dark #view-topik-exam .topik-btn-secondary:hover:not(:disabled) {
    background: #334155 !important;
    color: #f8fafc !important;
    border-color: #475569 !important;
}

html.dark #view-topik-exam .topik-detail-card {
    background: #0f172a !important;
    border: 1px solid #1e293b !important;
    color: #f8fafc !important;
}

html.dark #view-topik-exam.topik-exam-fullscreen {
    background: #0b0f19 !important;
}

html.dark #view-topik-exam .topik-question-card {
    background: #0f172a !important;
    border: 1px solid #1e293b !important;
}

html.dark #view-topik-exam .topik-choice {
    background: #131b2e !important;
    border: 1px solid #1e293b !important;
    color: #cbd5e1 !important;
}

html.dark #view-topik-exam .topik-question-nav {
    background: #0f172a !important;
    border: 1px solid #1e293b !important;
}

html.dark #view-topik-exam .topik-number {
    background: #131b2e !important;
    border: 1px solid #1e293b !important;
    color: #94a3b8 !important;
}

html.dark #view-topik-exam .topik-result-card {
    background: #0f172a !important;
    border: 1px solid #1e293b !important;
    color: #f8fafc !important;
}

/* =====================================================================
   DARK MODE: V2 SMART MODAL
   ===================================================================== */
html.dark #v2-smart-modal > div {
    background-color: #0f172a !important;
    border-color: #1e293b !important;
    color: #f8fafc !important;
}

html.dark #v2-smart-modal [class*="hw-bg-slate-50"],
html.dark #v2-smart-modal [class*="hw-border-slate-200"] {
    background-color: #131b2e !important;
    border-color: #1e293b !important;
}

html.dark #v2-smart-modal [class*="hw-text-slate-800"] {
    color: #f8fafc !important;
}

html.dark #v2-smart-modal [class*="hw-text-slate-600"],
html.dark #v2-smart-modal [class*="hw-text-slate-500"],
html.dark #v2-smart-modal [class*="hw-text-slate-700"] {
    color: #94a3b8 !important;
}

html.dark #v2-smart-modal [class*="hw-bg-slate-100"] {
    background-color: #1e293b !important;
    color: #94a3b8 !important;
}

html.dark #v2-smart-modal .hw-bg-white {
    background-color: #0f172a !important;
    color: #f8fafc !important;
}

html.dark #v2-smart-modal [class*="hw-bg-amber-50"] {
    background-color: rgba(245, 158, 11, 0.1) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
}

html.dark #v2-smart-modal [class*="hw-bg-indigo-50"] {
    background-color: rgba(99, 102, 241, 0.15) !important;
    border-color: rgba(99, 102, 241, 0.3) !important;
    color: #818cf8 !important;
}

html.dark #v2-smart-modal [class*="hw-border-slate-100"] {
    border-color: #1e293b !important;
}

html.dark #v2-smart-modal .v2-delay-pill-btn[class*="hw-bg-slate-100"],
html.dark #v2-smart-modal .v2-repeat-pill-btn[class*="hw-bg-slate-100"] {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

/* =====================================================================
   DARK MODE: MEMORY ACTION BUTTONS
   ===================================================================== */
html.dark .v2-memory-action-rose,
html.dark .v2-quick-memory-action-rose {
    color: #fb7185 !important;
    background: rgba(225, 29, 72, 0.15) !important;
    border-color: rgba(225, 29, 72, 0.35) !important;
}
html.dark .v2-memory-action-amber,
html.dark .v2-quick-memory-action-amber {
    color: #fbbf24 !important;
    background: rgba(217, 119, 6, 0.15) !important;
    border-color: rgba(217, 119, 6, 0.35) !important;
}
html.dark .v2-memory-action-emerald,
html.dark .v2-quick-memory-action-emerald {
    color: #34d399 !important;
    background: rgba(5, 150, 105, 0.15) !important;
    border-color: rgba(5, 150, 105, 0.35) !important;
}
html.dark .v2-memory-action-rose.is-active,
html.dark .v2-quick-memory-action-rose.is-active {
    color: #fff !important;
    background: #e11d48 !important;
    border-color: #e11d48 !important;
}
html.dark .v2-memory-action-amber.is-active,
html.dark .v2-quick-memory-action-amber.is-active {
    color: #fff !important;
    background: #d97706 !important;
    border-color: #d97706 !important;
}
html.dark .v2-memory-action-emerald.is-active,
html.dark .v2-quick-memory-action-emerald.is-active {
    color: #fff !important;
    background: #059669 !important;
    border-color: #059669 !important;
}

/* =====================================================================
   DARK MODE: MOCK EXAM SCREEN
   ===================================================================== */
html.dark #mock-exam-screen .hw-glass {
    background-color: #0f172a !important;
    border-color: #1e293b !important;
    color: #f8fafc !important;
}

html.dark #mock-exam-screen [class*="hw-text-slate-800"] {
    color: #f1f5f9 !important;
}

html.dark #mock-exam-screen [class*="hw-text-slate-500"] {
    color: #64748b !important;
}

html.dark #mock-exam-screen [class*="hw-bg-slate-100"] {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

html.dark #mock-exam-screen [id^="mock-cat-card-"] {
    background-color: #131b2e !important;
    border-color: #1e293b !important;
}

html.dark #mock-exam-screen [id^="mock-cat-card-"] [class*="hw-text-slate-800"] {
    color: #f1f5f9 !important;
}

html.dark #mock-exam-screen [id^="mock-sublist-"] [class*="hw-bg-white"] {
    background-color: #0f172a !important;
    border-color: #1e293b !important;
}

html.dark #mock-exam-screen select[class*="hw-bg-white"] {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

html.dark #mock-exam-screen input[type="checkbox"] {
    accent-color: #f59e0b !important;
}

/* =====================================================================
   DARK MODE: EPS-TOPIK LIBRARY CARDS
   ===================================================================== */
html.dark .eps-library-card {
    background: #0f172a !important;
    border-color: #1e293b !important;
    border-top-color: #2563eb !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3) !important;
}

html.dark .eps-library-card h2 {
    color: #f1f5f9 !important;
}

html.dark .eps-library-card > p {
    color: #94a3b8 !important;
}

html.dark .eps-library-card-top > span {
    background: rgba(37, 99, 235, 0.15) !important;
    color: #60a5fa !important;
}

html.dark .eps-library-card-top em {
    color: #34d399 !important;
}

html.dark .eps-library-stats {
    border-color: #1e293b !important;
}

html.dark .eps-library-stats span {
    border-right-color: #1e293b !important;
}

html.dark .eps-library-stats b {
    color: #e2e8f0 !important;
}

html.dark .eps-library-stats small {
    color: #64748b !important;
}

html.dark .eps-audio-type {
    background: #131b2e !important;
    color: #94a3b8 !important;
}

html.dark .eps-library-last-result {
    border-color: #1e293b !important;
    background: #131b2e !important;
}

html.dark .eps-library-last-result > span {
    color: #94a3b8 !important;
}

html.dark .eps-library-last-result > b {
    color: #60a5fa !important;
}

html.dark .eps-library-last-result.is-complete {
    background: rgba(5, 150, 105, 0.1) !important;
    border-color: rgba(5, 150, 105, 0.3) !important;
}

html.dark .eps-library-card > button {
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
}

/* =====================================================================
   DARK MODE: LIBRARY HOME QUEST ITEMS
   ===================================================================== */
html.dark .hw-library-quest-list > div[class*="hw-bg-white"] {
    background-color: #131b2e !important;
    border-color: #1e293b !important;
}

html.dark .hw-library-quest-list [class*="hw-text-slate-800"] {
    color: #f1f5f9 !important;
}

html.dark .hw-library-quest-list [class*="hw-text-slate-500"] {
    color: #94a3b8 !important;
}

html.dark .hw-library-quest-list [class*="hw-bg-amber-50"] {
    background-color: rgba(245, 158, 11, 0.15) !important;
}

html.dark .hw-library-quest-list button[class*="hw-bg-slate-100"] {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #64748b !important;
}

html.dark .hw-library-quest-list button[class*="hw-bg-emerald-50"] {
    background-color: rgba(5, 150, 105, 0.15) !important;
    border-color: rgba(5, 150, 105, 0.3) !important;
    color: #34d399 !important;
}

.hw-library-quest-track {
    background-color: #e2e8f0;
    transition: background-color 0.2s ease;
}

html.dark .hw-library-quest-track,
html[data-theme="dark"] .hw-library-quest-track,
.dark .hw-library-quest-track {
    background-color: #1e293b !important;
}

.hw-library-quest-progress {
    background: linear-gradient(90deg, #f59e0b 0%, #8b5cf6 100%);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
    min-width: 0;
}

html.dark .hw-library-card-kicker {
    color: #818cf8 !important;
}

html.dark .hw-library-reward-pill {
    background: rgba(16, 185, 129, 0.15) !important;
    border: 1px solid rgba(16, 185, 129, 0.35) !important;
    color: #34d399 !important;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.12) !important;
}
html.dark .hw-library-reward-pill i {
    color: #fbbf24 !important;
}

html.dark .hw-library-section-kicker {
    color: #818cf8 !important;
}

html.dark .hw-library-text-link {
    background: rgba(99, 102, 241, 0.16) !important;
    border: 1px solid rgba(99, 102, 241, 0.35) !important;
    color: #a5b4fc !important;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.12) !important;
    transition: all 0.2s ease !important;
}
html.dark .hw-library-text-link:hover {
    background: rgba(99, 102, 241, 0.28) !important;
    border-color: rgba(99, 102, 241, 0.55) !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
}
html.dark .hw-library-text-link i {
    color: currentColor !important;
}

html.dark .hw-library-quest-list [class*="hw-text-slate-700"] {
    color: #f59e0b !important;
}

/* =====================================================================
   DARK MODE: LIBRARY SHORTCUT ICONS
   ===================================================================== */
html.dark .hw-library-shortcut-icon {
    background: rgba(255, 255, 255, 0.06) !important;
}

html.dark .hw-library-shortcut-tag {
    background: rgba(255, 255, 255, 0.08) !important;
}

html.dark .hw-library-shortcut-arrow {
    color: #475569 !important;
}

html.dark .hw-library-shortcut::after {
    background: rgba(255, 255, 255, 0.03) !important;
    opacity: 0.5 !important;
}

/* =====================================================================
   DARK MODE: FLASHCARD TOOLBAR
   ===================================================================== */
html.dark #view-review .hw-flashcard-toolbar {
    background: #0f172a !important;
    border-color: #1e293b !important;
}

html.dark #view-review .hw-flashcard-tool,
html.dark #view-review .hw-flashcard-nav-button,
html.dark #view-review .hw-flashcard-bookmark {
    background: #131b2e !important;
    border-color: #1e293b !important;
    color: #94a3b8 !important;
}

html.dark #view-review .hw-flashcard-tool:hover,
html.dark #view-review .hw-flashcard-nav-button:hover,
html.dark #view-review .hw-flashcard-bookmark:hover {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

html.dark #view-review .hw-flashcard-navigation {
    background: #0f172a !important;
    border-color: #1e293b !important;
}

html.dark #view-review .hw-flashcard-position {
    color: #94a3b8 !important;
}

/* =====================================================================
   DARK MODE: ALPHABET MODULE
   ===================================================================== */
html.dark #view-alphabet-tab {
    background: transparent !important;
    color: #f8fafc !important;
}
html.dark #view-alphabet-tab .alphabet-tabs-wrap {
    background: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45) !important;
    overflow: hidden !important;
}
html.dark #view-alphabet-tab .alph-tab {
    background: #1e293b !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #cbd5e1 !important;
}
html.dark #view-alphabet-tab .alph-tab:hover {
    background: #27354a !important;
    border-color: rgba(255, 255, 255, 0.18) !important;
    color: #ffffff !important;
}
html.dark #view-alphabet-tab .alph-tab.active {
    background: #4f46e5 !important;
    border-color: #6366f1 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4) !important;
}
html.dark #view-alphabet-tab .alph-card {
    background: #131b2e !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
}
html.dark #view-alphabet-tab .alph-card:hover {
    background: #18223a !important;
    border-color: rgba(99, 102, 241, 0.45) !important;
}
html.dark #view-alphabet-tab .alph-char {
    color: #f8fafc !important;
}
html.dark #view-alphabet-tab .alph-title {
    color: #f8fafc !important;
}
html.dark #view-alphabet-tab .alph-count {
    background: rgba(37, 99, 235, 0.18) !important;
    border: 1px solid rgba(37, 99, 235, 0.35) !important;
    color: #93c5fd !important;
}
html.dark .alph-rules-subnav {
    background: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}
html.dark .alph-notice-banner {
    background: rgba(30, 58, 138, 0.25) !important;
    border: 1px solid rgba(59, 130, 246, 0.4) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35) !important;
}
html.dark .alph-notice-banner-title {
    color: #93c5fd !important;
}
html.dark .alph-notice-banner-desc {
    color: #cbd5e1 !important;
}
html.dark .alph-rule-card {
    background: #131b2e !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
}
html.dark .alph-rule-card:hover {
    background: #18223a !important;
    border-color: rgba(99, 102, 241, 0.45) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
}
html.dark .alph-rule-card-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
html.dark .alph-rule-card-title {
    color: #f8fafc !important;
}
html.dark .alph-rule-card-desc {
    color: #94a3b8 !important;
}
html.dark .alph-rule-item {
    background: #18223a !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}
html.dark .alph-rule-item:hover {
    background: #1e2d4a !important;
    border-color: rgba(99, 102, 241, 0.4) !important;
}
html.dark .alph-badge-head {
    background: rgba(37, 99, 235, 0.22) !important;
    color: #93c5fd !important;
    border: 1px solid rgba(37, 99, 235, 0.4) !important;
}
html.dark .alph-badge-tail {
    background: rgba(245, 158, 11, 0.22) !important;
    color: #fde68a !important;
    border: 1px solid rgba(245, 158, 11, 0.4) !important;
}
html.dark .hanja-text {
    color: #f8fafc !important;
}
html.dark .hv-text {
    color: #94a3b8 !important;
}
html.dark .kr-text {
    color: #60a5fa !important;
}

/* Guess countdown placeholder card in dark mode */
html.dark .v2-card-guess-placeholder,
html[data-theme="dark"] .v2-card-guess-placeholder,
.dark .v2-card-guess-placeholder,
[data-theme="dark"] .v2-card-guess-placeholder,
html.anki-mode-on .v2-card-guess-placeholder {
    background: rgba(15, 23, 42, 0.6) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}

html.dark .v2-card-guess-placeholder:hover,
html[data-theme="dark"] .v2-card-guess-placeholder:hover,
.dark .v2-card-guess-placeholder:hover,
[data-theme="dark"] .v2-card-guess-placeholder:hover,
html.anki-mode-on .v2-card-guess-placeholder:hover {
    background: rgba(30, 41, 59, 0.6) !important;
    border-color: rgba(99, 102, 241, 0.35) !important;
}

html.dark .v2-card-guess-placeholder p,
html[data-theme="dark"] .v2-card-guess-placeholder p,
.dark .v2-card-guess-placeholder p,
[data-theme="dark"] .v2-card-guess-placeholder p,
html.anki-mode-on .v2-card-guess-placeholder p {
    color: #94a3b8 !important;
}

html.dark .v2-card-guess-placeholder b,
html[data-theme="dark"] .v2-card-guess-placeholder b,
.dark .v2-card-guess-placeholder b,
[data-theme="dark"] .v2-card-guess-placeholder b,
html.anki-mode-on .v2-card-guess-placeholder b {
    color: #818cf8 !important;
}

/* Revealed answer card in dark mode (tools, signs, safety) */
html.dark .v2-card-answer-revealed,
html[data-theme="dark"] .v2-card-answer-revealed,
.dark .v2-card-answer-revealed,
[data-theme="dark"] .v2-card-answer-revealed,
html.anki-mode-on .v2-card-answer-revealed {
    background: #131b2e !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
}

html.dark .v2-card-answer-revealed .v2-ko-text,
html[data-theme="dark"] .v2-card-answer-revealed .v2-ko-text,
.dark .v2-card-answer-revealed .v2-ko-text,
[data-theme="dark"] .v2-card-answer-revealed .v2-ko-text,
html.anki-mode-on .v2-card-answer-revealed .v2-ko-text {
    color: #f1f5f9 !important;
}

html.dark .v2-card-answer-revealed .v2-vi-text,
html[data-theme="dark"] .v2-card-answer-revealed .v2-vi-text,
.dark .v2-card-answer-revealed .v2-vi-text,
[data-theme="dark"] .v2-card-answer-revealed .v2-vi-text,
html.anki-mode-on .v2-card-answer-revealed .v2-vi-text {
    color: #fbbf24 !important;
}

/* Print Guide Modal Dark Mode */
html.dark #v2-study-print-modal .v2-print-dialog,
html[data-theme="dark"] #v2-study-print-modal .v2-print-dialog,
.dark #v2-study-print-modal .v2-print-dialog,
[data-theme="dark"] #v2-study-print-modal .v2-print-dialog,
html.anki-mode-on #v2-study-print-modal .v2-print-dialog {
    background: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #f8fafc !important;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.68) !important;
}
html.dark #v2-study-print-modal .v2-print-head,
html[data-theme="dark"] #v2-study-print-modal .v2-print-head,
.dark #v2-study-print-modal .v2-print-head,
[data-theme="dark"] #v2-study-print-modal .v2-print-head,
html.anki-mode-on #v2-study-print-modal .v2-print-head {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
html.dark #v2-study-print-modal .v2-print-head h3,
html[data-theme="dark"] #v2-study-print-modal .v2-print-head h3,
.dark #v2-study-print-modal .v2-print-head h3,
[data-theme="dark"] #v2-study-print-modal .v2-print-head h3,
html.anki-mode-on #v2-study-print-modal .v2-print-head h3 {
    color: #f8fafc !important;
}
html.dark #v2-study-print-modal .v2-print-head p,
html[data-theme="dark"] #v2-study-print-modal .v2-print-head p,
.dark #v2-study-print-modal .v2-print-head p,
[data-theme="dark"] #v2-study-print-modal .v2-print-head p,
html.anki-mode-on #v2-study-print-modal .v2-print-head p {
    color: #94a3b8 !important;
}
html.dark #v2-study-print-modal .v2-print-close,
html[data-theme="dark"] #v2-study-print-modal .v2-print-close,
.dark #v2-study-print-modal .v2-print-close,
[data-theme="dark"] #v2-study-print-modal .v2-print-close,
html.anki-mode-on #v2-study-print-modal .v2-print-close {
    background: #1e293b !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #94a3b8 !important;
}
html.dark #v2-study-print-modal .v2-print-close:hover,
html[data-theme="dark"] #v2-study-print-modal .v2-print-close:hover,
.dark #v2-study-print-modal .v2-print-close:hover,
[data-theme="dark"] #v2-study-print-modal .v2-print-close:hover,
html.anki-mode-on #v2-study-print-modal .v2-print-close:hover {
    background: #334155 !important;
    color: #f8fafc !important;
}
html.dark #v2-study-print-modal .v2-print-option,
html[data-theme="dark"] #v2-study-print-modal .v2-print-option,
.dark #v2-study-print-modal .v2-print-option,
[data-theme="dark"] #v2-study-print-modal .v2-print-option,
html.anki-mode-on #v2-study-print-modal .v2-print-option {
    background: #1e293b !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #f1f5f9 !important;
}
html.dark #v2-study-print-modal .v2-print-option:hover,
html[data-theme="dark"] #v2-study-print-modal .v2-print-option:hover,
.dark #v2-study-print-modal .v2-print-option:hover,
[data-theme="dark"] #v2-study-print-modal .v2-print-option:hover,
html.anki-mode-on #v2-study-print-modal .v2-print-option:hover {
    background: #25334d !important;
    border-color: rgba(99, 102, 241, 0.5) !important;
}
html.dark #v2-study-print-modal .v2-print-option strong,
html[data-theme="dark"] #v2-study-print-modal .v2-print-option strong,
.dark #v2-study-print-modal .v2-print-option strong,
[data-theme="dark"] #v2-study-print-modal .v2-print-option strong,
html.anki-mode-on #v2-study-print-modal .v2-print-option strong {
    color: #f8fafc !important;
}
html.dark #v2-study-print-modal .v2-print-option small,
html[data-theme="dark"] #v2-study-print-modal .v2-print-option small,
.dark #v2-study-print-modal .v2-print-option small,
[data-theme="dark"] #v2-study-print-modal .v2-print-option small,
html.anki-mode-on #v2-study-print-modal .v2-print-option small {
    color: #94a3b8 !important;
}
html.dark #v2-study-print-modal .v2-print-check,
html[data-theme="dark"] #v2-study-print-modal .v2-print-check,
.dark #v2-study-print-modal .v2-print-check,
[data-theme="dark"] #v2-study-print-modal .v2-print-check,
html.anki-mode-on #v2-study-print-modal .v2-print-check {
    background: #0f172a !important;
    border-color: #475569 !important;
}
html.dark #v2-study-print-modal input:checked + .v2-print-check,
html[data-theme="dark"] #v2-study-print-modal input:checked + .v2-print-check,
.dark #v2-study-print-modal input:checked + .v2-print-check,
[data-theme="dark"] #v2-study-print-modal input:checked + .v2-print-check,
html.anki-mode-on #v2-study-print-modal input:checked + .v2-print-check {
    border-color: #6366f1 !important;
    background: #6366f1 !important;
}
html.dark #v2-study-print-modal .v2-print-info,
html[data-theme="dark"] #v2-study-print-modal .v2-print-info,
.dark #v2-study-print-modal .v2-print-info,
[data-theme="dark"] #v2-study-print-modal .v2-print-info,
html.anki-mode-on #v2-study-print-modal .v2-print-info {
    color: #93c5fd !important;
    background: rgba(30, 58, 138, 0.25) !important;
    border: 1px solid rgba(99, 102, 241, 0.3) !important;
}
html.dark #v2-study-print-modal .v2-print-footer,
html[data-theme="dark"] #v2-study-print-modal .v2-print-footer,
.dark #v2-study-print-modal .v2-print-footer,
[data-theme="dark"] #v2-study-print-modal .v2-print-footer,
html.anki-mode-on #v2-study-print-modal .v2-print-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}
html.dark #v2-study-print-modal [data-v2-print-summary],
html[data-theme="dark"] #v2-study-print-modal [data-v2-print-summary],
.dark #v2-study-print-modal [data-v2-print-summary],
[data-theme="dark"] #v2-study-print-modal [data-v2-print-summary],
html.anki-mode-on #v2-study-print-modal [data-v2-print-summary] {
    color: #94a3b8 !important;
}
html.dark #v2-study-print-modal .v2-print-open,
html[data-theme="dark"] #v2-study-print-modal .v2-print-open,
.dark #v2-study-print-modal .v2-print-open,
[data-theme="dark"] #v2-study-print-modal .v2-print-open,
html.anki-mode-on #v2-study-print-modal .v2-print-open {
    background: #6366f1 !important;
}
html.dark #v2-study-print-modal .v2-print-open:hover,
html[data-theme="dark"] #v2-study-print-modal .v2-print-open:hover,
.dark #v2-study-print-modal .v2-print-open:hover,
[data-theme="dark"] #v2-study-print-modal .v2-print-open:hover,
html.anki-mode-on #v2-study-print-modal .v2-print-open:hover {
    background: #4f46e5 !important;
}

/* =====================================================================
   DARK MODE: ROUND 2 ACTION SIMULATION WORKBENCH & SMART LIST MODAL
   Triệt tiêu hoàn toàn nền xám bẩn ở chế độ tối
   ===================================================================== */
html.dark #v2-simulation-container,
html[data-theme="dark"] #v2-simulation-container,
.dark #v2-simulation-container {
    color-scheme: dark;
}

/* Modal danh sách 80 bài thủ công thông minh - Tối ưu di động và máy tính */
#v2-sim-smart-list-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(2, 6, 23, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 8px;
    box-sizing: border-box;
}

@media (min-width: 640px) {
    #v2-sim-smart-list-modal {
        padding: 16px;
    }
}

#v2-sim-smart-list-modal .v2-smart-modal-box {
    width: 100%;
    max-width: 860px;
    height: 94vh;
    max-height: 94vh;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

@media (min-width: 640px) {
    #v2-sim-smart-list-modal .v2-smart-modal-box {
        height: 88vh;
        max-height: 88vh;
    }
}

/* Scroll area */
#v2-sim-smart-list-modal .v2-smart-list-scroll {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 8px;
}

@media (min-width: 640px) {
    #v2-sim-smart-list-modal .v2-smart-list-scroll {
        padding: 12px 14px;
    }
}

/* Search Box Container */
#v2-sim-smart-list-modal .v2-smart-search-box {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

#v2-sim-smart-list-modal .v2-smart-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #94a3b8;
    font-size: 12px;
}

#v2-sim-smart-list-modal #v2-sim-smart-search-input {
    width: 100%;
    height: 36px;
    padding-left: 36px !important;
    padding-right: 32px !important;
    border-radius: 10px;
    font-size: 12px;
    line-height: normal;
    outline: none;
    box-sizing: border-box;
}

#v2-sim-smart-list-modal .v2-smart-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 14px;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 2px;
}

/* Fixed thumbnail dimensions */
#v2-sim-smart-list-modal .v2-thumb-single {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    max-width: 44px !important;
    max-height: 44px !important;
    flex-shrink: 0 !important;
    position: relative;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    box-sizing: border-box;
}

@media (min-width: 640px) {
    #v2-sim-smart-list-modal .v2-thumb-single {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
        max-width: 48px !important;
        max-height: 48px !important;
    }
}

#v2-sim-smart-list-modal .v2-thumb-multi {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    max-width: 32px !important;
    max-height: 32px !important;
    flex-shrink: 0 !important;
    position: relative;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    box-sizing: border-box;
}

@media (min-width: 640px) {
    #v2-sim-smart-list-modal .v2-thumb-multi {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
        max-width: 36px !important;
        max-height: 36px !important;
    }
}

#v2-sim-smart-list-modal .v2-thumb-img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    display: block !important;
    border-radius: 6px;
}

html.dark #v2-sim-smart-list-modal > div,
html[data-theme="dark"] #v2-sim-smart-list-modal > div,
.dark #v2-sim-smart-list-modal > div {
    background-color: #0b1329 !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

html.dark #v2-sim-smart-list-modal .v2-thumb-single,
html.dark #v2-sim-smart-list-modal .v2-thumb-multi,
html[data-theme="dark"] #v2-sim-smart-list-modal .v2-thumb-single,
html[data-theme="dark"] #v2-sim-smart-list-modal .v2-thumb-multi,
.dark #v2-sim-smart-list-modal .v2-thumb-single,
.dark #v2-sim-smart-list-modal .v2-thumb-multi {
    background-color: #030712 !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Toàn bộ các thẻ bài tập thông thường */
html.dark #v2-sim-smart-list-modal .v2-sim-smart-item,
html[data-theme="dark"] #v2-sim-smart-list-modal .v2-sim-smart-item,
.dark #v2-sim-smart-list-modal .v2-sim-smart-item {
    background-color: #0f172a !important;
    border-color: rgba(255, 255, 255, 0.07) !important;
    color: #f8fafc !important;
}

html.dark #v2-sim-smart-list-modal .v2-sim-smart-item:hover,
html[data-theme="dark"] #v2-sim-smart-list-modal .v2-sim-smart-item:hover,
.dark #v2-sim-smart-list-modal .v2-sim-smart-item:hover {
    background-color: #131d38 !important;
    border-color: rgba(139, 92, 246, 0.35) !important;
}

/* Thẻ bài tập ĐANG HỌC (Active item) - Loại bỏ hoàn toàn nền trắng/xám bẩn */
html.dark #v2-sim-smart-list-modal .v2-sim-smart-item.v2-sim-smart-item-active,
html.dark #v2-sim-smart-list-modal .v2-sim-smart-item.hw-border-violet-400,
html.dark #v2-sim-smart-list-modal .v2-sim-smart-item[class*="hw-ring-violet-500"],
html[data-theme="dark"] #v2-sim-smart-list-modal .v2-sim-smart-item.v2-sim-smart-item-active,
html[data-theme="dark"] #v2-sim-smart-list-modal .v2-sim-smart-item.hw-border-violet-400,
html[data-theme="dark"] #v2-sim-smart-list-modal .v2-sim-smart-item[class*="hw-ring-violet-500"],
.dark #v2-sim-smart-list-modal .v2-sim-smart-item.v2-sim-smart-item-active,
.dark #v2-sim-smart-list-modal .v2-sim-smart-item.hw-border-violet-400,
.dark #v2-sim-smart-list-modal .v2-sim-smart-item[class*="hw-ring-violet-500"] {
    background: linear-gradient(135deg, rgba(76, 29, 149, 0.45) 0%, rgba(30, 27, 75, 0.75) 100%) !important;
    border-color: #8b5cf6 !important;
    box-shadow: 0 0 16px rgba(139, 92, 246, 0.35) !important;
}

/* Tags & chips bên trong thẻ bài tập: 🛠️ Dụng cụ, 📦 Phôi, ⚡ Thao tác */
html.dark #v2-sim-smart-list-modal [class*="hw-bg-sky-50"],
html.dark #v2-simulation-container [class*="hw-bg-sky-50"],
html[data-theme="dark"] #v2-sim-smart-list-modal [class*="hw-bg-sky-50"],
html[data-theme="dark"] #v2-simulation-container [class*="hw-bg-sky-50"],
.dark #v2-sim-smart-list-modal [class*="hw-bg-sky-50"],
.dark #v2-simulation-container [class*="hw-bg-sky-50"] {
    background-color: rgba(14, 165, 233, 0.15) !important;
    border-color: rgba(14, 165, 233, 0.3) !important;
    color: #7dd3fc !important;
}

html.dark #v2-sim-smart-list-modal [class*="hw-bg-amber-50"],
html.dark #v2-simulation-container [class*="hw-bg-amber-50"],
html[data-theme="dark"] #v2-sim-smart-list-modal [class*="hw-bg-amber-50"],
html[data-theme="dark"] #v2-simulation-container [class*="hw-bg-amber-50"],
.dark #v2-sim-smart-list-modal [class*="hw-bg-amber-50"],
.dark #v2-simulation-container [class*="hw-bg-amber-50"] {
    background-color: rgba(245, 158, 11, 0.15) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
    color: #fcd34d !important;
}

html.dark #v2-sim-smart-list-modal [class*="hw-bg-violet-50"],
html.dark #v2-simulation-container [class*="hw-bg-violet-50"],
html[data-theme="dark"] #v2-sim-smart-list-modal [class*="hw-bg-violet-50"],
html[data-theme="dark"] #v2-simulation-container [class*="hw-bg-violet-50"],
.dark #v2-sim-smart-list-modal [class*="hw-bg-violet-50"],
.dark #v2-simulation-container [class*="hw-bg-violet-50"] {
    background-color: rgba(139, 92, 246, 0.18) !important;
    border-color: rgba(139, 92, 246, 0.35) !important;
    color: #c4b5fd !important;
}

html.dark #v2-sim-smart-list-modal [class*="hw-bg-emerald-50"],
html.dark #v2-sim-smart-list-modal [class*="hw-bg-emerald-100"],
html.dark #v2-simulation-container [class*="hw-bg-emerald-50"],
html.dark #v2-simulation-container [class*="hw-bg-emerald-100"],
html[data-theme="dark"] #v2-sim-smart-list-modal [class*="hw-bg-emerald-50"],
html[data-theme="dark"] #v2-simulation-container [class*="hw-bg-emerald-50"],
.dark #v2-sim-smart-list-modal [class*="hw-bg-emerald-50"],
.dark #v2-simulation-container [class*="hw-bg-emerald-50"] {
    background-color: rgba(16, 185, 129, 0.15) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
    color: #6ee7b7 !important;
}

html.dark #v2-sim-smart-list-modal [class*="hw-bg-rose-50"],
html.dark #v2-simulation-container [class*="hw-bg-rose-50"],
html[data-theme="dark"] #v2-sim-smart-list-modal [class*="hw-bg-rose-50"],
html[data-theme="dark"] #v2-simulation-container [class*="hw-bg-rose-50"],
.dark #v2-sim-smart-list-modal [class*="hw-bg-rose-50"],
.dark #v2-simulation-container [class*="hw-bg-rose-50"] {
    background-color: rgba(244, 63, 94, 0.15) !important;
    border-color: rgba(244, 63, 94, 0.3) !important;
    color: #fda4af !important;
}

/* Nút phát âm thanh xem trước */
html.dark #v2-sim-smart-list-modal .v2-smart-preview-btn:not(.hw-bg-amber-500),
html[data-theme="dark"] #v2-sim-smart-list-modal .v2-smart-preview-btn:not(.hw-bg-amber-500),
.dark #v2-sim-smart-list-modal .v2-smart-preview-btn:not(.hw-bg-amber-500) {
    background-color: rgba(245, 158, 11, 0.15) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
    color: #fcd34d !important;
}

html.dark #v2-sim-smart-list-modal .v2-smart-preview-btn:not(.hw-bg-amber-500):hover,
html[data-theme="dark"] #v2-sim-smart-list-modal .v2-smart-preview-btn:not(.hw-bg-amber-500):hover,
.dark #v2-sim-smart-list-modal .v2-smart-preview-btn:not(.hw-bg-amber-500):hover {
    background-color: #f59e0b !important;
    color: #ffffff !important;
}

/* Badges: #id & Chưa làm */
html.dark #v2-sim-smart-list-modal [class*="hw-bg-slate-100"],
html[data-theme="dark"] #v2-sim-smart-list-modal [class*="hw-bg-slate-100"],
.dark #v2-sim-smart-list-modal [class*="hw-bg-slate-100"] {
    background-color: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #94a3b8 !important;
}

/* Input tìm kiếm */
html.dark #v2-sim-smart-list-modal #v2-sim-smart-search-input,
html[data-theme="dark"] #v2-sim-smart-list-modal #v2-sim-smart-search-input,
.dark #v2-sim-smart-list-modal #v2-sim-smart-search-input {
    background-color: #060b17 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #f8fafc !important;
}

/* Tabs bộ lọc danh mục */
html.dark #v2-sim-smart-list-modal button[onclick*="setSmartListFilterCategory"]:not(.hw-bg-violet-600),
html[data-theme="dark"] #v2-sim-smart-list-modal button[onclick*="setSmartListFilterCategory"]:not(.hw-bg-violet-600),
.dark #v2-sim-smart-list-modal button[onclick*="setSmartListFilterCategory"]:not(.hw-bg-violet-600) {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: #94a3b8 !important;
}

html.dark #v2-sim-smart-list-modal button[onclick*="setSmartListFilterCategory"]:not(.hw-bg-violet-600):hover,
html[data-theme="dark"] #v2-sim-smart-list-modal button[onclick*="setSmartListFilterCategory"]:not(.hw-bg-violet-600):hover,
.dark #v2-sim-smart-list-modal button[onclick*="setSmartListFilterCategory"]:not(.hw-bg-violet-600):hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #f8fafc !important;
}

/* Placeholder khung chấm điểm */
html.dark #v2-sim-eval-placeholder,
html[data-theme="dark"] #v2-sim-eval-placeholder,
.dark #v2-sim-eval-placeholder {
    background-color: rgba(2, 6, 23, 0.45) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Bàn thi slot stage */
html.dark #v2-simulation-container .v2-sim-workbench-stage {
    background-color: #020617 !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* 4 nút hành động Bước 3 */
html.dark #v2-simulation-container .v2-sim-action-btn:not([disabled]),
html[data-theme="dark"] #v2-simulation-container .v2-sim-action-btn:not([disabled]),
.dark #v2-simulation-container .v2-sim-action-btn:not([disabled]) {
    background-color: #0f172a !important;
    border-color: rgba(139, 92, 246, 0.28) !important;
}

html.dark #v2-simulation-container .v2-sim-action-btn:not([disabled]):hover,
html[data-theme="dark"] #v2-simulation-container .v2-sim-action-btn:not([disabled]):hover,
.dark #v2-simulation-container .v2-sim-action-btn:not([disabled]):hover {
    background-color: rgba(139, 92, 246, 0.12) !important;
    border-color: rgba(139, 92, 246, 0.6) !important;
}

/* ==========================================================================
   CROSS-DEVICE COMPATIBILITY ENGINE: ANDROID TV, IPAD, IPHONE, SAMSUNG & ALL
   ========================================================================== */

/* 1. Global Safe Area & Dynamic Viewport Variables */
:root {
    --sat: env(safe-area-inset-top, 0px);
    --sar: env(safe-area-inset-right, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left, 0px);
    --app-dvh: 100dvh;
    --tv-overscan-x: 0px;
    --tv-overscan-y: 0px;
}

/* 2. ANDROID TV & SMART TV 10-FOOT INTERFACE (.hw-env-tv) — strictly large TV viewports */
@media (min-width: 960px) {
    html.hw-env-tv:not(.hw-env-mobile) {
        --tv-overscan-x: 32px;
        --tv-overscan-y: 20px;
        font-size: 17px !important;
        user-select: none !important;
        -webkit-user-select: none !important;
        scroll-behavior: smooth !important;
    }

    html.hw-env-tv:not(.hw-env-mobile) body {
        padding-left: max(var(--tv-overscan-x), var(--sal)) !important;
        padding-right: max(var(--tv-overscan-x), var(--sar)) !important;
        padding-top: max(var(--tv-overscan-y), var(--sat)) !important;
        padding-bottom: max(var(--tv-overscan-y), var(--sab)) !important;
        overflow-x: hidden !important;
    }

    /* High-Contrast D-Pad Remote Focus Ring for TV Viewing (2-4m sofa distance) */
    html.hw-env-tv:not(.hw-env-mobile) *:focus-visible,
    html.hw-tv-nav-active *:focus-visible,
    html.hw-env-tv:not(.hw-env-mobile) .hw-tv-focused {
        outline: 3.5px solid #6366f1 !important;
        outline-offset: 3px !important;
        box-shadow: 0 0 24px rgba(99, 102, 241, 0.65), 0 0 8px #ffffff !important;
        transform: scale(1.03) !important;
        transition: transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.16s ease, outline 0.16s ease !important;
        z-index: 9999 !important;
    }

    /* Larger TV interactive target sizing (never deform circular floating toggles) */
    html.hw-env-tv:not(.hw-env-mobile) button:not(#mobile-top-theme-toggle):not(.hw-mobile-theme-pill):not(#desktop-sidebar-theme-toggle):not(.hw-theme-toggle-btn),
    html.hw-env-tv:not(.hw-env-mobile) a,
    html.hw-env-tv:not(.hw-env-mobile) input,
    html.hw-env-tv:not(.hw-env-mobile) .hw-tab-btn {
        min-height: 48px !important;
    }
}

/* 3. IPAD & IPADOS MULTITASKING / SPLIT VIEW (.hw-env-ipad, .hw-env-tablet) */
html.hw-env-ipad,
html.hw-env-tablet {
    -webkit-tap-highlight-color: transparent !important;
    touch-action: manipulation !important;
}

/* iPad in Landscape: Multi-column & comfortable card grid */
html.hw-env-ipad.hw-orientation-landscape #view-skills-test,
html.hw-env-tablet.hw-orientation-landscape #view-skills-test {
    max-width: 1280px !important;
    margin: 0 auto !important;
    padding-left: max(20px, var(--sal)) !important;
    padding-right: max(20px, var(--sar)) !important;
}

/* Smooth iPad Split-View resilience (when window width shrinks to 1/3 or 1/2) */
@media (min-width: 768px) and (max-width: 1024px) {
    .hw-container,
    .main-content,
    #main-container {
        padding-left: max(16px, var(--sal)) !important;
        padding-right: max(16px, var(--sar)) !important;
    }
}

/* 4. IPHONE & IOS SAFARI SPECIFIC OPTIMIZATIONS (.hw-env-iphone) */
html.hw-env-iphone body {
    padding-top: var(--sat) !important;
    padding-bottom: var(--sab) !important;
}

/* Prevent iOS Safari from auto-zooming when focusing inputs */
html.hw-env-iphone input[type="text"],
html.hw-env-iphone input[type="password"],
html.hw-env-iphone input[type="number"],
html.hw-env-iphone input[type="email"],
html.hw-env-iphone input[type="search"],
html.hw-env-iphone select,
html.hw-env-iphone textarea {
    font-size: 16px !important;
}

/* Clearance for iPhone Dynamic Island and Home Indicator Bar */
html.hw-env-iphone #hw-mobile-bottom-nav {
    padding-bottom: max(8px, var(--sab)) !important;
    height: calc(64px + var(--sab)) !important;
}

/* Dynamic Viewport height for iOS Safari address bar collapse */
@supports (height: 100dvh) {
    html.hw-env-iphone .hw-min-h-screen,
    html.hw-env-mobile .hw-min-h-screen {
        min-height: 100dvh !important;
    }
}

/* 5. SAMSUNG INTERNET & FOLDABLE DISPLAY COMPATIBILITY (.hw-env-samsung) */
html.hw-env-samsung {
    /* Smooth transition when Galaxy Z Fold inner/outer screen changes */
    transition: padding 0.2s ease;
}

/* Samsung High-Contrast preservation */
@media screen and (-ms-high-contrast: active) {
    button, a, input, select {
        border: 2px solid currentColor !important;
    }
}

/* 6. UNIVERSAL SCREEN ROTATION ADAPTIVE RULES */
/* When phone is rotated horizontally for video, exam, or full simulation */
@media (max-height: 520px) and (orientation: landscape) {
    .v2-header-row {
        padding-top: 4px !important;
        padding-bottom: 4px !important;
    }

    #hw-mobile-bottom-nav {
        height: calc(50px + var(--sab)) !important;
    }

    #hw-mobile-bottom-nav > .hw-tab-btn {
        height: 42px !important;
        padding: 4px 2px !important;
    }
}





/* =========================================================================
   GLOBAL VIEWPORT OVERFLOW-X GUARD FOR MOBILE RESPONSIVENESS
   ========================================================================= */
html, body {
    max-width: 100% !important;
    overflow-x: hidden !important;
}

#hw-app-layout {
    max-width: 100% !important;
    overflow-x: hidden !important;
}

.hw-library-home {
    max-width: 100% !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
}

main.hw-flex-1 {
    max-width: 100% !important;
    overflow-x: hidden !important;
}


/* =========================================================================
   PERFECT UNIFIED HUD MOBILE MARGIN ALIGNMENT
   ========================================================================= */
@media (max-width: 640px) {
    #unified-hud-wrapper,
    body #hw-app-layout #unified-hud-wrapper,
    html.dark body #hw-app-layout #unified-hud-wrapper,
    body.skin-tutien #hw-app-layout #unified-hud-wrapper {
        width: min(calc(100% - 20px), 1320px) !important;
        max-width: min(calc(100% - 20px), 1320px) !important;
        margin: 8px auto 12px !important;
        margin-inline: auto !important;
        align-self: center !important;
        box-sizing: border-box !important;
        border-radius: 18px !important;
    }

    #hw-app-layout > main > .hw-flex-1 {
        width: min(calc(100% - 20px), 1320px) !important;
        max-width: min(calc(100% - 20px), 1320px) !important;
        box-sizing: border-box !important;
        align-self: center !important;
        margin-inline: auto !important;
    }
}

/* DARK MODE: EPS 3-TAB LIBRARY & FLEXIBLE PRACTICE UI */
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-tabs {
    background: #0f172a !important;
    border-color: #1e293b !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-tabs > button {
    color: #94a3b8 !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-tabs > button em {
    background: rgba(59, 130, 246, 0.2) !important;
    color: #93c5fd !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-tabs > button.is-active {
    background: #1e293b !important;
    border-color: #3b82f6 !important;
    color: #f8fafc !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-tabs > button.is-active em {
    background: #2563eb !important;
    color: #ffffff !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-search i {
    color: #94a3b8 !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-search input,
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-status-pills > button,
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-pills > button {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-status-pills > span {
    color: #cbd5e1 !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-status-pills > button.is-active,
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-pills > button.is-active {
    background: #2563eb !important;
    border-color: #3b82f6 !important;
    color: #ffffff !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-library-heading h2,
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-group-toggle,
:is(html.dark, html[data-theme="dark"], body.dark) .eps-library-heading > span {
    color: #f1f5f9 !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-group-toggle > i {
    color: #60a5fa !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-library-heading small,
:is(html.dark, html[data-theme="dark"], body.dark) .eps-library-stats small,
:is(html.dark, html[data-theme="dark"], body.dark) .eps-library-last-result > small {
    color: #94a3b8 !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-library-card-top em.is-locked {
    background: rgba(245, 158, 11, 0.18) !important;
    color: #fcd34d !important;
    border: 1px solid rgba(251, 191, 36, 0.35) !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-empty {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-text-input,
:is(html.dark, html[data-theme="dark"], body.dark) .eps-textarea-input {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-question-stimulus {
    background: #131c31 !important;
    border-left-color: #3b82f6 !important;
    color: #e2e8f0 !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-flex-audio-bar {
    background: #111c36 !important;
    border-color: #1e3a8a !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-flex-audio-bar > button {
    background: #2563eb !important;
    color: #ffffff !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-flex-audio-bar > span {
    color: #cbd5e1 !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-model-answer-hint {
    background: rgba(16, 185, 129, 0.14) !important;
    border-color: rgba(52, 211, 153, 0.4) !important;
    color: #6ee7b7 !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) :is(#view-eps-exam, .eps-cbt-scope) .eps-nav-head strong,
:is(html.dark, html[data-theme="dark"], body.dark) .eps-nav-head strong {
    color: #f8fafc !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) :is(#view-eps-exam, .eps-cbt-scope) .eps-question-nav.is-flexible-nav {
    background: #0f172a !important;
    border-color: #1e293b !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) :is(#view-eps-exam, .eps-cbt-scope) .eps-question-nav.is-flexible-nav .eps-nav-head {
    background: #1e293b !important;
    border-color: #334155 !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) :is(#view-eps-exam, .eps-cbt-scope) .eps-question-nav.is-flexible-nav .eps-nav-head b {
    background: #1e293b !important;
    border-bottom: 1px solid #334155 !important;
    color: #f1f5f9 !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) :is(#view-eps-exam, .eps-cbt-scope) .eps-question-nav.is-flexible-nav .eps-nav-head span {
    background: #0f172a !important;
    color: #f8fafc !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) :is(#view-eps-exam, .eps-cbt-scope) .eps-question-nav.is-flexible-nav .eps-nav-head em {
    background: #334155 !important;
    color: #e2e8f0 !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) :is(#view-eps-exam, .eps-cbt-scope) .eps-question-nav.is-flexible-nav .eps-submit-answer,
:is(html.dark, html[data-theme="dark"], body.dark) :is(#view-eps-exam, .eps-cbt-scope) .eps-question-nav.is-flexible-nav footer > button {
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    border-color: #3b82f6 !important;
    color: #ffffff !important;
}
.eps-library-grid {
    width: 100%;
    max-width: 1360px;
    margin: 0 auto;
    grid-template-columns: repeat(auto-fill, minmax(262px, 1fr));
    gap: 14px;
    align-items: stretch;
}
.eps-library-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.eps-library-card-top {
    gap: 8px;
    flex-wrap: nowrap;
    min-height: 26px;
}
.eps-library-card-top > span,
.eps-library-card-top em {
    white-space: nowrap;
}
.eps-library-card-top > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.eps-library-card-top em {
    flex-shrink: 0;
}
.eps-practice-card h2 {
    margin: 12px 0 6px;
    font-size: 16.5px;
    font-weight: 700;
    line-height: 1.38;
    min-height: calc(16.5px * 1.38 * 2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
.eps-practice-card > p {
    margin: 0 0 12px;
    color: #475569;
    font-size: 12px;
    line-height: 1.45;
    min-height: calc(12px * 1.45 * 2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-practice-card > p {
    color: #94a3b8 !important;
}
.eps-library-card .eps-library-stats {
    margin-top: auto;
    margin-bottom: 12px;
}
.eps-practice-card .eps-library-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.eps-practice-card .eps-library-stats span:last-child {
    border-right: 0;
}
.eps-library-card > button {
    margin-top: 0;
    width: 100%;
    min-height: 40px;
}
@media (max-width: 640px) {
    .eps-library-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }
    .eps-practice-card h2,
    .eps-practice-card > p {
        min-height: 0;
    }
}

/* =========================================================================
   UNIFIED LIBRARY FRAME ARCHITECTURE (DESKTOP STANDARD = 1440px + MOBILE/TABLET)
   ========================================================================= */
:root {
    --hw-library-frame-max: 1440px;
}

@media (min-width: 768px) {
    body:not(.hw-game-core-active) #hw-app-layout > main {
        scrollbar-gutter: stable;
    }

    #hw-app-layout > main > #unified-hud-wrapper,
    body #hw-app-layout > main > #unified-hud-wrapper,
    html.anki-mode-off body #hw-app-layout > main > #unified-hud-wrapper,
    body.skin-tutien #hw-app-layout > main > #unified-hud-wrapper {
        width: min(var(--hw-library-frame-max), calc(100% - 48px)) !important;
        max-width: min(var(--hw-library-frame-max), calc(100% - 48px)) !important;
        margin: 0 auto 14px !important;
        box-sizing: border-box !important;
    }
}

@media (max-width: 767px) {
    #hw-app-layout > main > #unified-hud-wrapper,
    body #hw-app-layout > main > #unified-hud-wrapper,
    html.anki-mode-off body #hw-app-layout > main > #unified-hud-wrapper,
    body.skin-tutien #hw-app-layout > main > #unified-hud-wrapper {
        width: calc(100% - 20px) !important;
        max-width: calc(100% - 20px) !important;
        margin: 8px auto 12px !important;
        box-sizing: border-box !important;
        border-radius: 18px !important;
    }

    #hw-app-layout > main > .hw-flex-1 {
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px !important;
        box-sizing: border-box !important;
    }
}

#hw-app-layout > main > .hw-flex-1 {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

#hw-app-layout > main > .hw-flex-1 > .hw-tab-view:not(.topik-exam-fullscreen):not(#view-review):not(:has(.eps-cbt-page)),
body.hw-game-core-active #hw-app-layout > main > .hw-flex-1 > #view-rpg.hw-game-core-workspace {
    width: min(var(--hw-library-frame-max), 100%) !important;
    max-width: min(var(--hw-library-frame-max), 100%) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

#hw-app-layout #view-classroom > div,
#hw-app-layout #view-teacher > div,
#hw-app-layout #view-settings .hw-settings-container > div,
#hw-app-layout #view-attendance #attendance-root {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
}

#hw-app-layout #view-classroom > div,
#hw-app-layout #view-teacher > div,
#hw-app-layout #view-settings .hw-settings-container > div {
    padding-top: 0 !important;
}

#hw-app-layout #view-reference.hw-ref-container {
    width: min(var(--hw-library-frame-max), 100%) !important;
    max-width: min(var(--hw-library-frame-max), 100%) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

#hw-app-layout #view-shadowing .shadowing-shell,
#hw-app-layout #view-alphabet-tab .alphabet-page-shell,
#hw-app-layout #view-analytics .fv-analytics-shell,
#hw-app-layout #view-topik-exam:not(.topik-exam-fullscreen) .topik-library {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
}

#hw-app-layout #view-shadowing .shadowing-shell {
    padding-top: 0 !important;
}

#hw-app-layout #view-alphabet-tab,
#hw-app-layout #view-analytics {
    background: transparent !important;
    min-height: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

#hw-app-layout #view-eps-exam .eps-library {
    padding: 0 0 40px !important;
    background: transparent !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

#hw-app-layout #view-eps-exam .eps-library-hero,
#hw-app-layout #view-eps-exam .eps-lib-notice,
#hw-app-layout #view-eps-exam .eps-lib-tabs,
#hw-app-layout #view-eps-exam .eps-lib-toolbar,
#hw-app-layout #view-eps-exam .eps-lib-pills,
#hw-app-layout #view-eps-exam .eps-library-group,
#hw-app-layout #view-eps-exam .eps-library-grid,
#hw-app-layout #view-eps-exam .eps-lib-empty {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

@container (min-width: 1060px) {
    #hw-app-layout #view-eps-exam .eps-library-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }
}

@container (min-width: 800px) and (max-width: 1059px) {
    #hw-app-layout #view-eps-exam .eps-library-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

@container (min-width: 540px) and (max-width: 799px) {
    #hw-app-layout #view-eps-exam .eps-library-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@container (max-width: 539px) {
    #hw-app-layout #view-eps-exam .eps-library-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}

#hw-app-layout #view-skills-test,
html.hw-env-ipad.hw-orientation-landscape #hw-app-layout #view-skills-test,
html.hw-env-tablet.hw-orientation-landscape #hw-app-layout #view-skills-test {
    width: min(var(--hw-library-frame-max), 100%) !important;
    max-width: min(var(--hw-library-frame-max), 100%) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

@media (max-width: 640px) {
    #hw-app-layout #view-topik-exam:not(.topik-exam-fullscreen) {
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

@media (min-width: 768px) {
    #hw-app-layout > main > .hw-flex-1 {
        padding: 24px !important;
    }
    #hw-app-layout > nav,
    #hw-app-layout > #hw-mobile-bottom-nav,
    #hw-mobile-bottom-nav {
        display: none !important;
    }
}

@media (max-width: 767px) {
    #hw-app-layout > main {
        scrollbar-width: none;
    }
    #hw-app-layout > main::-webkit-scrollbar {
        display: none;
    }
}

@media (max-width: 1024px) {
    #hw-app-layout #view-shadowing .shadowing-library-add {
        grid-template-columns: minmax(0, 1fr) !important;
    }
    #hw-app-layout #view-alphabet-tab .alphabet-hero {
        grid-template-columns: minmax(0, 1fr) !important;
    }
    #hw-app-layout #view-teacher > div > div:first-child,
    #hw-app-layout #view-teacher > div > div:first-child > div:last-child {
        flex-wrap: wrap !important;
    }
    #hw-app-layout #view-skills-test {
        min-width: 0 !important;
        overflow-x: hidden !important;
    }
    #hw-app-layout #view-skills-test > *,
    #hw-app-layout #view-skills-test .v2-header-row,
    #hw-app-layout #view-skills-test .v2-sub-nav-container {
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }
}
