/* Extracted from new/templ/page/course.templ (templ Course) */
                    .course-modern-page {
						background: radial-gradient(circle at 0% 0%, rgba(0, 140, 255, 0.03) 0%, transparent 50%),
									radial-gradient(circle at 100% 100%, rgba(0, 140, 255, 0.03) 0%, transparent 50%),
									#f8fafc;
						min-height: 100vh;
						padding-bottom: 80px;
					}
					.course-header-content {
						display: flex;
						align-items: center;
						justify-content: center;
						gap: 1.75rem;
						max-width: 900px;
						margin: 0 auto;
						text-align: left;
						position: relative;
						z-index: 10;
					}
					.course-icon-container {
						position: relative;
						flex-shrink: 0;
					}
					.course-icon-container::before {
						content: "";
						position: absolute;
						inset: -14px;
						border-radius: 40px;
						background: radial-gradient(circle at center, var(--rgba-primary-3, rgba(0,140,255,0.25)) 0%, transparent 70%);
						z-index: -1;
						opacity: 0.9;
					}
					.course-main-icon {
						width: 88px;
						height: 88px;
						border-radius: 24px;
						object-fit: cover;
						box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.28);
						background: #fff;
						padding: 10px;
						border: 1px solid #eef2f6;
						animation: icon-float 5s ease-in-out infinite;
						transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
					}
					.course-main-icon:hover {
						transform: rotate(-4deg) scale(1.06);
					}
     @keyframes icon-float {
						0%, 100% { transform: translateY(0); }
						50% { transform: translateY(-10px); }
					}
					.qualification-badge {
						display: inline-block;
						padding: 5px 14px;
						background: var(--primary);
						color: #fff;
						border-radius: 999px;
						font-weight: 700;
						font-size: 0.75rem;
						text-transform: uppercase;
						letter-spacing: 0.08em;
						margin-bottom: 0.5rem;
						box-shadow: 0 6px 14px -4px var(--rgba-primary-4, rgba(0,140,255,0.4));
					}
                    /* Exam board tag badge shown alongside qualification (e.g., GL) */
                    .exam-board-badge {
                        display: inline-block;
                        padding: 5px 12px;
                        background: #0f172a;
                        color: #fff;
                        border-radius: 999px;
                        font-weight: 700;
                        font-size: 0.72rem;
                        text-transform: uppercase;
                        letter-spacing: 0.08em;
                        margin-left: 8px;
                        margin-bottom: 0.5rem;
                        border: 1px solid rgba(255,255,255,0.12);
                        box-shadow: 0 6px 14px -6px rgba(15, 23, 42, 0.35);
                    }
					.course-main-title {
						color: #0f172a;
						font-size: 2.25rem;
						font-weight: 800;
						letter-spacing: -0.04em;
						line-height: 1.05;
						margin-bottom: 0.75rem;
						text-shadow: 0 2px 12px rgba(255, 255, 255, 0.6);
					}
					.course-stats-badges {
						display: flex;
						flex-wrap: wrap;
						gap: 0.75rem;
					}
					.stat-badge {
						display: flex;
						align-items: center;
						gap: 0.5rem;
						background: rgba(15, 23, 42, 0.85);
						-webkit-backdrop-filter: blur(8px);
						backdrop-filter: blur(8px);
						border: 1px solid rgba(255, 255, 255, 0.12);
						color: #fff;
						padding: 7px 15px;
						border-radius: 999px;
						font-size: 0.9rem;
						font-weight: 600;
						box-shadow: 0 8px 18px -6px rgba(0, 0, 0, 0.35);
						transition: transform 0.25s ease, box-shadow 0.25s ease;
					}
					@media (max-width: 768px) {
						.course-header-content {
							flex-direction: column;
							text-align: center;
							gap: 1.5rem;
						}
						.course-title-section {
							min-width: 0;
							max-width: 100%;
						}
						.course-stats-badges {
							justify-content: center;
						}
						.course-main-title {
							font-size: 1.75rem;
							overflow-wrap: break-word;
						}
						.stat-badge {
							font-size: 0.8rem;
							padding: 6px 12px;
						}
					}
					.stat-badge:hover {
						transform: translateY(-2px);
						box-shadow: 0 12px 22px -6px rgba(0, 0, 0, 0.4);
					}
					.stat-badge i {
						font-size: 0.8rem;
						opacity: 0.8;
					}
					.stat-value {
						background: rgba(255, 255, 255, 0.15);
						padding: 2px 8px;
						border-radius: 6px;
						font-size: 0.8rem;
						margin-left: 4px;
					}
					.topic-card-modern {
						background: #fff;
						border-radius: 32px;
						box-shadow: 0 10px 40px -8px rgba(15, 23, 42, 0.08);
						border: 2px solid #eef2f6;
						margin-bottom: 2rem;
						transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
						flex: 1;
						position: relative;
						overflow: visible;
					}
					.topic-rail-item.is-active .topic-card-modern:hover {
						transform: translateY(-8px) scale(1.01);
						box-shadow: 0 30px 70px -12px rgba(15, 23, 42, 0.2);
						border-color: #3b82f6;
					}
					.topic-header-modern {
						padding: 2.25rem 1.5rem 1.5rem;
						text-align: center;
						position: relative;
						background: linear-gradient(to bottom, #f8fafc, #fff);
						border-radius: 32px 32px 0 0;
					}
					.topic-icon-wrapper {
						width: 76px;
						height: 76px;
						background: linear-gradient(135deg, #ffffff 0%, #f0f7ff 100%);
						border-radius: 24px;
						display: flex;
						align-items: center;
						justify-content: center;
						margin: 0 auto;
						position: absolute;
						top: -38px;
						left: 50%;
						transform: translateX(-50%);
						color: #008cff;
						font-size: 2.2rem;
						box-shadow: 0 14px 30px -8px rgba(0,140,255,0.3);
						border: 2px solid #fff;
						z-index: 10;
						transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
					}
					.topic-card-modern:hover .topic-icon-wrapper {
						transform: translateX(-50%) translateY(-6px) rotate(8deg);
						background: #008cff;
						color: #fff;
						box-shadow: 0 20px 40px -8px rgba(0,140,255,0.5);
					}
					.subtopic-list {
						border-radius: 0 0 32px 32px;
						overflow: hidden;
					}
					.subtopic-item-modern {
						padding: 1.25rem 1.5rem;
						border-bottom: 1px solid #f1f5f9;
						transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
						position: relative;
						z-index: 1;
					}
					.subtopic-item-modern:hover {
						background: #f8fbff;
						transform: scale(1.02);
						z-index: 2;
						box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.1);
						border-radius: 16px;
						border-bottom-color: transparent;
					}
					.subtopic-icon-box {
						width: 48px;
						height: 48px;
						min-width: 48px;
						flex-shrink: 0;
						aspect-ratio: 1 / 1;
						background: #f1f5f9;
						color: #475569;
						border-radius: 14px;
						display: flex;
						align-items: center;
						justify-content: center;
						font-size: 1.2rem;
						transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
					}
					/* "In the Workshop" - subtopics with no content yet. Soft
					   amber treatment: gently tinted row, faint stripe accent,
					   and a dashed amber chip so stacked rows stay calm. */
					.subtopic-maintenance {
						overflow: hidden;
						border-radius: 16px;
						cursor: not-allowed;
						background: #fffcf3;
						padding-top: 1.35rem;
					}
					.subtopic-maintenance:hover {
						background: #fffcf3;
						transform: none;
						box-shadow: none;
						border-bottom-color: #f1f5f9;
					}
					.maintenance-tape {
						position: absolute;
						top: 0;
						left: 0;
						right: 0;
						height: 4px;
						background: repeating-linear-gradient(
							-45deg,
							#fcd34d 0 10px,
							transparent 10px 20px
						);
						opacity: 0.65;
						-webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
						mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
					}
					.maintenance-icon,
					.subtopic-maintenance:hover .subtopic-icon-box {
						background: #fffbeb;
						color: #d97706;
						border: 2px dashed #fcd34d;
						transform: none;
						box-shadow: none;
					}
					.maintenance-name {
						color: #64748b;
						font-size: 1.15rem;
					}
					.maintenance-chip {
						display: inline-flex;
						align-items: center;
						gap: 8px;
						padding: 6px 14px;
						border-radius: 999px;
						background: #fef3c7;
						color: #92400e;
						border: 1.5px dashed #f59e0b;
						font-weight: 800;
						font-size: 0.72rem;
						text-transform: uppercase;
						letter-spacing: 0.12em;
						white-space: nowrap;
					}
					.maintenance-chip i {
						animation: workshop-tinker 2.6s ease-in-out infinite;
						transform-origin: 50% 80%;
					}
					@keyframes workshop-tinker {
						0%, 70%, 100% { transform: rotate(0); }
						76% { transform: rotate(-12deg); }
						82% { transform: rotate(9deg); }
						88% { transform: rotate(-6deg); }
						94% { transform: rotate(0); }
					}
					.subtopic-item-modern:hover .subtopic-icon-box {
						background: #008cff;
						color: #fff;
						transform: scale(1.1) rotate(-5deg);
						box-shadow: 0 8px 16px -4px rgba(0,140,255,0.4);
					}
					.modern-progress {
						height: 8px;
						background: #eef2f6;
						border-radius: 10px;
						overflow: hidden;
						border: 1px solid rgba(0,0,0,0.03);
					}
					.modern-progress-bar {
						height: 100%;
						background: linear-gradient(90deg, #008cff 0%, #4dabff 50%, #008cff 100%);
						background-size: 200% 100%;
						animation: progress-shine 3s linear infinite;
						border-radius: 10px;
						transition: width 1s cubic-bezier(0.65, 0, 0.35, 1);
						box-shadow: 0 0 12px rgba(0,140,255,0.3);
					}
					@keyframes progress-shine {
						0% { background-position: 200% 0; }
						100% { background-position: 0 0; }
					}
					.btn-modern-primary {
						background: linear-gradient(135deg, #008cff 0%, #4dabff 100%);
						color: #fff;
						border: none;
						border-radius: 16px;
						padding: 0.8rem 1.5rem;
						font-weight: 800;
						text-transform: uppercase;
						letter-spacing: 0.02em;
						transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
						box-shadow: 0 8px 20px -6px rgba(0,140,255,0.4);
						position: relative;
						overflow: hidden;
					}
					.btn-modern-primary::after {
						content: "";
						position: absolute;
						top: 0;
						left: -100%;
						width: 100%;
						height: 100%;
						background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
						transition: 0.5s;
					}
					.btn-modern-primary:hover::after {
						left: 100%;
					}
					.btn-modern-primary:hover {
						transform: translateY(-3px) scale(1.02);
						box-shadow: 0 12px 25px -5px rgba(0,140,255,0.5);
						color: #fff;
					}
					.side-card-modern {
						background: rgba(255, 255, 255, 0.8);
						backdrop-filter: blur(10px);
						border-radius: 24px;
						padding: 2.5rem 1.5rem;
						border: 1px solid #e2e8f0;
						opacity: 0.8;
						transition: all 0.3s ease;
						text-align: center;
						box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
					}
					.side-card-modern:hover {
						opacity: 1;
						transform: scale(1.02);
						background: #fff;
					}
					.avatar-stack {
						display: flex;
						align-items: center;
						justify-content: center;
					}
					.avatar-stack img {
						width: 80px;
						height: 80px;
						border-radius: 50%;
						border: 4px solid #fff;
						box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
						margin-left: -30px;
						background: #f1f5f9;
					}
					.avatar-stack img:first-child {
						margin-left: 0;
					}
					.course-modern-header {
						background: #fff;
						padding: 2.25rem 0 2rem;
						border-bottom: 1px solid #eef2f6;
						position: relative;
						background-size: cover;
						background-position: center;
					}
					.course-header-content {
						animation: header-fade-up 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
					}
					@keyframes header-fade-up {
						from { opacity: 0; transform: translateY(18px); }
						to { opacity: 1; transform: translateY(0); }
					}
					.course-modern-header::before {
						content: "";
						position: absolute;
						top: 0;
						left: 0;
						width: 100%;
						height: 100%;
						background: rgba(255, 255, 255, 0.8);
						z-index: 1;
					}
					.course-modern-header.has-banner::before {
						background: linear-gradient(to bottom, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.65));
						backdrop-filter: blur(12px);
						-webkit-backdrop-filter: blur(12px);
					}
					.course-modern-header > .container-fluid {
						position: relative;
						z-index: 2;
					}
					.course-modern-header::after {
						content: "";
						position: absolute;
						bottom: -1px;
						left: 0;
						width: 100%;
						height: 40px;
						background: #f8fafc;
						clip-path: url(#wave-clip-header);
						z-index: 1;
					}
					.tour-popover {
						background-color: var(--primary) !important;
						border: none !important;
						border-radius: 12px !important;
						box-shadow: 0 10px 15px -3px var(--rgba-primary-4) !important;
						/* below the offcanvas (1045) and its backdrop (1040) so modals cover the tour */
						z-index: 1035 !important;
						margin-bottom: 12px !important;
					}
					.tour-popover .popover-body {
						color: #fff !important;
						font-weight: 700 !important;
						padding: 0.75rem 1rem !important;
						font-size: 0.9rem !important;
					}
					.tour-popover .popover-arrow::after {
						border-bottom-color: var(--primary) !important;
						border-top-color: var(--primary) !important;
					}
					@keyframes pulse-tour {
						0% {
							transform: scale(1);
							box-shadow: 0 0 0 0 var(--rgba-primary-7);
						}
						70% {
							transform: scale(1.02);
							box-shadow: 0 0 0 10px rgba(0, 140, 255, 0);
						}
						100% {
							transform: scale(1);
							box-shadow: 0 0 0 0 rgba(0, 140, 255, 0);
						}
					}
					.pulse-tour {
						animation: pulse-tour 2s infinite !important;
					}
					.footer.fixed {
						box-shadow: 0 -8px 30px -12px rgba(15, 23, 42, 0.12);
						border-top: 1px solid #eef2f6;
					}
					.footer.fixed .btn-primary {
						background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover, #0056b3) 100%) !important;
						color: #fff !important;
						border: none !important;
						box-shadow: 0 10px 24px -8px var(--rgba-primary-5, rgba(0,140,255,0.5)) !important;
						font-weight: 700;
						transition: transform 0.2s ease, box-shadow 0.2s ease;
					}
					.footer.fixed .btn-primary:hover {
						transform: translateY(-2px);
						box-shadow: 0 16px 32px -8px var(--rgba-primary-6, rgba(0,140,255,0.55)) !important;
					}
                    .pagination-dots .swiper-pagination-bullet-active {
                        background: var(--primary) !important;
                        width: 26px;
                        border-radius: 999px;
                        transition: all 0.3s ease;
                    }
                    /* Tighten the band between the header wave and the topic cards:
                       shorter header, pagination dots tucked just under the wave,
                       and less dead space around the floating topic icons. */
                    .course-modern-header {
                        padding: 1.75rem 0 1.5rem;
                    }
                    .course-modern-page .content-body > .container-fluid {
                        padding-top: 0 !important;
                    }

                    /* ---- Bottom CTA banner + About card ---- */
                    .course-cta-card {
                        position: relative;
                        overflow: hidden;
                        border-radius: 28px;
                        padding: 3rem 2.5rem;
                        text-align: center;
                        color: #fff;
                        background:
                            radial-gradient(120% 160% at 8% -20%, rgba(77, 171, 255, 0.55) 0%, transparent 55%),
                            radial-gradient(120% 160% at 100% 120%, rgba(99, 102, 241, 0.5) 0%, transparent 55%),
                            linear-gradient(135deg, #0b3a8c 0%, #0f172a 100%);
                        box-shadow: 0 24px 60px -18px rgba(11, 58, 140, 0.45);
                        border: 1px solid rgba(255, 255, 255, 0.08);
                    }
                    .course-cta-glow {
                        position: absolute;
                        border-radius: 50%;
                        filter: blur(60px);
                        opacity: 0.5;
                        pointer-events: none;
                    }
                    .course-cta-glow-1 {
                        width: 320px;
                        height: 320px;
                        top: -160px;
                        left: -80px;
                        background: #008cff;
                    }
                    .course-cta-glow-2 {
                        width: 280px;
                        height: 280px;
                        bottom: -160px;
                        right: -60px;
                        background: #8b5cf6;
                    }
                    .course-cta-kicker {
                        position: relative;
                        display: inline-flex;
                        align-items: center;
                        gap: 8px;
                        padding: 6px 16px;
                        border-radius: 999px;
                        background: rgba(255, 255, 255, 0.12);
                        border: 1px solid rgba(255, 255, 255, 0.18);
                        color: #dbeafe;
                        font-weight: 700;
                        font-size: 0.72rem;
                        text-transform: uppercase;
                        letter-spacing: 0.12em;
                        margin-bottom: 1.25rem;
                        backdrop-filter: blur(6px);
                        -webkit-backdrop-filter: blur(6px);
                    }
                    .course-cta-kicker i {
                        color: #fbbf24;
                    }
                    .course-cta-text {
                        position: relative;
                        font-size: 1.35rem;
                        font-weight: 700;
                        line-height: 1.55;
                        letter-spacing: -0.01em;
                        max-width: 720px;
                        margin: 0 auto 2rem;
                        color: #f8fafc;
                        text-wrap: balance;
                    }
                    .course-cta-actions {
                        position: relative;
                        display: flex;
                        flex-wrap: wrap;
                        justify-content: center;
                        gap: 1rem;
                    }
                    .course-cta-btn-primary,
                    .course-cta-btn-ghost {
                        display: inline-flex;
                        align-items: center;
                        gap: 10px;
                        border-radius: 16px;
                        padding: 0.9rem 2rem;
                        font-size: 1.05rem;
                        font-weight: 800;
                        transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, background 0.25s ease;
                    }
                    .course-cta-btn-primary {
                        background: #fff;
                        color: #0b3a8c;
                        border: none;
                        box-shadow: 0 12px 28px -10px rgba(0, 0, 0, 0.45);
                    }
                    .course-cta-btn-primary:hover {
                        transform: translateY(-3px) scale(1.02);
                        color: #0b3a8c;
                        box-shadow: 0 18px 36px -10px rgba(0, 0, 0, 0.5);
                    }
                    .course-cta-btn-primary .fa-arrow-right {
                        transition: transform 0.25s ease;
                    }
                    .course-cta-btn-primary:hover .fa-arrow-right {
                        transform: translateX(4px);
                    }
                    .course-cta-btn-ghost {
                        background: rgba(255, 255, 255, 0.08);
                        color: #fff;
                        border: 1.5px solid rgba(255, 255, 255, 0.35);
                        backdrop-filter: blur(6px);
                        -webkit-backdrop-filter: blur(6px);
                    }
                    .course-cta-btn-ghost:hover {
                        transform: translateY(-3px);
                        background: rgba(255, 255, 255, 0.16);
                        color: #fff;
                        border-color: rgba(255, 255, 255, 0.55);
                    }
                    .course-about-card {
                        background: #fff;
                        border: 2px solid #eef2f6;
                        border-radius: 28px;
                        padding: 2.25rem 2.5rem;
                        box-shadow: 0 10px 40px -8px rgba(15, 23, 42, 0.08);
                    }
                    .course-about-header {
                        display: flex;
                        align-items: center;
                        gap: 1rem;
                        margin-bottom: 1.25rem;
                    }
                    .course-about-icon {
                        width: 52px;
                        height: 52px;
                        flex-shrink: 0;
                        border-radius: 16px;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        font-size: 1.3rem;
                        color: #008cff;
                        background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
                        border: 1px solid #dbeafe;
                        box-shadow: 0 8px 18px -8px rgba(0, 140, 255, 0.35);
                    }
                    .course-about-title {
                        font-size: 1.35rem;
                        font-weight: 800;
                        letter-spacing: -0.02em;
                        color: #0f172a;
                        margin-bottom: 0.1rem;
                    }
                    .course-about-subtitle {
                        font-size: 0.85rem;
                        font-weight: 600;
                        color: #64748b;
                        margin-bottom: 0;
                    }
                    .course-about-text {
                        font-size: 1.05rem;
                        line-height: 1.75;
                        color: #334155;
                        margin-bottom: 1.5rem;
                    }
                    .course-about-disclaimer {
                        font-size: 0.78rem;
                        font-style: italic;
                        line-height: 1.6;
                        color: #94a3b8;
                        background: #f8fafc;
                        border: 1px dashed #e2e8f0;
                        border-radius: 14px;
                        padding: 0.85rem 1.1rem;
                        margin-bottom: 1rem;
                    }
                    @media (max-width: 576px) {
                        .course-cta-card {
                            padding: 2.25rem 1.5rem;
                            border-radius: 24px;
                        }
                        .course-cta-text {
                            font-size: 1.1rem;
                        }
                        .course-cta-btn-primary,
                        .course-cta-btn-ghost {
                            width: 100%;
                            justify-content: center;
                        }
                        .course-about-card {
                            padding: 1.75rem 1.35rem;
                            border-radius: 24px;
                        }
                    }

/* ============ Dark theme ============ */
/* theme.css stamps html[data-theme="dark"] and supplies the --tt-* scale
   (#0b1120 canvas / #111a2e surfaces / #263450 lines). Everything above
   hardcodes the light palette, so this block re-skins each surface. The
   bottom CTA banner is already dark artwork and keeps its light-mode look;
   brand gradients (progress bar, primary buttons, tour popover) stay. */

html[data-theme="dark"] .course-modern-page {
    background: radial-gradient(circle at 0% 0%, rgba(0, 140, 255, 0.05) 0%, transparent 50%),
                radial-gradient(circle at 100% 100%, rgba(0, 140, 255, 0.05) 0%, transparent 50%),
                var(--tt-bg, #0b1120);
}

/* Header band, overlay + wave */
html[data-theme="dark"] .course-modern-header {
    background-color: var(--tt-surface, #111a2e);
    border-bottom-color: var(--tt-line, #263450);
}
html[data-theme="dark"] .course-modern-header::before {
    background: rgba(11, 17, 32, 0.8);
}
html[data-theme="dark"] .course-modern-header.has-banner::before {
    background: linear-gradient(to bottom, rgba(11, 17, 32, 0.45), rgba(11, 17, 32, 0.72));
}
html[data-theme="dark"] .course-modern-header::after {
    background: var(--tt-bg, #0b1120);
}

/* Hero icon, title, badges */
html[data-theme="dark"] .course-main-icon {
    background: var(--tt-surface, #111a2e);
    border-color: var(--tt-line, #263450);
    box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.45);
}
html[data-theme="dark"] .course-main-title {
    color: var(--tt-ink, #e6ebf5);
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}
html[data-theme="dark"] .exam-board-badge {
    background: var(--tt-surface-3, #1e2c48);
    border-color: var(--tt-line-strong, #33436a);
    box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.55);
}
html[data-theme="dark"] .stat-badge {
    background: rgba(23, 35, 59, 0.9);
    border-color: var(--tt-line-strong, #33436a);
    box-shadow: 0 8px 18px -6px rgba(0, 0, 0, 0.55);
}
html[data-theme="dark"] .stat-badge:hover {
    box-shadow: 0 12px 22px -6px rgba(0, 0, 0, 0.65);
}

/* Topic cards */
html[data-theme="dark"] .topic-card-modern {
    background: var(--tt-surface, #111a2e);
    border-color: var(--tt-line, #263450);
    box-shadow: 0 10px 40px -8px rgba(0, 0, 0, 0.35);
}
html[data-theme="dark"] .topic-rail-item.is-active .topic-card-modern:hover {
    box-shadow: 0 30px 70px -12px rgba(0, 0, 0, 0.55);
    border-color: #60a5fa;
}
html[data-theme="dark"] .topic-header-modern {
    background: linear-gradient(to bottom, var(--tt-surface-2, #17233b), var(--tt-surface, #111a2e));
}
html[data-theme="dark"] .topic-icon-wrapper {
    background: linear-gradient(135deg, var(--tt-surface-2, #17233b) 0%, var(--tt-surface-3, #1e2c48) 100%);
    color: #4dabff;
    border-color: var(--tt-line-strong, #33436a);
    box-shadow: 0 14px 30px -8px rgba(0, 0, 0, 0.5);
}
html[data-theme="dark"] .topic-card-modern:hover .topic-icon-wrapper {
    background: #008cff;
    color: #fff;
    box-shadow: 0 20px 40px -8px rgba(0, 140, 255, 0.4);
}

/* Subtopic rows */
html[data-theme="dark"] .subtopic-item-modern {
    border-bottom-color: var(--tt-line, #263450);
}
html[data-theme="dark"] .subtopic-item-modern:hover {
    background: var(--tt-surface-2, #17233b);
    box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.4);
}
html[data-theme="dark"] .subtopic-icon-box {
    background: var(--tt-surface-3, #1e2c48);
    color: #c3cddd;
}
html[data-theme="dark"] .subtopic-item-modern:hover .subtopic-icon-box {
    background: #008cff;
    color: #fff;
}

/* "In the Workshop" maintenance rows: keep the amber accent, tint on dark */
html[data-theme="dark"] .subtopic-maintenance,
html[data-theme="dark"] .subtopic-maintenance:hover {
    background: rgba(245, 158, 11, 0.08);
}
html[data-theme="dark"] .subtopic-maintenance:hover {
    border-bottom-color: var(--tt-line, #263450);
}
html[data-theme="dark"] .maintenance-icon,
html[data-theme="dark"] .subtopic-maintenance:hover .subtopic-icon-box {
    background: rgba(245, 158, 11, 0.14);
    color: #fbbf24;
    border-color: rgba(252, 211, 77, 0.45);
}
html[data-theme="dark"] .maintenance-name {
    color: var(--tt-muted, #94a3b8);
}
html[data-theme="dark"] .maintenance-chip {
    background: rgba(245, 158, 11, 0.16);
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.55);
}

/* Empty course slide (no topics yet) */
.course-empty {
    border-style: dashed;
    border-color: #cbd5e1;
    text-align: center;
}
.course-empty .topic-icon-wrapper {
    color: #94a3b8;
}
.course-empty .course-empty-busy,
.course-empty.is-generating .course-empty-idle {
    display: none;
}
.course-empty.is-generating .course-empty-busy {
    display: revert;
}
.course-empty.is-generating .topic-icon-wrapper {
    color: #008cff;
}
.course-empty-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    border: 1.5px dashed #94a3b8;
    font-weight: 800;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.course-empty.is-generating .course-empty-chip {
    display: inline-flex;
    background: #e0f2fe;
    color: #0369a1;
    border-color: #38bdf8;
}
.course-empty-body {
    padding: 0.5rem 1.75rem 2.25rem;
}
.course-empty-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0f172a;
    margin-bottom: 0.5rem;
}
.course-empty-text {
    color: #64748b;
    font-size: 1rem;
    max-width: 30rem;
    margin: 0 auto 1.5rem;
}
/* Ghost rows: the shape of the topics that aren't there */
.course-empty-rows {
    display: grid;
    gap: 0.75rem;
    max-width: 30rem;
    margin: 0 auto 1.5rem;
}
.course-empty-rows span {
    height: 56px;
    border-radius: 14px;
    border: 2px dashed #e2e8f0;
}
.course-empty-rows span:nth-child(2) { opacity: 0.65; }
.course-empty-rows span:nth-child(3) { opacity: 0.35; }
.course-empty.is-generating .course-empty-rows span {
    animation: course-empty-pulse 1.6s ease-in-out infinite;
}
.course-empty.is-generating .course-empty-rows span:nth-child(2) { animation-delay: 0.2s; }
.course-empty.is-generating .course-empty-rows span:nth-child(3) { animation-delay: 0.4s; }
@keyframes course-empty-pulse {
    0%, 100% { border-color: #e2e8f0; }
    50% { border-color: #38bdf8; }
}
.course-empty-hint {
    margin: 0;
    font-weight: 700;
    color: #008cff;
}
.course-empty-hint i {
    margin-right: 6px;
    animation: course-empty-nudge 1.4s ease-in-out infinite;
}
@keyframes course-empty-nudge {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}
@media (prefers-reduced-motion: reduce) {
    .course-empty-hint i,
    .course-empty.is-generating .course-empty-rows span { animation: none; }
}
html[data-theme="dark"] .course-empty {
    border-color: var(--tt-line-strong, #33436a);
}
html[data-theme="dark"] .course-empty .topic-icon-wrapper {
    color: var(--tt-muted, #94a3b8);
}
html[data-theme="dark"] .course-empty.is-generating .topic-icon-wrapper {
    color: #4dabff;
}
html[data-theme="dark"] .course-empty-chip {
    background: rgba(148, 163, 184, 0.14);
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.5);
}
html[data-theme="dark"] .course-empty.is-generating .course-empty-chip {
    background: rgba(56, 189, 248, 0.14);
    color: #7dd3fc;
    border-color: rgba(56, 189, 248, 0.5);
}
html[data-theme="dark"] .course-empty-title {
    color: var(--tt-text, #f1f5f9);
}
html[data-theme="dark"] .course-empty-text {
    color: var(--tt-muted, #94a3b8);
}
html[data-theme="dark"] .course-empty-rows span {
    border-color: var(--tt-line, #263450);
}

/* Progress track */
html[data-theme="dark"] .modern-progress {
    background: var(--tt-surface-3, #1e2c48);
    border-color: rgba(255, 255, 255, 0.04);
}

/* Side / placeholder cards */
html[data-theme="dark"] .side-card-modern {
    background: rgba(17, 26, 46, 0.8);
    border-color: var(--tt-line, #263450);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}
html[data-theme="dark"] .side-card-modern:hover {
    background: var(--tt-surface, #111a2e);
}
html[data-theme="dark"] .avatar-stack img {
    border-color: var(--tt-line-strong, #33436a);
    background: var(--tt-surface-3, #1e2c48);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.35);
}

/* Fixed footer */
html[data-theme="dark"] .footer.fixed {
    box-shadow: 0 -8px 30px -12px rgba(0, 0, 0, 0.5);
    border-top-color: var(--tt-line, #263450);
}

/* About card */
html[data-theme="dark"] .course-about-card {
    background: var(--tt-surface, #111a2e);
    border-color: var(--tt-line, #263450);
    box-shadow: 0 10px 40px -8px rgba(0, 0, 0, 0.35);
}
html[data-theme="dark"] .course-about-icon {
    background: linear-gradient(135deg, rgba(0, 140, 255, 0.14) 0%, rgba(0, 140, 255, 0.2) 100%);
    border-color: rgba(96, 165, 250, 0.35);
    color: #4dabff;
    box-shadow: 0 8px 18px -8px rgba(0, 0, 0, 0.45);
}
html[data-theme="dark"] .course-about-title {
    color: var(--tt-ink, #e6ebf5);
}
html[data-theme="dark"] .course-about-subtitle {
    color: var(--tt-muted, #94a3b8);
}
html[data-theme="dark"] .course-about-text {
    color: #c3cddd;
}
html[data-theme="dark"] .course-about-disclaimer {
    color: var(--tt-muted, #94a3b8);
    background: var(--tt-surface-2, #17233b);
    border-color: var(--tt-line, #263450);
}

/* ============================================================
   Personal route - a course baseline tunes the course per student.
   The hero sits above the topic swiper; subtopics carry a chip.
   (No "card" in these class names: theme.css paints [class*="card"].)
   ============================================================ */
.route-hero {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    display: flex;
    align-items: center;
    gap: 2rem;
    margin: 0.25rem 0 1.5rem;
    padding: 1.9rem 2rem;
    border-radius: 28px;
    color: #fff;
    background:
        radial-gradient(90% 140% at 0% 0%, rgba(56, 189, 248, 0.5) 0%, transparent 58%),
        radial-gradient(80% 120% at 100% 100%, rgba(168, 85, 247, 0.55) 0%, transparent 60%),
        linear-gradient(135deg, #0b1b3f 0%, #17256b 48%, #2a1a66 100%);
    box-shadow: 0 24px 60px -24px rgba(30, 41, 120, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.14);
    animation: routeHeroIn 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes routeHeroIn { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
.route-hero-glow { position: absolute; z-index: -1; border-radius: 50%; filter: blur(46px); opacity: 0.55; pointer-events: none; animation: routeGlowDrift 9s ease-in-out infinite alternate; }
.route-hero-glow-1 { width: 220px; height: 220px; left: -60px; top: -90px; background: #22d3ee; }
.route-hero-glow-2 { width: 260px; height: 260px; right: -70px; bottom: -130px; background: #c084fc; animation-delay: -4s; }
@keyframes routeGlowDrift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(26px, 18px, 0) scale(1.15); } }
/* The route itself: a dashed line that flows across the panel. */
.route-hero-path { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.route-hero-path path {
    fill: none;
    stroke: rgba(255, 255, 255, 0.26);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 3 11;
    vector-effect: non-scaling-stroke;
    animation: routePathFlow 1.6s linear infinite;
}
@keyframes routePathFlow { to { stroke-dashoffset: -28; } }
.route-hero-main { flex: 1 1 320px; min-width: 0; }
.route-hero-kicker {
    display: inline-flex; align-items: center; gap: 0.5rem;
    font-size: 0.7rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
    color: #a5f3fc;
}
.route-hero-sat {
    margin-left: 0.35rem; padding: 0.2rem 0.6rem; border-radius: 999px;
    background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.86); letter-spacing: 0.04em; text-transform: none; font-weight: 700;
}
.route-hero-title { margin: 0.55rem 0 0.4rem; font-size: clamp(1.45rem, 2.6vw, 2rem); font-weight: 900; letter-spacing: -0.025em; line-height: 1.1; color: #fff; }
.route-hero-title em {
    font-style: normal;
    background: linear-gradient(100deg, #67e8f9 0%, #a5b4fc 45%, #f0abfc 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.route-hero-text { margin: 0; max-width: 46ch; font-size: 0.95rem; line-height: 1.5; color: rgba(255, 255, 255, 0.78); }
.route-hero-cta {
    display: inline-flex; align-items: center; gap: 0.9rem;
    margin-top: 1.1rem; padding: 0.6rem 0.75rem 0.6rem 1.15rem; max-width: 100%;
    border-radius: 16px; text-decoration: none;
    color: #0b1b3f; background: #fff;
    box-shadow: 0 12px 28px -10px rgba(0, 0, 0, 0.5);
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s ease;
}
.route-hero-cta:hover { transform: translateY(-2px); color: #0b1b3f; box-shadow: 0 18px 34px -10px rgba(0, 0, 0, 0.55); }
.route-hero-cta:active { transform: translateY(0) scale(0.98); }
.route-hero-cta-label { display: flex; flex-direction: column; min-width: 0; text-align: left; line-height: 1.2; }
.route-hero-cta-label small { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: #6366f1; }
.route-hero-cta-label strong { font-size: 1rem; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-hero-cta > i {
    flex-shrink: 0; width: 36px; height: 36px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; background: linear-gradient(135deg, #6366f1, #a855f7);
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.route-hero-cta:hover > i { transform: translateX(3px); }
.route-hero-stats { flex: 0 0 auto; display: grid; grid-template-columns: repeat(3, minmax(104px, 1fr)); gap: 0.7rem; }
.route-stat {
    --route-c: #38bdf8;
    display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem;
    padding: 0.95rem 1rem; border-radius: 20px;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.14);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    animation: routeStatIn 0.6s cubic-bezier(0.2, 0.9, 0.25, 1.2) both;
    animation-delay: calc(0.18s + var(--route-i, 0) * 0.09s);
    transition: transform 0.25s ease, background 0.25s ease;
}
.route-stat:hover { transform: translateY(-3px); background: rgba(255, 255, 255, 0.14); }
@keyframes routeStatIn { from { opacity: 0; transform: translateY(16px) scale(0.92); } to { opacity: 1; transform: none; } }
.route-stat-fast { --route-c: #34d399; }
.route-stat-focus { --route-c: #fbbf24; }
.route-stat-track { --route-c: #7dd3fc; }
.route-stat-icon {
    width: 30px; height: 30px; border-radius: 10px; margin-bottom: 0.35rem;
    display: inline-flex; align-items: center; justify-content: center; font-size: 0.8rem;
    color: #0b1b3f; background: var(--route-c);
    box-shadow: 0 6px 16px -4px var(--route-c);
}
.route-stat-num { font-size: 1.9rem; font-weight: 900; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: #fff; }
.route-stat-label { font-size: 0.78rem; font-weight: 800; color: #fff; }
.route-stat-hint { font-size: 0.68rem; font-weight: 600; color: rgba(255, 255, 255, 0.6); }

/* Subtopic chips */
.route-chip {
    display: inline-flex; align-items: center; gap: 0.35rem;
    margin-bottom: 0.45rem; padding: 0.22rem 0.65rem; border-radius: 999px;
    font-size: 0.66rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase;
    cursor: default;
}
.route-chip-fast { color: #047857; background: #d1fae5; border: 1px solid rgba(16, 185, 129, 0.35); }
.route-chip-focus {
    color: #92400e; background: linear-gradient(100deg, #fef3c7, #fde68a, #fef3c7); background-size: 200% 100%;
    border: 1px solid rgba(245, 158, 11, 0.45);
    animation: routeChipShine 3.2s linear infinite;
}
@keyframes routeChipShine { to { background-position: -200% 0; } }

/* Focus subtopics get a lit left edge; fast-tracked ones step back. */
.subtopic-item-modern.route-focus { background: linear-gradient(90deg, rgba(251, 191, 36, 0.11), transparent 62%); border-radius: 16px; }
.subtopic-item-modern.route-focus::before {
    content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 4px;
    background: linear-gradient(180deg, #fbbf24, #f97316);
    box-shadow: 0 0 14px rgba(251, 191, 36, 0.7);
}
.subtopic-item-modern.route-focus .subtopic-icon-box { background: #fef3c7; color: #b45309; border-color: rgba(245, 158, 11, 0.35); }
.subtopic-item-modern.route-focus .btn-modern-primary { background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%); box-shadow: 0 8px 20px -6px rgba(249, 115, 22, 0.55); }
.subtopic-item-modern.route-fast .subtopic-icon-box { background: #d1fae5; color: #047857; border-color: rgba(16, 185, 129, 0.3); }
.subtopic-item-modern.route-fast h5 { opacity: 0.72; }
.subtopic-item-modern.route-fast .modern-progress { background: repeating-linear-gradient(135deg, #d1fae5 0 8px, #ecfdf5 8px 16px); border-color: rgba(16, 185, 129, 0.2); }
.subtopic-item-modern.route-fast .modern-progress-bar { background: linear-gradient(90deg, #10b981, #34d399); box-shadow: 0 0 12px rgba(16, 185, 129, 0.35); animation: none; }
.subtopic-item-modern.route-fast .btn-modern-primary { background: transparent; color: #047857; border: 2px solid rgba(16, 185, 129, 0.45); box-shadow: none; }
.subtopic-item-modern.route-fast .btn-modern-primary:hover { background: #ecfdf5; color: #047857; box-shadow: 0 8px 18px -8px rgba(16, 185, 129, 0.5); }

@media (max-width: 991px) {
    .route-hero { flex-direction: column; align-items: stretch; gap: 1.25rem; padding: 1.5rem 1.25rem; border-radius: 24px; }
    .route-hero-main { flex-basis: auto; }
    .route-hero-kicker { white-space: nowrap; letter-spacing: 0.1em; }
    .route-hero-stats { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
    .route-stat { padding: 0.8rem 0.7rem; border-radius: 16px; }
    .route-stat-num { font-size: 1.55rem; }
    .route-stat-hint { display: none; }
    .route-hero-cta { display: flex; justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
    .route-hero, .route-hero-glow, .route-hero-path path, .route-stat, .route-chip-focus { animation: none !important; }
}

html[data-theme="dark"] .route-hero { box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.1); }
html[data-theme="dark"] .route-chip-fast { color: #6ee7b7; background: rgba(16, 185, 129, 0.16); border-color: rgba(16, 185, 129, 0.35); }
html[data-theme="dark"] .route-chip-focus { color: #fcd34d; background: rgba(245, 158, 11, 0.16); border-color: rgba(245, 158, 11, 0.4); animation: none; }
html[data-theme="dark"] .subtopic-item-modern.route-focus { background: linear-gradient(90deg, rgba(251, 191, 36, 0.09), transparent 62%); }
html[data-theme="dark"] .subtopic-item-modern.route-focus .subtopic-icon-box { background: rgba(245, 158, 11, 0.16); color: #fcd34d; }
html[data-theme="dark"] .subtopic-item-modern.route-fast .subtopic-icon-box { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; }
html[data-theme="dark"] .subtopic-item-modern.route-fast .modern-progress { background: repeating-linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0 8px, rgba(16, 185, 129, 0.08) 8px 16px); }
html[data-theme="dark"] .subtopic-item-modern.route-fast .btn-modern-primary { color: #6ee7b7; border-color: rgba(52, 211, 153, 0.45); }
html[data-theme="dark"] .subtopic-item-modern.route-fast .btn-modern-primary:hover { background: rgba(16, 185, 129, 0.14); color: #6ee7b7; }


/* ======================================================================
   Topic rail v2 (2026-10-08): a centred, one-card-in-focus swiper built on
   native scroll-snap. Neighbours sit back a little; the focused card is
   the only thing that asks for attention. The old juice layer, card v3
   and rail v1 rules were removed, this block is the whole topic UI.
   ====================================================================== */
.topic-rail {
    --tc-accent: #008cff;
    --tc-ink: #0f172a;
    --tc-muted: #64748b;
    --tc-line: #e8edf4;
    --tc-surface: #fff;
    --tc-surface-2: #f6f8fc;
    --card-w: min(600px, 100%);
    --rail-gap: 1.5rem;
    position: relative;
    margin: 0.5rem 0 0;
}
html[data-theme="dark"] .topic-rail {
    --tc-ink: var(--tt-ink, #e6ebf5);
    --tc-muted: var(--tt-muted, #94a3b8);
    --tc-line: var(--tt-line, #263450);
    --tc-surface: var(--tt-surface, #111a2e);
    --tc-surface-2: var(--tt-surface-2, #17233b);
}

.topic-rail-track {
    display: flex; align-items: flex-start; gap: var(--rail-gap);
    overflow-x: auto; overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 1rem calc((100% - var(--card-w)) / 2) 2rem;
    margin: -1rem 0 -2rem;
    cursor: grab;
    outline: none;
}
.topic-rail-track::-webkit-scrollbar { display: none; }
.topic-rail-track.is-dragging { cursor: grabbing; scroll-snap-type: none; }
.topic-rail-track.is-dragging * { pointer-events: none; }
.topic-rail-item {
    flex: 0 0 var(--card-w);
    width: var(--card-w);
    scroll-snap-align: center;
    scroll-snap-stop: always;
    position: relative;
    display: flex;
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
    opacity: 0.45;
    transform: scale(0.94);
}
.topic-rail-item.is-active { opacity: 1; transform: none; }
.topic-rail-item:not(.is-active) > .tour-popover { visibility: hidden; }

/* Arrows: float at the sides of the focused card, desktop only */
.topic-rail-arrow {
    position: absolute; top: 50%; z-index: 3;
    width: 44px; height: 44px; margin-top: -22px; border-radius: 999px;
    display: none; align-items: center; justify-content: center;
    border: 1px solid var(--tc-line); background: var(--tc-surface); color: var(--tc-ink);
    box-shadow: 0 10px 24px -12px rgba(15, 23, 42, 0.45);
    transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.topic-rail-arrow.is-prev { left: calc((100% - var(--card-w)) / 2 - 22px - 1rem); }
.topic-rail-arrow.is-next { right: calc((100% - var(--card-w)) / 2 - 22px - 1rem); }
.topic-rail-arrow:hover:not(:disabled) { background: var(--tc-accent); color: #fff; border-color: transparent; transform: scale(1.06); }
.topic-rail-arrow:disabled { opacity: 0; pointer-events: none; }
@media (min-width: 900px) { .topic-rail-arrow { display: inline-flex; } }
@media (hover: none) { .topic-rail-arrow { display: none !important; } }

/* Foot: dots + a quiet count */
.topic-rail-foot { display: flex; align-items: center; justify-content: center; gap: 0.9rem; padding-top: 1.25rem; }
.topic-rail-dots { display: flex; gap: 6px; }
.topic-rail-dot {
    width: 7px; height: 7px; padding: 0; border: 0; border-radius: 999px;
    background: rgba(100, 116, 139, 0.3);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
}
.topic-rail-dot.is-on { width: 22px; background: var(--tc-accent); }
.topic-rail-count { font-size: 0.74rem; font-weight: 700; color: var(--tc-muted); font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.topic-rail.is-single .topic-rail-foot { display: none; }

/* ---- Card ---- */
.tcard {
    width: 100%;
    background: var(--tc-surface);
    border: 1px solid var(--tc-line);
    border-radius: 24px;
    box-shadow: 0 24px 60px -30px rgba(15, 23, 42, 0.35);
    overflow: hidden;
}
.topic-rail-item.is-active .tcard { border-color: rgba(0, 140, 255, 0.35); box-shadow: 0 30px 70px -30px rgba(0, 140, 255, 0.35); }
.tcard-head { display: flex; align-items: center; gap: 1rem; padding: 1.35rem 1.5rem 1.1rem; }
.tcard-icon {
    flex: 0 0 56px; width: 56px; height: 56px; border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.45rem; color: #fff;
    background: linear-gradient(135deg, #0a84ff, #4dabff);
    box-shadow: 0 10px 20px -10px rgba(0, 140, 255, 0.7);
}
.tcard-heading { flex: 1 1 auto; min-width: 0; }
.tcard-title { margin: 0; font-size: 1.2rem; font-weight: 800; line-height: 1.2; letter-spacing: -0.02em; color: var(--tc-ink); text-wrap: balance; }
.tcard-sub { margin: 0.25rem 0 0; font-size: 0.8rem; font-weight: 600; color: var(--tc-muted); }
.tcard-pct { flex: 0 0 auto; font-size: 1.1rem; font-weight: 900; color: var(--tc-accent); font-variant-numeric: tabular-nums; }
.is-complete .tcard-pct { color: #10b981; }
.is-complete .tcard-icon { background: linear-gradient(135deg, #10b981, #34d399); box-shadow: 0 10px 20px -10px rgba(16, 185, 129, 0.7); }
.is-locked .tcard-icon { background: var(--tc-surface-2); color: var(--tc-muted); box-shadow: none; border: 1px solid var(--tc-line); }
.tcard-bar { height: 4px; margin: 0 1.5rem; border-radius: 4px; background: rgba(100, 116, 139, 0.18); overflow: hidden; }
.tcard-bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #0a84ff, #4dabff); transition: width 0.8s cubic-bezier(0.65, 0, 0.35, 1); }
.is-complete .tcard-bar > span { background: linear-gradient(90deg, #10b981, #34d399); }
.tcard-list { padding: 0.6rem 0.6rem 0.6rem; }

/* ---- Rows ---- */
.trow {
    display: flex; align-items: center; gap: 0.9rem;
    padding: 0.8rem 0.9rem; border-radius: 16px;
    color: var(--tc-ink); text-decoration: none;
    transition: background 0.18s ease, transform 0.18s ease;
}
a.trow:hover { background: var(--tc-surface-2); color: var(--tc-ink); }
a.trow:active { transform: scale(0.99); }
.trow + .trow { margin-top: 2px; }
.trow-icon {
    position: relative; flex: 0 0 42px; width: 42px; height: 42px; border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; color: var(--tc-accent);
    background: rgba(0, 140, 255, 0.1);
}
.trow-icon-img img { width: 22px; height: 22px; object-fit: contain; }
.trow-check {
    position: absolute; right: -4px; bottom: -4px; width: 16px; height: 16px; border-radius: 50%;
    display: none; align-items: center; justify-content: center; font-size: 0.5rem;
    background: #10b981; color: #fff; box-shadow: 0 0 0 2px var(--tc-surface);
}
.is-done .trow-icon { color: #10b981; background: rgba(16, 185, 129, 0.12); }
.is-done .trow-check { display: flex; }
.route-focus .trow-icon { color: #d97706; background: rgba(245, 158, 11, 0.14); }
.route-fast .trow-icon { color: #059669; background: rgba(16, 185, 129, 0.12); }
.trow-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.trow-name { font-size: 0.95rem; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; text-wrap: pretty; }
.trow-meta { font-size: 0.72rem; font-weight: 600; color: var(--tc-muted); }
.trow-meta i { font-size: 0.85em; }
.route-focus .trow-meta { color: #d97706; }
.route-fast .trow-meta { color: #059669; }
.is-started .trow-meta { color: var(--tc-accent); }
.is-done .trow-meta { color: #10b981; }
.trow-bar { display: block; height: 3px; width: 100%; max-width: 180px; border-radius: 3px; background: rgba(100, 116, 139, 0.18); overflow: hidden; margin-top: 2px; }
.trow-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--tc-accent); }
.trow-go {
    flex: 0 0 34px; width: 34px; height: 34px; border-radius: 999px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.72rem; color: var(--tc-accent);
    background: rgba(0, 140, 255, 0.1);
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
a.trow:hover .trow-go { background: var(--tc-accent); color: #fff; transform: translateX(2px); }
.is-done .trow-go { color: #10b981; background: rgba(16, 185, 129, 0.12); }
.is-done a.trow:hover .trow-go { background: #10b981; }
.route-focus .trow-go { color: #d97706; background: rgba(245, 158, 11, 0.14); }
.route-focus a.trow:hover .trow-go, .route-focus.trow:hover .trow-go { background: #d97706; }
.trow.is-soon { opacity: 0.55; cursor: default; }
.trow.is-soon .trow-icon { color: var(--tc-muted); background: var(--tc-surface-2); }
.trow-tag { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tc-muted); padding: 3px 8px; border-radius: 999px; border: 1px solid var(--tc-line); }
.trow-all { margin-top: 0.4rem; border: 1px dashed var(--tc-line); justify-content: space-between; }
.tcard-more .tcard-icon { background: linear-gradient(135deg, #7c3aed, #a78bfa); box-shadow: 0 10px 20px -10px rgba(124, 58, 237, 0.7); }

/* The tour popover hangs off the first row; it must not be clipped by the card */
.tour-popover.popover { max-width: 240px; }
.pulse-tour.trow { animation: none !important; box-shadow: inset 0 0 0 2px rgba(0, 140, 255, 0.45); }

/* Empty-course card: reuse the card shell */
.topic-rail-item > .topic-card-modern { width: 100%; margin-bottom: 0; }

@media (max-width: 767.98px) {
    .topic-rail { --card-w: calc(100% - 2.5rem); --rail-gap: 0.9rem; }
    .topic-rail-item { transform: scale(0.97); }
    .topic-rail-item.is-active { transform: none; }
    .tcard-head { padding: 1.15rem 1.15rem 0.9rem; gap: 0.85rem; }
    .tcard-icon { flex-basis: 50px; width: 50px; height: 50px; font-size: 1.3rem; border-radius: 16px; }
    .tcard-title { font-size: 1.08rem; }
    .tcard-bar { margin: 0 1.15rem; }
    .tcard-list { padding: 0.45rem; }
    .trow { padding: 0.7rem 0.7rem; gap: 0.75rem; }
}
@media (prefers-reduced-motion: reduce) {
    .topic-rail-item, .topic-rail-dot, .trow, .trow-go, .tcard-bar > span { transition: none !important; }
}
.topic-rail-track { touch-action: pan-x pan-y; }
.topic-rail-track a, .topic-rail-track img { -webkit-user-drag: none; user-select: none; }
.topic-rail-track.is-dragging { user-select: none; }

/* Lead "More courses" card sized by course.js to fit the left gutter beside
   the first topic: readable rather than parked-slide faded, and compact so
   its rows survive the narrower width. */
.topic-rail-item.is-gutter:not(.is-active) { opacity: 0.85; transform: scale(0.97); }
.topic-rail-item.is-gutter .tcard { width: 100%; }
.topic-rail-item.is-gutter .trow { padding: 0.6rem 0.7rem; gap: 0.7rem; }
.topic-rail-item.is-gutter .trow-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topic-rail-item.is-gutter .trow-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topic-rail-item.is-gutter .trow-body { min-width: 0; }
