/* EducationGuard — Course Details page (matches Home / Courses design language) */

.eg-course-detail {
    --eg-primary: #F39318;
    --eg-primary-dark: #d47d0f;
    --eg-primary-light: #ffb347;
    --eg-primary-soft: rgba(243, 147, 24, 0.12);
    --eg-secondary: #461E38;
    --eg-secondary-dark: #2f1018;
    --eg-secondary-light: #6b3456;
    --eg-cream: #faf8f5;
    --eg-surface: #ffffff;
    --eg-text: #1a1a1a;
    --eg-text-muted: #5c5c5c;
    --eg-border: rgba(70, 30, 56, 0.15);
    --eg-radius: 1.25rem;
    --eg-radius-sm: 0.75rem;
    --eg-shadow: 0 8px 32px rgba(70, 30, 56, 0.1);
    --eg-shadow-lg: 0 16px 48px rgba(70, 30, 56, 0.16);
    --eg-nav-h: 4.5rem;
    --eg-font-display: 'Cairo', 'Segoe UI', 'Tajawal', sans-serif;
    --eg-success: #1f9d61;
    --eg-success-soft: rgba(31, 157, 97, 0.14);
    --eg-danger: #d64545;
    --eg-danger-soft: rgba(214, 69, 69, 0.14);

    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--eg-font-display);
    color: var(--eg-text);
    overflow-x: hidden;
}

html[data-bs-theme="dark"] .eg-course-detail {
    --eg-cream: #241820;
    --eg-surface: #322430;
    --eg-text: #faf5f7;
    --eg-text-muted: #d4c4cc;
    --eg-border: rgba(243, 147, 24, 0.28);
    --eg-primary-soft: rgba(243, 147, 24, 0.18);
    --eg-secondary-light: #8b4d72;
    --eg-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
    --eg-shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.38);
    --eg-success-soft: rgba(31, 157, 97, 0.22);
    --eg-danger-soft: rgba(214, 69, 69, 0.24);
}

.eg-course-detail *,
.eg-course-detail *::before,
.eg-course-detail *::after {
    box-sizing: border-box;
}

/* Keep page content above the fixed ambient layer */
.eg-course-detail > *:not(.eg-ambient):not(.eg-cd-topbar) {
    position: relative;
    z-index: 1;
}

/* ─────────────────────────  TOP BAR  ───────────────────────── */

.eg-cd-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--eg-nav-h);
    display: flex;
    align-items: center;
    background: var(--eg-surface);
    border-bottom: 2px solid var(--eg-secondary);
    box-shadow: var(--eg-shadow);
}

html[data-bs-theme="dark"] .eg-cd-topbar {
    background: rgba(50, 36, 48, 0.92);
    backdrop-filter: blur(12px);
    border-bottom-color: rgba(243, 147, 24, 0.35);
}

.eg-cd-topbar-inner {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.eg-cd-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.1rem 0.5rem 0.75rem;
    background: var(--eg-primary-soft);
    color: var(--eg-secondary);
    border: 1.5px solid var(--eg-primary);
    border-radius: 2rem;
    font-weight: 700;
    font-size: 0.88rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
}

html[data-bs-theme="dark"] .eg-cd-back {
    color: var(--eg-primary-light);
}

.eg-cd-back:hover {
    background: var(--eg-primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(243, 147, 24, 0.35);
}

.eg-cd-back__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    background: var(--eg-secondary);
    color: var(--eg-primary-light);
    font-size: 0.85rem;
    transition: transform 0.25s ease;
}

.eg-cd-back:hover .eg-cd-back__icon {
    transform: translateX(3px) rotate(-8deg);
    background: #fff;
    color: var(--eg-primary);
}

.eg-cd-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.eg-cd-brand img {
    height: 2.5rem;
    width: auto;
    object-fit: contain;
}

.eg-cd-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.eg-cd-status {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.9rem;
    border-radius: 2rem;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    background: var(--eg-primary-soft);
    color: var(--eg-primary-dark);
    border: 1px solid rgba(243, 147, 24, 0.35);
}

html[data-bs-theme="dark"] .eg-cd-status {
    color: var(--eg-primary-light);
}

.eg-cd-status.is-locked {
    background: rgba(70, 30, 56, 0.08);
    color: var(--eg-secondary);
    border-color: var(--eg-border);
}

html[data-bs-theme="dark"] .eg-cd-status.is-locked {
    color: var(--eg-text-muted);
}

.eg-cd-status .dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: currentColor;
}

.eg-cd-status.is-enrolled .dot {
    background: var(--eg-primary);
    animation: eg-cd-pulse 2s infinite;
}

@keyframes eg-cd-pulse {
    0% { box-shadow: 0 0 0 0 rgba(243, 147, 24, 0.6); }
    70% { box-shadow: 0 0 0 7px rgba(243, 147, 24, 0); }
    100% { box-shadow: 0 0 0 0 rgba(243, 147, 24, 0); }
}

/* ─────────────────────────  MAIN  ───────────────────────── */

.eg-cd-main {
    flex: 1 1 auto;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: calc(var(--eg-nav-h) + 2.25rem) 1.25rem 4rem;
}

/* Hero / course header */
.eg-cd-hero {
    text-align: center;
    margin-bottom: 2.5rem;
    animation: eg-cd-fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.eg-cd-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1.1rem;
    margin-bottom: 1.1rem;
    border-radius: 2rem;
    font-weight: 800;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

.eg-cd-hero-badge.is-enrolled {
    background: var(--eg-primary-soft);
    border: 1px solid rgba(243, 147, 24, 0.35);
    color: var(--eg-primary-dark);
}

html[data-bs-theme="dark"] .eg-cd-hero-badge.is-enrolled {
    color: var(--eg-primary-light);
}

.eg-cd-hero-badge.is-preview {
    background: rgba(70, 30, 56, 0.08);
    border: 1px solid var(--eg-border);
    color: var(--eg-secondary);
}

html[data-bs-theme="dark"] .eg-cd-hero-badge.is-preview {
    color: var(--eg-text-muted);
}

.eg-cd-hero-image {
    width: min(100%, 30rem);
    margin: 0 auto 1.4rem;
    border-radius: 1.25rem;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    box-shadow: 0 18px 45px rgba(20, 36, 64, 0.28);
    border: 1px solid var(--eg-border);
}

.eg-cd-hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.eg-cd-hero h1 {
    font-size: clamp(1.7rem, 5vw, 2.85rem);
    font-weight: 900;
    color: var(--eg-text);
    margin: 0;
    line-height: 1.25;
}

/* Two-column layout: aside + lessons */
.eg-cd-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.75rem;
    align-items: start;
}

@media (min-width: 992px) {
    .eg-cd-layout {
        grid-template-columns: 22rem 1fr;
    }
}

/* ── Aside intel card ── */
.eg-cd-aside {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: var(--eg-surface);
    border: 2px solid var(--eg-border);
    border-radius: var(--eg-radius);
    padding: 1.75rem;
    box-shadow: var(--eg-shadow);
    animation: eg-cd-fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

@media (min-width: 992px) {
    .eg-cd-aside {
        position: sticky;
        top: calc(var(--eg-nav-h) + 1.5rem);
    }
}

.eg-cd-card-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--eg-primary-dark);
}

html[data-bs-theme="dark"] .eg-cd-card-label {
    color: var(--eg-primary-light);
}

.eg-cd-card-label i {
    color: var(--eg-primary);
}

.eg-cd-desc {
    margin: 0;
    color: var(--eg-text-muted);
    line-height: 1.8;
    font-size: 0.95rem;
}

.eg-cd-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
}

.eg-cd-stat {
    flex: 1 1 8rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.9rem 1rem;
    background: var(--eg-cream);
    border: 1.5px solid var(--eg-border);
    border-radius: var(--eg-radius-sm);
}

.eg-cd-stat.is-accent {
    background: var(--eg-primary-soft);
    border-color: rgba(243, 147, 24, 0.4);
}

.eg-cd-stat-label {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--eg-text-muted);
}

.eg-cd-stat-value {
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--eg-secondary);
}

html[data-bs-theme="dark"] .eg-cd-stat-value {
    color: var(--eg-primary-light);
}

/* Enrollment gate */
.eg-cd-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.eg-cd-enroll {
    position: relative;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.35rem;
    border: none;
    border-radius: var(--eg-radius-sm);
    cursor: pointer;
    overflow: hidden;
    background: linear-gradient(135deg, var(--eg-primary) 0%, var(--eg-primary-dark) 100%);
    color: #fff;
    box-shadow: 0 10px 26px rgba(243, 147, 24, 0.35);
    font-family: inherit;
    transition: transform 0.25s ease, box-shadow 0.3s ease;
}

.eg-cd-enroll:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 14px 34px rgba(243, 147, 24, 0.45);
}

.eg-cd-enroll:disabled {
    cursor: not-allowed;
    opacity: 0.9;
    transform: none;
}

.eg-cd-enroll-text {
    display: flex;
    flex-direction: column;
    text-align: start;
    gap: 0.1rem;
}

.eg-cd-enroll-sub {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.85;
}

.eg-cd-enroll-title {
    font-size: 1.05rem;
    font-weight: 900;
}

.eg-cd-enroll-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    font-size: 1.25rem;
    transition: transform 0.4s ease;
}

.eg-cd-enroll:hover:not(:disabled) .eg-cd-enroll-icon {
    transform: translateY(-4px) rotate(-12deg) scale(1.1);
}

.eg-cd-enroll-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.25) 50%, transparent 70%);
    transform: translateX(-120%);
    animation: eg-cd-shimmer 3.2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes eg-cd-shimmer {
    0% { transform: translateX(-120%); }
    25%, 100% { transform: translateX(120%); }
}

.eg-cd-spinner {
    width: 1.4rem;
    height: 1.4rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: eg-cd-spin 0.8s linear infinite;
}

@keyframes eg-cd-spin {
    to { transform: rotate(360deg); }
}

.eg-cd-gate-note {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--eg-text-muted);
}

.eg-cd-gate-note i {
    color: var(--eg-success);
}

/* ── Lessons stream ── */
.eg-cd-lessons {
    animation: eg-cd-fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
}

.eg-cd-stream-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.35rem;
}

.eg-cd-stream-header h3 {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0;
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--eg-secondary);
}

html[data-bs-theme="dark"] .eg-cd-stream-header h3 {
    color: var(--eg-primary-light);
}

.eg-cd-stream-header h3 i {
    color: var(--eg-primary);
}

.eg-cd-stream-count {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    background: var(--eg-primary-soft);
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--eg-primary-dark);
}

html[data-bs-theme="dark"] .eg-cd-stream-count {
    color: var(--eg-primary-light);
}

.eg-cd-lessons-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.eg-cd-lesson {
    display: flex;
    gap: 1.1rem;
    padding: 1.25rem;
    background: var(--eg-surface);
    border: 2px solid var(--eg-border);
    border-radius: var(--eg-radius);
    box-shadow: var(--eg-shadow);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.3s ease, box-shadow 0.3s ease;
}

.eg-cd-lesson.is-active:hover {
    transform: translateY(-4px);
    border-color: var(--eg-primary);
    box-shadow: var(--eg-shadow-lg);
}

.eg-cd-lesson.is-locked {
    opacity: 0.85;
}

.eg-cd-lesson-index {
    flex-shrink: 0;
    width: 2.9rem;
    height: 2.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--eg-radius-sm);
    background: linear-gradient(135deg, var(--eg-secondary) 0%, var(--eg-secondary-light) 100%);
    color: var(--eg-primary-light);
    font-weight: 900;
    font-size: 1.05rem;
}

.eg-cd-lesson.is-active .eg-cd-lesson-index {
    background: linear-gradient(135deg, var(--eg-primary) 0%, var(--eg-primary-dark) 100%);
    color: #fff;
}

.eg-cd-lesson-body {
    flex: 1;
    min-width: 0;
}

.eg-cd-lesson-titlebar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.eg-cd-lesson-body h4 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--eg-secondary);
    line-height: 1.4;
}

html[data-bs-theme="dark"] .eg-cd-lesson-body h4 {
    color: var(--eg-text);
}

.eg-cd-lesson-body p {
    margin: 0.35rem 0 0;
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--eg-text-muted);
}

.eg-cd-lesson-q {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    background: var(--eg-primary-soft);
    border-radius: 2rem;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--eg-primary-dark);
    white-space: nowrap;
}

html[data-bs-theme="dark"] .eg-cd-lesson-q {
    color: var(--eg-primary-light);
}

.eg-cd-lesson-q.is-lock {
    background: rgba(70, 30, 56, 0.08);
    color: var(--eg-text-muted);
}

/* Lesson media actions */
.eg-cd-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin-top: 1.1rem;
}

.eg-cd-action {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.eg-cd-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.05rem;
    border-radius: var(--eg-radius-sm);
    border: 1.5px solid var(--eg-border);
    background: var(--eg-cream);
    color: var(--eg-secondary);
    font-family: inherit;
    font-weight: 800;
    font-size: 0.82rem;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.25s ease, border-color 0.2s ease;
}

html[data-bs-theme="dark"] .eg-cd-btn {
    color: var(--eg-text);
}

.eg-cd-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(70, 30, 56, 0.12);
}

.eg-cd-btn--play {
    background: linear-gradient(135deg, var(--eg-primary) 0%, var(--eg-primary-dark) 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 16px rgba(243, 147, 24, 0.3);
}

.eg-cd-btn--play:hover {
    box-shadow: 0 10px 24px rgba(243, 147, 24, 0.42);
    color: #fff;
}

.eg-cd-btn--solve:hover {
    border-color: var(--eg-primary);
    color: var(--eg-primary-dark);
}

.eg-cd-btn--exam {
    background: var(--eg-secondary);
    color: var(--eg-primary-light);
    border-color: transparent;
}

.eg-cd-btn--exam:hover {
    background: var(--eg-secondary-dark);
    color: #fff;
}

.eg-cd-btn--discuss {
    background: color-mix(in srgb, var(--eg-primary) 14%, var(--eg-cream));
    color: var(--eg-secondary);
    border-color: color-mix(in srgb, var(--eg-primary) 40%, transparent);
}

.eg-cd-btn--discuss:hover,
.eg-cd-btn--discuss.is-active {
    background: linear-gradient(135deg, var(--eg-primary) 0%, var(--eg-primary-dark) 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 16px rgba(243, 147, 24, 0.3);
}

.eg-cd-btn--report {
    background: var(--eg-success-soft);
    color: var(--eg-success);
    border-color: rgba(31, 157, 97, 0.35);
}

.eg-cd-action-hint {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--eg-text-muted);
    padding-inline-start: 0.2rem;
}

@keyframes eg-cd-fade-up {
    from { opacity: 0; transform: translateY(22px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────  VIDEO STAGE  ───────────────────────── */

.eg-cd-video-stage {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: clamp(0.75rem, 2vw, 1.5rem);
    background:
        radial-gradient(120% 120% at 50% -10%, rgba(243, 147, 24, 0.18) 0%, transparent 55%),
        linear-gradient(160deg, var(--eg-secondary-dark) 0%, var(--eg-secondary) 60%, #5a2848 100%);
    animation: eg-cd-fade-up 0.45s ease both;
    overflow: hidden;
}

.eg-cd-video-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.eg-cd-video-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.5;
}

.eg-cd-video-glow--1 {
    width: 38vw;
    height: 38vw;
    top: -12vw;
    inset-inline-start: -8vw;
    background: var(--eg-primary);
}

.eg-cd-video-glow--2 {
    width: 34vw;
    height: 34vw;
    bottom: -14vw;
    inset-inline-end: -6vw;
    background: var(--eg-secondary-light);
}

.eg-cd-video-header {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.eg-cd-video-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.2rem;
    border-radius: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-family: inherit;
    font-weight: 800;
    font-size: 0.85rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: background 0.25s ease, transform 0.2s ease, border-color 0.25s ease;
}

.eg-cd-video-back:hover {
    background: var(--eg-primary);
    border-color: var(--eg-primary);
    transform: translateY(-1px);
}

.eg-cd-video-identity {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.4rem 1.15rem 0.4rem 0.4rem;
    border-radius: 2rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(10px);
}

.eg-cd-video-identity img {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.45);
}

.eg-cd-video-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 900;
    color: #fff;
    font-size: 0.95rem;
}

.eg-cd-video-kicker i {
    color: var(--eg-primary-light);
    font-size: 1.05rem;
}

.eg-cd-video-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
}

.eg-cd-video-live {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1rem;
    border-radius: 2rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    backdrop-filter: blur(10px);
}

.eg-cd-video-live .dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--eg-primary-light);
    box-shadow: 0 0 0 0 rgba(255, 179, 71, 0.6);
    animation: eg-cd-pulse 1.8s infinite;
}

.eg-cd-video-stage-body {
    position: relative;
    z-index: 1;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eg-cd-video-frame {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: min(100%, 1400px);
    margin-inline: auto;
    border-radius: var(--eg-radius);
    overflow: hidden;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.eg-cd-video-el {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* Hide the native video fullscreen button so users go through the custom
   fullscreen control, which fullscreens the frame and keeps the watermark. */
.eg-cd-video-el::-webkit-media-controls-fullscreen-button {
    display: none;
}

.eg-cd-video-mark {
    position: absolute;
    top: 1.1rem;
    inset-inline-end: 1.1rem;
    width: 3.25rem;
    height: auto;
    opacity: 0.35;
    pointer-events: none;
    user-select: none;
    filter: grayscale(35%) drop-shadow(0 5px 15px rgba(0, 0, 0, 0.4));
    z-index: 5;
}

.eg-cd-video-accent {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--eg-primary), var(--eg-primary-light));
    z-index: 6;
    pointer-events: none;
}

/* ── Anti-piracy moving watermark (student phone number) ── */
.eg-cd-video-watermark {
    position: absolute;
    inset: 0;
    pointer-events: none;
    user-select: none;
    overflow: hidden;
    z-index: 7;
}

.eg-cd-video-watermark-text {
    position: absolute;
    top: 0;
    left: 0;
    display: inline-block;
    padding: 0.2rem 0.55rem;
    font-size: clamp(0.95rem, 1.8vw, 1.35rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.9);
    white-space: nowrap;
    will-change: top, left, opacity;
    animation:
        eg-cd-watermark-move 19s linear infinite alternate,
        eg-cd-watermark-fade 7s ease-in-out infinite;
}

.eg-cd-video-watermark-text--alt {
    animation:
        eg-cd-watermark-move-alt 23s linear infinite alternate,
        eg-cd-watermark-fade 9s ease-in-out infinite;
    animation-delay: -4s, -2s;
}

@keyframes eg-cd-watermark-move {
    0%   { top: 8%;  left: 4%; }
    20%  { top: 28%; left: 68%; }
    40%  { top: 75%; left: 30%; }
    60%  { top: 55%; left: 78%; }
    80%  { top: 42%; left: 12%; }
    100% { top: 82%; left: 60%; }
}

@keyframes eg-cd-watermark-move-alt {
    0%   { top: 70%; left: 72%; }
    20%  { top: 18%; left: 22%; }
    40%  { top: 50%; left: 82%; }
    60%  { top: 85%; left: 38%; }
    80%  { top: 22%; left: 60%; }
    100% { top: 60%; left: 8%; }
}

@keyframes eg-cd-watermark-fade {
    0%, 100% { opacity: 0.55; }
    50%      { opacity: 0.9; }
}

@media (prefers-reduced-motion: reduce) {
    .eg-cd-video-watermark-text {
        animation-duration: 40s, 0s;
        opacity: 0.7;
    }
}

/* ── Custom fullscreen button (fullscreens the frame so watermark stays on top) ── */
.eg-cd-video-fs-btn {
    position: absolute;
    top: 1.1rem;
    inset-inline-start: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 0.7rem;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 1.05rem;
    cursor: pointer;
    opacity: 0.55;
    backdrop-filter: blur(4px);
    transition: opacity 0.2s ease, background 0.2s ease, transform 0.2s ease;
    z-index: 8;
}

.eg-cd-video-fs-btn:hover {
    opacity: 1;
    background: var(--eg-primary);
    transform: scale(1.05);
}

/* When the frame itself is fullscreen, fill the screen and center the video */
.eg-cd-video-frame:fullscreen {
    max-width: none;
    width: 100vw;
    height: 100vh;
    border: none;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.eg-cd-video-frame:fullscreen .eg-cd-video-el {
    width: 100%;
    height: 100%;
}

/* ─────────────────────────  MODALS (shared)  ───────────────────────── */

.eg-cd-overlay {
    /* Overlays render as siblings outside .eg-course-detail, so the design
       tokens must be re-declared here for modals to inherit them. */
    --eg-primary: #F39318;
    --eg-primary-dark: #d47d0f;
    --eg-primary-light: #ffb347;
    --eg-primary-soft: rgba(243, 147, 24, 0.12);
    --eg-secondary: #461E38;
    --eg-secondary-dark: #2f1018;
    --eg-secondary-light: #6b3456;
    --eg-cream: #faf8f5;
    --eg-surface: #ffffff;
    --eg-text: #1a1a1a;
    --eg-text-muted: #5c5c5c;
    --eg-border: rgba(70, 30, 56, 0.15);
    --eg-radius: 1.25rem;
    --eg-radius-sm: 0.75rem;
    --eg-shadow: 0 8px 32px rgba(70, 30, 56, 0.1);
    --eg-shadow-lg: 0 16px 48px rgba(70, 30, 56, 0.16);
    --eg-font-display: 'Cairo', 'Segoe UI', 'Tajawal', sans-serif;
    --eg-success: #1f9d61;
    --eg-success-soft: rgba(31, 157, 97, 0.14);
    --eg-danger: #d64545;
    --eg-danger-soft: rgba(214, 69, 69, 0.14);

    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    font-family: var(--eg-font-display);
    background: rgba(47, 16, 24, 0.55);
    backdrop-filter: blur(10px);
    animation: eg-cd-overlay-in 0.25s ease both;
}

html[data-bs-theme="dark"] .eg-cd-overlay {
    --eg-cream: #241820;
    --eg-surface: #322430;
    --eg-text: #faf5f7;
    --eg-text-muted: #d4c4cc;
    --eg-border: rgba(243, 147, 24, 0.28);
    --eg-primary-soft: rgba(243, 147, 24, 0.18);
    --eg-secondary-light: #8b4d72;
    --eg-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
    --eg-shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.38);
    --eg-success-soft: rgba(31, 157, 97, 0.22);
    --eg-danger-soft: rgba(214, 69, 69, 0.24);
}

@keyframes eg-cd-overlay-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.eg-cd-modal-pop {
    animation: eg-cd-pop 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes eg-cd-pop {
    from { opacity: 0; transform: scale(0.96) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Exam modal ── */
.eg-cd-exam {
    width: min(70rem, 94vw);
    height: 92vh;
    display: flex;
    flex-direction: column;
    background: var(--eg-surface);
    border: 2px solid var(--eg-border);
    border-radius: var(--eg-radius);
    box-shadow: var(--eg-shadow-lg);
    overflow: hidden;
}

.eg-cd-exam-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1.35rem 1.75rem;
    border-bottom: 1px solid var(--eg-border);
}

.eg-cd-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    padding: 0.3rem 0.85rem;
    border-radius: 2rem;
    background: var(--eg-primary-soft);
    color: var(--eg-primary-dark);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

html[data-bs-theme="dark"] .eg-cd-pill {
    color: var(--eg-primary-light);
}

.eg-cd-exam-header h1 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--eg-secondary);
}

html[data-bs-theme="dark"] .eg-cd-exam-header h1 {
    color: var(--eg-primary-light);
}

.eg-cd-exam-header p {
    margin: 0.15rem 0 0;
    font-size: 0.8rem;
    color: var(--eg-text-muted);
    font-weight: 600;
}

.eg-cd-exam-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.eg-cd-timer {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 1.1rem;
    border-radius: var(--eg-radius-sm);
    background: var(--eg-cream);
    border: 1.5px solid var(--eg-border);
}

.eg-cd-timer i {
    color: var(--eg-primary);
    font-size: 1.15rem;
}

.eg-cd-timer-values {
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--eg-secondary);
    font-variant-numeric: tabular-nums;
}

html[data-bs-theme="dark"] .eg-cd-timer-values {
    color: var(--eg-text);
}

.eg-cd-timer .sep { color: var(--eg-primary); margin: 0 0.1rem; }

.eg-cd-timer.is-warning {
    border-color: var(--eg-danger);
    animation: eg-cd-warn 1s infinite;
}

.eg-cd-timer.is-warning i,
.eg-cd-timer.is-warning .eg-cd-timer-values,
.eg-cd-timer.is-warning .sep {
    color: var(--eg-danger);
}

@keyframes eg-cd-warn {
    0%, 100% { background: var(--eg-cream); }
    50% { background: var(--eg-danger-soft); }
}

.eg-cd-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    border: none;
    background: var(--eg-cream);
    color: var(--eg-text-muted);
    font-size: 1.05rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.eg-cd-icon-btn:hover {
    background: var(--eg-danger-soft);
    color: var(--eg-danger);
}

.eg-cd-exam-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1.75rem;
    background: var(--eg-cream);
}

.eg-cd-task {
    background: var(--eg-surface);
    border: 1.5px solid var(--eg-border);
    border-radius: var(--eg-radius);
    padding: 1.25rem 1.4rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.eg-cd-task:hover {
    border-color: var(--eg-primary);
    box-shadow: var(--eg-shadow);
}

.eg-cd-task-id {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--eg-primary-dark);
}

html[data-bs-theme="dark"] .eg-cd-task-id {
    color: var(--eg-primary-light);
}

.eg-cd-task h3 {
    margin: 0.4rem 0 1rem;
    font-size: 1.02rem;
    font-weight: 800;
    color: var(--eg-secondary);
    line-height: 1.5;
}

html[data-bs-theme="dark"] .eg-cd-task h3 {
    color: var(--eg-text);
}

.eg-cd-choices {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
}

@media (min-width: 640px) {
    .eg-cd-choices { grid-template-columns: 1fr 1fr; }
}

.eg-cd-choice {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.95rem 1.1rem;
    border-radius: var(--eg-radius-sm);
    background: var(--eg-surface);
    border: 1.5px solid var(--eg-border);
    cursor: pointer;
    user-select: none;
    overflow: hidden;
    transition: transform 0.18s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.eg-cd-choice::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--eg-primary);
    transform: scaleY(0);
    transform-origin: center;
    transition: transform 0.2s ease;
}

.eg-cd-choice:hover {
    border-color: var(--eg-primary);
    background: var(--eg-cream);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.eg-cd-choice:hover::before {
    transform: scaleY(0.6);
}

.eg-cd-choice.is-active {
    background: var(--eg-primary-soft);
    border-color: var(--eg-primary);
    box-shadow: 0 6px 20px rgba(243, 147, 24, 0.22);
}

.eg-cd-choice.is-active::before {
    transform: scaleY(1);
}

html[data-bs-theme="dark"] .eg-cd-choice {
    background: rgba(255, 255, 255, 0.03);
}

html[data-bs-theme="dark"] .eg-cd-choice:hover {
    background: rgba(255, 255, 255, 0.06);
}

.eg-cd-choice-order {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.6rem;
    background: var(--eg-cream);
    border: 1.5px solid var(--eg-border);
    font-size: 0.85rem;
    font-weight: 900;
    color: var(--eg-secondary);
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

html[data-bs-theme="dark"] .eg-cd-choice-order {
    background: rgba(255, 255, 255, 0.06);
    color: var(--eg-text);
}

.eg-cd-choice:hover .eg-cd-choice-order {
    border-color: var(--eg-primary);
    color: var(--eg-primary-dark);
}

.eg-cd-choice.is-active .eg-cd-choice-order {
    background: var(--eg-primary);
    border-color: var(--eg-primary);
    color: #fff;
    transform: scale(1.05);
}

.eg-cd-choice-label {
    flex: 1;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.45;
    color: var(--eg-text);
}

.eg-cd-choice.is-active .eg-cd-choice-label {
    color: var(--eg-primary-dark);
}

html[data-bs-theme="dark"] .eg-cd-choice.is-active .eg-cd-choice-label {
    color: var(--eg-primary-light);
}

.eg-cd-choice-check {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: var(--eg-primary);
    color: #fff;
    font-size: 0.95rem;
    animation: eg-cd-check-pop 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes eg-cd-check-pop {
    from { opacity: 0; transform: scale(0.4); }
    to { opacity: 1; transform: scale(1); }
}

.eg-cd-exam-footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1.1rem 1.75rem;
    border-top: 1px solid var(--eg-border);
}

.eg-cd-progress {
    flex: 1;
    min-width: 12rem;
}

.eg-cd-progress-text {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--eg-text-muted);
}

.eg-cd-progress-track {
    height: 0.5rem;
    border-radius: 2rem;
    background: var(--eg-border);
    overflow: hidden;
}

.eg-cd-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--eg-primary), var(--eg-primary-light));
    transition: width 0.4s ease;
}

.eg-cd-finalize {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1.6rem;
    border: none;
    border-radius: var(--eg-radius-sm);
    background: linear-gradient(135deg, var(--eg-primary) 0%, var(--eg-primary-dark) 100%);
    color: #fff;
    font-family: inherit;
    font-weight: 900;
    font-size: 0.92rem;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(243, 147, 24, 0.32);
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.eg-cd-finalize:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(243, 147, 24, 0.42);
}

.eg-cd-finalize:disabled { cursor: not-allowed; opacity: 0.85; }

.eg-cd-finalize .eg-cd-spinner {
    width: 1.1rem;
    height: 1.1rem;
    border-width: 2px;
}

/* ── Result modal ── */
.eg-cd-result {
    width: min(50rem, 94vw);
    height: 90vh;
    display: flex;
    flex-direction: column;
    background: var(--eg-surface);
    border: 2px solid var(--eg-border);
    border-radius: var(--eg-radius);
    box-shadow: var(--eg-shadow-lg);
    overflow: hidden;
}

.eg-cd-result-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.35rem 1.75rem;
    border-bottom: 1px solid var(--eg-border);
}

.eg-cd-result-id {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--eg-text-muted);
}

.eg-cd-result-id .dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
}

.eg-cd-result-id .dot.is-pass { background: var(--eg-success); box-shadow: 0 0 8px var(--eg-success); }
.eg-cd-result-id .dot.is-fail { background: var(--eg-danger); box-shadow: 0 0 8px var(--eg-danger); }

.eg-cd-result-header h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--eg-secondary);
}

html[data-bs-theme="dark"] .eg-cd-result-header h1 {
    color: var(--eg-primary-light);
}

.eg-cd-result-header p {
    margin: 0.15rem 0 0;
    font-size: 0.78rem;
    color: var(--eg-text-muted);
}

.eg-cd-result-scroll {
    flex: 1;
    overflow-y: auto;
}

.eg-cd-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    padding: 2rem 1.5rem;
    background: var(--eg-cream);
    border-bottom: 1px solid var(--eg-border);
}

.eg-cd-ring {
    position: relative;
    width: 8rem;
    height: 8rem;
}

.eg-cd-ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.eg-cd-ring .ring-bg { fill: none; stroke: var(--eg-border); stroke-width: 2.8; }
.eg-cd-ring .ring-fill { fill: none; stroke-width: 2.8; stroke-linecap: round; transition: stroke-dasharray 1s ease; }
.eg-cd-ring.is-pass .ring-fill { stroke: var(--eg-primary); }
.eg-cd-ring.is-fail .ring-fill { stroke: var(--eg-danger); }

.eg-cd-ring-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.eg-cd-ring-percent {
    font-size: 1.7rem;
    font-weight: 900;
    color: var(--eg-secondary);
}

html[data-bs-theme="dark"] .eg-cd-ring-percent {
    color: var(--eg-text);
}

.eg-cd-ring-status {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: var(--eg-text-muted);
}

.eg-cd-score-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.eg-cd-score-stat { text-align: center; }
.eg-cd-score-stat .label {
    display: block;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--eg-text-muted);
    margin-bottom: 0.25rem;
}
.eg-cd-score-stat .val {
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--eg-secondary);
}

html[data-bs-theme="dark"] .eg-cd-score-stat .val {
    color: var(--eg-primary-light);
}

.eg-cd-score-divider {
    width: 1px;
    height: 2rem;
    background: var(--eg-border);
}

.eg-cd-audit {
    padding: 1.75rem;
}

.eg-cd-audit-title {
    margin: 0 0 1.5rem;
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--eg-text-muted);
}

.eg-cd-node {
    display: flex;
    gap: 1rem;
    padding-bottom: 1.5rem;
}

.eg-cd-node-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 1.8rem;
}

.eg-cd-node-num {
    flex-shrink: 0;
    width: 1.8rem;
    height: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.72rem;
    font-weight: 900;
    color: #fff;
}

.eg-cd-node.is-success .eg-cd-node-num { background: var(--eg-success); }
.eg-cd-node.is-error .eg-cd-node-num { background: var(--eg-danger); }
.eg-cd-node.is-warn .eg-cd-node-num { background: var(--eg-text-muted); }

.eg-cd-node-line {
    width: 2px;
    flex: 1;
    margin-top: 0.5rem;
    background: var(--eg-border);
}

.eg-cd-node:last-child .eg-cd-node-line { display: none; }

.eg-cd-node-content { flex: 1; min-width: 0; }

.eg-cd-node-content h3 {
    margin: 0 0 0.85rem;
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--eg-secondary);
    line-height: 1.5;
}

html[data-bs-theme="dark"] .eg-cd-node-content h3 {
    color: var(--eg-text);
}

.eg-cd-node-options-label {
    display: block;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--eg-text-muted);
    margin-bottom: 0.5rem;
}

.eg-cd-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
}

.eg-cd-opt-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    border-radius: 2rem;
    background: var(--eg-cream);
    border: 1.5px solid var(--eg-border);
    font-size: 0.74rem;
}

.eg-cd-opt-pill .order {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 0.35rem;
    background: var(--eg-primary-soft);
    color: var(--eg-primary-dark);
    font-size: 0.62rem;
    font-weight: 900;
}

.eg-cd-opt-pill .text { color: var(--eg-text-muted); font-weight: 700; }

.eg-cd-opt-pill.is-correct {
    background: var(--eg-success-soft);
    border-color: rgba(31, 157, 97, 0.5);
}
.eg-cd-opt-pill.is-correct .order { background: var(--eg-success); color: #fff; }
.eg-cd-opt-pill.is-correct .text { color: var(--eg-success); }

.eg-cd-opt-pill.is-pick-correct { box-shadow: 0 0 0 2px rgba(31, 157, 97, 0.45); }

.eg-cd-opt-pill.is-wrong {
    background: var(--eg-danger-soft);
    border-color: rgba(214, 69, 69, 0.5);
}
.eg-cd-opt-pill.is-wrong .order { background: var(--eg-danger); color: #fff; }
.eg-cd-opt-pill.is-wrong .text { color: var(--eg-danger); }

.eg-cd-node-details {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: center;
}

.eg-cd-detail .dlabel {
    font-size: 0.64rem;
    font-weight: 800;
    color: var(--eg-text-muted);
    margin-inline-end: 0.35rem;
}

.eg-cd-detail .dval {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--eg-secondary);
}

html[data-bs-theme="dark"] .eg-cd-detail .dval {
    color: var(--eg-text);
}

.eg-cd-detail.is-correction .dval { color: var(--eg-primary-dark); }

html[data-bs-theme="dark"] .eg-cd-detail.is-correction .dval {
    color: var(--eg-primary-light);
}

.eg-cd-detail-warn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    border-radius: 2rem;
    background: var(--eg-danger-soft);
    color: var(--eg-danger);
    font-size: 0.7rem;
    font-weight: 800;
}

.eg-cd-node-status {
    flex-shrink: 0;
    font-size: 1.35rem;
}

.eg-cd-node.is-success .eg-cd-node-status { color: var(--eg-success); }
.eg-cd-node.is-error .eg-cd-node-status { color: var(--eg-danger); }
.eg-cd-node.is-warn .eg-cd-node-status { color: var(--eg-text-muted); }

/* ── Enrollment modal ── */
.eg-cd-enroll-modal {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 30rem;
    max-height: 92vh;
    background: var(--eg-surface);
    border: 2px solid var(--eg-border);
    border-radius: var(--eg-radius);
    box-shadow: var(--eg-shadow-lg);
    overflow: hidden;
}

.eg-cd-enroll-close {
    position: absolute;
    top: 1rem;
    inset-inline-end: 1rem;
    z-index: 3;
}

.eg-cd-enroll-hero {
    position: relative;
    overflow: hidden;
    padding: 2rem 1.5rem 1.5rem;
    text-align: center;
    background:
        radial-gradient(125% 120% at 50% -25%, var(--eg-primary-soft) 0%, transparent 60%),
        linear-gradient(160deg, rgba(70, 30, 56, 0.05), transparent 70%);
    border-bottom: 1px solid var(--eg-border);
}

.eg-cd-enroll-hero-glow {
    position: absolute;
    top: -45%;
    left: 50%;
    width: 18rem;
    height: 18rem;
    transform: translateX(-50%);
    background: radial-gradient(circle, var(--eg-primary-soft), transparent 70%);
    filter: blur(8px);
    pointer-events: none;
}

.eg-cd-enroll-orb {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    margin-bottom: 1rem;
    border-radius: 50%;
    color: #fff;
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--eg-primary), var(--eg-primary-dark));
    box-shadow: 0 12px 28px rgba(243, 147, 24, 0.4);
    animation: eg-cd-orb-float 3s ease-in-out infinite;
}

.eg-cd-enroll-orb::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid var(--eg-primary);
    opacity: 0.5;
    animation: eg-cd-orb-pulse 2.4s ease-out infinite;
}

@keyframes eg-cd-orb-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes eg-cd-orb-pulse {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(1.55); opacity: 0; }
}

.eg-cd-enroll-hero .eg-cd-pill {
    margin-bottom: 0.7rem;
}

.eg-cd-enroll-modal-title {
    margin: 0 0 0.4rem;
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--eg-secondary);
}

html[data-bs-theme="dark"] .eg-cd-enroll-modal-title {
    color: var(--eg-primary-light);
}

.eg-cd-enroll-modal-sub {
    margin: 0 auto;
    max-width: 22rem;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--eg-text-muted);
}

.eg-cd-enroll-hero {
    flex-shrink: 0;
}

.eg-cd-enroll-modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1.35rem 1.5rem 0.5rem;
}

/* ── Subscription guide / stepper ── */
.eg-cd-guide {
    margin-bottom: 1.3rem;
    padding: 1.1rem 1.15rem 1.2rem;
    background:
        radial-gradient(120% 120% at 100% 0%, var(--eg-primary-soft) 0%, transparent 55%),
        var(--eg-cream);
    border: 1.5px solid var(--eg-border);
    border-radius: var(--eg-radius);
}

.eg-cd-guide-head {
    margin-bottom: 1.1rem;
}

.eg-cd-guide-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.95rem;
    font-weight: 900;
    color: var(--eg-secondary);
}

.eg-cd-guide-kicker i {
    color: var(--eg-primary);
}

html[data-bs-theme="dark"] .eg-cd-guide-kicker {
    color: var(--eg-primary-light);
}

.eg-cd-guide-sub {
    margin: 0.35rem 0 0;
    font-size: 0.8rem;
    line-height: 1.55;
    font-weight: 600;
    color: var(--eg-text-muted);
}

.eg-cd-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: eg-cd-step;
}

.eg-cd-step {
    position: relative;
    display: grid;
    grid-template-columns: 2rem 2.4rem 1fr;
    align-items: start;
    gap: 0.75rem;
    padding-bottom: 1.15rem;
}

.eg-cd-step--last {
    padding-bottom: 0;
}

.eg-cd-step-rail {
    position: relative;
    display: flex;
    justify-content: center;
}

.eg-cd-step-num {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 900;
    color: #fff;
    background: linear-gradient(135deg, var(--eg-primary), var(--eg-primary-dark));
    box-shadow: 0 6px 14px rgba(243, 147, 24, 0.32);
}

.eg-cd-step:not(.eg-cd-step--last) .eg-cd-step-rail::after {
    content: "";
    position: absolute;
    top: 1.9rem;
    bottom: -1.15rem;
    width: 2px;
    background: linear-gradient(var(--eg-primary), var(--eg-border));
    opacity: 0.55;
}

.eg-cd-step-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 0.7rem;
    font-size: 1.05rem;
    color: var(--eg-primary-dark);
    background: var(--eg-surface);
    border: 1.5px solid var(--eg-border);
}

html[data-bs-theme="dark"] .eg-cd-step-icon {
    color: var(--eg-primary-light);
}

.eg-cd-step-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-top: 0.1rem;
}

.eg-cd-step-title {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--eg-text);
}

.eg-cd-step-desc {
    font-size: 0.8rem;
    line-height: 1.55;
    color: var(--eg-text-muted);
}

.eg-cd-guide-cta {
    margin-top: 1.2rem;
    padding-top: 1.1rem;
    border-top: 1px dashed var(--eg-border);
}

.eg-cd-guide-cta-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.7rem;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--eg-secondary);
}

.eg-cd-guide-cta-label i {
    color: var(--eg-primary);
}

html[data-bs-theme="dark"] .eg-cd-guide-cta-label {
    color: var(--eg-primary-light);
}

.eg-cd-guide-channels {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.eg-cd-guide-channel {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.8rem 0.45rem 0.55rem;
    border-radius: 2rem;
    background: var(--eg-surface);
    border: 1.5px solid var(--eg-border);
    color: var(--eg-text);
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.eg-cd-guide-channel:hover {
    transform: translateY(-2px);
    border-color: var(--eg-primary);
    box-shadow: var(--eg-shadow);
    color: var(--eg-secondary);
}

html[data-bs-theme="dark"] .eg-cd-guide-channel:hover {
    color: var(--eg-primary-light);
}

.eg-cd-guide-channel img,
.eg-cd-guide-channel > i {
    width: 1.5rem;
    height: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    object-fit: cover;
    background: var(--eg-primary-soft);
    color: var(--eg-primary-dark);
    font-size: 0.95rem;
}

.eg-cd-enroll-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.1rem;
    margin-bottom: 1.1rem;
    background: var(--eg-cream);
    border: 1.5px solid var(--eg-border);
    border-radius: var(--eg-radius-sm);
}

.eg-cd-enroll-summary-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--eg-primary-dark);
}

html[data-bs-theme="dark"] .eg-cd-enroll-summary-label {
    color: var(--eg-primary-light);
}

.eg-cd-enroll-summary-title {
    margin: 0.3rem 0 0;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.35;
    color: var(--eg-text);
}

.eg-cd-enroll-summary-price {
    flex-shrink: 0;
    text-align: center;
}

.eg-cd-enroll-summary-price .amount {
    display: block;
    font-size: 1.2rem;
    font-weight: 900;
    white-space: nowrap;
    color: var(--eg-secondary);
}

html[data-bs-theme="dark"] .eg-cd-enroll-summary-price .amount {
    color: var(--eg-primary-light);
}

.eg-cd-enroll-perks {
    list-style: none;
    display: grid;
    gap: 0.55rem;
    margin: 0 0 1.3rem;
    padding: 0;
}

.eg-cd-enroll-perks li {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--eg-text);
}

.eg-cd-enroll-perks li i {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 0.55rem;
    font-size: 0.85rem;
    color: var(--eg-primary-dark);
    background: var(--eg-primary-soft);
}

html[data-bs-theme="dark"] .eg-cd-enroll-perks li i {
    color: var(--eg-primary-light);
}

.eg-cd-input-wrap {
    position: relative;
}

.eg-cd-input-icon {
    position: absolute;
    top: 50%;
    inset-inline-start: 1rem;
    transform: translateY(-50%);
    font-size: 1rem;
    color: var(--eg-text-muted);
    pointer-events: none;
    transition: color 0.2s ease;
}

.eg-cd-input-wrap .eg-cd-input {
    padding-inline-start: 2.7rem;
}

.eg-cd-input-wrap:focus-within .eg-cd-input-icon {
    color: var(--eg-primary);
}

.eg-cd-enroll-secure-note {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin: 0;
    padding: 0 1.5rem 1.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--eg-text-muted);
}

.eg-cd-enroll-secure-note i {
    color: var(--eg-success);
}

.eg-cd-field-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--eg-text-muted);
}

.eg-cd-input {
    width: 100%;
    padding: 0.85rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    color: var(--eg-text);
    background: var(--eg-cream);
    border: 2px solid var(--eg-border);
    border-radius: var(--eg-radius-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.eg-cd-input::placeholder { color: var(--eg-text-muted); font-weight: 500; }

.eg-cd-input:focus {
    outline: none;
    border-color: var(--eg-primary);
    box-shadow: 0 0 0 4px var(--eg-primary-soft);
}

.eg-cd-enroll-modal-footer {
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    padding: 1rem 1.5rem;
}

.eg-cd-modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem 1.3rem;
    border-radius: var(--eg-radius-sm);
    border: none;
    font-family: inherit;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.25s ease, background 0.2s ease;
}

.eg-cd-modal-btn--ghost {
    background: var(--eg-cream);
    color: var(--eg-text-muted);
    border: 1.5px solid var(--eg-border);
}

.eg-cd-modal-btn--ghost:hover { color: var(--eg-secondary); border-color: var(--eg-primary); }

.eg-cd-modal-btn--primary {
    min-width: 9rem;
    background: linear-gradient(135deg, var(--eg-primary) 0%, var(--eg-primary-dark) 100%);
    color: #fff;
    box-shadow: 0 8px 20px rgba(243, 147, 24, 0.32);
}

.eg-cd-modal-btn--primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(243, 147, 24, 0.42);
}

.eg-cd-modal-btn--primary:disabled { cursor: not-allowed; opacity: 0.85; }

.eg-cd-modal-btn--primary .eg-cd-spinner {
    width: 1.05rem;
    height: 1.05rem;
    border-width: 2px;
}

/* ─────────────────────────  RESPONSIVE  ───────────────────────── */

@media (max-width: 991px) {
    .eg-cd-status-text-full { display: none; }
}

@media (max-width: 640px) {
    .eg-cd-video-stage { padding: 0.6rem; gap: 0.65rem; }
    .eg-cd-video-kicker { display: none; }
    .eg-cd-video-identity { padding: 0.35rem; }
    .eg-cd-video-frame { border-radius: var(--eg-radius-sm); }

    .eg-cd-exam, .eg-cd-result {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        border-radius: 0;
        border: none;
    }

    .eg-cd-exam-header, .eg-cd-result-header {
        padding: 1rem 1.1rem;
    }

    .eg-cd-exam-scroll { padding: 1rem; }
    .eg-cd-audit { padding: 1.1rem; }

    .eg-cd-exam-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .eg-cd-finalize { justify-content: center; }

    .eg-cd-enroll-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .eg-cd-enroll-summary-price { align-self: flex-start; }

    .eg-cd-enroll-modal-footer {
        flex-direction: column-reverse;
    }

    .eg-cd-enroll-modal-footer .eg-cd-modal-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .eg-cd-hero,
    .eg-cd-aside,
    .eg-cd-lessons,
    .eg-cd-enroll-shimmer,
    .eg-cd-status.is-enrolled .dot,
    .eg-cd-video-live .dot,
    .eg-cd-enroll-orb,
    .eg-cd-enroll-orb::after {
        animation: none !important;
    }
}

.eg-cd-watch-progress {
    margin: 0.75rem 0 0.25rem;
}

.eg-cd-watch-progress-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    justify-content: space-between;
    font-size: 0.82rem;
    opacity: 0.85;
    margin-bottom: 0.35rem;
}

.eg-cd-watch-completed {
    color: #1f9d55;
    font-weight: 700;
}

.eg-cd-watch-bar {
    height: 6px;
    border-radius: 999px;
    background: rgba(0,0,0,0.08);
    overflow: hidden;
}

[data-bs-theme='dark'] .eg-cd-watch-bar {
    background: rgba(255,255,255,0.12);
}

.eg-cd-watch-bar > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #f97316, #fb923c);
}

.eg-cd-resume-modal .eg-cd-enroll-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0 1.25rem 1.5rem;
}
