/* ============================================
   Component-Specific Styles
   ============================================ */

/* === HOME VIEW === */
.home-greeting {
    margin-bottom: var(--space-md);
}

.home-greeting h2 {
    font-size: var(--font-size-xl);
    color: var(--primary);
}

.home-greeting p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* Readiness Card */
.readiness-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--text-on-primary);
    border: none;
}

.readiness-ring {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

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

.readiness-bg {
    fill: none;
    stroke: rgba(255,255,255,0.2);
    stroke-width: 8;
}

.readiness-progress {
    fill: none;
    stroke: var(--accent);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 327;
    stroke-dashoffset: 327;
    transition: stroke-dashoffset 1s ease;
}

.readiness-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-lg);
    font-weight: 700;
}

.readiness-info h3 {
    font-size: var(--font-size-md);
    margin-bottom: 4px;
}

.readiness-info p {
    font-size: var(--font-size-sm);
    opacity: 0.85;
}

/* Exam Countdown */
.exam-countdown {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: var(--accent-light);
    border-color: var(--accent);
}

.countdown-number {
    font-size: var(--font-size-xxl);
    font-weight: 700;
    color: var(--accent-dark);
    min-width: 60px;
    text-align: center;
}

.countdown-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    flex: 1;
}

.exam-countdown-card.cramming {
    background: var(--error-light);
    border: 2px solid var(--error);
    animation: pulse 2s infinite;
}

.exam-countdown-card.cramming .countdown-number {
    color: var(--error-dark);
}

.exam-countdown-card.cramming .countdown-label {
    color: var(--error-dark);
    font-weight: 600;
}

/* Preset Cards */
.preset-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.preset-card {
    text-align: center;
    padding: var(--space-md);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.preset-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.preset-card:active {
    transform: scale(0.97);
}

.preset-icon {
    font-size: 28px;
    margin-bottom: var(--space-xs);
}

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

.preset-desc {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

/* Topic List */
.topic-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.topic-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

.topic-item:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.topic-item:active { transform: scale(0.99); }

.topic-mastery-bar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    font-weight: 700;
    flex-shrink: 0;
    color: var(--text-on-primary);
}

.topic-info {
    flex: 1;
    min-width: 0;
}

.topic-name-fr {
    font-weight: 600;
    font-size: var(--font-size-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topic-name-en {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.topic-accuracy {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
}

/* Stats Row */
.stats-row {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    margin-top: var(--space-md);
}

.stat-item {
    flex: 1;
    text-align: center;
}

.stat-value {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

/* === PRACTICE VIEW === */
.practice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.session-progress {
    display: flex;
    gap: var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

#practice-count { font-weight: 600; color: var(--primary); }

/* Timer Bar */
.timer-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    margin-bottom: var(--space-md);
    overflow: hidden;
    position: relative;
}

.timer-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.1s linear;
    width: 100%;
}

.timer-fill.warning { background: var(--warning); }
.timer-fill.danger { background: var(--error); }

.timer-text {
    position: absolute;
    right: 0;
    top: -20px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-secondary);
}

/* Overall exam timer */
.overall-timer {
    font-weight: 700;
    font-size: var(--font-size-sm);
    font-variant-numeric: tabular-nums;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    background: var(--surface-alt, var(--surface));
}
.overall-timer.timer-warning { color: var(--warning); }
.overall-timer.timer-danger { color: var(--error); font-weight: 800; }

/* Time analytics in results */
.time-analytics {
    margin-top: var(--space-lg);
    text-align: center;
}
.time-analytics h3 {
    font-size: var(--font-size-md);
    margin-bottom: var(--space-sm);
}
.time-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    flex-wrap: wrap;
}
.time-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.time-stat-value {
    font-size: var(--font-size-xl, 1.5rem);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.time-stat-label {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Question Card */
.question-card {
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    position: relative;
}

.question-badges {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
}

.topic-badge {
    font-size: var(--font-size-xs);
    padding: 3px 10px;
    border-radius: 12px;
    background: var(--primary-50);
    color: var(--primary);
    font-weight: 600;
}

.multi-badge {
    font-size: var(--font-size-xs);
    padding: 3px 10px;
    border-radius: 12px;
    background: var(--accent-light);
    color: var(--accent-dark);
    font-weight: 600;
}

/* Retry Banner */
.retry-banner {
    background: var(--accent-light);
    color: var(--accent-dark);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    text-align: center;
}

/* Sign Images in Question Cards */
.sign-container {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    background: var(--bg);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border);
}

.media-container {
    margin-bottom: var(--space-md);
    text-align: center;
}

.question-media-img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-md);
    object-fit: contain;
}

.sign-image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sign-image svg {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.question-text-fr {
    font-size: var(--font-size-lg);
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.question-text-en {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.5;
    font-style: italic;
}

.tts-btn {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background: var(--primary-50);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.tts-btn:hover { background: var(--primary-100); }
.tts-btn.speaking { animation: pulse 1s ease infinite; }

/* Answer Options */
.answer-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.answer-tile {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 56px;
    -webkit-tap-highlight-color: transparent;
}

.answer-tile:hover {
    border-color: var(--primary-light);
    background: var(--primary-50);
}

.answer-tile:active { transform: scale(0.99); }

.answer-tile.selected {
    border-color: var(--primary);
    background: var(--primary-50);
}

.answer-tile.correct {
    border-color: var(--success);
    background: var(--success-light);
}

.answer-tile.incorrect {
    border-color: var(--error);
    background: var(--error-light);
}

.answer-tile.missed {
    border-color: var(--missed);
    background: var(--warning-light);
}

.answer-tile.locked {
    pointer-events: none;
}

.answer-letter {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--text-on-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-size-sm);
    flex-shrink: 0;
}

.answer-tile.correct .answer-letter { background: var(--success); }
.answer-tile.incorrect .answer-letter { background: var(--error); }
.answer-tile.missed .answer-letter { background: var(--missed); }

.answer-content { flex: 1; }

.answer-text-fr {
    font-size: var(--font-size-base);
    font-weight: 500;
    line-height: 1.4;
}

.answer-text-en {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-top: 2px;
}

.answer-indicator {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    align-self: center;
}

/* Confirm Button */
.btn-confirm {
    margin-top: var(--space-md);
}

/* Explanation Panel */
.explanation-panel {
    margin-top: var(--space-md);
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    animation: slideUp 0.3s ease;
}

.verdict {
    padding: var(--space-md) var(--space-lg);
    font-size: var(--font-size-md);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.verdict.correct {
    background: var(--success-light);
    color: var(--success-dark);
}

.verdict.incorrect {
    background: var(--error-light);
    color: var(--error-dark);
}

.explanation-body {
    padding: var(--space-md) var(--space-lg);
}

.explanation-section {
    margin-bottom: var(--space-md);
}

.explanation-section h4 {
    font-size: var(--font-size-sm);
    color: var(--primary);
    margin-bottom: var(--space-xs);
    font-weight: 600;
}

.explanation-section p {
    font-size: var(--font-size-sm);
    line-height: 1.6;
    color: var(--text-primary);
}

#trap-section {
    background: var(--warning-light);
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--warning);
}

#distractor-section {
    background: var(--error-light);
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--error);
}

.vocab-item {
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-light);
    font-size: var(--font-size-sm);
}

.vocab-fr {
    font-weight: 600;
    color: var(--primary);
}

.vocab-en {
    color: var(--text-secondary);
}

.explanation-actions {
    padding: var(--space-md) var(--space-lg);
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.explanation-actions .btn-primary { flex: 1; }

/* === EXAM VIEW === */
.exam-intro {
    text-align: center;
    padding: var(--space-xxl) var(--space-lg);
}

.exam-intro-icon {
    font-size: 64px;
    margin-bottom: var(--space-lg);
}

.exam-intro h2 {
    font-size: var(--font-size-xl);
    color: var(--primary);
    margin-bottom: var(--space-lg);
}

.exam-rules {
    margin-bottom: var(--space-xl);
}

.exam-rules p {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.exam-mode-select {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* Exam Results */
.results-score-ring {
    width: 160px;
    height: 160px;
    margin: var(--space-xl) auto var(--space-md);
    position: relative;
}

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

.results-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 10;
}

.results-progress {
    fill: none;
    stroke: var(--success);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 440;
    stroke-dashoffset: 440;
    transition: stroke-dashoffset 1.5s ease;
}

.results-score {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xxl);
    font-weight: 700;
}

.results-verdict {
    text-align: center;
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.results-verdict.pass { color: var(--success-dark); }
.results-verdict.fail { color: var(--error-dark); }

.results-context {
    text-align: center;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-lg);
}

.results-topics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.result-topic-item {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-topic-item.good { background: var(--success-light); color: var(--success-dark); }
.result-topic-item.medium { background: var(--warning-light); color: var(--accent-dark); }
.result-topic-item.bad { background: var(--error-light); color: var(--error-dark); }

.results-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* === PROGRESS VIEW === */
.progress-header-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.stat-card {
    text-align: center;
    padding: var(--space-md) var(--space-sm);
}

.stat-card-value {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--primary);
}

.stat-card-label {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

/* Spaced Repetition Analytics */
.sr-analytics {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.sr-summary-row {
    display: flex;
    justify-content: space-around;
    margin-bottom: var(--space-md);
}

.sr-stat {
    text-align: center;
}

.sr-stat-value {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--primary);
}

.sr-stat-value.sr-graduated { color: var(--success-dark); }
.sr-stat-value.sr-due { color: var(--warning-dark); }

.sr-stat-label {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-top: 2px;
}

.sr-bar-track {
    display: flex;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: var(--space-xs);
}

.sr-bar-graduated {
    background: var(--success);
    transition: width 0.5s ease;
}

.sr-bar-active {
    background: var(--primary-light);
    transition: width 0.5s ease;
}

.sr-bar-label {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    text-align: center;
}

.sr-stuck-header {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--warning-dark);
    margin-top: var(--space-md);
    margin-bottom: var(--space-sm);
}

.sr-stuck-header.sr-no-stuck {
    color: var(--success-dark);
    text-align: center;
}

.sr-stuck-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.sr-stuck-item:hover {
    background: var(--primary-50);
}

.sr-stuck-topic {
    flex-shrink: 0;
    font-size: 16px;
}

.sr-stuck-text {
    flex: 1;
    font-size: var(--font-size-xs);
    color: var(--text-primary);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sr-stuck-badge {
    flex-shrink: 0;
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--error-dark);
    background: var(--error-light);
    padding: 2px 6px;
    border-radius: 8px;
}

.mastery-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.mastery-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.mastery-level-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    white-space: nowrap;
}

.mastery-level-badge.novice { background: var(--error-light); color: var(--error-dark); }
.mastery-level-badge.learning { background: var(--warning-light); color: var(--accent-dark); }
.mastery-level-badge.competent { background: var(--warning-light); color: var(--warning-dark); }
.mastery-level-badge.proficient { background: var(--info-light); color: var(--info-dark); }
.mastery-level-badge.mastered { background: var(--success-light); color: var(--success-dark); }

.mastery-bar-container {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.mastery-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.mastery-accuracy {
    font-size: var(--font-size-sm);
    font-weight: 600;
    min-width: 40px;
    text-align: right;
}

/* Exam History */
.exam-history-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.exam-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    background: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.exam-history-score {
    font-size: var(--font-size-lg);
    font-weight: 700;
}

.exam-history-score.pass { color: var(--success-dark); }
.exam-history-score.fail { color: var(--error-dark); }

.exam-history-date {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

/* === SETTINGS === */
.settings-group {
    margin-bottom: var(--space-lg);
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-light);
}

.setting-item label:first-child {
    font-size: var(--font-size-base);
    color: var(--text-primary);
}

.setting-select {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    background: var(--surface);
    color: var(--text-primary);
}

.setting-input {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    background: var(--surface);
    color: var(--text-primary);
}

.settings-about {
    text-align: center;
    padding: var(--space-xl) 0;
    color: var(--text-tertiary);
    font-size: var(--font-size-sm);
}

.settings-about p { margin-bottom: var(--space-xs); }

/* === CONFIDENCE MODAL === */
.confidence-content {
    text-align: center;
}

.confidence-content p {
    font-size: var(--font-size-md);
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.confidence-options {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
}

.confidence-chip {
    padding: 10px 16px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: all 0.2s;
}

.confidence-chip:hover {
    border-color: var(--primary);
    background: var(--primary-50);
}

.confidence-chip:active { transform: scale(0.95); }

/* === DIAGNOSTIC ASSESSMENT === */
.diagnostic-container {
    padding: var(--space-lg);
    padding-bottom: calc(var(--space-xxl) + 40px);
    max-width: 480px;
    margin: 0 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}

.diag-header {
    text-align: center;
    margin-bottom: var(--space-lg);
}

.diag-header h2 {
    font-size: var(--font-size-xl);
    color: var(--primary);
    margin-bottom: var(--space-xs);
}

.diag-header p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-md);
}

.diag-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.diag-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.diag-results-header {
    text-align: center;
    padding: var(--space-xl) 0;
}

.diag-score-display {
    margin-bottom: var(--space-md);
}

.diag-score-number {
    font-size: 48px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.diag-score-pct {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

.diag-verdict {
    font-size: var(--font-size-md);
    font-weight: 600;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    display: inline-block;
}

.diag-verdict.good { background: var(--success-light); color: var(--success-dark); }
.diag-verdict.medium { background: var(--warning-light); color: var(--accent-dark); }
.diag-verdict.needs-work { background: var(--error-light); color: var(--error-dark); }

.diag-topic-results {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.diag-topic-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
}

.diag-topic-row.good { background: var(--success-light); color: var(--success-dark); }
.diag-topic-row.medium { background: var(--warning-light); color: var(--accent-dark); }
.diag-topic-row.bad { background: var(--error-light); color: var(--error-dark); }

/* === TUTOR CHAT === */
.tutor-fab {
    position: fixed;
    bottom: 80px;
    right: 16px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--text-on-primary);
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    z-index: 100;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tutor-fab:hover { transform: scale(1.08); }
.tutor-fab.active { background: var(--text-tertiary); }

.tutor-panel {
    position: fixed;
    bottom: 140px;
    right: 16px;
    width: min(360px, calc(100vw - 32px));
    height: 400px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    z-index: 101;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
}

.tutor-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--primary);
    color: var(--text-on-primary);
}

.tutor-avatar { font-size: 28px; }

.tutor-title {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tutor-title strong { font-size: var(--font-size-base); }
.tutor-title span { font-size: var(--font-size-xs); opacity: 0.8; }

.tutor-close {
    background: none;
    border: none;
    color: var(--text-on-primary);
    font-size: 24px;
    cursor: pointer;
    opacity: 0.8;
    padding: 0 4px;
}

.tutor-close:hover { opacity: 1; }

.tutor-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.tutor-msg {
    max-width: 85%;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.tutor-msg p { margin: 0; }

.tutor-msg-bot {
    align-self: flex-start;
    background: var(--bg);
    border: 1px solid var(--border-light);
}

.tutor-msg-user {
    align-self: flex-end;
    background: var(--primary);
    color: var(--text-on-primary);
}

.tutor-msg.loading p {
    animation: pulse 1s infinite;
}

.tutor-input-area {
    display: flex;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    border-top: 1px solid var(--border-light);
}

.tutor-input-area input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    background: var(--bg);
    color: var(--text-primary);
}

.tutor-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--text-on-primary);
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tutor-send:hover { opacity: 0.9; }

.tutor-offline-msg {
    padding: var(--space-sm) var(--space-md);
    background: var(--warning-light);
    color: var(--accent-dark);
    font-size: var(--font-size-xs);
    text-align: center;
}

/* === VOCABULARY / LEARN VIEW === */
.vocab-mode-toggle {
    display: flex;
    gap: var(--space-xs);
    background: var(--border-light);
    border-radius: var(--radius-md);
    padding: 3px;
    margin-bottom: var(--space-md);
}

.vocab-mode-btn {
    flex: 1;
    padding: 10px var(--space-md);
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
}

.vocab-mode-btn.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* Topic filter chips */
.topic-filter-bar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 0 var(--space-sm);
    margin-bottom: var(--space-xs);
}
.topic-filter-bar::-webkit-scrollbar { display: none; }

.topic-chip {
    flex-shrink: 0;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    font-size: var(--font-size-xs);
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.topic-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.vocab-stats-bar {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.vocab-stat {
    flex: 1;
    text-align: center;
    padding: var(--space-sm);
    background: var(--surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.vocab-stat-num {
    display: block;
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--primary);
}

.vocab-stat-num.vocab-known { color: var(--success); }
.vocab-stat-num.vocab-learning { color: var(--warning); }
.vocab-stat-num.vocab-unseen { color: var(--text-tertiary); }

.vocab-stat-label {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

.vocab-progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: var(--space-lg);
}

.vocab-progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* Flashcard */
.vocab-card-area {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.vocab-counter {
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    margin-bottom: var(--space-sm);
}

.vocab-flashcard {
    width: 100%;
    min-height: 200px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 2px solid var(--border-light);
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.vocab-flashcard:active {
    transform: scale(0.98);
}

.vocab-flashcard.revealed {
    border-color: var(--primary-light);
}

.vocab-front, .vocab-back {
    padding: var(--space-lg);
    text-align: center;
}

.vocab-front {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.vocab-front.flipped {
    display: none;
}

.vocab-back {
    display: none;
    animation: fadeInUp 0.3s ease;
}

.vocab-back.visible {
    display: block;
}

.vocab-topic-tag {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    margin-bottom: var(--space-md);
}

.vocab-badges-row {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: var(--space-xs);
    min-height: 22px;
}

.vocab-badge {
    font-size: var(--font-size-xs);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.vocab-badge.known {
    background: var(--success-light);
    color: var(--success-dark);
}

.vocab-badge.learning {
    background: var(--warning-light);
    color: var(--accent-dark);
}

.vocab-badge.due {
    background: var(--error-light, #fce4ec);
    color: var(--error, #e53935);
}

.vocab-badge.review {
    background: var(--surface-alt, #f5f5f5);
    color: var(--text-secondary);
}

.vocab-stat-num.vocab-due {
    color: var(--error, #e53935);
}

.vocab-word-fr {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--space-sm);
    line-height: 1.3;
}

.vocab-word-en {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.vocab-definition {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.5;
    font-style: italic;
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border-light);
}

.vocab-hint {
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    margin-top: var(--space-md);
}

.vocab-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    width: 100%;
}

.vocab-btn {
    flex: 1;
    padding: 14px var(--space-md) !important;
    border-radius: var(--radius-md) !important;
    font-weight: 600 !important;
    font-size: var(--font-size-base) !important;
}

.vocab-btn-reveal {
    background: var(--primary-50) !important;
    color: var(--primary) !important;
    border: 2px solid var(--primary) !important;
}

.vocab-btn-learning {
    background: var(--warning-light) !important;
    color: var(--accent-dark) !important;
    border: 2px solid var(--warning) !important;
}

.vocab-btn-known {
    background: var(--success-light) !important;
    color: var(--success-dark) !important;
    border: 2px solid var(--success) !important;
}

/* === ROAD SIGNS QUIZ === */
.signs-quiz-area {
    text-align: center;
}

.signs-prompt {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.signs-display {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border);
    min-height: 140px;
}

.signs-svg-display svg {
    width: 120px;
    height: 120px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
}

.signs-choices {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.signs-choice-btn {
    padding: var(--space-md);
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
}

.signs-choice-btn:hover {
    border-color: var(--primary-light);
    background: var(--primary-50);
}

.signs-choice-btn:active { transform: scale(0.99); }

.signs-choice-btn.correct {
    border-color: var(--success);
    background: var(--success-light);
    color: var(--success-dark);
    font-weight: 700;
}

.signs-choice-btn.incorrect {
    border-color: var(--error);
    background: var(--error-light);
    color: var(--error-dark);
}

.signs-choice-btn.locked {
    pointer-events: none;
}

.signs-next-btn {
    margin-top: var(--space-sm);
}

/* === Study Activity Chart === */
.study-activity-chart {
    padding: var(--space-md);
    background: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: var(--space-md);
}

/* Streak stats row */
.streak-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border);
}
.streak-stat {
    text-align: center;
}
.streak-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}
.streak-stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 30-day calendar grid */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}
.cal-cell {
    aspect-ratio: 1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.cal-day {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.cal-level-0 {
    background: var(--surface-alt, rgba(128, 128, 128, 0.08));
}
.cal-level-1 {
    background: rgba(34, 139, 34, 0.2);
}
.cal-level-1 .cal-day { color: rgba(34, 139, 34, 0.8); }
.cal-level-2 {
    background: rgba(34, 139, 34, 0.45);
}
.cal-level-2 .cal-day { color: #fff; }
.cal-level-3 {
    background: rgba(34, 139, 34, 0.75);
}
.cal-level-3 .cal-day { color: #fff; }
.cal-today {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
}

/* Calendar legend */
.cal-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
}
.cal-legend-label {
    font-size: 0.6rem;
    color: var(--text-secondary);
    margin: 0 2px;
}
.cal-legend-cell {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}
.cal-legend-cell .cal-day { display: none; }

/* Calendar accuracy borders */
.cal-acc-good { box-shadow: inset 0 0 0 2px var(--success, #4CAF50); }
.cal-acc-mid { box-shadow: inset 0 0 0 2px var(--warning, #FF9800); }
.cal-acc-low { box-shadow: inset 0 0 0 2px var(--error, #E53935); }
.cal-legend-sep { color: var(--text-tertiary); margin: 0 4px; }

/* Weekly accuracy trend */
.weekly-trend {
    margin-top: var(--space-md);
    text-align: center;
}
.trend-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}
.trend-chart {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    align-items: flex-end;
    height: 80px;
}
.trend-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 48px;
}
.trend-bar-wrapper {
    width: 32px;
    height: 60px;
    display: flex;
    align-items: flex-end;
    background: var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.trend-bar {
    width: 100%;
    border-radius: var(--radius-sm);
    transition: height 0.4s ease;
}
.trend-good { background: var(--success, #4CAF50); }
.trend-mid { background: var(--warning, #FF9800); }
.trend-low { background: var(--error, #E53935); }
.trend-empty { background: var(--border); }
.trend-val {
    font-size: var(--font-size-xs);
    font-weight: 600;
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}
.trend-label {
    font-size: 10px;
    color: var(--text-tertiary);
}

/* Exam score trend */
.exam-trend { margin-bottom: var(--space-md); }
.exam-trend-chart {
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
    align-items: flex-end;
    height: 70px;
    position: relative;
    padding: 0 var(--space-sm);
}
.exam-trend-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    max-width: 48px;
}
.exam-trend-bar-wrapper {
    width: 28px;
    height: 50px;
    display: flex;
    align-items: flex-end;
    background: var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.exam-trend-bar {
    width: 100%;
    border-radius: var(--radius-sm);
    transition: height 0.4s ease;
}
.exam-trend-pass { background: var(--success, #4CAF50); }
.exam-trend-fail { background: var(--error, #E53935); }
.exam-trend-score {
    font-size: var(--font-size-xs);
    font-weight: 700;
    margin-top: 2px;
}
.exam-trend-date {
    font-size: 9px;
    color: var(--text-tertiary);
}
.exam-trend-pass-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 1.5px;
    background: var(--text-tertiary);
    opacity: 0.5;
    z-index: 1;
}

.activity-count {
    font-size: 10px;
    color: var(--text-tertiary);
    font-weight: 600;
}

/* === Mastery Item Restructured === */
.mastery-icon {
    text-align: center;
    min-width: 32px;
    font-size: 20px;
}

.mastery-info {
    flex: 1;
    min-width: 0;
}

.mastery-name {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
}

.mastery-name-fr {
    font-size: 11px;
    color: var(--text-tertiary);
}

.mastery-score {
    text-align: right;
}

/* === Exam Badge === */
.exam-history-verdict {
    text-align: right;
}

.exam-badge {
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.exam-badge.pass {
    background: var(--success-light);
    color: var(--success-dark);
}

.exam-badge.fail {
    background: var(--error-light);
    color: var(--error-dark);
}

/* === Smart Recommendation Card === */
.recommendation-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: linear-gradient(135deg, var(--primary-50), var(--surface));
    border: 1px solid var(--primary-100);
    margin-bottom: var(--space-md);
}

.recommendation-icon {
    font-size: 28px;
    min-width: 40px;
    text-align: center;
}

.recommendation-body {
    flex: 1;
    min-width: 0;
}

.recommendation-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
}

.recommendation-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* === Session Summary Stats === */
.session-summary {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-light);
}

.summary-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.summary-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

/* === Bookmark Drill Card === */
.bookmark-drill-card {
    cursor: pointer;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.bookmark-icon {
    font-size: 24px;
}

.bookmark-title {
    font-weight: 600;
}

.bookmark-count {
    font-size: 12px;
}

/* === Settings Input Small === */
.setting-input-sm {
    max-width: 200px;
    font-size: 11px;
}

/* === Diagnostic Continue Button === */
.diag-continue-btn {
    margin-top: 20px;
    width: 100%;
}

/* === DARK MODE OVERRIDES === */
[data-theme="dark"] .readiness-card,
@media (prefers-color-scheme: dark) { [data-theme="auto"] .readiness-card {
    background: linear-gradient(135deg, #1B3A5C 0%, #2A4A6C 100%);
}}

[data-theme="dark"] #splash-screen,
@media (prefers-color-scheme: dark) { [data-theme="auto"] #splash-screen {
    background: linear-gradient(135deg, #1B3A5C 0%, #0D1F33 100%);
}}

[data-theme="dark"] .exam-countdown,
@media (prefers-color-scheme: dark) { [data-theme="auto"] .exam-countdown {
    background: var(--accent-light);
    border-color: #555;
}}

[data-theme="dark"] .sign-container,
@media (prefers-color-scheme: dark) { [data-theme="auto"] .sign-container {
    background: var(--surface-elevated);
    border-color: var(--border);
}}

[data-theme="dark"] .option-btn,
@media (prefers-color-scheme: dark) { [data-theme="auto"] .option-btn {
    background: var(--surface-elevated);
    border-color: var(--border);
    color: var(--text-primary);
}}

[data-theme="dark"] .toggle-slider::before,
@media (prefers-color-scheme: dark) { [data-theme="auto"] .toggle-slider::before {
    background: #ccc;
}}

[data-theme="dark"] .setting-input,
[data-theme="dark"] .setting-select,
@media (prefers-color-scheme: dark) { [data-theme="auto"] .setting-input, [data-theme="auto"] .setting-select {
    background: var(--surface-elevated);
    color: var(--text-primary);
    border-color: var(--border);
}}

/* Notification card styles */
.notification-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--info-light);
    border: 1px solid var(--info);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.notification-card:hover {
    box-shadow: var(--shadow-sm);
}

.notification-card.active {
    background: var(--success-light);
    border-color: var(--success);
}

.notification-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.notification-body {
    flex: 1;
}

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

.notification-desc {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.notification-status {
    font-size: var(--font-size-xs);
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
}

.notification-status.enabled {
    background: var(--success-light);
    color: var(--success-dark);
}

.notification-status.disabled {
    background: var(--border-light);
    color: var(--text-secondary);
}

/* ============================================
   Intersection Scenario Diagrams
   ============================================ */

.intersection-container {
    margin-bottom: var(--space-md);
}

.intersection-scene {
    background: var(--bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

.intersection-title {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    background: var(--primary-50);
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.intersection-svg-wrapper {
    padding: var(--space-sm);
    display: flex;
    justify-content: center;
}

.intersection-diagram {
    max-width: 280px;
    height: auto;
    border-radius: var(--radius-sm);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.intersection-legend {
    padding: var(--space-xs) var(--space-md) var(--space-sm);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.5;
    border-top: 1px solid var(--border-light);
}

.legend-you {
    display: inline-block;
    background: #2196F3;
    color: white;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
    font-size: 10px;
}

.legend-inside {
    display: inline-block;
    background: #4CAF50;
    color: white;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
    font-size: 10px;
}

.legend-emergency {
    display: inline-block;
    background: #D32F2F;
    color: white;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
    font-size: 10px;
}

/* Passage order animation */
.passage-order {
    opacity: 0;
}

.intersection-revealed .passage-order {
    opacity: 1;
}

.passage-order-animate {
    animation: orderAppear 0.4s ease forwards;
}

@keyframes orderAppear {
    from { opacity: 0; transform: scale(0.3); }
    to { opacity: 1; transform: scale(1); }
}

/* Dark mode overrides */
[data-theme="dark"] .intersection-title {
    background: var(--surface);
}

[data-theme="dark"] .intersection-scene {
    border-color: var(--border);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .intersection-title {
        background: var(--surface);
    }
    :root:not([data-theme="light"]) .intersection-scene {
        border-color: var(--border);
    }
}

/* ============================================
   Knowledge Insight Badge (Tutor Integration)
   ============================================ */

.knowledge-insight {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    margin-top: var(--space-sm);
    background: linear-gradient(135deg, var(--primary-50), transparent);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    line-height: 1.4;
}

.knowledge-insight-icon {
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 1px;
}

.knowledge-insight-text {
    flex: 1;
}

.knowledge-insight-text strong {
    color: var(--text-primary);
}

[data-theme="dark"] .knowledge-insight {
    background: linear-gradient(135deg, rgba(46, 89, 132, 0.15), transparent);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .knowledge-insight {
        background: linear-gradient(135deg, rgba(46, 89, 132, 0.15), transparent);
    }
}

/* Custom Practice Panel */
.custom-practice {
    padding: 16px;
}
.custom-practice-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.custom-label {
    font-weight: 600;
    font-size: 0.95rem;
}
.timer-toggle-group,
.count-toggle-group {
    display: flex;
    gap: 6px;
}
.timer-chip,
.count-chip {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: transparent;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.timer-chip.active,
.count-chip.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.topic-filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}
.topic-filter-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: transparent;
    color: var(--text-primary);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}
.topic-filter-chip.selected {
    background: var(--accent-light, rgba(46, 89, 132, 0.12));
    border-color: var(--accent);
    font-weight: 600;
}
.topic-filter-chip .topic-filter-icon {
    font-size: 1.1rem;
}
#start-custom-btn {
    width: 100%;
    margin-top: 4px;
}

/* ============================================
   Gamification — Achievements, Challenges, Streaks
   ============================================ */

/* Gamification row on home */
.gamification-row {
    display: flex;
    gap: var(--space-sm, 8px);
    margin-bottom: var(--space-md, 16px);
    align-items: stretch;
}

/* Streak Shield */
.streak-shield {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg, #fff);
    border-radius: var(--radius-md, 12px);
    padding: 12px;
    min-width: 100px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.streak-shield-icon {
    font-size: 1.8rem;
    line-height: 1;
}
.streak-level-0 { opacity: 0.5; }
.streak-level-1 { filter: none; }
.streak-level-2 { filter: drop-shadow(0 0 4px #FF9800); }
.streak-level-3 { filter: drop-shadow(0 0 6px #FF5722); }
.streak-shield-count {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}
.streak-shield-freezes {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Daily Challenge Card */
.daily-challenge-container {
    flex: 1;
}
.challenge-card {
    background: var(--card-bg, #fff);
    border-radius: var(--radius-md, 12px);
    padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-left: 3px solid var(--primary, #2E5984);
}
.challenge-card.challenge-complete {
    border-left-color: var(--success, #4CAF50);
    background: var(--success-light, #E8F5E9);
}
.challenge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.challenge-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 600;
}
.challenge-badge {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--success, #4CAF50);
    background: var(--success-light, #E8F5E9);
    padding: 2px 8px;
    border-radius: 10px;
}
.challenge-complete .challenge-badge {
    background: var(--success, #4CAF50);
    color: #fff;
}
.challenge-desc {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.challenge-progress-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.challenge-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border, #e0e0e0);
    border-radius: 3px;
    overflow: hidden;
}
.challenge-progress-fill {
    height: 100%;
    background: var(--primary, #2E5984);
    border-radius: 3px;
    transition: width 0.3s ease;
}
.challenge-complete .challenge-progress-fill {
    background: var(--success, #4CAF50);
}
.challenge-progress-text {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Achievement Section in Progress View */
.achievements-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.achievements-count {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--primary, #2E5984);
    white-space: nowrap;
}
.achievements-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border, #e0e0e0);
    border-radius: 3px;
    overflow: hidden;
}
.achievements-progress-fill {
    height: 100%;
    background: var(--primary, #2E5984);
    border-radius: 3px;
    transition: width 0.3s;
}
.achievement-category-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 600;
    margin: 12px 0 6px;
}
.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    margin-bottom: 4px;
}
.achievement-card {
    background: var(--card-bg, #fff);
    border-radius: var(--radius-md, 12px);
    padding: 12px 10px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: transform 0.15s;
}
.achievement-card.unlocked {
    border: 1.5px solid var(--success, #4CAF50);
}
.achievement-card.locked {
    opacity: 0.5;
    filter: grayscale(0.6);
}
.achievement-icon {
    font-size: 1.6rem;
    margin-bottom: 4px;
}
.achievement-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.achievement-desc {
    font-size: 0.65rem;
    color: var(--text-secondary);
    line-height: 1.3;
}
.achievement-date {
    font-size: 0.6rem;
    color: var(--success, #4CAF50);
    margin-top: 4px;
    font-weight: 600;
}

.achievement-share-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: none;
    border: none;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.achievement-share-btn:hover,
.achievement-share-btn:active {
    opacity: 1;
    background: rgba(0,0,0,0.05);
}
.achievement-card { position: relative; }

/* Achievement Toast */
.achievement-toast {
    display: flex;
    align-items: center;
    gap: 6px;
}
.achievement-toast-icon {
    font-size: 1.2rem;
}

/* Confetti Overlay */
.confetti-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.4);
    animation: confetti-in 0.3s ease;
}
.confetti-overlay.confetti-fade {
    opacity: 0;
    transition: opacity 0.5s;
}
.confetti-content {
    background: var(--card-bg, #fff);
    border-radius: 20px;
    padding: 32px 40px;
    text-align: center;
    z-index: 2;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.confetti-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary, #2E5984);
    margin-bottom: 8px;
}
.confetti-message {
    font-size: 0.95rem;
    color: var(--text-secondary);
}
.confetti-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.confetti-particle {
    position: absolute;
    top: -10px;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    animation: confetti-fall linear forwards;
}
@keyframes confetti-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes confetti-fall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}
[data-theme="dark"] .confetti-overlay { background: rgba(0,0,0,0.6); }
[data-theme="dark"] .confetti-content { background: var(--surface-elevated, #2A2A2A); box-shadow: 0 8px 32px rgba(0,0,0,0.5); }
[data-theme="dark"] .confetti-title { color: var(--primary-light, #7BB3E0); }

/* Improvement indicators in session summary */
.improvement-up {
    color: var(--success, #4CAF50);
    font-weight: 700;
}
.improvement-down {
    color: var(--error, #E57373);
    font-weight: 700;
}
.improvement-same {
    color: var(--text-secondary);
    font-weight: 600;
}

/* ============================================
   Exam Topic Heatmap & Trend Indicators
   ============================================ */

/* Trend arrows in mastery list */
.exam-trend-arrow {
    display: inline-block;
    font-size: 0.6rem;
    margin-left: 4px;
    vertical-align: middle;
}
.exam-trend-arrow.trend-up { color: var(--success, #4CAF50); }
.exam-trend-arrow.trend-down { color: var(--error, #E57373); }
.exam-trend-arrow.trend-stable { color: var(--text-secondary); font-size: 0.5rem; }

/* Heatmap table */
.exam-topic-heatmap-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 12px 0;
}
.exam-topic-heatmap {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.7rem;
    min-width: 360px;
}
.exam-topic-heatmap th,
.exam-topic-heatmap td {
    padding: 6px 4px;
    text-align: center;
    border-bottom: 1px solid var(--border, #e0e0e0);
}
.heatmap-topic-th {
    text-align: left !important;
    font-weight: 600;
    color: var(--text-secondary);
}
.heatmap-date-th {
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}
.heatmap-topic-cell {
    text-align: left !important;
    font-weight: 500;
    white-space: nowrap;
    color: var(--text-primary);
}
.heatmap-cell {
    font-weight: 600;
    border-radius: 4px;
    min-width: 36px;
}
.heatmap-good { background: var(--success-light, #E8F5E9); color: var(--success-dark, #2E7D32); }
.heatmap-mid { background: var(--warning-light, #FFF8E1); color: var(--warning-dark, #F57F17); }
.heatmap-low { background: var(--error-light, #FFEBEE); color: var(--error-dark, #C62828); }
.heatmap-none { color: var(--text-secondary); opacity: 0.5; }

/* Exam recommendations */
.exam-recommendations {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}
.exam-rec-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md, 12px);
    background: var(--card-bg, #fff);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.exam-rec-decline {
    border-left: 3px solid var(--error, #E57373);
}
.exam-rec-improve {
    border-left: 3px solid var(--success, #4CAF50);
}
.exam-rec-icon {
    font-size: 0.9rem;
    width: 20px;
    text-align: center;
}
.exam-rec-decline .exam-rec-icon { color: var(--error, #E57373); }
.exam-rec-improve .exam-rec-icon { color: var(--success, #4CAF50); }
.exam-rec-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.exam-rec-text strong {
    font-size: 0.8rem;
    color: var(--text-primary);
}
.exam-rec-text span {
    font-size: 0.7rem;
    color: var(--text-secondary);
}
.exam-rec-action {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--primary, #2E5984);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

