/* ============================================
   OUDIFY — Learn Page & Lesson Runner
   Skill tree, exercise UI, and lesson flow
   ============================================ */

/* ─── Skill Tree (v2 — Unit Path) ─── */
.skill-tree {
    max-width: 640px;
    margin: 0 auto;
    padding: var(--space-4) 0 var(--space-12);
}

/* Course Plan Summary Card */
.course-plan-card {
    padding: var(--space-4);
    margin-bottom: var(--space-6);
    border-radius: var(--radius-lg);
}

.course-plan-card__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2);
}

.course-plan-card__label {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.course-plan-card__goal {
    font-size: var(--text-xs);
    color: var(--accent-primary);
    font-weight: 600;
}

.course-plan-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.course-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    background: rgba(212, 165, 116, 0.1);
    border: 1px solid rgba(212, 165, 116, 0.25);
    color: var(--accent-primary);
    font-size: var(--text-xs);
    font-weight: 600;
}

/* ─── Daily Challenge Card ─── */
.daily-challenge {
    margin-bottom: var(--space-4);
    padding: var(--space-5);
}

.daily-challenge__header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.daily-challenge__icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.daily-challenge__info {
    flex: 1;
}

.daily-challenge__title {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.daily-challenge__name {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--text-primary);
}

.daily-challenge__bonus {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, rgba(250, 204, 21, 0.2), rgba(249, 115, 22, 0.15));
    border: 1px solid rgba(250, 204, 21, 0.3);
    color: #facc15;
    font-size: var(--text-xs);
    font-weight: 700;
    white-space: nowrap;
}

.daily-challenge__desc {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

.daily-challenge__btn {
    width: 100%;
}

.daily-challenge__btn:disabled {
    opacity: 0.7;
    cursor: default;
    color: #4ade80 !important;
    border-color: rgba(74, 222, 128, 0.2) !important;
}

/* Unit Badges */
.unit-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: var(--radius-full);
    margin-left: var(--space-2);
    vertical-align: middle;
}

.unit-badge--skip {
    background: rgba(120, 120, 140, 0.2);
    color: var(--text-muted);
    border: 1px solid rgba(120, 120, 140, 0.3);
}

.unit-badge--emph {
    background: rgba(212, 165, 116, 0.15);
    color: var(--accent-primary);
    border: 1px solid rgba(212, 165, 116, 0.3);
}

/* Tier Banner */
.tier-banner {
    text-align: center;
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-primary);
    padding: var(--space-2) var(--space-4);
    margin: var(--space-6) 0 var(--space-3);
    background: linear-gradient(90deg, transparent, rgba(212, 165, 116, 0.1), transparent);
    border-radius: var(--radius-full);
}

.tier-banner:first-child {
    margin-top: 0;
}

/* Unit Card */
.unit-card {
    border-radius: var(--radius-xl);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    backdrop-filter: blur(16px);
    margin-bottom: var(--space-3);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.unit-card__header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.unit-card__header:hover {
    background: rgba(255, 255, 255, 0.02);
}

.unit-card__icon {
    font-size: 1.6rem;
    flex-shrink: 0;
}

.unit-card__info {
    flex: 1;
    min-width: 0;
}

.unit-card__name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.unit-card__desc {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unit-card__progress {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    flex-shrink: 0;
    color: var(--text-muted);
}

.unit-card__bar {
    width: 60px;
    height: 5px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.unit-card__bar-fill {
    height: 100%;
    background: var(--accent-primary);
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

.unit-card__lock,
.unit-card__check {
    font-size: 1rem;
    flex-shrink: 0;
    margin-left: var(--space-2);
}

/* Lessons container — hidden by default, shown when expanded */
.unit-card__lessons {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 var(--space-4);
}

.unit-card--expanded .unit-card__lessons {
    max-height: 2000px;
    padding: 0 var(--space-4) var(--space-4);
}

/* States */
.unit-card--locked {
    opacity: 0.45;
    filter: grayscale(0.5);
}

.unit-card--locked .unit-card__header {
    cursor: default;
}

.unit-card--done {
    border-color: rgba(74, 222, 128, 0.2);
}

.unit-card--active {
    border-color: rgba(212, 165, 116, 0.25);
}

/* ─── Lesson Node ─── */
.lesson-node {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    margin-bottom: 2px;
}

.lesson-node:hover:not(.lesson-node--locked) {
    background: rgba(212, 165, 116, 0.06);
}

.lesson-node__marker {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 700;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid var(--border-glass);
    color: var(--text-muted);
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.lesson-node__body {
    flex: 1;
    min-width: 0;
}

.lesson-node__name {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
}

.lesson-node__meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: 2px;
}

.lesson-node__crowns {
    display: inline-flex;
    gap: 2px;
    font-size: 0.55rem;
}

.crown-dot {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.55rem;
}

.crown-dot--filled {
    font-size: 0.65rem;
}

.crown-dot--empty {
    color: var(--text-muted);
    opacity: 0.35;
}

.lesson-node__lock {
    font-size: 0.75rem;
    flex-shrink: 0;
    margin-left: var(--space-2);
}

/* Lesson states */
.lesson-node--locked {
    opacity: 0.35;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.lesson-node--current .lesson-node__marker {
    border-color: var(--accent-primary);
    background: rgba(212, 165, 116, 0.15);
    color: var(--accent-primary);
    animation: pulse-glow 2s ease-in-out infinite;
}

.lesson-node--done .lesson-node__marker {
    border-color: var(--success);
    background: rgba(74, 222, 128, 0.12);
    color: var(--success);
}

.lesson-node--maxed .lesson-node__marker {
    border-color: #fbbf24;
    background: rgba(251, 191, 36, 0.12);
    color: #fbbf24;
}

/* Exam node */
.lesson-node--exam {
    margin-top: var(--space-2);
}

.lesson-node--exam .lesson-node__marker {
    background: rgba(212, 165, 116, 0.08);
    border-style: dashed;
}

.lesson-node--exam.lesson-node--done .lesson-node__marker,
.lesson-node--exam.lesson-node--current .lesson-node__marker {
    border-style: solid;
}

/* ─── Skill Decay Visual States ─── */
.lesson-node--decay-warning .lesson-node__marker {
    border-color: #f59e0b;
    opacity: 0.85;
    animation: decay-pulse 2.5s ease-in-out infinite;
}

.lesson-node--decay-weak .lesson-node__marker {
    border-color: #f97316;
    opacity: 0.7;
    animation: decay-pulse 2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(249, 115, 22, 0.3);
}

.lesson-node--decay-critical .lesson-node__marker {
    border-color: var(--error);
    opacity: 0.55;
    animation: decay-pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
    filter: grayscale(0.3);
}

@keyframes decay-pulse {

    0%,
    100% {
        opacity: 0.55;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.04);
    }
}

/* ─── Review Needed Section ─── */
.review-needed {
    padding: var(--space-4);
    margin-bottom: var(--space-5);
    border-left: 3px solid #f59e0b;
}

.review-needed__header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.review-needed__icon {
    font-size: 1.2rem;
}

.review-needed__title {
    font-weight: 600;
    color: #f59e0b;
    font-size: var(--text-sm);
}

.review-needed__count {
    margin-left: auto;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.review-needed__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.review-needed__item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.review-needed__item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.review-needed__bar {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    flex-shrink: 0;
}

.review-needed__bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease;
}

.review-needed__bar-fill--warning {
    background: #f59e0b;
}

.review-needed__bar-fill--weak {
    background: #f97316;
}

.review-needed__bar-fill--critical {
    background: var(--error);
}

.review-needed__name {
    flex: 1;
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.review-needed__pct {
    font-size: var(--text-xs);
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
}

.review-needed__item--warning .review-needed__pct {
    color: #f59e0b;
}

.review-needed__item--weak .review-needed__pct {
    color: #f97316;
}

.review-needed__item--critical .review-needed__pct {
    color: var(--error);
}

.review-item--clickable {
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.review-item--clickable:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(4px);
}

.review-needed__arrow {
    font-size: var(--text-sm);
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s;
}

.review-item--clickable:hover .review-needed__arrow {
    opacity: 1;
}

.review-needed__all {
    margin-top: var(--space-3);
    width: 100%;
    font-size: var(--text-sm);
    color: var(--accent-primary);
    border-color: rgba(212, 165, 116, 0.2);
}

/* Entry animation */
.lesson-node--enter {
    animation: lesson-enter 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateX(-12px);
}

@keyframes lesson-enter {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ─── Skill Modal (kept from v1) ─── */

.skill-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: var(--space-4);
}

.skill-modal--visible {
    opacity: 1;
}

.skill-modal__card {
    max-width: 400px;
    width: 100%;
    padding: var(--space-8);
    border-radius: var(--radius-2xl);
    text-align: center;
}

.skill-modal__header {
    margin-bottom: var(--space-6);
}

.skill-modal__icon {
    font-size: 3rem;
    display: block;
    margin-bottom: var(--space-3);
}

.skill-modal__title {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.skill-modal__desc {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.skill-modal__crown {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: rgba(212, 165, 116, 0.1);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
    color: var(--accent-primary);
    font-weight: 600;
}

.skill-modal__crown-icon {
    font-size: 1.4rem;
}

.skill-modal__info {
    display: flex;
    justify-content: space-around;
    margin-bottom: var(--space-6);
    padding: var(--space-4) 0;
    border-top: 1px solid var(--border-glass);
    border-bottom: 1px solid var(--border-glass);
}

.skill-modal__stat {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.skill-modal__actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.skill-modal__start {
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-base);
    font-weight: 600;
}

/* ============================================
   Lesson Runner
   ============================================ */
.lesson-runner {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* ─── Lesson Header ─── */
.lesson-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    max-width: 700px;
    margin: 0 auto;
    width: 100%;
    flex-shrink: 0;
}

.lesson-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.lesson-close:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* Progress Bar */
.lesson-progress-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lesson-progress-bar {
    display: flex;
    gap: 3px;
    height: 8px;
}

.lesson-progress-count {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.progress-seg {
    flex: 1;
    height: 100%;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.08);
    transition: background 0.3s ease;
}

.progress-seg--current {
    background: rgba(212, 165, 116, 0.4);
    animation: pulse-seg 1.5s ease-in-out infinite;
}

.progress-seg--correct {
    background: var(--success);
}

.progress-seg--wrong {
    background: var(--error);
}

@keyframes pulse-seg {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* Hearts */
.lesson-hearts {
    display: flex;
    gap: var(--space-1);
    font-size: 1.2rem;
}

.heart--empty {
    opacity: 0.3;
}

/* ─── Lesson Content ─── */
.lesson-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-4) var(--space-5);
    padding-bottom: var(--space-5);
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.lesson-question {
    text-align: center;
    margin-bottom: var(--space-4);
}

.lesson-question__instruction {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

.lesson-question__text {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-primary);
}

.lesson-audio-btn {
    margin-top: var(--space-4);
    font-size: 1.1rem;
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-full);
    animation: pulse-glow 2s ease-in-out infinite;
}

/* ─── Options ─── */
.lesson-options {
    width: 100%;
    max-width: 500px;
}

/* Button Options (listen_pick, interval_id) */
.option-btn {
    display: block;
    width: 100%;
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-3);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-glass);
    background: var(--bg-glass);
    color: var(--text-primary);
    font-size: var(--text-base);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.option-btn:hover {
    border-color: var(--accent-primary);
    background: rgba(212, 165, 116, 0.08);
}

.option-btn {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.option-btn__preview {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(212, 165, 116, 0.1);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.option-btn__preview:hover {
    background: rgba(212, 165, 116, 0.25);
    transform: scale(1.1);
}

.option-btn__preview:active {
    transform: scale(0.95);
}

.option-btn__label {
    flex: 1;
}

.option-btn--selected {
    border-color: var(--accent-primary);
    background: rgba(212, 165, 116, 0.15);
    box-shadow: 0 0 0 1px var(--accent-primary);
}

.option-btn--correct {
    border-color: var(--success) !important;
    background: rgba(74, 222, 128, 0.15) !important;
    color: var(--success) !important;
}

.option-btn--wrong {
    border-color: var(--error) !important;
    background: rgba(239, 68, 68, 0.15) !important;
    color: var(--error) !important;
}

/* Drag Items (scale_order) */
.drag-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.drag-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    border: 2px solid var(--border-glass);
    background: var(--bg-glass);
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: grab;
    transition: all var(--transition-fast);
    user-select: none;
}

.drag-item:active {
    cursor: grabbing;
}

.drag-item--dragging {
    opacity: 0.5;
    border-color: var(--accent-primary);
    transform: scale(1.02);
}

.drag-handle {
    color: var(--text-muted);
    font-size: 1.2rem;
    line-height: 1;
}

.drag-hint {
    text-align: center;
    margin-top: var(--space-3);
}

/* Perde Chips (find_wrong) */
.find-wrong-scale {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    justify-content: center;
}

.perde-chip {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-glass);
    background: var(--bg-glass);
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.perde-chip:hover {
    border-color: var(--accent-primary);
}

.perde-chip--selected {
    border-color: var(--accent-primary);
    background: rgba(212, 165, 116, 0.15);
}

.perde-chip--correct {
    border-color: var(--success) !important;
    background: rgba(74, 222, 128, 0.15) !important;
    color: var(--success) !important;
}

.perde-chip--wrong {
    border-color: var(--error) !important;
    background: rgba(239, 68, 68, 0.15) !important;
    color: var(--error) !important;
}

/* ─── Fill the Blank Exercise ─── */
.fill-blank {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    width: 100%;
}

.fill-blank__scale {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    font-size: var(--text-lg);
    color: var(--text-primary);
    padding: var(--space-4);
}

.fill-blank__perde {
    padding: var(--space-1) var(--space-2);
}

.fill-blank__slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    padding: var(--space-2) var(--space-3);
    border: 2px dashed var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: var(--text-base);
}

.fill-blank__slot--active {
    border-color: var(--accent-primary);
    background: rgba(212, 165, 116, 0.1);
    color: var(--accent-primary);
    animation: slot-pulse 1.2s ease-in-out infinite;
}

@keyframes slot-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(212, 165, 116, 0.3);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(212, 165, 116, 0);
    }
}

.fill-blank__slot--filled {
    border-style: solid;
    border-color: var(--success);
    background: rgba(74, 222, 128, 0.08);
    color: var(--text-primary);
}

.fill-blank__options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    justify-content: center;
}

.fill-blank__chip {
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.fill-blank__chip:hover {
    border-color: var(--accent-primary);
    background: rgba(212, 165, 116, 0.1);
}

.fill-blank__chip--used {
    opacity: 0.3;
    pointer-events: none;
}

/* ─── Match Pairs Exercise ─── */
.match-pairs {
    display: flex;
    gap: var(--space-4);
    width: 100%;
}

.match-pairs__col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.match-pairs__term,
.match-pairs__def {
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.match-pairs__term:hover,
.match-pairs__def:hover {
    border-color: var(--accent-primary);
    background: rgba(212, 165, 116, 0.08);
}

.match-pairs__term--selected {
    border-color: var(--accent-primary);
    background: rgba(212, 165, 116, 0.15);
    box-shadow: 0 0 0 2px rgba(212, 165, 116, 0.2);
}

.match-pairs__term--matched,
.match-pairs__def--matched {
    border-color: var(--success);
    background: rgba(74, 222, 128, 0.08);
    opacity: 0.7;
    pointer-events: none;
}

/* ─── Category Sort Exercise ─── */
.category-sort {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    width: 100%;
}

.category-sort__items {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    justify-content: center;
    padding: var(--space-3);
    min-height: 48px;
}

.category-sort__item {
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.category-sort__item:hover {
    border-color: var(--accent-primary);
    background: rgba(212, 165, 116, 0.1);
}

.category-sort__item--selected {
    border-color: var(--accent-primary);
    background: rgba(212, 165, 116, 0.15);
    box-shadow: 0 0 0 2px rgba(212, 165, 116, 0.2);
}

.category-sort__item--placed {
    opacity: 0.2;
    pointer-events: none;
}

.category-sort__buckets {
    display: flex;
    gap: var(--space-3);
}

.category-sort__bucket {
    flex: 1;
    padding: var(--space-3);
    border: 1px dashed var(--border-glass);
    border-radius: var(--radius-lg);
    min-height: 100px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.category-sort__bucket:hover {
    border-color: var(--accent-primary);
    background: rgba(212, 165, 116, 0.04);
}

.category-sort__bucket-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-2);
    text-align: center;
}

.category-sort__bucket-items {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    justify-content: center;
}

.category-sort__placed-chip {
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid var(--success);
    font-size: var(--text-xs);
    color: var(--text-primary);
    animation: chip-drop 0.3s ease-out;
}

@keyframes chip-drop {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.9);
    }

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

/* ─── Lesson Footer & Feedback ─── */
.lesson-footer {
    padding: var(--space-4) 0 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    width: 100%;
}

.lesson-check {
    width: 100%;
    padding: var(--space-4);
    font-size: var(--text-base);
    font-weight: 600;
}

.lesson-check:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.lesson-feedback {
    min-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.feedback-content {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: 500;
}

.feedback-content--correct {
    background: rgba(74, 222, 128, 0.1);
    color: var(--success);
    border: 1px solid rgba(74, 222, 128, 0.2);
}

.feedback-content--wrong {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.feedback-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

/* Success/Danger button variants */
.btn--success {
    background: var(--success) !important;
    color: #000 !important;
    border-color: var(--success) !important;
}

.btn--danger {
    background: var(--error) !important;
    color: #fff !important;
    border-color: var(--error) !important;
}

/* ─── Celebration Overlay ─── */
.celebration-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--space-8);
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Confetti */
.confetti-container {
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.confetti {
    position: absolute;
    top: -20px;
    border-radius: 2px;
    animation: confetti-fall linear forwards;
    opacity: 0.9;
}

.confetti--circle {
    border-radius: 50%;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }

    70% {
        opacity: 0.8;
    }

    100% {
        transform: translateY(100vh) rotate(720deg) scale(0.3);
        opacity: 0;
    }
}

/* Content */
.celebration__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-5);
    animation: celebration-fade-in 0.6s ease both;
}

@keyframes celebration-fade-in {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

/* Accuracy Ring */
.celebration__ring {
    position: relative;
    width: 140px;
    height: 140px;
}

.accuracy-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.accuracy-ring__fill {
    transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.celebration__ring-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.celebration__icon {
    font-size: 2.5rem;
    animation: bounce-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}

.celebration__accuracy {
    font-size: var(--text-lg);
    font-weight: 800;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* Title */
.celebration__title {
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--text-primary);
    animation: celebration-fade-in 0.5s ease 0.4s both;
}

/* Stats */
.celebration__stats {
    display: flex;
    gap: var(--space-6);
    animation: celebration-fade-in 0.5s ease 0.6s both;
}

.celebration__stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    min-width: 80px;
}

.celebration__stat-icon {
    font-size: 1.25rem;
}

.celebration__stat-value {
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.celebration__stat--kp .celebration__stat-value {
    color: var(--accent-primary);
}

.celebration__stat--streak .celebration__stat-value {
    color: #f97316;
}

.celebration__stat-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Crown */
.celebration__crown {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, rgba(212, 165, 116, 0.15), rgba(250, 204, 21, 0.1));
    border: 1px solid rgba(212, 165, 116, 0.3);
    animation: celebration-fade-in 0.5s ease 0.8s both;
}

.celebration__crown-icon {
    font-size: 1.5rem;
    animation: crown-glow 2s ease-in-out infinite;
}

@keyframes crown-glow {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.3) drop-shadow(0 0 8px rgba(250, 204, 21, 0.4));
    }
}

.celebration__crown-text {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--accent-primary);
}

/* Daily Goal */
.celebration__goal-banner {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.15), rgba(34, 197, 94, 0.1));
    border: 1px solid rgba(74, 222, 128, 0.3);
    color: #4ade80;
    font-weight: 600;
    font-size: var(--text-sm);
    animation: celebration-fade-in 0.5s ease 1s both;
}

.celebration__goal-progress {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    max-width: 240px;
    animation: celebration-fade-in 0.5s ease 1s both;
}

.celebration__goal-bar {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.celebration__goal-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent-primary), #facc15);
    transition: width 1s ease 1.2s;
}

.celebration__goal-text {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Actions */
.celebration__actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-width: 200px;
    animation: celebration-fade-in 0.5s ease 1.2s both;
}

.celebration__continue {
    font-size: var(--text-base) !important;
    padding: var(--space-4) var(--space-8) !important;
}

@keyframes bounce-in {
    0% {
        transform: scale(0);
    }

    60% {
        transform: scale(1.2);
    }

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

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 640px) {
    .skill-tree__row {
        flex-direction: column;
        align-items: center;
    }

    .skill-node {
        min-width: 160px;
    }

    .lesson-header {
        padding: var(--space-3) var(--space-4);
    }

    .lesson-content {
        padding: var(--space-6) var(--space-4);
    }

    .lesson-footer {
        padding: var(--space-3) var(--space-4);
    }

    .celebration__stats {
        gap: var(--space-4);
    }

    .find-wrong-scale {
        gap: var(--space-1);
    }

    .perde-chip {
        padding: var(--space-2) var(--space-3);
        font-size: var(--text-xs);
    }
}

/* ─── Rhythm Tap Exercise ─── */
.rhythm-tap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) 0;
    position: relative;
}

.rhythm-tap__info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
}

.rhythm-tap__name {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.rhythm-tap__controls {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-2);
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.rhythm-tap__mic-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--text-muted);
    padding: var(--space-1) var(--space-3);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.rhythm-tap__mic-toggle:hover {
    border-color: var(--accent-primary);
}

.rhythm-tap__mic-toggle input {
    display: none;
}

.rhythm-tap__mic-toggle:has(input:checked) {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(212, 165, 116, 0.1);
}

/* ─ Timeline with Playhead ─ */
.rhythm-timeline {
    position: relative;
    width: 100%;
    max-width: 520px;
    padding: var(--space-3) 0;
}

.rhythm-timeline__playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 3px;
    background: var(--accent-primary);
    border-radius: 2px;
    z-index: 2;
    box-shadow: 0 0 12px rgba(212, 165, 116, 0.6);
    pointer-events: none;
}

.rhythm-timeline__beats {
    display: flex;
    gap: var(--space-2);
    justify-content: center;
    position: relative;
    z-index: 1;
}

.beat-box {
    flex: 1;
    min-width: 48px;
    max-width: 72px;
    height: 72px;
    border: 2px solid var(--border-glass);
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    transition: all 0.12s ease;
    user-select: none;
}

.beat-box__label {
    font-size: var(--text-sm);
    font-weight: 600;
}

.beat-box__indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.12s ease;
    font-size: 10px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Düm = warm bass */
.beat-box--d {
    border-color: rgba(200, 120, 60, 0.3);
}

.beat-box--d .beat-box__label {
    color: #d4a574;
}

/* Tek = bright treble */
.beat-box--t {
    border-color: rgba(120, 180, 220, 0.3);
}

.beat-box--t .beat-box__label {
    color: #78b4dc;
}

/* Es = muted rest */
.beat-box--e {
    border-color: rgba(255, 255, 255, 0.1);
    opacity: 0.5;
}

.beat-box--e .beat-box__label {
    color: var(--text-muted);
}

/* Active (playhead is on this beat) */
.beat-box--active {
    border-color: var(--accent-primary) !important;
    background: rgba(212, 165, 116, 0.2);
    transform: scale(1.1);
    box-shadow: 0 0 16px rgba(212, 165, 116, 0.3);
}

.beat-box--active .beat-box__indicator {
    background: var(--accent-primary);
    box-shadow: 0 0 8px var(--accent-primary);
}

/* Tapped flash */
.beat-box--tapped {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(0.92);
}

/* Hit */
.beat-box--hit {
    border-color: var(--color-success, #4ade80) !important;
    background: rgba(74, 222, 128, 0.1);
}

.beat-box--hit .beat-box__indicator {
    background: var(--color-success, #4ade80);
    color: #fff;
}

/* Miss */
.beat-box--miss {
    border-color: var(--color-error, #f87171) !important;
    background: rgba(248, 113, 113, 0.1);
}

.beat-box--miss .beat-box__indicator {
    background: var(--color-error, #f87171);
}

/* ─ Big Tap Zone ─ */
.rhythm-tap-zone {
    width: 100%;
    max-width: 520px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.rhythm-tap-zone__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-6) var(--space-4);
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.15s ease;
}

.rhythm-tap-zone__icon {
    font-size: 32px;
}

.rhythm-tap-zone__text {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* Active state — waiting for taps */
.rhythm-tap-zone--active .rhythm-tap-zone__inner {
    border-color: var(--accent-primary);
    background: rgba(212, 165, 116, 0.05);
    border-style: solid;
}

.rhythm-tap-zone--active .rhythm-tap-zone__text {
    color: var(--accent-primary);
}

/* Flash on tap */
.rhythm-tap-zone--flash .rhythm-tap-zone__inner {
    background: rgba(212, 165, 116, 0.15) !important;
}

/* ─ Countdown ─ */
.rhythm-countdown {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border-radius: var(--radius-lg);
    z-index: 10;
}

.rhythm-countdown__number {
    font-size: 72px;
    font-weight: 700;
    color: var(--accent-primary);
    text-shadow: 0 0 24px rgba(212, 165, 116, 0.5);
}

.rhythm-countdown__pop {
    animation: countdownPop 0.6s ease-out;
}

@keyframes countdownPop {
    0% {
        transform: scale(1.8);
        opacity: 0;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }

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

/* ─── Nota Read Exercise ─── */
.nota-read {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-6);
}

.staff-container {
    width: 100%;
    max-width: 480px;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    border: 1px solid var(--border-glass);
}

.staff-svg {
    overflow: visible;
}

/* Notehead glow animation */
.staff-note__glow {
    animation: noteGlow 1.5s ease-in-out infinite alternate;
}

@keyframes noteGlow {
    from {
        opacity: 0.3;
    }

    to {
        opacity: 0.7;
    }
}

.nota-read__options {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    width: 100%;
    max-width: 400px;
}

@media (max-width: 480px) {
    .beat-box {
        width: 52px;
        height: 60px;
    }

    .beat-box__label {
        font-size: var(--text-xs);
    }

    .staff-container {
        padding: var(--space-2);
    }
}