/* @Title       static/learn/app.css
 * @Description 知识点学习闭环（learn）前端样式
 *
 * 绿色主题与「会员 / 支付」页保持一致（#07C160 微信绿做主动作色），
 * 这一份 CSS 服务 4 个页面（/learn /test /errorbook /weight），
 * 用 .lk-* 前缀与 wiki、vocab 的样式完全隔离，不会互相污染。
 *
 * 移动端优先：所有可点元素 ≥ 44px 高，避免"点不中"；桌面端用 max-width 收窄，
 * 因为这套页面的主要使用场景是手机（家长/孩子），电脑上打开只是顺便。
 */

:root {
    --lk-green: #07c160;
    --lk-green-dark: #14532d;
    --lk-green-bg: #f2fbf5;
    --lk-green-line: #cdebd8;
    --lk-red: #e64340;
    --lk-orange: #f59e0b;
    --lk-text: #1f2937;
    --lk-text-sub: #6b7280;
    --lk-text-light: #9ca3af;
    --lk-line: #eef0f2;
    --lk-bg: #f6f7f9;
    --lk-card: #ffffff;
    --lk-radius: 10px;
    --lk-shadow: 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--lk-bg);
    color: var(--lk-text);
    font-size: 15px;
    line-height: 1.6;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; }

.lk-app { min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }

/* ---------- 顶部导航 ---------- */
.lk-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--lk-card);
    border-bottom: 1px solid var(--lk-line);
}

.lk-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 16px;
}

.lk-nav-title { font-size: 17px; font-weight: 600; }
.lk-nav-right { font-size: 13px; color: var(--lk-text-sub); display: flex; gap: 12px; align-items: center; }

.lk-tabs { display: flex; gap: 4px; padding: 0 12px 8px; }
.lk-tab {
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 14px;
    color: var(--lk-text-sub);
    background: #f3f4f6;
}
.lk-tab.is-active {
    background: var(--lk-green);
    color: #fff;
    font-weight: 600;
}

/* ---------- 内容区 ---------- */
.lk-main {
    max-width: 720px;
    margin: 0 auto;
    padding: 12px 12px 32px;
}

.lk-card {
    background: var(--lk-card);
    border-radius: var(--lk-radius);
    box-shadow: var(--lk-shadow);
    padding: 14px;
    margin-bottom: 12px;
}

.lk-card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
}
.lk-card-title small { font-weight: 400; color: var(--lk-text-light); font-size: 12px; }

.lk-muted { color: var(--lk-text-sub); font-size: 13px; }
.lk-light { color: var(--lk-text-light); font-size: 12px; }

/* ---------- 按钮 ---------- */
.lk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--lk-green-line);
    border-radius: 8px;
    background: var(--lk-green-bg);
    color: var(--lk-green-dark);
    font-weight: 600;
    cursor: pointer;
}
.lk-btn:active { transform: translateY(1px); }
.lk-btn.is-primary { background: var(--lk-green); border-color: var(--lk-green); color: #fff; }
.lk-btn.is-ghost { background: #fff; border-color: var(--lk-line); color: var(--lk-text); font-weight: 400; }
.lk-btn.is-danger { background: #fef2f2; border-color: #fbd5d5; color: var(--lk-red); }
.lk-btn[disabled] { opacity: .5; cursor: not-allowed; }
.lk-btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 徽标 / 标签 ---------- */
.lk-badge {
    display: inline-block;
    min-width: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--lk-red);
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
}

.lk-chip {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 12px;
    background: #f3f4f6;
    color: var(--lk-text-sub);
}
.lk-chip.is-green { background: var(--lk-green-bg); color: var(--lk-green-dark); }
.lk-chip.is-red { background: #fef2f2; color: var(--lk-red); }
.lk-chip.is-orange { background: #fffbeb; color: #b45309; }

/* 重要度 1~4 的四档配色：老师扫一眼就知道哪些是"必考" */
.lk-w1 { background: #f3f4f6; color: var(--lk-text-sub); }
.lk-w2 { background: #eff6ff; color: #1d4ed8; }
.lk-w3 { background: var(--lk-green-bg); color: var(--lk-green-dark); }
.lk-w4 { background: #fef2f2; color: var(--lk-red); }

/* 掌握度四级 */
.lk-m0 { color: var(--lk-text-light); }
.lk-m1 { color: var(--lk-red); }
.lk-m2 { color: var(--lk-green-dark); }
.lk-m3 { color: #0e7490; }

/* ---------- 知识点树 ---------- */
.lk-tree { list-style: none; margin: 0; padding: 0; }
.lk-tree .lk-tree { padding-left: 14px; border-left: 1px dashed var(--lk-line); margin-left: 8px; }

.lk-node {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 8px;
    border-bottom: 1px solid var(--lk-line);
    cursor: pointer;
}
.lk-node:last-child { border-bottom: 0; }
.lk-node:active { background: var(--lk-green-bg); }
.lk-node-main { flex: 1; min-width: 0; }
.lk-node-title { font-size: 14px; font-weight: 500; }
.lk-node-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.lk-caret {
    width: 16px; text-align: center; color: var(--lk-text-light);
    transition: transform .15s ease;
}
.lk-caret.is-open { transform: rotate(90deg); }

/* ---------- 进度条 ---------- */
.lk-bar { height: 6px; border-radius: 999px; background: #eef0f2; overflow: hidden; }
.lk-bar > i { display: block; height: 100%; background: var(--lk-green); border-radius: 999px; }

/* ---------- 今日任务 ---------- */
.lk-task { padding: 10px 0; border-bottom: 1px solid var(--lk-line); }
.lk-task:last-child { border-bottom: 0; }
.lk-task-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lk-task-name { font-size: 14px; font-weight: 500; }
.lk-task-name.is-done { color: var(--lk-text-light); text-decoration: line-through; }
.lk-task-desc { margin: 4px 0 6px; }
.lk-task-links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.lk-task-links .lk-chip { cursor: pointer; }

/* 打卡卡：连续天数要显眼，这是孩子最在意的数字 */
.lk-punch { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lk-streak { font-size: 26px; font-weight: 700; color: var(--lk-green); line-height: 1.1; }
.lk-streak small { font-size: 12px; font-weight: 400; color: var(--lk-text-sub); margin-left: 4px; }

/* ---------- 知识点详情 ---------- */
.lk-body { font-size: 15px; line-height: 1.8; word-break: break-word; }
.lk-body img { max-width: 100%; height: auto; border-radius: 6px; }
.lk-body pre {
    background: #f6f7f9; padding: 10px; border-radius: 8px; overflow-x: auto; font-size: 13px;
}
.lk-body code { background: #f6f7f9; padding: 1px 4px; border-radius: 4px; font-size: 13px; }
.lk-body table { width: 100%; border-collapse: collapse; font-size: 14px; }
.lk-body th, .lk-body td { border: 1px solid var(--lk-line); padding: 6px 8px; }

/* 相关资料：一行一个文件，整行可点（比只有文字可点好按很多） */
.lk-attach {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; margin-bottom: 6px;
    border: 1px solid var(--lk-line); border-radius: 10px;
    background: #fafbfc; font-size: 14px;
}
.lk-attach:last-child { margin-bottom: 0; }
.lk-attach:active { background: var(--lk-green-bg); border-color: var(--lk-green-line); }
.lk-attach-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lk-attach-go { color: var(--lk-text-light); }

.lk-textarea {
    width: 100%;
    min-height: 88px;
    padding: 10px;
    border: 1px solid var(--lk-line);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
}

.lk-input, .lk-select {
    width: 100%;
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid var(--lk-line);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: var(--lk-text);
}
.lk-field { margin-bottom: 10px; }
.lk-field-label { display: block; font-size: 13px; color: var(--lk-text-sub); margin-bottom: 4px; }
.lk-field-row { display: flex; gap: 8px; }
.lk-field-row > * { flex: 1; }

/* 题库/知识点列表里点标题 = 直接进那道题 / 那个知识点：给一个明确的“可点”提示
   （默认 a 继承颜色、无下划线，不加提示看不出来） */
.lk-row-title a:hover, .lk-table a:hover { color: var(--lk-green-dark); text-decoration: underline; }

/* 题目编号：老师之间口头/文档里指“第几题”靠它，也是直达链接的尾号 */
.lk-q-id {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    color: var(--lk-text-light);
    margin-right: 2px;
}

/* 表单里的小提示，例如正文支持哪些 Markdown 语法 */
.lk-md-tips { margin-top: 6px; font-size: 12px; line-height: 1.8; color: var(--lk-text-light); }
.lk-md-tips b { font-weight: 600; color: var(--lk-text-sub); }

/* ---------- 试卷 ---------- */
.lk-q { padding: 12px 0; border-bottom: 1px solid var(--lk-line); }
.lk-q:last-child { border-bottom: 0; }
.lk-q-head { display: flex; gap: 8px; align-items: baseline; }
.lk-q-no { font-weight: 700; color: var(--lk-green-dark); }
.lk-q-stem { flex: 1; font-size: 15px; }
.lk-q-opts { margin: 8px 0 0; }

.lk-opt {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 9px 10px;
    border: 1px solid var(--lk-line);
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    background: #fff;
    min-height: 44px;
}
.lk-opt-key {
    flex: 0 0 22px; height: 22px; line-height: 22px; text-align: center;
    border-radius: 50%; background: #f3f4f6; font-size: 12px; font-weight: 600;
}
.lk-opt.is-picked { border-color: var(--lk-green); background: var(--lk-green-bg); }
.lk-opt.is-picked .lk-opt-key { background: var(--lk-green); color: #fff; }
/* 交卷后的正确/错误标记：绿色=正确答案，红色=你选的错项 */
.lk-opt.is-right { border-color: var(--lk-green); background: var(--lk-green-bg); }
.lk-opt.is-wrong { border-color: #fbd5d5; background: #fef2f2; }

.lk-answer-line {
    margin-top: 6px;
    font-size: 13px;
    color: var(--lk-text-sub);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.lk-answer-line b { color: var(--lk-green-dark); }
.lk-answer-line .is-bad { color: var(--lk-red); }

.lk-analysis {
    margin-top: 8px;
    padding: 8px 10px;
    background: var(--lk-green-bg);
    border-radius: 8px;
    font-size: 13px;
    color: var(--lk-green-dark);
    white-space: pre-wrap;
}

/* ---------- 结果面板 ---------- */
.lk-result { text-align: center; padding: 8px 0 4px; }
.lk-result-score { font-size: 34px; font-weight: 700; color: var(--lk-green); }
.lk-result-score small { font-size: 14px; font-weight: 400; color: var(--lk-text-sub); }
.lk-result-row { display: flex; justify-content: space-around; margin-top: 10px; }
.lk-result-row > div { text-align: center; }
.lk-result-num { font-size: 18px; font-weight: 600; }

/* ---------- 列表行 ---------- */
.lk-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 0; border-bottom: 1px solid var(--lk-line);
}
.lk-row:last-child { border-bottom: 0; }
.lk-row-main { flex: 1; min-width: 0; }
.lk-row-title { font-size: 14px; }
.lk-row-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }

/* ---------- 管理端表格 ---------- */
.lk-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.lk-table th, .lk-table td { border-bottom: 1px solid var(--lk-line); padding: 8px 6px; text-align: left; }
.lk-table th { color: var(--lk-text-sub); font-weight: 500; background: #fafbfc; }
.lk-table .lk-t-center { text-align: center; }

.lk-check { width: 20px; height: 20px; }

/* ---------- 空态 / 加载 ---------- */
.lk-empty { text-align: center; padding: 32px 12px; color: var(--lk-text-light); }
.lk-empty-title { font-size: 15px; color: var(--lk-text-sub); margin-bottom: 6px; }

.lk-loading { display: flex; justify-content: center; padding: 40px 0; }
.lk-spinner {
    width: 22px; height: 22px; border-radius: 50%;
    border: 2px solid var(--lk-green-line); border-top-color: var(--lk-green);
    animation: lk-spin .8s linear infinite;
}
@keyframes lk-spin { to { transform: rotate(360deg); } }

/* ---------- 浮层 ---------- */
.lk-toast {
    position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%);
    max-width: 80vw; padding: 9px 16px; border-radius: 999px;
    background: rgba(17, 24, 39, .88); color: #fff; font-size: 14px;
    z-index: 90; text-align: center;
}
.lk-mask { position: fixed; inset: 0; background: rgba(17, 24, 39, .45); z-index: 80; }
.lk-dialog {
    position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: min(92vw, 460px); max-height: 84vh; overflow: auto;
    background: #fff; border-radius: 12px; padding: 16px; z-index: 85;
}
.lk-dialog-title { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.lk-dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

/* ---------- 桌面端 ---------- */
@media (min-width: 900px) {
    .lk-main { max-width: 860px; padding-top: 20px; }
}

/* ---------- 知识点详情页（/learn/point/:id，旧形状 /learn?point_id=N 也行） ---------- */
/* 深链接进来的这一页是「读一篇文章」，不是「看一摞卡片」，所以给它标题层级、
   留白和阅读节奏。链接是老师/家长直接发给人的地址，第一屏必须一眼看出
   「这是哪个知识点、学到什么程度了」，因此指标提到头部而不是散在正文上面。 */
.lk-pt-hero {
    background: linear-gradient(180deg, #fff 0%, #fbfcfd 100%);
    border: 1px solid var(--lk-line);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.lk-pt-crumb {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: var(--lk-text-sub); margin-bottom: 6px;
}
.lk-pt-crumb a { color: var(--lk-green-dark); font-weight: 500; }
.lk-pt-title {
    margin: 0; font-size: 22px; font-weight: 700; line-height: 1.35;
    letter-spacing: -.2px; color: #111827;
}
.lk-pt-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.lk-pt-stats {
    display: flex; gap: 8px; margin-top: 12px;
    padding-top: 12px; border-top: 1px solid var(--lk-line);
}
.lk-pt-stat {
    flex: 1; text-align: center; padding: 8px 4px;
    background: #fafbfc; border-radius: 10px;
}
.lk-pt-stat b { display: block; font-size: 18px; font-weight: 700; color: var(--lk-green-dark); }
.lk-pt-stat b i { font-size: 11px; font-weight: 400; font-style: normal; margin-left: 2px; }
.lk-pt-stat span { font-size: 11px; color: var(--lk-text-sub); }
.lk-pt-stat.is-red b { color: var(--lk-red); }
.lk-pt-summary { margin: 12px 0 0; font-size: 14px; line-height: 1.7; color: var(--lk-text-sub); }

/* 段落卡：标题前一小段绿色营条，扫一眼就能分段 */
.lk-sec {
    background: var(--lk-card); border-radius: 12px;
    box-shadow: var(--lk-shadow); padding: 14px; margin-bottom: 12px;
}
.lk-sec-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 600; color: #111827; margin-bottom: 10px;
}
.lk-sec-title::before {
    content: ''; width: 3px; height: 14px; border-radius: 2px; background: var(--lk-green);
}

/* 正文排版：标签全部来自服务端渲染的知识点正文 */
.lk-article { font-size: 15.5px; line-height: 1.85; color: #24292f; word-break: break-word; }
.lk-article > :first-child { margin-top: 0; }
.lk-article > :last-child { margin-bottom: 0; }
.lk-article p { margin: 0 0 14px; }
.lk-article h1, .lk-article h2, .lk-article h3, .lk-article h4 {
    margin: 22px 0 10px; line-height: 1.45; font-weight: 600; color: #111827;
}
.lk-article h1 { font-size: 20px; }
.lk-article h2 { font-size: 18px; }
.lk-article h3 { font-size: 16px; }
.lk-article ul, .lk-article ol { margin: 0 0 14px; padding-left: 22px; }
.lk-article li { margin: 4px 0; }
.lk-article img {
    max-width: 100%; height: auto; border-radius: 10px; margin: 6px 0;
    box-shadow: 0 1px 3px rgba(16, 24, 40, .08);
}
.lk-article blockquote {
    margin: 0 0 14px; padding: 9px 12px; border-left: 3px solid var(--lk-green-line);
    background: var(--lk-green-bg); border-radius: 0 8px 8px 0; color: var(--lk-green-dark);
}
.lk-article pre {
    margin: 0 0 14px; padding: 12px; overflow-x: auto;
    background: #f6f8fa; border: 1px solid var(--lk-line); border-radius: 10px;
    font-size: 13px; line-height: 1.6;
}
.lk-article code { background: #f6f8fa; padding: 1px 5px; border-radius: 5px; font-size: 13px; }
.lk-article pre code { background: none; padding: 0; }
.lk-article table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0 0 14px; }
.lk-article th, .lk-article td { border: 1px solid var(--lk-line); padding: 7px 10px; }
.lk-article th { background: #fafbfc; font-weight: 600; }
.lk-article a { color: #1d4ed8; text-decoration: underline; }
.lk-article hr { border: 0; border-top: 1px solid var(--lk-line); margin: 20px 0; }

/* 前置知识：可点的小胶囊 */
.lk-pt-prev { display: flex; gap: 8px; flex-wrap: wrap; }
.lk-pt-prev-item { cursor: pointer; padding: 5px 12px; }

/* 动作区：主操作「我学完了」放最后、最右，符合「先读完再动手」的顺序 */
.lk-pt-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 10px; }

/* 复制链接弹窗：地址用等宽字体，一眼能看出是 URL */
.lk-link-hint { margin: 6px 0 10px; }
.lk-link-label { display: block; font-size: 12px; color: var(--lk-text-sub); margin-bottom: 4px; }
.lk-link-input {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px; background: #fafbfc;
}

/* 输入框聚焦：mac 风格的柔和外环（而不是默认的硬边框） */
.lk-textarea:focus, .lk-input:focus, .lk-select:focus {
    outline: none; border-color: var(--lk-green);
    box-shadow: 0 0 0 3px rgba(7, 193, 96, .12);
}

/* 桌面端（宽屏）专属放大：
   【必须放在本文件最末】媒体查询里的覆盖规则和基础规则**同优先级**，
   靠“谁在后面谁赢”生效。放在前面的话，后面的 .lk-pt-title{font-size:22px}
   会把这里的 26px 盖回去（写完屏幕预览才发现，见 2026-10-07 开发日志）。 */
@media (min-width: 900px) {
    .lk-pt-title { font-size: 26px; }
    .lk-pt-stat b { font-size: 20px; }
    .lk-article { font-size: 16px; }
}
