html[data-learning-archive] #basketFloatBtn { display: none !important; }
#learningArchiveEntry[hidden] { display: none !important; }
.learning-archive-entry { min-width: 0; font-weight: 600; }
.learning-practice-card .question-card-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-left: auto; min-width: 0; }
/* Override the legacy narrow-screen answer order so DOM order stays consistent. */
.learning-practice-card .question-card-actions > .btn-answer { order: 0; }
.learning-mastery { position: relative; display: inline-flex; align-items: center; flex: 0 0 auto; color: #475569; font-size: 11px; }
.learning-mastery button, .learning-archive-dialog button:not(:where(.site-tour button)) {
    border: 1px solid #cbd5e1; border-radius: 6px; padding: 6px 10px;
    background: #fff; color: #334155; font: inherit; cursor: pointer;
}
.learning-mastery [data-status="unmastered"] { --mastery-color: #dc2626; --mastery-tint: #fef2f2; }
.learning-mastery [data-status="uncertain"] { --mastery-color: #2563eb; --mastery-tint: #eff6ff; }
.learning-mastery [data-status="mastered"] { --mastery-color: #15803d; --mastery-tint: #f0fdf4; }
.learning-mastery .learning-mastery-trigger { box-sizing: border-box; width: calc(3em + 22px); flex: 0 0 auto; padding: 4px 10px; font-weight: 600; text-align: center; white-space: nowrap; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: color .12s ease, background-color .12s ease, border-color .12s ease; }
.learning-mastery-trigger[data-status="unmarked"] { color: #64748b; border-color: #cbd5e1; background: #fff; }
.learning-mastery-trigger:not([data-status="unmarked"]) { color: var(--mastery-color); border-color: var(--mastery-color); background: var(--mastery-tint); }
.learning-mastery button:disabled, .learning-archive-dialog button:disabled { opacity: .6; cursor: wait; }
.learning-mastery-message, .learning-archive-message { color: #b45309; }
.learning-mastery-message { position: absolute; top: calc(100% + 4px); right: 0; z-index: 1; width: max-content; max-width: min(260px, calc(100vw - 24px)); padding: 4px 6px; border: 1px solid #fde68a; border-radius: 4px; background: #fffbeb; overflow-wrap: anywhere; }
.learning-mastery-message:empty, .learning-archive-message:empty { display: none; }
.learning-mastery button:focus-visible, .learning-archive-dialog :focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.learning-archive-dialog {
    --archive-color: #475569; --archive-tint: #f1f5f9;
    position: fixed; inset: 0; margin: auto;
    box-sizing: border-box; width: min(760px, calc(100vw - 24px));
    height: min(760px, calc(100dvh - 32px));
    max-height: calc(100dvh - 32px); padding: 0; overflow: auto;
    border: 1px solid #e2e8f0; border-radius: 18px; color: #334155;
    box-shadow: 0 24px 80px rgb(15 23 42 / 20%);
    background: #fff; font-family: system-ui, sans-serif; font-size: 14px;
}
.learning-archive-dialog[open] { display: flex; flex-direction: column; }
.learning-archive-dialog::backdrop { background: rgb(15 23 42 / 45%); }
.learning-archive-dialog [data-status="unmarked"] { --archive-color: #64748b; --archive-fill: #cbd5e1; --archive-tint: #f1f5f9; }
.learning-archive-dialog [data-status="unmastered"] { --archive-color: #dc2626; --archive-fill: #dc2626; --archive-tint: #fef2f2; }
.learning-archive-dialog [data-status="uncertain"] { --archive-color: #2563eb; --archive-fill: #2563eb; --archive-tint: #eff6ff; }
.learning-archive-dialog [data-status="mastered"] { --archive-color: #15803d; --archive-fill: #15803d; --archive-tint: #f0fdf4; }
.learning-archive-heading { display: grid; flex: 0 0 auto; grid-template-columns: 32px minmax(0, 1fr) 32px; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid #f1f5f9; }
.learning-archive-heading h2 { grid-column: 2; grid-row: 1; margin: 0; text-align: center; font-size: 19px; font-weight: 650; color: #0f172a; }
.learning-archive-dialog .learning-archive-close { display: inline-flex; grid-column: 3; grid-row: 1; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border-color: transparent; color: #64748b; font-size: 25px; line-height: 1; }
.learning-archive-dialog .learning-archive-close:hover { background: #f1f5f9; color: #334155; }
.learning-archive-summary { flex: 0 0 auto; margin: 18px 22px; padding: 18px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; }
.learning-archive-chapter-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.learning-archive-chapter-heading h3 { margin: 0; font-size: 16px; font-weight: 650; color: #0f172a; }
.learning-archive-total { color: #64748b; font-size: 12px; font-variant-numeric: tabular-nums; }
.learning-archive-distribution { display: flex; box-sizing: border-box; width: 100%; height: 20px; overflow: hidden; border: 1px solid #e2e8f0; border-radius: 6px; background: #e2e8f0; }
.learning-archive-segment { display: block; flex: 0 0 auto; height: 100%; background: var(--archive-fill); }
.learning-archive-segment:not([data-count="0"]) ~ .learning-archive-segment:not([data-count="0"]) { box-shadow: inset 2px 0 #fff; }
.learning-archive-filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.learning-archive-dialog .learning-archive-filter { display: flex; min-width: 0; flex-direction: column; align-items: center; gap: 5px; padding: 8px 2px; border-color: transparent; border-radius: 8px; color: var(--archive-color); background: transparent; line-height: 1.3; }
.learning-archive-dialog .learning-archive-filter:hover { background: #fff; }
.learning-archive-dialog .learning-archive-filter[aria-pressed="true"] { border-color: var(--archive-color); background: var(--archive-tint); }
.learning-archive-filter-label { font-size: 12px; white-space: nowrap; }
.learning-archive-filter-count { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.learning-archive-filter-percent { color: #64748b; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.learning-archive-feedback { display: flex; flex: 0 0 auto; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0 22px 10px; }
.learning-archive-feedback[hidden] { display: none; }
.learning-archive-feedback .learning-archive-message { margin: 0; font-size: 12px; }
.learning-archive-dialog .learning-archive-retry { padding: 4px 8px; font-size: 12px; }
.learning-archive-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 22px 8px; }
.learning-archive-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid #f1f5f9; }
.learning-archive-item:first-child { border-top: 0; }
.learning-archive-topic { display: flex; flex-direction: column; gap: 3px; min-width: 0; line-height: 1.5; overflow-wrap: anywhere; }
.learning-archive-number { color: #94a3b8; font-size: 11px; font-variant-numeric: tabular-nums; }
.learning-archive-topic-title { color: #334155; }
.learning-archive-state { padding: 4px 7px; border-radius: 5px; color: var(--archive-color); background: var(--archive-tint); font-size: 11px; white-space: nowrap; }
.learning-archive-dialog .learning-archive-practice { padding: 5px 9px; border-color: #e2e8f0; color: #475569; font-size: 12px; white-space: nowrap; }
.learning-archive-dialog .learning-archive-practice:hover { border-color: #93c5fd; background: #eff6ff; color: #2563eb; }
.learning-archive-empty { padding: 24px 0; margin: 0; color: #94a3b8; text-align: center; line-height: 1.7; }
.learning-archive-footer { flex: 0 0 auto; padding: 14px 22px 18px; border-top: 1px solid #f1f5f9; }
.learning-archive-notice { margin: 0; color: #64748b; font-size: 12px; line-height: 1.7; }
.learning-archive-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.learning-archive-dialog .learning-archive-actions button { padding: 5px 9px; border-color: #e2e8f0; font-size: 12px; }
.learning-archive-dialog .learning-archive-actions button:hover:not(:disabled) { background: #f8fafc; }
.learning-archive-actions span { font-size: 12px; color: #64748b; }
/* Existing directory access classes are presentation only on these level-3 nodes. */
html[data-learning-archive] #treeContainer .tree-item.level-3[data-learning-status="unmastered"] { --learning-color: #dc2626; --learning-background: linear-gradient(90deg, #fef2f2, #fffafa); }
html[data-learning-archive] #treeContainer .tree-item.level-3.partially-unlocked[data-learning-status="uncertain"] { --learning-color: #2563eb; --learning-background: linear-gradient(90deg, #eff6ff, #f8fbff); }
html[data-learning-archive] #treeContainer .tree-item.level-3.unlocked[data-learning-status="mastered"] { --learning-color: #15803d; --learning-background: linear-gradient(90deg, #f0fdf4, #fafffb); }
/* Selection only adds the shared currentColor marker; retain mastery colors. */
html[data-learning-archive] #treeContainer .tree-item.level-3[data-learning-status] { background: var(--learning-background); border-radius: 6px; }
html[data-learning-archive] #treeContainer .tree-item.level-3[data-learning-status] .tree-item-label { color: var(--learning-color); }
@media (max-width: 480px) {
    .learning-archive-dialog { height: calc(100dvh - 20px); max-height: calc(100dvh - 20px); border-radius: 14px; }
    .learning-archive-heading { padding: 14px; }
    .learning-archive-summary { margin: 14px; padding: 12px; }
    .learning-archive-chapter-heading h3 { font-size: 15px; }
    .learning-archive-filters { gap: 3px; }
    .learning-archive-feedback { margin-right: 14px; margin-left: 14px; }
    .learning-archive-list { padding-right: 14px; padding-left: 14px; }
    .learning-archive-item { gap: 8px; font-size: 13px; }
    .learning-archive-footer { padding: 12px 14px 14px; }
    .learning-mastery-message { max-width: 150px; }
}
