* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}
html, body {
    font-family: 'Inter', sans-serif;
    background-color: #1e1f22 !important;
    color: #e5e7eb;
    overflow: hidden;
    touch-action: none;
    margin: 0;
    padding: 0;
}
/* Nền bàn vẽ caro tối (Dark Checkerboard) chuẩn Inkscape — có !important để không bao giờ bị ghi đè thành nền trắng */
#canvas-viewport, .inkscape-canvas-bg {
    background-color: #2b2d30 !important;
    background-image: 
        linear-gradient(45deg, #323539 25%, transparent 25%), 
        linear-gradient(-45deg, #323539 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #323539 75%), 
        linear-gradient(-45deg, transparent 75%, #323539 75%) !important;
    background-size: 20px 20px !important;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px !important;
}
#main-svg {
    background: transparent !important;
}
/* Custom scrollbars for drawers */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: #1e1f22;
}
::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 3px;
}
.tool-btn.active {
    background-color: #2563eb !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 1px #60a5fa, 0 4px 10px rgba(37, 99, 235, 0.35);
}
.handle-grip {
    cursor: pointer;
    transition: transform 0.1s ease;
}
.handle-grip:hover {
    transform: scale(1.25);
}
.no-scrollbar::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}
.no-scrollbar {
    -ms-overflow-style: none !important;
    scrollbar-width: none !important;
}
input[type="number"], input[type="text"], select {
    user-select: text;
    -webkit-user-select: text;
}
.node-selected {
    fill: #facc15 !important;
    stroke: #dc2626 !important;
    stroke-width: 2.5px !important;
    filter: drop-shadow(0 0 4px rgba(250, 204, 21, 0.9));
}
.bezier-handle-line {
    stroke: #38bdf8;
    stroke-dasharray: 3, 2;
    pointer-events: none;
}
.bezier-handle-knob {
    fill: #ffffff;
    stroke: #0284c7;
    cursor: pointer;
}

/* ==========================================================================
   INKSCAPE STUDIO V18 — TỈ LỆ GỌN ~66% Ở ZOOM 100% + HIỆU ỨNG 3D HIỆN ĐẠI
   - Thanh công cụ 1 dòng duy nhất, không rớt dòng, không che bảng màu
   - Bỏ hoàn toàn cụm nút điều hướng nổi góc phải dưới (.ltk-floating-nav)
   - Hiệu ứng 3D nổi khối (Bevel, Depth Shadow, Tactile Press) cho toàn giao diện
   ========================================================================== */
html, body {
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    padding-bottom: 0 !important;
    font-size: 13px !important;
}

/* Ẩn tuyệt đối thanh điều hướng nổi ở góc phải dưới */
.ltk-floating-nav,
#ltk-floating-nav,
[class*="floating-nav"] {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Thanh Auth Bar trên cùng: 1 dòng gọn gàng, hiệu ứng 3D chìm nhẹ */
#ltk-global-auth-bar {
    padding: 3px 10px !important;
    min-height: 30px !important;
    font-size: 11px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    background: linear-gradient(180deg, #162033 0%, #0b1220 100%) !important;
    border-bottom: 1px solid #38bdf8 !important;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.55) !important;
}
#ltk-global-auth-bar a,
#ltk-global-auth-bar button {
    padding: 2px 8px !important;
    font-size: 11px !important;
    border-radius: 6px !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 2px 4px rgba(0,0,0,0.4) !important;
}

/* Thanh tiêu đề Inkscape (Header): 1 dòng gọn tỉ lệ ~66%, nổi khối 3D */
header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    min-height: 36px !important;
    height: 36px !important;
    padding: 2px 6px !important;
    gap: 4px !important;
    background: linear-gradient(180deg, #2d3139 0%, #1e2026 100%) !important;
    border-bottom: 1px solid #3f4450 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

header > div {
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 3px !important;
    flex-shrink: 0 !important;
}

/* Nút bấm 3D nổi khối, có hiệu ứng lún khi nhấn */
header button,
header a,
#tool-controls-bar button {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    padding: 3px 7px !important;
    font-size: 11px !important;
    line-height: 1.2 !important;
    border-radius: 6px !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 4px rgba(0, 0, 0, 0.4) !important;
    transition: transform 0.08s ease, box-shadow 0.12s ease, filter 0.12s ease !important;
}

header button:hover,
header a:hover,
#tool-controls-bar button:hover {
    filter: brightness(1.12);
    transform: translateY(-0.5px);
}

header button:active,
header a:active,
#tool-controls-bar button:active {
    transform: translateY(1px) !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5) !important;
}

/* Thanh thuộc tính ngữ cảnh (#tool-controls-bar): 1 dòng gọn */
#tool-controls-bar {
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    min-height: 30px !important;
    height: 30px !important;
    padding: 2px 8px !important;
    gap: 6px !important;
    font-size: 11px !important;
    background: linear-gradient(180deg, #252830 0%, #1c1e24 100%) !important;
    border-bottom: 1px solid #383c47 !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 2px 6px rgba(0,0,0,0.3) !important;
}

#tool-controls-bar > div {
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
}

#tool-controls-bar input[type="number"],
#tool-controls-bar select {
    padding: 1px 4px !important;
    font-size: 11px !important;
    height: 22px !important;
}

/* Thanh công cụ trái (Toolbox): mảnh gọn 44px + nút 3D nổi khối */
aside:first-of-type {
    width: 44px !important;
    padding: 6px 0 !important;
    gap: 4px !important;
    background: linear-gradient(90deg, #262930 0%, #1d1f25 100%) !important;
    border-right: 1px solid #3a3e48 !important;
    box-shadow: 3px 0 12px rgba(0, 0, 0, 0.4) !important;
}

aside .tool-btn,
#btn-multiselect {
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
    background: linear-gradient(180deg, #323640 0%, #23262e 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 2px 5px rgba(0, 0, 0, 0.45) !important;
}

aside .tool-btn i {
    font-size: 12px !important;
}

aside .tool-btn.active {
    background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%) !important;
    border: 1px solid #93c5fd !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 0 10px rgba(59, 130, 246, 0.65), 0 3px 6px rgba(0, 0, 0, 0.5) !important;
}

/* Hiệu ứng 3D nổi khối cho Trang giấy vẽ (Artboard) */
#page-shadow {
    filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.65));
}

/* Khung hướng dẫn bài tập nổi 3D (Glassmorphism) */
#practice-banner {
    background: linear-gradient(145deg, rgba(30, 34, 44, 0.94), rgba(18, 20, 26, 0.96)) !important;
    border: 1px solid rgba(245, 158, 11, 0.55) !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
    padding: 8px 10px !important;
    max-width: 340px !important;
}

/* Bảng màu & Thanh trạng thái đáy: gọn gàng, sạch sẽ, không bị che */
footer {
    background: linear-gradient(180deg, #252830 0%, #17191f 100%) !important;
    border-top: 1px solid #3a3f4b !important;
    box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.45) !important;
}

footer > div:first-child {
    height: 30px !important;
    padding: 0 6px !important;
}

#color-swatches-bar button {
    width: 18px !important;
    height: 18px !important;
    border-radius: 4px !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 1px 3px rgba(0,0,0,0.5) !important;
}

footer > div:last-child {
    height: 22px !important;
    font-size: 10.5px !important;
}


/* ==========================================================================
   V28.1: THU GỌN HEADER ~80% HIỂN THỊ ĐỦ NÚT "XUẤT BẢN" + DÒNG 2 CỐ ĐỊNH CHẤM ĐIỂM
   ========================================================================== */
header {
    min-height: 32px !important;
    height: 32px !important;
    padding: 2px 5px !important;
    gap: 3px !important;
}
header > div {
    gap: 2px !important;
}
header button,
header a {
    padding: 2px 5px !important;
    font-size: 10px !important;
    gap: 3px !important;
    border-radius: 5px !important;
}
header svg.w-4, header svg.w-5 {
    width: 13px !important;
    height: 13px !important;
}
header .px-2\.5 {
    padding-left: 6px !important;
    padding-right: 6px !important;
}
#tool-controls-row {
    min-height: 30px !important;
    height: 30px !important;
    background: linear-gradient(180deg, #252830 0%, #1c1e24 100%) !important;
    border-bottom: 1px solid #383c47 !important;
}
#tool-controls-row #tool-controls-bar {
    border-bottom: none !important;
    background: transparent !important;
    box-shadow: none !important;
    height: 28px !important;
    min-height: 28px !important;
}
#btn-fixed-grade-inkscape {
    background: linear-gradient(180deg, #f59e0b 0%, #ea580c 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.28) !important;
    border-bottom: 2.5px solid #9a3412 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 2px 6px rgba(234, 88, 12, 0.45) !important;
}
#btn-fixed-grade-inkscape:hover {
    background: linear-gradient(180deg, #fbbf24 0%, #f97316 100%) !important;
}

/* ==========================================================================
   V55: ĐỒNG BỘ TƯƠNG PHẢN CAO, CHỐNG TRÀN CODE & ẨN NÚT TRANG CHỦ NỔI
   ========================================================================== */
code:not(pre code) {
    color: #C2410C !important;
    background: #FFEDD5 !important;
    border: 1px solid #FDBA74 !important;
    padding: 1px 5px !important;
    border-radius: 4px !important;
    font-weight: 600 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
}

pre code {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

.ltk-floating-nav .home-btn,
.ltk-floating-nav a[href="index.html"] {
    display: none !important;
}


/* ==========================================================================
   V58.2: ĐỔI MÀU MÃ LỆNH INLINE `code` SANG XANH NAVY IN ĐẬM (#1E3A8A)
   - Thay thế nền đỏ/chữ đỏ gây rối mắt bằng Xanh Navy đậm trên nền xanh dịu nhẹ
   ========================================================================== */
code:not(pre code) {
    background: #EFF6FF !important;
    color: #1E3A8A !important;
    border: 1px solid #DBEAFE !important;
    padding: 1px 6px !important;
    border-radius: 4px !important;
    font-weight: 700 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    display: inline !important;
}


/* ==========================================================================
   V62.1: TỰ ĐỘNG ĐIỀU CHỈNH PHÔNG CHỮ, CỠ CHỮ ĐỘNG (FLUID TYPOGRAPHY)
          & CHỐNG RỚT DÒNG CHO NHÃN TRẠNG THÁI, NÚT LỆNH, TIÊU ĐỀ / Ô NGẮN
   ========================================================================== */
body {
    font-family: 'Plus Jakarta Sans', 'Be Vietnam Pro', 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: clamp(0.88rem, 1.1vw + 0.65rem, 1rem);
    text-rendering: optimizeLegibility;
}

h1, .top-banner h1 {
    font-size: clamp(1.15rem, 2.6vw, 1.7rem) !important;
    line-height: 1.3 !important;
    text-wrap: balance;
}

h2, .card-title, .panel-card h2 {
    font-size: clamp(0.96rem, 2vw, 1.24rem) !important;
    line-height: 1.35 !important;
    text-wrap: balance;
}

h3 {
    font-size: clamp(0.9rem, 1.7vw, 1.08rem) !important;
    line-height: 1.38 !important;
}

/* Giữ các nhãn trạng thái, huy hiệu, thẻ định hướng, nút điều hướng luôn gọn trên 1 dòng */
.badge,
.ltk-track-pill,
.ltk-track-tag,
.ltk-status-badge,
.status-badge,
.nav-tab-btn,
.ltk-ts-btn,
.ltk-tb-zoom-btn,
.ltk-float-btn,
.score-chip {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    white-space: nowrap !important;
    word-break: keep-all !important;
    line-height: 1.25 !important;
    font-size: clamp(0.72rem, 1.6vw, 0.84rem) !important;
}

/* Chống rớt dòng cho tiêu đề cột ngắn & ô dữ liệu ngắn trong bảng */
table th {
    font-size: clamp(0.76rem, 1.4vw, 0.9rem) !important;
    white-space: nowrap;
}

table td.ltk-nowrap,
table th.ltk-nowrap,
.ltk-nowrap {
    white-space: nowrap !important;
    word-break: keep-all !important;
}

/* Tự động co cỡ chữ nút bấm để không bị rớt chữ trên màn hình nhỏ */
button:not(.ltk-mm-toggle-btn):not(.btn-start):not(.btn-submit):not(.btn-clear),
.btn-action,
.btn-mini {
    white-space: nowrap;
    font-size: clamp(0.74rem, 1.7vw, 0.88rem) !important;
}


/* ==========================================================================
   V64.3: CHỐNG TRÀN LỀ TOÀN HỆ THỐNG (ĐẶC BIỆT THẺ NĂNG LỰC AI, KHUNG BÀI HỌC)
   ========================================================================== */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

.container,
.main-wrapper,
.card,
.panel-card,
.note-box,
.question-card,
.ltk-khbd-box,
.ltk-khbd-item,
.ltk-ai-activity {
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.ltk-khbd-grid > *,
.ltk-ai-steps > *,
.card > * {
    min-width: 0;
}

/* Cho phép mã Năng lực số / Năng lực AI tự động xuống dòng gọn trong khung thẻ */
.ltk-comp-code,
.ltk-comp-code.ltk-ai-code {
    display: inline-block !important;
    max-width: 100% !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    box-sizing: border-box !important;
    line-height: 1.4 !important;
    vertical-align: top !important;
}

pre,
.quiz-code-block,
.code-block {
    max-width: 100%;
    overflow-x: auto;
    box-sizing: border-box;
}

.table-responsive {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

@media (max-width: 768px) {
    .ltk-khbd-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ==========================================================================
   V66.1: PHÂN BIỆT RÕ RÀNG GIAO DIỆN PHÒNG ÔN TẬP (XANH NGỌC) vs PHÒNG KIỂM TRA (XANH NAVY)
          & SỬA LỖI CẮT CHỮ .hero-badge TRÊN ĐIỆN THOẠI
   ========================================================================== */
.hero-badge {
    display: inline-block !important;
    max-width: 100% !important;
    white-space: normal !important;
    word-break: break-word !important;
    text-align: center !important;
    line-height: 1.38 !important;
    padding: 5px 14px !important;
    box-sizing: border-box !important;
}

/* --- CHẾ ĐỘ 1: PHÒNG ÔN TẬP TRỰC TUYẾN (XANH NGỌC LỤC BẢO - EMERALD) --- */
body.ltk-mode-practice .hero {
    background: linear-gradient(135deg, #ECFDF5 0%, #F0FDF4 65%, #E6FFFA 100%) !important;
    border: 1.5px solid #A7F3D0 !important;
    border-top: 5px solid #059669 !important;
    border-bottom: 2.5px solid #10B981 !important;
}
body.ltk-mode-practice .hero-badge {
    background: #047857 !important;
    color: #FFFFFF !important;
    box-shadow: 0 2px 8px rgba(4, 120, 87, 0.25);
}
body.ltk-mode-practice .hero h1,
body.ltk-mode-practice #exam-header-title {
    color: #065F46 !important;
}
body.ltk-mode-practice .hero p {
    color: #047857 !important;
    font-weight: 600;
}
body.ltk-mode-practice .card-title {
    background: linear-gradient(90deg, #DCFCE7 0%, #F0FDF4 100%) !important;
    border-left: 5px solid #059669 !important;
    color: #065F46 !important;
}
body.ltk-mode-practice .note-box {
    border-left-color: #059669 !important;
}
body.ltk-mode-practice .btn-start {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.32) !important;
}
body.ltk-mode-practice .btn-start:hover {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%) !important;
}
body.ltk-mode-practice #exam-status-bar {
    background: #064E3B !important;
    border-bottom: 2.5px solid #10B981 !important;
}

/* --- CHẾ ĐỘ 2: PHÒNG KIỂM TRA CHÍNH THỨC (XANH NAVY - OFFICIAL EXAM) --- */
body.ltk-mode-exam .hero {
    background: linear-gradient(135deg, #EFF6FF 0%, #F8FAFC 65%, #DBEAFE 100%) !important;
    border: 1.5px solid #93C5FD !important;
    border-top: 5px solid #1E3A8A !important;
    border-bottom: 2.5px solid #1E40AF !important;
}
body.ltk-mode-exam .hero-badge {
    background: #1E3A8A !important;
    color: #FFFFFF !important;
    box-shadow: 0 2px 8px rgba(30, 58, 138, 0.28);
}
body.ltk-mode-exam .hero h1,
body.ltk-mode-exam #exam-header-title {
    color: #1E3A8A !important;
}
body.ltk-mode-exam .hero p {
    color: #1E40AF !important;
    font-weight: 600;
}
body.ltk-mode-exam .card-title {
    background: linear-gradient(90deg, #DBEAFE 0%, #EFF6FF 100%) !important;
    border-left: 5px solid #1E3A8A !important;
    color: #1E3A8A !important;
}
body.ltk-mode-exam .note-box {
    border-left-color: #1E3A8A !important;
}
body.ltk-mode-exam .btn-start {
    background: linear-gradient(135deg, #1E3A8A 0%, #172554 100%) !important;
    box-shadow: 0 4px 14px rgba(30, 58, 138, 0.34) !important;
}
body.ltk-mode-exam .btn-start:hover {
    background: linear-gradient(135deg, #1D4ED8 0%, #1E3A8A 100%) !important;
}
body.ltk-mode-exam #exam-status-bar {
    background: #0F172A !important;
    border-bottom: 2.5px solid #3B82F6 !important;
}


/* ==========================================================================
   V67.3: KHẮC PHỤC TRIỆT ĐỂ LỖI HIỂN THỊ TRÊN DI ĐỘNG TOÀN HỆ THỐNG
   1. Danh mục Ôn tập / Kiểm tra (.lesson-item) chuyển Thẻ 2 tầng gọn đẹp (<= 720px)
      -> Không bao giờ bị bóp tên bài thành từng chữ xếp dọc!
   2. Thanh điều hướng nổi (.ltk-floating-nav) căn giữa khi ít nút & vuốt ngang mượt khi nhiều nút
      -> Không bao giờ bị cắt nút ở 2 mép trái/phải!
   3. Lưới biểu mẫu nhiều cột (.ltk-mob-stack) tự xếp 1 cột trên điện thoại (<= 680px)
   ========================================================================== */
.ltk-floating-nav {
    max-width: calc(100vw - 16px) !important;
    box-sizing: border-box !important;
}

@media (max-width: 720px) {
    /* 1. Thẻ Ôn tập & Kiểm tra trên Mục lục 10/11/12: Bố cục 2 tầng (Tầng 1: Tiêu đề 100%, Tầng 2: Kỳ + Trạng thái + Thời lượng + Mũi tên) */
    #ltk-review-list-core .lesson-item,
    #ltk-exam-list-core .lesson-item,
    #ltk-dynamic-exams-list .lesson-item,
    .lesson-item:has(.ltk-exam-state-slot) {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        row-gap: 8px !important;
        column-gap: 8px !important;
        padding: 12px 12px !important;
    }

    #ltk-review-list-core .lesson-item .lesson-name,
    #ltk-exam-list-core .lesson-item .lesson-name,
    #ltk-dynamic-exams-list .lesson-item .lesson-name,
    .lesson-item:has(.ltk-exam-state-slot) .lesson-name {
        order: 1 !important;
        flex: 1 0 100% !important;
        width: 100% !important;
        min-width: 0 !important;
        font-size: 0.94rem !important;
        font-weight: 700 !important;
        line-height: 1.45 !important;
        word-break: normal !important;
        overflow-wrap: break-word !important;
    }

    #ltk-review-list-core .lesson-item .lesson-num,
    #ltk-exam-list-core .lesson-item .lesson-num,
    #ltk-dynamic-exams-list .lesson-item .lesson-num,
    .lesson-item:has(.ltk-exam-state-slot) .lesson-num {
        order: 2 !important;
        min-width: auto !important;
        flex-shrink: 0 !important;
        font-size: 0.78rem !important;
        padding: 3px 8px !important;
        border-radius: 6px !important;
        background: #EFF6FF !important;
        border: 1px solid #BFDBFE !important;
        color: #1E3A8A !important;
    }

    #ltk-review-list-core .lesson-item .ltk-exam-state-slot,
    #ltk-exam-list-core .lesson-item .ltk-exam-state-slot,
    #ltk-dynamic-exams-list .lesson-item .ltk-exam-state-slot,
    .lesson-item:has(.ltk-exam-state-slot) .ltk-exam-state-slot {
        order: 3 !important;
        flex-shrink: 0 !important;
        max-width: 100% !important;
    }

    #ltk-review-list-core .lesson-item .ltk-exam-state-slot .ltk-status-badge,
    #ltk-exam-list-core .lesson-item .ltk-exam-state-slot .ltk-status-badge,
    #ltk-dynamic-exams-list .lesson-item .ltk-exam-state-slot .ltk-status-badge {
        font-size: 0.73rem !important;
        padding: 3px 8px !important;
        white-space: nowrap !important;
    }

    #ltk-review-list-core .lesson-item .page-num,
    #ltk-exam-list-core .lesson-item .page-num,
    #ltk-dynamic-exams-list .lesson-item .page-num,
    .lesson-item:has(.ltk-exam-state-slot) .page-num {
        order: 4 !important;
        margin-right: 0 !important;
        font-size: 0.78rem !important;
        color: #475569 !important;
        white-space: nowrap !important;
    }

    #ltk-review-list-core .lesson-item .icon-link,
    #ltk-exam-list-core .lesson-item .icon-link,
    #ltk-dynamic-exams-list .lesson-item .icon-link,
    .lesson-item:has(.ltk-exam-state-slot) .icon-link {
        order: 5 !important;
        margin-left: auto !important;
        flex-shrink: 0 !important;
    }

    /* Bảo vệ các dòng bài học thông thường (Bài 1–34) trên màn hình nhỏ không bao giờ bị bóp chữ */
    .lesson-item {
        flex-wrap: wrap !important;
        row-gap: 4px !important;
    }
    .lesson-item .lesson-name {
        flex: 1 1 160px !important;
        word-break: normal !important;
        overflow-wrap: break-word !important;
    }

    /* 2. Thanh điều hướng nổi (.ltk-floating-nav): căn giữa khi ít nút, vuốt ngang mượt từ nút đầu tiên khi nhiều nút */
    .ltk-floating-nav {
        left: 8px !important;
        right: 8px !important;
        bottom: 8px !important;
        width: auto !important;
        max-width: calc(100vw - 16px) !important;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        padding: 6px 8px !important;
        gap: 6px !important;
    }
    .ltk-floating-nav::-webkit-scrollbar {
        display: none !important;
    }
    .ltk-floating-nav::before,
    .ltk-floating-nav::after {
        content: "";
        margin: auto;
        flex: 0 0 0px;
    }
    .ltk-floating-nav .ltk-float-btn {
        flex: 0 0 auto !important;
        white-space: nowrap !important;
        padding: 6px 10px !important;
        font-size: 0.75rem !important;
    }
}

/* 3. Lưới biểu mẫu nhiều cột trên các trang Quản trị & Đăng nhập tự động xếp 1 cột gọn trên điện thoại */
@media (max-width: 680px) {
    .ltk-mob-stack {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
    .ltk-mob-stack > * {
        min-width: 0 !important;
    }
}
