.mastery-roadmap-container {
    background: var(--ql-bg);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--ql-border);
    position: relative;
    overflow: hidden;
}

.roadmap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px dashed var(--ql-border);
}

.roadmap-header h2 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--ql-text);
    margin: 0;
}

.mastery-stats {
    display: flex;
    align-items: center;
    gap: 15px;
}

.progress-bar-outer {
    width: 150px;
    height: 10px;
    background: var(--ql-bg-alt);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-inner {
    height: 100%;
    background: linear-gradient(90deg, var(--ql-primary), var(--ql-accent));
    border-radius: 10px;
    transition: width 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.roadmap-path {
    position: relative;
    padding: 40px 0;
    min-height: 250px;
}

.roadmap-svg-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.nodes-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 40px 80px;
    position: relative;
    z-index: 2;
}

.chapter-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100px;
    cursor: pointer;
    transition: transform 0.3s;
}

.chapter-node:hover {
    transform: translateY(-5px) scale(1.05);
}

.node-circle {
    width: 60px;
    height: 60px;
    background: var(--ql-bg-alt);
    border: 4px solid var(--ql-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    position: relative;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    z-index: 2;
    transition: all 0.3s;
}

.node-label {
    margin-top: 12px;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--ql-text);
    text-align: center;
    max-width: 120px;
}

/* Success State */
.chapter-node.mastered .node-circle {
    background: rgba(var(--ql-success-rgb, 16, 185, 129), 0.1);
    border: 4px solid var(--ql-success, #10b981);
    color: var(--ql-success, #10b981);
}

/* Active/Current State */
.chapter-node.in_progress .node-circle {
    background: rgba(var(--ql-primary-rgb), 0.1);
    border: 4px solid var(--ql-primary);
    animation: nodePulse 2s infinite;
}

.node-pulse {
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-radius: 50%;
    border: 2px solid var(--ql-primary);
    opacity: 0;
}

.chapter-node.in_progress .node-pulse {
    animation: pulseRing 2s infinite;
}

/* Locked State */
.chapter-node.locked {
    filter: grayscale(1);
    opacity: 0.4;
    cursor: not-allowed;
}

@keyframes nodePulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes pulseRing {
    0% {
        transform: scale(0.95);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Path Line Connection */
.roadmap-line {
    fill: none;
    stroke: var(--ql-border);
    stroke-width: 5;
    stroke-linecap: round;
    stroke-dasharray: 8, 12;
}

.roadmap-line.active {
    stroke: var(--ql-primary);
    stroke-dasharray: 0;
}

/* ──── Toast Notifications ──── */
.k12-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #1e293b;
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 10px;
}

.k12-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.k12-toast.success {
    border-bottom: 3px solid #10b981;
}

.k12-toast.badge {
    border-bottom: 3px solid #fbbf24;
    background: #92400e;
}

/* ──── Level Up Modal ──── */
.k12-levelup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
}

.k12-levelup-card {
    background: white;
    width: 350px;
    padding: 40px;
    border-radius: 30px;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: levelPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.levelup-icon {
    font-size: 5rem;
    margin-bottom: 20px;
}

.k12-levelup-card h2 {
    color: #4f46e5;
    margin: 0;
    font-size: 1.5rem;
    letter-spacing: 2px;
}

.new-level {
    font-size: 8rem;
    font-weight: 900;
    line-height: 1;
    color: #1e293b;
    margin: 20px 0;
}

.k12-levelup-card button {
    background: #4f46e5;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-weight: 800;
    cursor: pointer;
    width: 100%;
    transition: transform 0.2s;
}

.k12-levelup-card button:hover {
    transform: scale(1.05);
}

.tutor-mini-speech {
    animation: speechSlide 0.5s ease-out;
}

@keyframes speechSlide {
    from {
        transform: translateX(-30px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.k12-fact-cool-btn:hover {
    background: #4dabf7 !important;
    color: white !important;
    transform: scale(1.02);
}

.k12-fact-cool-btn:disabled {
    cursor: default;
    opacity: 0.8;
}

@keyframes levelPop {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}