/**
 * ViewMath Academy — Lesson Viewer Styles v4.0
 *
 * Fixed-viewport card stepper: top (header+progress+nav), middle (scrollable card).
 * Nav bar lives in the top area so it's always visible.
 * Gamification: XP badge, confetti, cheer toasts.
 * BEM: .vm-lesson__*
 */

/* ══════════════════════════════════════════════════════════
   FLUSH SECTION (no padding when viewing a specific lesson)
   ══════════════════════════════════════════════════════════ */
.vm-section--flush {
    padding: 0 !important;
}

/* ══════════════════════════════════════════════════════════
   STEPPER ROOT
   ══════════════════════════════════════════════════════════ */
.vm-lesson__stepper {
    max-width: 720px;
    margin: 0 auto;
    padding: 0;
}

/* ══════════════════════════════════════════════════════════
   VIEWPORT — fixed-height window layout
   ══════════════════════════════════════════════════════════ */
.vm-lesson__viewport {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);    /* full screen minus site header */
    min-height: 500px;
    position: relative;
    overflow: hidden;
}

/* ── Top: header + progress + nav (fixed) ────────────────── */
.vm-lesson__top {
    flex-shrink: 0;
    padding: 0.6rem var(--vm-sp-3, 1rem) 0;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 50%, #dbeafe 100%);
    border-bottom: 2px solid var(--vm-primary, #4f46e5);
    box-shadow: 0 2px 12px rgba(79, 70, 229, 0.10);
}

/* ── Breadcrumb row ──────────────────────────────────────── */
.vm-lesson__breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding-bottom: 0.3rem;
    margin-bottom: 0.3rem;
    border-bottom: 1px solid rgba(79, 70, 229, 0.15);
    font-size: 0.78rem;
}

.vm-lesson__breadcrumb-link {
    color: var(--vm-primary, #4f46e5);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s ease;
}

.vm-lesson__breadcrumb-link:hover {
    color: #4338ca;
    text-decoration: underline;
}

.vm-lesson__breadcrumb-sep {
    color: var(--vm-text-muted, #9ca3af);
    font-weight: 400;
}

/* ── Quiz header variant (standalone, not in viewport) ──── */
.vm-lesson__top--quiz {
    max-width: 720px;
    margin: 0 auto var(--vm-sp-3, 1rem);
    border-radius: var(--vm-radius, 10px);
    padding: 0.6rem 1rem 0.5rem;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 50%, #dbeafe 100%);
    border-bottom: 2px solid var(--vm-primary, #4f46e5);
    box-shadow: 0 2px 12px rgba(79, 70, 229, 0.10);
}

.vm-lesson__top--quiz .vm-lesson__breadcrumb {
    border-bottom-color: rgba(79, 70, 229, 0.15);
    margin-bottom: 0.3rem;
    padding-bottom: 0.3rem;
}

.vm-lesson__top--quiz .vm-lesson__header {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.vm-lesson__top--quiz .vm-lesson__meta {
    margin-bottom: 0.15rem;
    gap: 0.35rem;
}

.vm-lesson__top--quiz .vm-lesson__grade-badge {
    background: var(--vm-primary, #4f46e5);
    color: #fff;
}

.vm-lesson__top--quiz .vm-lesson__chapter-badge {
    background: rgba(79, 70, 229, 0.15);
    color: var(--vm-primary, #4f46e5);
}

.vm-lesson__top--quiz .vm-lesson__title {
    font-size: 1.05rem;
    margin: 0.1rem 0 0;
    line-height: 1.3;
    color: var(--vm-text, #1e293b);
}

/* ── Middle: scrollable card area ────────────────────────── */
.vm-lesson__middle {
    flex: 1;
    overflow-y: auto;
    padding: var(--vm-sp-3, 1rem);
    position: relative;
    -webkit-overflow-scrolling: touch;
}

/* ── Nav bar (inside top) ─────────────────────────────────── */
.vm-lesson__nav-bar {
    display: flex;
    align-items: center;
    gap: var(--vm-sp-2, 0.5rem);
    padding: var(--vm-sp-2, 0.75rem) 0;
}
.vm-lesson__loading,
.vm-lesson__error {
    text-align: center;
    padding: var(--vm-sp-6, 4rem) var(--vm-sp-4, 2rem);
    color: var(--vm-text-muted, #6b7280);
}

.vm-lesson__error p {
    margin-bottom: var(--vm-sp-3, 1rem);
    font-size: 1.1rem;
}

/* ── Lesson list ──────────────────────────────────────────── */
.vm-lesson__list-title {
    margin-bottom: var(--vm-sp-4, 2rem);
    font-size: 1.75rem;
}

.vm-lesson__chapter {
    margin-bottom: var(--vm-sp-5, 3rem);
}

.vm-lesson__chapter-title {
    font-size: 1.25rem;
    margin-bottom: var(--vm-sp-3, 1rem);
    padding-bottom: var(--vm-sp-2, 0.5rem);
    border-bottom: 2px solid var(--vm-border-light, #e5e7eb);
    color: var(--vm-text, #1f2937);
}

.vm-lesson__topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--vm-sp-3, 1rem);
}

.vm-lesson__topic-card {
    display: flex;
    align-items: center;
    gap: var(--vm-sp-2, 0.5rem);
    padding: var(--vm-sp-3, 1rem) var(--vm-sp-4, 1.5rem);
    background: #fff;
    border: 1px solid var(--vm-border-light, #e5e7eb);
    border-radius: var(--vm-radius, 10px);
    text-decoration: none;
    color: var(--vm-text, #1f2937);
    transition: box-shadow var(--vm-dur, 0.2s) var(--vm-ease, ease),
                border-color var(--vm-dur, 0.2s) var(--vm-ease, ease);
}

.vm-lesson__topic-card:hover {
    border-color: var(--vm-primary, #4f46e5);
    box-shadow: var(--vm-shadow-sm, 0 2px 8px rgba(0,0,0,.08));
}

.vm-lesson__topic-num {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--vm-primary-lt, #eef2ff);
    color: var(--vm-primary, #4f46e5);
    border-radius: var(--vm-radius-sm, 6px);
    font-weight: 700;
    font-size: 0.875rem;
}

.vm-lesson__topic-name {
    flex: 1;
    font-weight: 500;
}

.vm-lesson__topic-arrow {
    color: var(--vm-text-muted, #9ca3af);
    font-size: 1.25rem;
}

/* ══════════════════════════════════════════════════════════
   LESSON HEADER
   ══════════════════════════════════════════════════════════ */
.vm-lesson__header {
    margin-bottom: 0.25rem;
    padding-bottom: 0.25rem;
    border-bottom: none;
}

.vm-lesson__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.15rem;
}

.vm-lesson__grade-badge,
.vm-lesson__chapter-badge,
.vm-lesson__standard {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: var(--vm-radius-sm, 6px);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.vm-lesson__grade-badge {
    background: var(--vm-primary, #4f46e5);
    color: #fff;
}

.vm-lesson__chapter-badge {
    background: rgba(79, 70, 229, 0.15);
    color: var(--vm-primary, #4f46e5);
}

.vm-lesson__standard {
    background: var(--vm-bg-alt, #f3f4f6);
    color: var(--vm-text-muted, #6b7280);
}

.vm-lesson__title {
    font-size: 1.25rem;
    line-height: 1.3;
    margin: 0.15rem 0 0.1rem;
}

.vm-lesson__subtitle {
    color: var(--vm-text-muted, #6b7280);
    font-size: 0.85rem;
    margin: 0;
}

/* ══════════════════════════════════════════════════════════
   PROGRESS ROW (progress bar + XP badge)
   ══════════════════════════════════════════════════════════ */
.vm-lesson__progress-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: var(--vm-sp-1, 0.25rem);
}

.vm-lesson__progress {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.vm-lesson__progress-bar {
    flex: 1;
    height: 8px;
    background: var(--vm-border-light, #e5e7eb);
    border-radius: 4px;
    overflow: hidden;
}

.vm-lesson__progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #06b6d4);
    border-radius: 4px;
    transition: width 0.4s ease;
    width: 0%;
}

.vm-lesson__progress-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--vm-text-muted, #6b7280);
    white-space: nowrap;
}

/* ── XP Badge ──────────────────────────────────────────── */
.vm-lesson__xp-badge {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem 0.6rem;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #f59e0b;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #92400e;
    white-space: nowrap;
    transition: transform 0.3s ease;
}

.vm-lesson__xp-badge--pop {
    transform: scale(1.2);
}

/* ── Step Label ────────────────────────────────────────── */
.vm-lesson__step-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: var(--vm-sp-1, 0.25rem) 0 var(--vm-sp-2, 0.5rem);
}

.vm-lesson__step-label-icon {
    font-size: 1.1rem;
}

.vm-lesson__step-label-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--vm-text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ══════════════════════════════════════════════════════════
   CARDS  (only active card visible)
   ══════════════════════════════════════════════════════════ */
.vm-lesson__card {
    display: none;
    animation: vmCardFadeIn 0.3s ease;
}

.vm-lesson__card--active {
    display: block;
}

@keyframes vmCardFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════
   NAV BAR  (dots between prev/next — inside top)
   ══════════════════════════════════════════════════════════ */
.vm-lesson__nav-dots {
    flex: 1;
    display: flex;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
    overflow: hidden;
    max-height: 24px;
}

.vm-lesson__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid var(--vm-border, #d1d5db);
    background: #fff;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.vm-lesson__dot:hover {
    border-color: var(--vm-primary, #4f46e5);
}

.vm-lesson__dot--active {
    background: var(--vm-primary, #4f46e5);
    border-color: var(--vm-primary, #4f46e5);
    transform: scale(1.4);
}

.vm-lesson__dot--done {
    background: var(--vm-primary, #4f46e5);
    border-color: var(--vm-primary, #4f46e5);
    opacity: 0.45;
}

.vm-lesson__nav-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.55rem 1rem;
    border: 2px solid var(--vm-primary, #4f46e5);
    border-radius: var(--vm-radius, 10px);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.vm-lesson__nav-btn--prev {
    background: #fff;
    color: var(--vm-primary, #4f46e5);
}

.vm-lesson__nav-btn--prev:hover:not(:disabled) {
    background: var(--vm-primary-lt, #eef2ff);
}

.vm-lesson__nav-btn--next {
    background: var(--vm-primary, #4f46e5);
    color: #fff;
}

.vm-lesson__nav-btn--next:hover:not(:disabled) {
    background: #4338ca;
}

.vm-lesson__nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.vm-lesson__nav-arrow {
    font-size: 1rem;
}

/* ══════════════════════════════════════════════════════════
   CHEER TOAST
   ══════════════════════════════════════════════════════════ */
.vm-lesson__cheer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 2px solid #f59e0b;
    color: #92400e;
    padding: 0.5rem 1.5rem;
    border-radius: 24px;
    font-size: 1.1rem;
    font-weight: 700;
    z-index: 10;
    pointer-events: none;
    animation: vmCheerPop 2s ease forwards;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

@keyframes vmCheerPop {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    15%  { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    30%  { transform: translate(-50%, -50%) scale(1); }
    80%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -60%) scale(0.9); }
}

/* ══════════════════════════════════════════════════════════
   CONFETTI
   ══════════════════════════════════════════════════════════ */
.vm-lesson__confetti {
    position: absolute;
    top: -10px;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    z-index: 20;
    pointer-events: none;
    animation: vmConfettiFall linear forwards;
}

@keyframes vmConfettiFall {
    0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ══════════════════════════════════════════════════════════
   BLOCK BASE
   ══════════════════════════════════════════════════════════ */
.vm-lesson__block {
    margin-bottom: 0;
    padding: var(--vm-sp-4, 1.5rem);
    background: #fff;
    border: 1px solid var(--vm-border-light, #e5e7eb);
    border-radius: var(--vm-radius, 10px);
    position: relative;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.vm-lesson__block h3 {
    font-size: 1.2rem;
    margin: 0 0 var(--vm-sp-2, 0.5rem);
}

.vm-lesson__block h4 {
    font-size: 1.05rem;
    margin: var(--vm-sp-3, 1rem) 0 var(--vm-sp-2, 0.5rem);
}

.vm-lesson__block p {
    margin: 0 0 var(--vm-sp-2, 0.5rem);
    line-height: 1.65;
}

.vm-lesson__block ul,
.vm-lesson__block ol {
    margin: 0 0 var(--vm-sp-2, 0.5rem);
    padding-left: 1.5rem;
}

.vm-lesson__block li {
    margin-bottom: 0.35rem;
    line-height: 1.6;
}

.vm-lesson__block-icon {
    font-size: 1.5rem;
    margin-bottom: var(--vm-sp-2, 0.5rem);
}

/* ══════════════════════════════════════════════════════════
   BLOCK VARIANTS
   ══════════════════════════════════════════════════════════ */

/* Goals */
.vm-lesson__goals {
    border-left: 4px solid var(--vm-primary, #4f46e5);
    background: var(--vm-primary-lt, #eef2ff);
}

/* Conversation */
.vm-lesson__conversation {
    background: var(--vm-bg-alt, #f9fafb);
    padding: var(--vm-sp-3, 1rem);
}

.vm-lesson__chat {
    display: flex;
    flex-direction: column;
    margin-bottom: var(--vm-sp-2, 0.5rem);
}

.vm-lesson__chat--left {
    align-items: flex-start;
}

.vm-lesson__chat--right {
    align-items: flex-end;
}

.vm-lesson__chat-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--vm-text-muted, #6b7280);
    margin-bottom: 0.15rem;
    padding: 0 0.5rem;
}

.vm-lesson__chat-bubble {
    max-width: 80%;
    padding: 0.6rem 1rem;
    border-radius: var(--vm-radius, 10px);
    line-height: 1.5;
}

.vm-lesson__chat--left .vm-lesson__chat-bubble {
    background: #fff;
    border: 1px solid var(--vm-border-light, #e5e7eb);
}

.vm-lesson__chat--right .vm-lesson__chat-bubble {
    background: var(--vm-primary, #4f46e5);
    color: #fff;
}

/* Concept */
.vm-lesson__concept {
    border-left: 4px solid var(--vm-accent, #0ea5e9);
}

.vm-lesson__concept-summary {
    font-weight: 600;
    background: var(--vm-bg-alt, #f3f4f6);
    padding: var(--vm-sp-2, 0.5rem) var(--vm-sp-3, 1rem);
    border-radius: var(--vm-radius-sm, 6px);
    margin-top: var(--vm-sp-2, 0.5rem);
}

/* Vocab */
.vm-lesson__vocab {
    border-left: 4px solid #8b5cf6;
    background: #f5f3ff;
}

.vm-lesson__vocab dl {
    margin: 0;
}

.vm-lesson__vocab dt {
    font-weight: 700;
    margin-top: var(--vm-sp-2, 0.5rem);
    color: #7c3aed;
}

.vm-lesson__vocab dd {
    margin: 0.15rem 0 0 1rem;
    color: var(--vm-text, #1f2937);
}

/* Tip */
.vm-lesson__tip {
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
}

/* Example */
.vm-lesson__example {
    border-left: 4px solid var(--vm-success, #10b981);
    background: #f0fdf4;
}

.vm-lesson__steps {
    padding-left: 1.2rem;
}

.vm-lesson__steps li {
    margin-bottom: 0.5rem;
}

.vm-lesson__answer-box {
    background: #dcfce7;
    padding: var(--vm-sp-2, 0.5rem) var(--vm-sp-3, 1rem);
    border-radius: var(--vm-radius-sm, 6px);
    margin-top: var(--vm-sp-2, 0.5rem);
}

/* Try It */
.vm-lesson__tryit {
    border-left: 4px solid #06b6d4;
    background: #ecfeff;
}

/* Real World */
.vm-lesson__realworld {
    border-left: 4px solid #14b8a6;
    background: #f0fdfa;
}

/* Explore */
.vm-lesson__explore {
    border-left: 4px solid #6366f1;
    background: #eef2ff;
}

.vm-lesson__followup {
    margin-top: var(--vm-sp-3, 1rem);
    padding-top: var(--vm-sp-3, 1rem);
    border-top: 1px dashed var(--vm-border-light, #e5e7eb);
}

/* Error Box */
.vm-lesson__errorbox {
    border-left: 4px solid var(--vm-danger, #ef4444);
    background: #fef2f2;
}

.vm-lesson__scenario {
    font-style: italic;
    background: #fee2e2;
    padding: var(--vm-sp-2, 0.5rem) var(--vm-sp-3, 1rem);
    border-radius: var(--vm-radius-sm, 6px);
}

/* Summary */
.vm-lesson__summary {
    border-left: 4px solid var(--vm-primary, #4f46e5);
    background: var(--vm-primary-lt, #eef2ff);
}

/* Challenge */
.vm-lesson__challenge {
    border-left: 4px solid #f97316;
    background: #fff7ed;
}

/* Encouragement */
.vm-lesson__encouragement {
    text-align: center;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-color: #f59e0b;
    font-size: 1.15rem;
    font-weight: 600;
}

/* Riddle */
.vm-lesson__riddle {
    border-left: 4px solid #a855f7;
    background: #faf5ff;
}

.vm-lesson__riddle-q {
    font-weight: 700;
    font-size: 1.05rem;
}

/* Math Rule */
.vm-lesson__rule {
    border-left: 4px solid #0ea5e9;
    background: #f0f9ff;
}

.vm-lesson__formula {
    text-align: center;
    padding: var(--vm-sp-3, 1rem);
    font-size: 1.1rem;
    background: #fff;
    border-radius: var(--vm-radius-sm, 6px);
    margin: var(--vm-sp-2, 0.5rem) 0;
}

.vm-lesson__rule-detail {
    text-align: center;
    color: var(--vm-text-muted, #6b7280);
}

/* Steps Box */
.vm-lesson__stepsbox {
    border-left: 4px solid #10b981;
}

/* Compare Box */
.vm-lesson__compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--vm-sp-3, 1rem);
    padding: 0;
}

.vm-lesson__compare-col {
    padding: var(--vm-sp-3, 1rem);
    border-radius: var(--vm-radius-sm, 6px);
}

.vm-lesson__compare-col:first-child {
    background: #f0fdf4;
}

.vm-lesson__compare-col:last-child {
    background: #fef2f2;
}

/* Pattern Box */
.vm-lesson__pattern {
    border-left: 4px solid #8b5cf6;
}

.vm-lesson__pattern-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--vm-sp-2, 0.5rem) 0;
}

.vm-lesson__pattern-table th,
.vm-lesson__pattern-table td {
    padding: 0.5rem 1rem;
    border: 1px solid var(--vm-border-light, #e5e7eb);
    text-align: left;
}

.vm-lesson__pattern-table th {
    background: var(--vm-bg-alt, #f3f4f6);
    font-weight: 600;
}

.vm-lesson__pattern-rules {
    margin-top: var(--vm-sp-3, 1rem);
    padding: var(--vm-sp-2, 0.5rem) var(--vm-sp-3, 1rem);
    background: #f5f3ff;
    border-radius: var(--vm-radius-sm, 6px);
}

/* Warning */
.vm-lesson__warning {
    border-left: 4px solid var(--vm-danger, #ef4444);
    background: #fef2f2;
}

/* Fun Fact */
.vm-lesson__funfact {
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
}

/* Story Problem */
.vm-lesson__story {
    border-left: 4px solid #0284c7;
    background: #f0f9ff;
}

/* ══════════════════════════════════════════════════════════
   PLACE VALUE TABLE
   ══════════════════════════════════════════════════════════ */
.vm-lesson__pv-table {
    width: auto;
    margin: var(--vm-sp-2, 0.5rem) auto;
    border-collapse: collapse;
    text-align: center;
}

.vm-lesson__pv-table th,
.vm-lesson__pv-table td {
    padding: 0.5rem 1.5rem;
    border: 1px solid var(--vm-border-light, #e5e7eb);
}

.vm-lesson__pv-table th {
    background: var(--vm-primary-lt, #eef2ff);
    color: var(--vm-primary, #4f46e5);
    font-weight: 600;
}

.vm-lesson__pv-digit {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--vm-primary, #4f46e5);
}

.vm-lesson__pv-value {
    color: var(--vm-text-muted, #6b7280);
    font-size: 0.9rem;
}

/* ══════════════════════════════════════════════════════════
   BASE TEN BLOCKS
   ══════════════════════════════════════════════════════════ */
.vm-lesson__base-ten {
    display: flex;
    gap: var(--vm-sp-4, 2rem);
    justify-content: center;
    margin: var(--vm-sp-3, 1rem) 0;
    flex-wrap: wrap;
}

.vm-lesson__base-ten-group {
    text-align: center;
}

.vm-lesson__base-ten-count {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--vm-primary, #4f46e5);
}

.vm-lesson__base-ten-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--vm-text-muted, #6b7280);
    margin-bottom: 0.35rem;
}

.vm-lesson__base-ten-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    justify-content: center;
    max-width: 80px;
}

.vm-lesson__base-ten-icon {
    display: inline-block;
    border-radius: 2px;
}

.vm-lesson__base-ten-icon--hundred {
    width: 24px;
    height: 24px;
    background: var(--vm-primary, #4f46e5);
    opacity: 0.7;
}

.vm-lesson__base-ten-icon--ten {
    width: 6px;
    height: 24px;
    background: var(--vm-accent, #0ea5e9);
    opacity: 0.8;
}

.vm-lesson__base-ten-icon--one {
    width: 8px;
    height: 8px;
    background: var(--vm-success, #10b981);
    border-radius: 50%;
}

/* ══════════════════════════════════════════════════════════
   INTERACTIVE QUESTIONS
   ══════════════════════════════════════════════════════════ */
.vm-lesson__iq-list {
    display: flex;
    flex-direction: column;
    gap: var(--vm-sp-2, 0.5rem);
}

.vm-lesson__iq {
    padding: var(--vm-sp-2, 0.5rem) 0;
}

.vm-lesson__iq-prompt {
    font-weight: 500;
    margin-bottom: 0.35rem;
}

/* ══════════════════════════════════════════════════════════
   REVEAL / SHOW ANSWER
   ══════════════════════════════════════════════════════════ */
.vm-lesson__reveal {
    margin-top: 0.35rem;
}

.vm-lesson__reveal-btn {
    font-size: 0.8rem;
}

.vm-lesson__reveal-content {
    margin-top: var(--vm-sp-2, 0.5rem);
    padding: var(--vm-sp-2, 0.5rem) var(--vm-sp-3, 1rem);
    background: #dcfce7;
    border-radius: var(--vm-radius-sm, 6px);
    animation: vmLessonFadeIn 0.2s ease;
}

@keyframes vmLessonFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════
   PRACTICE SET
   ══════════════════════════════════════════════════════════ */
.vm-lesson__practice {
    border-left: 4px solid var(--vm-primary, #4f46e5);
}

.vm-lesson__practice-section {
    margin-bottom: var(--vm-sp-3, 1rem);
    padding: var(--vm-sp-3, 1rem);
    border-radius: var(--vm-radius-sm, 6px);
    background: var(--vm-bg-alt, #f9fafb);
}

.vm-lesson__practice-section--blue   { background: #eff6ff; }
.vm-lesson__practice-section--orange { background: #fff7ed; }
.vm-lesson__practice-section--purple { background: #faf5ff; }
.vm-lesson__practice-section--teal   { background: #f0fdfa; }
.vm-lesson__practice-section--green  { background: #f0fdf4; }

.vm-lesson__practice-instr {
    font-style: italic;
    color: var(--vm-text-muted, #6b7280);
    margin-bottom: var(--vm-sp-2, 0.5rem);
}

.vm-lesson__problem-list {
    padding-left: 1.2rem;
}

.vm-lesson__problem {
    margin-bottom: var(--vm-sp-3, 1rem);
    padding-bottom: var(--vm-sp-2, 0.5rem);
    border-bottom: 1px solid var(--vm-border-light, #e5e7eb);
}

.vm-lesson__problem:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* True/False */
.vm-lesson__tf-choices {
    display: flex;
    gap: var(--vm-sp-2, 0.5rem);
    margin-top: 0.35rem;
}

.vm-lesson__tf-btn,
.vm-lesson__mc-btn {
    padding: 0.4rem 1.2rem;
    border: 2px solid var(--vm-border, #d1d5db);
    border-radius: var(--vm-radius-sm, 6px);
    background: #fff;
    cursor: pointer;
    font-weight: 500;
    transition: all var(--vm-dur, 0.2s) var(--vm-ease, ease);
}

.vm-lesson__tf-btn:hover:not(.vm-lesson__tf-btn--answered),
.vm-lesson__mc-btn:hover:not(.vm-lesson__mc-btn--answered) {
    border-color: var(--vm-primary, #4f46e5);
    background: var(--vm-primary-lt, #eef2ff);
}

.vm-lesson__tf-btn--correct,
.vm-lesson__mc-btn--correct {
    border-color: var(--vm-success, #10b981) !important;
    background: #dcfce7 !important;
    color: #166534;
}

.vm-lesson__tf-btn--wrong,
.vm-lesson__mc-btn--wrong {
    border-color: var(--vm-danger, #ef4444) !important;
    background: #fee2e2 !important;
    color: #991b1b;
}

.vm-lesson__tf-btn--answered,
.vm-lesson__mc-btn--answered {
    cursor: default;
    opacity: 0.85;
}

/* Multiple choice */
.vm-lesson__mc-choices {
    display: flex;
    flex-direction: column;
    gap: var(--vm-sp-2, 0.5rem);
    margin-top: 0.35rem;
}

/* ══════════════════════════════════════════════════════════
   QUIZ CTA  (final card — celebration!)
   ══════════════════════════════════════════════════════════ */
.vm-lesson__quiz-cta {
    padding: var(--vm-sp-5, 3rem) var(--vm-sp-4, 2rem);
    background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
    border: 2px solid var(--vm-primary, #2563eb);
    border-radius: var(--vm-radius, 12px);
    text-align: center;
}

.vm-lesson__quiz-cta-xp {
    font-size: 1.1rem;
    color: #92400e;
    margin: 0 0 var(--vm-sp-2, 0.5rem);
}

.vm-lesson__quiz-cta-icon {
    color: var(--vm-primary, #2563eb);
    margin-bottom: var(--vm-sp-2, 0.5rem);
}

.vm-lesson__quiz-cta-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--vm-text, #1e293b);
    margin: 0 0 var(--vm-sp-2, 0.5rem);
}

.vm-lesson__quiz-cta-text {
    color: var(--vm-text-muted, #64748b);
    margin: 0 0 var(--vm-sp-3, 1rem);
    font-size: 0.95rem;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */

/* Tablet */
@media (max-width: 768px) {
    .vm-lesson__viewport {
        height: calc(100vh - 80px);
    }

    .vm-lesson__top {
        padding: var(--vm-sp-2, 0.5rem) var(--vm-sp-2, 0.5rem) 0;
    }

    .vm-lesson__middle {
        padding: var(--vm-sp-2, 0.5rem);
    }

    .vm-lesson__title {
        font-size: 1.15rem;
    }

    .vm-lesson__nav-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    .vm-lesson__quiz-cta {
        padding: var(--vm-sp-4, 2rem) var(--vm-sp-3, 1rem);
    }
}

/* Phone */
@media (max-width: 640px) {
    .vm-lesson__viewport {
        height: calc(100vh - 60px);
        min-height: 400px;
    }

    .vm-lesson__top {
        padding: var(--vm-sp-1, 0.25rem) var(--vm-sp-2, 0.5rem) 0;
    }

    .vm-lesson__middle {
        padding: var(--vm-sp-2, 0.5rem);
    }

    .vm-lesson__nav-bar {
        padding: var(--vm-sp-1, 0.25rem) 0;
    }

    .vm-lesson__header {
        margin-bottom: var(--vm-sp-1, 0.25rem);
        padding-bottom: var(--vm-sp-1, 0.25rem);
    }

    .vm-lesson__title {
        font-size: 1rem;
        margin: 0.1rem 0 0.05rem;
    }

    .vm-lesson__subtitle {
        font-size: 0.85rem;
    }

    .vm-lesson__block {
        padding: var(--vm-sp-3, 1rem);
        border-radius: var(--vm-radius-sm, 6px);
    }

    .vm-lesson__compare {
        grid-template-columns: 1fr;
    }

    .vm-lesson__topic-grid {
        grid-template-columns: 1fr;
    }

    .vm-lesson__chat-bubble {
        max-width: 90%;
    }

    .vm-lesson__base-ten {
        gap: var(--vm-sp-3, 1rem);
    }

    .vm-lesson__dot {
        width: 6px;
        height: 6px;
    }

    .vm-lesson__nav-dots {
        gap: 4px;
    }

    .vm-lesson__nav-btn {
        padding: 0.45rem 0.6rem;
        font-size: 0.78rem;
        border-radius: var(--vm-radius-sm, 6px);
    }

    .vm-lesson__xp-badge {
        font-size: 0.7rem;
        padding: 0.15rem 0.5rem;
    }

    .vm-lesson__step-label-text {
        font-size: 0.7rem;
    }

    .vm-lesson__quiz-cta {
        padding: var(--vm-sp-3, 1rem);
    }

    .vm-lesson__quiz-cta-title {
        font-size: 1.1rem;
    }

    .vm-lesson__pv-table th,
    .vm-lesson__pv-table td {
        padding: 0.35rem 0.75rem;
    }

    .vm-lesson__pv-digit {
        font-size: 1.35rem;
    }
}
