/* ═══════════════════════════════════════════════════════
   Course Manager — Stylesheet
   ═══════════════════════════════════════════════════════ */

/* ── Reset / base ───────────────────────────────────── */
#cm-wrapper *,
#cm-wrapper *::before,
#cm-wrapper *::after {
    box-sizing: border-box;
}

#cm-wrapper {
    display: flex;
    gap: 0;
    min-height: 80vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
    color: #1a1a2e;
    background: #f4f7fb;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,.10);
    max-width: 1200px;
    margin: 40px auto;
}

/* ── Sidebar ────────────────────────────────────────── */
#cm-sidebar {
    width: 280px;
    min-width: 280px;
    background: #36604e;
    color: #fff;
    padding: 32px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cm-sidebar-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #a8c7fa;
    margin: 0 0 8px;
    padding: 0;
}

/* ── Lesson list ────────────────────────────────────── */
.cm-lesson-list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
}

.cm-lesson-item {
    border-radius: 10px;
    margin-bottom: 4px;
    transition: background .2s;
}

.cm-lesson-item.cm-active {
    background: rgba(255,255,255,.12);
}

.cm-lesson-link {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    text-decoration: none;
    color: #e0eaff;
    border-radius: 10px;
    font-size: 15px;
    line-height: 1.4;
    transition: background .2s, color .2s;
}

.cm-lesson-link:hover:not(.cm-lesson-link--locked) {
    background: rgba(255,255,255,.18);
    color: #fff;
}

.cm-lesson-link--locked {
    cursor: default;
    opacity: .45;
}

.cm-lesson-icon {
    font-size: 1rem;
    line-height: 1.4;
    flex-shrink: 0;
}

.cm-lesson-label {
    flex: 1;
}

.cm-lesson-item.cm-completed .cm-lesson-link { color: #b9fbc0; }
.cm-lesson-item.cm-active .cm-lesson-link    { color: #fff; font-weight: 600; }

/* ── Progress bar ───────────────────────────────────── */
.cm-progress-wrap {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,.12);
}

.cm-progress-label {
    font-size: .78rem;
    color: #a8c7fa;
    display: block;
    margin-bottom: 6px;
}

.cm-progress-bar-bg {
    background: rgba(255,255,255,.15);
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}

.cm-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #43e97b, #38f9d7);
    border-radius: 999px;
    transition: width .6s ease;
}

/* ── Main content ───────────────────────────────────── */
#cm-main {
    flex: 1;
    overflow-y: auto;
    padding: 40px 48px;
    background: #f4f7fb;
}

/* ── Lesson content ─────────────────────────────────── */
.cm-lesson-header {
    margin-bottom: 24px;
}

.cm-lesson-badge {
    display: inline-block;
    background: #e8f0fe;
    color: #1a73e8;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 999px;
    margin-bottom: 10px;
}

.cm-lesson-title {
    font-size: 30px;
    font-weight: 800;
    color: #36604e;
    margin: 0;
    padding: 0;
    line-height: 1.25;
}

.cm-lesson-body {
    font-size: 17px;
    line-height: 1.75;
    color: #374151;
    background: #fff;
    border-radius: 12px;
    padding: 28px 32px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    margin-bottom: 32px;
}

.cm-lesson-body h3 {
    color: #36604e;
    margin-top: 28px;
    margin-bottom: 10px;
    font-size: 22px;
    font-weight: 700;
}

.cm-lesson-body ul, .cm-lesson-body ol {
    padding-left: 24px;
}

.cm-lesson-body blockquote {
    border-left: 4px solid #1a73e8;
    margin: 20px 0;
    padding: 12px 20px;
    background: #e8f0fe;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #1a5fbd;
}

/* ── Quiz section ───────────────────────────────────── */
#cm-quiz-section {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

.cm-quiz-header {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f4ff;
}

.cm-quiz-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: #36604e;
    margin: 0 0 6px;
    padding: 0;
}

.cm-quiz-subtitle {
    color: #6b7280;
    font-size: .9rem;
    margin: 0;
}

/* ── Questions ──────────────────────────────────────── */
.cm-question {
    margin-bottom: 28px;
    padding: 20px 24px;
    background: #f9fbff;
    border-radius: 10px;
    border: 1px solid #e4ecfb;
    transition: border-color .3s;
}

.cm-question.cm-correct-q  { border-color: #34d399; background: #f0fdf4; }
.cm-question.cm-wrong-q    { border-color: #f87171; background: #fff5f5; }

.cm-question-text {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 14px;
}

.cm-q-num {
    color: #1a73e8;
    margin-right: 4px;
}

.cm-options {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cm-option-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1.5px solid #d1d9f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: .93rem;
    transition: background .2s, border-color .2s;
    background: #fff;
}

.cm-option-label:hover {
    background: #eef2ff;
    border-color: #a5b4fc;
}

.cm-option-label.cm-selected {
    border-color: #1a73e8;
    background: #e8f0fe;
}

.cm-option-label.cm-answer-correct {
    border-color: #10b981;
    background: #d1fae5;
}

.cm-option-label.cm-answer-wrong {
    border-color: #ef4444;
    background: #fee2e2;
}

.cm-option-radio {
    display: none;
}

.cm-option-key {
    font-weight: 700;
    color: #374151;
    min-width: 20px;
}

/* ── Quiz footer ────────────────────────────────────── */
.cm-quiz-footer {
    margin-top: 28px;
    display: flex;
    justify-content: flex-end;
}

/* ── Buttons ────────────────────────────────────────── */
.cm-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: transform .15s, box-shadow .15s;
}

.cm-btn:hover    { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.cm-btn:active   { transform: translateY(0); }

.cm-btn-primary {
    background: linear-gradient(135deg, #1a73e8, #36604e);
    color: #fff;
}

.cm-btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

/* ── Results panel ──────────────────────────────────── */
#cm-quiz-results {
    margin-top: 28px;
    padding: 24px;
    border-radius: 12px;
    animation: cm-fade-in .4s ease;
}

#cm-quiz-results.cm-result-pass  { background: #ecfdf5; border: 2px solid #10b981; }
#cm-quiz-results.cm-result-fail  { background: #fff5f5; border: 2px solid #ef4444; }

.cm-result-headline {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0 0 6px;
}

.cm-result-pass  .cm-result-headline { color: #065f46; }
.cm-result-fail  .cm-result-headline { color: #991b1b; }

.cm-result-score {
    font-size: 1rem;
    color: #374151;
    margin-bottom: 20px;
}

.cm-result-details { margin: 0 0 20px; }
.cm-result-item    { padding: 6px 0; font-size: .9rem; color: #374151; }
.cm-result-item span { font-weight: 600; }

.cm-result-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ── Already passed notice ──────────────────────────── */
.cm-quiz-passed-notice {
    text-align: center;
    padding: 40px 20px;
}

.cm-notice-icon { font-size: 3rem; margin-bottom: 12px; }

.cm-quiz-passed-notice h3 {
    font-size: 1.3rem;
    color: #065f46;
    margin-bottom: 20px;
}

.cm-congrats {
    font-size: 1.1rem;
    font-weight: 700;
    color: #36604e;
}

/* ── Loading spinner ────────────────────────────────── */
.cm-spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 3px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cm-spin .7s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes cm-spin   { to { transform: rotate(360deg); } }
@keyframes cm-fade-in { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform: translateY(0); } }

/* ── Take Quiz button ───────────────────────────────── */
.cm-take-quiz-wrap {
    text-align: center;
    padding: 32px 40px 8px;
}
.cm-take-quiz-wrap .cm-btn-primary {
    font-size: 16px;
    padding: 14px 44px;
}

/* Quiz hidden by default — revealed by button click */
#cm-quiz-section {
    display: none !important;
}
#cm-quiz-section.cm-quiz-open {
    display: block !important;
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 820px) {
    #cm-wrapper { flex-direction: column; border-radius: 0; margin: 0; }
    #cm-sidebar { width: 100%; min-width: unset; }
    #cm-main    { padding: 24px 20px; }
    .cm-lesson-body { padding: 20px; }
    #cm-quiz-section { padding: 20px; }
}

/* ═══════════════════════════════════════════════════════
   Level groups in sidebar
   ═══════════════════════════════════════════════════════ */

.cm-level-group {
    margin-bottom: 6px;
}

.cm-level-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    transition: background .2s;
    color: #fff;
}
.cm-level-header:hover {
    background: rgba(255,255,255,.12);
}
.cm-level-group.cm-level-active > .cm-level-header {
    background: rgba(255,255,255,.18);
}
.cm-level-group.cm-level-locked > .cm-level-header {
    cursor: default;
    opacity: .45;
}

.cm-level-icon  { font-size: 1rem; flex-shrink: 0; }
.cm-level-title { flex: 1; font-weight: 700; font-size: 17px; }
.cm-level-chevron { font-size: 11px; color: rgba(255,255,255,.6); }

/* Lesson list inside level — hidden by default, shown for active level */
.cm-lesson-list {
    display: none;
    list-style: none;
    margin: 0 0 4px;
    padding: 0 0 0 12px;
}
.cm-lesson-list.cm-level-open {
    display: block;
}

/* Login gate */
.cm-login-gate {
    text-align: center;
    padding: 60px 40px;
    background: #f9fbf9;
    border: 2px dashed #d4e4da;
    border-radius: 12px;
    margin-bottom: 32px;
}
.cm-login-gate-icon { font-size: 48px; margin-bottom: 16px; }
.cm-login-gate-msg  { font-size: 18px; color: #374151; margin-bottom: 24px; font-weight: 500; }

/* Login popup */
#cm-login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}
#cm-login-modal {
    background: #fff;
    border-radius: 16px;
    padding: 48px 40px 40px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    animation: cm-fade-in .25s ease;
}
#cm-login-modal-close {
    position: absolute;
    top: 14px; right: 16px;
    background: none; border: none;
    font-size: 18px; cursor: pointer;
    color: #9ca3af; padding: 4px 8px;
    border-radius: 6px; transition: background .2s, color .2s;
}
#cm-login-modal-close:hover { background: #f3f4f6; color: #374151; }
.cm-modal-icon  { font-size: 48px; margin-bottom: 12px; }
.cm-modal-title { font-size: 22px; font-weight: 800; color: #1a3328; margin: 0 0 10px; }
.cm-modal-msg   { color: #6b7280; font-size: 15px; line-height: 1.6; margin-bottom: 28px; }
.cm-modal-login-btn { width: 100%; justify-content: center; font-size: 16px; padding: 14px; }

/* Reveal answers button */
.cm-btn-reveal {
    background: transparent;
    border: 2px solid #36604e;
    color: #36604e;
}
.cm-btn-reveal:hover { background: #e8f0ec; }

/* ═══════════════════════════════════════════════════════
   Level Completion Modal
   ═══════════════════════════════════════════════════════ */

#cm-level-complete-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .65);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#cm-level-complete-modal {
    background: #fff;
    border-radius: 24px;
    padding: 56px 48px 48px;
    max-width: 460px;
    width: 100%;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 32px 80px rgba(0, 0, 0, .25);
    animation: cm-lc-pop .4s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes cm-lc-pop {
    from { opacity: 0; transform: scale(.7); }
    to   { opacity: 1; transform: scale(1); }
}

/* Confetti container */
.cm-lc-confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.cm-confetti-piece {
    position: absolute;
    top: -10px;
    width: var(--size, 8px);
    height: var(--size, 8px);
    border-radius: 2px;
    animation: cm-confetti-fall 1.8s var(--delay, 0s) ease-in forwards;
}

@keyframes cm-confetti-fall {
    0%   { transform: translateX(0) translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateX(var(--x, 0)) translateY(420px) rotate(var(--rot, 360deg)); opacity: 0; }
}

/* Badge */
.cm-lc-badge {
    font-size: 64px;
    line-height: 1;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
    animation: cm-lc-bounce .6s .3s cubic-bezier(.34,1.56,.64,1) both;
}

@keyframes cm-lc-bounce {
    from { transform: scale(0) rotate(-15deg); }
    to   { transform: scale(1) rotate(0deg); }
}

.cm-lc-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #36604e;
    margin: 0 0 6px;
    position: relative;
    z-index: 1;
}

.cm-lc-title {
    font-size: 26px;
    font-weight: 800;
    color: #1a3328;
    margin: 0 0 24px;
    line-height: 1.2;
    position: relative;
    z-index: 1;
}

/* Score grid */
.cm-lc-score {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

.cm-lc-score-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.cm-lc-score-num {
    font-size: 28px;
    font-weight: 800;
    color: #36604e;
    line-height: 1;
}

.cm-lc-score-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.cm-lc-divider {
    height: 1px;
    background: #e8f0ec;
    margin: 0 0 24px;
    position: relative;
    z-index: 1;
}

/* Actions */
.cm-lc-actions {
    position: relative;
    z-index: 1;
}

.cm-lc-next-btn {
    width: 100%;
    justify-content: center;
    font-size: 17px;
    padding: 16px 24px;
    border-radius: 12px;
}

@media (max-width: 480px) {
    #cm-level-complete-modal { padding: 40px 24px 32px; }
    .cm-lc-title             { font-size: 22px; }
    .cm-lc-badge             { font-size: 52px; }
}

/* ═══════════════════════════════════════════════════════
   Course Completion Modal
   ═══════════════════════════════════════════════════════ */

#cm-course-complete-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .75);
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#cm-course-complete-modal {
    background: linear-gradient(160deg, #1a3328 0%, #36604e 60%, #2a4d3e 100%);
    border-radius: 28px;
    padding: 64px 52px 52px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 40px 100px rgba(0, 0, 0, .45);
    animation: cm-lc-pop .45s cubic-bezier(.34, 1.56, .64, 1);
}

/* Close button */
#cm-course-complete-close {
    position: absolute;
    top: 16px; right: 18px;
    background: rgba(255,255,255,.15);
    border: none;
    color: rgba(255,255,255,.8);
    font-size: 16px;
    width: 32px; height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s;
    z-index: 2;
}
#cm-course-complete-close:hover { background: rgba(255,255,255,.28); color: #fff; }

/* Confetti sits inside modal */
.cm-cc-confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

/* Stars row */
.cm-cc-stars {
    font-size: 28px;
    letter-spacing: 8px;
    margin-bottom: 12px;
    position: relative;
    z-index: 2;
    animation: cm-lc-bounce .5s .2s cubic-bezier(.34,1.56,.64,1) both;
}

/* Trophy */
.cm-cc-trophy {
    font-size: 80px;
    line-height: 1;
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
    animation: cm-lc-bounce .6s .35s cubic-bezier(.34,1.56,.64,1) both;
    filter: drop-shadow(0 8px 24px rgba(0,0,0,.3));
}

/* Headline */
.cm-cc-headline {
    font-size: 32px;
    font-weight: 900;
    color: #fff;
    margin: 0 0 10px;
    line-height: 1.15;
    position: relative;
    z-index: 2;
    text-shadow: 0 2px 12px rgba(0,0,0,.2);
}

/* Subline */
.cm-cc-subline {
    font-size: 17px;
    color: rgba(255,255,255,.8);
    margin: 0 0 32px;
    line-height: 1.5;
    position: relative;
    z-index: 2;
}

/* Date */
.cm-cc-date-wrap {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 14px;
    padding: 16px 32px;
    position: relative;
    z-index: 2;
    backdrop-filter: blur(4px);
}

.cm-cc-date-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(255,255,255,.6);
}

.cm-cc-date {
    font-size: 20px;
    font-weight: 800;
    color: #a8d5b5;
    letter-spacing: .02em;
}

@media (max-width: 480px) {
    #cm-course-complete-modal { padding: 48px 28px 40px; }
    .cm-cc-trophy             { font-size: 64px; }
    .cm-cc-headline           { font-size: 26px; }
}

/* ═══════════════════════════════════════════════════════
   State Banners
   ═══════════════════════════════════════════════════════ */

.cm-state-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    border-radius: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.cm-banner-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.cm-banner-text {
    flex: 1;
    min-width: 200px;
    font-size: 14px;
    line-height: 1.5;
}

.cm-banner-text strong {
    display: block;
    font-size: 15px;
    margin-bottom: 2px;
}

.cm-banner-text a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

/* Visitor — neutral blue-grey */
.cm-banner-visitor {
    background: #f0f4ff;
    border: 1px solid #c7d4f5;
    color: #374151;
}
.cm-banner-visitor .cm-banner-text a { color: #3b5bdb; }

/* Logged in, not enrolled — warm amber */
.cm-banner-loggedin {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #78350f;
}

/* Enrolled — green */
.cm-banner-enrolled {
    background: #e8f0ec;
    border: 1px solid #a8d5b5;
    color: #1a3328;
}

/* Enroll button in banner */
.cm-btn-enroll {
    background: linear-gradient(135deg, #36604e, #1a3328);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity .2s;
}
.cm-btn-enroll:hover { opacity: .88; }

/* Disabled completion buttons */
.cm-btn-disabled {
    opacity: .45;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* Inline hint beneath disabled button */
.cm-action-hint {
    margin: 8px 0 0;
    font-size: 13px;
    color: #6b7280;
}
.cm-action-hint a,
.cm-link-btn {
    color: #36604e;
    font-weight: 600;
    text-decoration: underline;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
}

/* Progress bar locked state */
.cm-progress-locked .cm-progress-label { color: rgba(255,255,255,.4); font-style: italic; }
.cm-progress-locked .cm-progress-bar-bg { opacity: .3; }

/* ═══════════════════════════════════════════════════════
   Enrollment Modal
   ═══════════════════════════════════════════════════════ */

#cm-enroll-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#cm-enroll-modal {
    background: #fff;
    border-radius: 20px;
    padding: 48px 44px 44px;
    max-width: 520px;
    width: 100%;
    position: relative;
    box-shadow: 0 24px 72px rgba(0,0,0,.22);
    animation: cm-lc-pop .3s cubic-bezier(.34,1.56,.64,1);
    max-height: 90vh;
    overflow-y: auto;
}

#cm-enroll-close {
    position: absolute;
    top: 14px; right: 16px;
    background: none; border: none;
    font-size: 18px; cursor: pointer;
    color: #9ca3af; padding: 4px 8px;
    border-radius: 6px; transition: background .2s, color .2s;
}
#cm-enroll-close:hover { background: #f3f4f6; color: #374151; }

.cm-enroll-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 12px;
}

.cm-enroll-title {
    font-size: 22px;
    font-weight: 800;
    color: #1a3328;
    text-align: center;
    margin: 0 0 12px;
    line-height: 1.25;
}

.cm-enroll-intro {
    font-size: 15px;
    color: #374151;
    text-align: center;
    line-height: 1.6;
    margin-bottom: 20px;
}

.cm-enroll-terms {
    background: #f9fbf9;
    border: 1px solid #d4e4da;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 28px;
    font-size: 14px;
    color: #374151;
    line-height: 1.65;
}

.cm-enroll-terms p { margin: 0 0 10px; }
.cm-enroll-terms p:last-child { margin-bottom: 0; }

.cm-enroll-terms ul {
    margin: 8px 0 12px 20px;
    padding: 0;
}

.cm-enroll-terms ul li {
    margin-bottom: 6px;
}

.cm-enroll-agree {
    width: 100%;
    justify-content: center;
    font-size: 16px;
    padding: 15px 24px;
    border-radius: 12px;
}

@media (max-width: 480px) {
    #cm-enroll-modal { padding: 40px 24px 32px; }
    .cm-enroll-title { font-size: 19px; }
    .cm-state-banner { gap: 12px; }
    .cm-btn-enroll   { width: 100%; text-align: center; margin-top: 4px; }
}

/* ═══════════════════════════════════════════════════════
   Lesson Completion Button States
   ═══════════════════════════════════════════════════════ */

/* Base complete button — replaces cm-btn-primary for lesson actions */
.cm-btn-complete {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: background .2s, opacity .2s, transform .15s, box-shadow .2s;
    position: relative;
    overflow: hidden;
}

/* 🔒 State 1 — Visitor / not enrolled (faded, tooltip on hover) */
.cm-btn-disabled.cm-btn-complete {
    background: #e8f0ec;
    color: #9ab8a8;
    cursor: not-allowed;
    pointer-events: auto; /* keep for tooltip */
    box-shadow: none;
}
.cm-btn-disabled.cm-btn-complete:hover {
    opacity: 1; /* let tooltip show, no other change */
}

/* 🔒 State 2 — Enrolled, previous lesson incomplete */
.cm-btn-prev-locked {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
    border: 2px dashed #d1d5db;
}

.cm-hint-locked {
    color: #ef4444 !important;
    font-weight: 600;
}

/* 🟢 State 3 — Active, ready to complete */
.cm-btn-active-complete {
    background: linear-gradient(135deg, #36604e, #1a3328);
    color: #fff;
    box-shadow: 0 4px 14px rgba(54,96,78,.35);
}
.cm-btn-active-complete:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(54,96,78,.4);
}
.cm-btn-active-complete:active {
    transform: translateY(0);
}

/* Ripple/pulse on active button */
.cm-btn-active-complete::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(255,255,255,.25) 0%, transparent 70%);
    opacity: 0;
    transition: opacity .3s;
}
.cm-btn-active-complete:hover::after { opacity: 1; }

/* ⏳ Confirming state — mid-animation */
.cm-btn-confirming {
    background: linear-gradient(135deg, #1a3328, #36604e);
    color: #fff;
    cursor: wait;
    animation: cm-btn-pulse 0.7s ease infinite;
}

@keyframes cm-btn-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .75; }
}

.cm-btn-check-anim {
    display: inline-block;
    animation: cm-check-pop .3s cubic-bezier(.34,1.56,.64,1);
}

@keyframes cm-check-pop {
    from { transform: scale(0) rotate(-20deg); opacity: 0; }
    to   { transform: scale(1) rotate(0deg);   opacity: 1; }
}

/* ✅ State 4 — Done / locked */
.cm-btn-done {
    background: #e8f0ec;
    color: #36604e;
    cursor: default;
    border: 2px solid #a8d5b5;
    box-shadow: none;
    font-weight: 700;
}

/* Tooltip styling (native title attr, enhanced via CSS) */
.cm-btn-complete[title] {
    position: relative;
}

/* Progress bar smooth transition */
.cm-progress-bar-fill {
    transition: width .6s cubic-bezier(.4,0,.2,1) !important;
}

/* ═══════════════════════════════════════════════════════
   Master Progress Tracker
   ═══════════════════════════════════════════════════════ */

.cm-master-progress {
    background: #fff;
    border: 1px solid #d4e4da;
    border-radius: 16px;
    padding: 28px 32px 20px;
    margin-bottom: 28px;
    overflow-x: auto;
}

/* One row per level */
.cm-mpt-row {
    display: grid;
    grid-template-columns: 160px 1fr auto;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid #e8f0ec;
    transition: opacity .3s;
}
.cm-mpt-row:last-of-type { border-bottom: none; }

.cm-mpt-row--locked { opacity: .45; }

/* Level label */
.cm-mpt-level-label {
    font-size: 13px;
    font-weight: 700;
    color: #36604e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cm-mpt-row--locked .cm-mpt-level-label { color: #9ca3af; }

/* Track: dots + connectors */
.cm-mpt-track {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: nowrap;
}

/* Connector line between dots */
.cm-mpt-connector {
    flex: 1;
    height: 3px;
    background: #e8f0ec;
    min-width: 8px;
    border-radius: 2px;
    transition: background .4s;
}
.cm-mpt-connector--done { background: #36604e; }

/* Individual lesson dot */
.cm-mpt-dot {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
    text-decoration: none;
    transition: background .3s, border-color .3s, transform .2s, box-shadow .2s;
    position: relative;
    border: 2.5px solid #d4e4da;
    background: #f9fbf9;
    color: #9ab8a8;
}

.cm-mpt-dot:hover:not(.cm-mpt-dot--locked):not(.cm-mpt-dot--done) {
    transform: scale(1.12);
    box-shadow: 0 4px 12px rgba(54,96,78,.2);
    border-color: #36604e;
    color: #36604e;
}

/* Done dot */
.cm-mpt-dot--done {
    background: #36604e;
    border-color: #36604e;
    color: #fff;
    box-shadow: 0 2px 8px rgba(54,96,78,.3);
}
.cm-mpt-dot--done .cm-mpt-dot-inner {
    animation: cm-dot-pop .35s cubic-bezier(.34,1.56,.64,1);
}

@keyframes cm-dot-pop {
    from { transform: scale(0) rotate(-30deg); }
    to   { transform: scale(1) rotate(0deg); }
}

/* Current active dot */
.cm-mpt-dot--current {
    border-color: #36604e;
    color: #36604e;
    background: #e8f0ec;
    box-shadow: 0 0 0 4px rgba(54,96,78,.15);
    animation: cm-dot-pulse 2s ease infinite;
}

@keyframes cm-dot-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(54,96,78,.15); }
    50%       { box-shadow: 0 0 0 7px rgba(54,96,78,.08); }
}

/* Locked dot */
.cm-mpt-dot--locked {
    opacity: .35;
    cursor: not-allowed;
    pointer-events: none;
}

/* Level badge */
.cm-mpt-badge {
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    color: #9ab8a8;
    min-width: 120px;
    text-align: right;
    padding: 5px 10px;
    border-radius: 20px;
    border: 1.5px solid #e8f0ec;
    background: #f9fbf9;
    transition: all .4s;
}

.cm-mpt-badge--done {
    background: #e8f0ec;
    border-color: #a8d5b5;
    color: #1a3328;
    font-size: 12px;
}

.cm-mpt-badge-progress {
    color: #36604e;
}

/* Final completion row */
.cm-mpt-final {
    margin-top: 20px;
    padding: 14px 20px;
    border-radius: 10px;
    text-align: center;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .04em;
    background: #f3f4f6;
    color: #9ca3af;
    border: 2px dashed #e5e7eb;
    transition: all .5s;
}

.cm-mpt-final--done {
    background: linear-gradient(135deg, #e8f0ec, #d4e4da);
    border: 2px solid #a8d5b5;
    color: #1a3328;
    font-size: 17px;
    animation: cm-final-glow 1s ease;
}

@keyframes cm-final-glow {
    0%   { box-shadow: 0 0 0 0 rgba(54,96,78,.4); }
    50%  { box-shadow: 0 0 0 12px rgba(54,96,78,.1); }
    100% { box-shadow: 0 0 0 0 rgba(54,96,78,0); }
}

/* Permanence note */
.cm-mpt-permanence {
    margin: 12px 0 0;
    font-size: 12px;
    color: #9ab8a8;
    text-align: center;
    font-style: italic;
}

/* Responsive */
@media (max-width: 640px) {
    .cm-master-progress { padding: 20px 16px 16px; }
    .cm-mpt-row         { grid-template-columns: 100px 1fr auto; gap: 10px; }
    .cm-mpt-dot         { width: 28px; height: 28px; font-size: 11px; }
    .cm-mpt-badge       { min-width: 80px; font-size: 11px; padding: 4px 8px; }
    .cm-mpt-level-label { font-size: 12px; }
}

@media (max-width: 480px) {
    .cm-mpt-row         { grid-template-columns: 1fr; gap: 8px; }
    .cm-mpt-level-label { font-size: 13px; }
    .cm-mpt-badge       { text-align: left; }
}