/* 物理诊断练习系统 样式 */

* { margin: 0; padding: 0; box-sizing: border-box; }

mjx-container[display="true"] {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 0;
}

body {
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f5f6fa;
    color: #2d3436;
    line-height: 1.6;
}

/* ─── 顶栏 ─── */
.topbar {
    background: #2d3436;
    color: #fff;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.brand { font-weight: 700; font-size: 16px; }
.user-info { font-size: 14px; }
.user-info a {
    color: #dfe6e9;
    text-decoration: none;
    margin-left: 12px;
}
.user-info a:hover { color: #fff; text-decoration: underline; }

/* ─── 容器 ─── */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 16px;
}

/* ─── Flash消息 ─── */
.flash {
    background: #ffeaa7;
    border: 1px solid #fdcb6e;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}
.flash p { margin: 4px 0; }

/* ─── 登录 ─── */
.login-box {
    max-width: 360px;
    margin: 80px auto;
    background: #fff;
    border-radius: 12px;
    padding: 40px 32px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    text-align: center;
}
.login-box h2 { margin-bottom: 8px; }
.login-box .subtitle { color: #636e72; margin-bottom: 24px; font-size: 14px; }
.login-box input {
    display: block;
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 12px;
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    font-size: 16px;
}
.login-box input:focus {
    outline: none;
    border-color: #0984e3;
}
.login-box button {
    width: 100%;
    padding: 12px;
    background: #0984e3;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 8px;
}
.login-box button:hover { background: #0769b8; }

/* ─── 模型卡片网格 ─── */
h2 { margin-bottom: 8px; }
.hint { color: #636e72; font-size: 14px; margin-bottom: 20px; }

.model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}
.model-card {
    display: block;
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    text-decoration: none;
    color: inherit;
    border: 2px solid transparent;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.model-card:hover {
    border-color: #0984e3;
    box-shadow: 0 2px 8px rgba(9,132,227,0.15);
}
.model-card.locked {
    background: #f8f9fa;
    border-color: #dfe6e9;
    color: #636e72;
    cursor: not-allowed;
}
.model-card.locked:hover {
    border-color: #dfe6e9;
    box-shadow: none;
}
.model-code { font-size: 13px; color: #636e72; }
.model-name { font-size: 16px; font-weight: 600; margin: 4px 0 8px; }
.model-stats { font-size: 13px; color: #636e72; display: flex; gap: 8px; flex-wrap: wrap; }
.model-stats .new { color: #0984e3; }
.model-stats .available-at { color: #b45309; font-weight: 600; }
.model-stats .accuracy { font-weight: 600; }
.accuracy.good { color: #00b894; }
.accuracy.ok { color: #fdcb6e; }
.accuracy.bad { color: #d63031; }

.review-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 18px;
    border-left: 4px solid #0984e3;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.review-entry strong { display: block; font-size: 17px; }
.review-entry span { color: #636e72; font-size: 14px; }
.review-entry .btn { flex: 0 0 auto; min-width: 120px; }
.review-entry-strong { border-left-color: #f97316; }

/* ─── 做题页 ─── */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 8px;
}
.back {
    color: #0984e3;
    text-decoration: none;
    font-size: 14px;
}
.quiz-info { font-size: 14px; color: #636e72; }

.quiz-body {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.quiz-image {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}
.quiz-image-card {
    margin: 0;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px;
}
.quiz-image-card figcaption {
    color: #334155;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 6px;
}
.quiz-image img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}
.question-text {
    font-size: 17px;
    line-height: 1.8;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.options { display: flex; flex-direction: column; gap: 10px; }
.option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #dfe6e9;
    border-radius: 10px;
    background: #fff;
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-align: left;
    transition: all 0.15s;
}
.option:hover { border-color: #74b9ff; background: #f8f9ff; }
.option:active { transform: translateY(1px); }
.option.selected { border-color: #0984e3; background: #ebf5ff; }
.option input { display: none; }
.letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #dfe6e9;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.option.selected .letter { background: #0984e3; color: #fff; }
.option .text { font-size: 15px; padding-top: 2px; }

.submit-btn {
    display: block;
    width: 100%;
    padding: 14px;
    margin-top: 20px;
    background: #0984e3;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}
.submit-btn:disabled { background: #b2bec3; cursor: not-allowed; }
.submit-btn:not(:disabled):hover { background: #0769b8; }

.unknown-btn {
    display: block;
    width: 100%;
    padding: 13px;
    margin-top: 10px;
    background: #fff7ed;
    color: #9a3412;
    border: 2px solid #fed7aa;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.unknown-btn:hover { background: #ffedd5; }
.report-btn {
    display: block;
    width: 100%;
    padding: 11px;
    margin-top: 10px;
    background: #f8fafc;
    color: #475569;
    border: 1px dashed #94a3b8;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.report-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.review-mode-note {
    padding: 12px 14px;
    margin-bottom: 16px;
    border-radius: 10px;
    background: #eef6ff;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
    font-size: 14px;
}

/* ─── 结果页 ─── */
.result-box {
    text-align: center;
    padding: 32px;
    border-radius: 12px;
    margin-bottom: 20px;
}
.result-box.correct { background: #e8f8f0; }
.result-box.wrong { background: #fde8e8; }
.result-icon { font-size: 48px; margin-bottom: 8px; }
.result-box.correct .result-icon { color: #00b894; }
.result-box.wrong .result-icon { color: #d63031; }
.your-answer { margin-top: 8px; font-size: 15px; color: #636e72; }

.review-added-box {
    background: #fff7ed;
    border-left: 4px solid #f97316;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 14px;
    color: #9a3412;
    font-weight: 600;
}

.diagnosis-box, .solution-box, .explanation-box {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 12px;
}
.diagnosis-box {
    border-left: 4px solid #e17055;
}
.diagnosis-box h3 { color: #d63031; margin-bottom: 8px; }
.diagnosis-text { font-size: 16px; font-weight: 500; }
.shared-context {
    background: #f8fafc;
    border-left: 4px solid #64748b;
    padding: 16px 18px;
    margin-bottom: 18px;
}
.shared-context-text { font-size: 17px; line-height: 1.8; }
.shared-context-images { margin-top: 14px; }
.solution-images { margin-top: 14px; margin-bottom: 0; }
.solution-box { border-left: 4px solid #0984e3; }
.solution-box h3 { color: #0984e3; margin-bottom: 8px; }
.explanation-box { border-left: 4px solid #636e72; }
.explanation-box h3 { color: #636e72; margin-bottom: 8px; }

.next-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}
.btn {
    flex: 1;
    text-align: center;
    padding: 14px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
}
.btn.primary { background: #0984e3; color: #fff; }
.btn.primary:hover { background: #0769b8; }
.btn.secondary { background: #dfe6e9; color: #2d3436; }
.btn.secondary:hover { background: #c8d6e5; }

/* ─── 表格 ─── */
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
    font-size: 14px;
}
th {
    background: #f5f6fa;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #636e72;
}
td {
    padding: 10px 12px;
    border-top: 1px solid #f0f0f0;
}
td.good { color: #00b894; font-weight: 600; }
td.ok { color: #e17055; font-weight: 600; }
td.bad { color: #d63031; font-weight: 600; }
td a { color: #0984e3; text-decoration: none; }
td a:hover { text-decoration: underline; }
.question-preview { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-correct { background: #f0fff4; }
.row-wrong { background: #fff5f5; }
.muted-small { color: #636e72; font-size: 12px; margin-top: 2px; }

/* ─── 教师面板 ─── */
.panel { margin-bottom: 32px; }
.panel h3 { margin-bottom: 12px; color: #2d3436; }
.pool-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    flex-wrap: wrap;
}
.pool-filter label {
    color: #636e72;
    font-weight: 700;
    font-size: 13px;
}
.pool-filter select {
    min-width: 280px;
    max-width: 100%;
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    padding: 8px 10px;
    background: #fff;
    color: #2d3436;
}
.cohort-panel {
    border-top: 1px solid #dfe6e9;
    margin-bottom: 18px;
}
.cohort-panel > summary {
    cursor: pointer;
    padding: 14px 4px;
    font-size: 17px;
    font-weight: 700;
    color: #2d3436;
}
.cohort-classes {
    padding: 0 0 4px 18px;
    border-left: 3px solid #dfe6e9;
}
.class-panel {
    background: #fff;
    border-radius: 10px;
    margin-bottom: 12px;
    border: 1px solid #edf0f2;
    overflow-x: auto;
}
.nested-class-panel { border-radius: 6px; }
.class-panel summary {
    cursor: pointer;
    padding: 12px 14px;
    font-weight: 700;
    color: #2d3436;
    background: #f8fafc;
}
.class-panel table {
    border-radius: 0;
    margin-bottom: 0;
    min-width: 720px;
}
.pool-cell {
    display: grid;
    gap: 2px;
    min-width: 76px;
}
.pool-cell strong {
    color: #2d3436;
    font-size: 13px;
}
.pool-cell span {
    font-size: 12px;
}
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}
.badge.good { background: #e8f8f0; color: #00b894; }
.badge.ok { background: #fef3e5; color: #e17055; }
.badge.bad { background: #fde8e8; color: #d63031; }
.inline-danger-btn {
    border: 1px solid #e17055;
    background: #fff;
    color: #b23b2a;
    padding: 5px 10px;
    font-size: 13px;
    cursor: pointer;
}
.inline-danger-btn:hover { background: #fff5f2; }
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
}
.summary-grid div {
    background: #fff;
    border: 1px solid #edf0f2;
    border-radius: 10px;
    padding: 14px;
}
.summary-grid strong {
    display: block;
    font-size: 24px;
    color: #0984e3;
    line-height: 1.2;
}
.summary-grid span {
    color: #636e72;
    font-size: 13px;
}
.option-list-static {
    background: #f8fafc;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 12px;
}
.option-list-static p { margin: 8px 0; }
.teacher-answer { color: #2d3436; }
.report-note {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    font-weight: 600;
}
.teacher-explanation {
    margin-top: 14px;
    padding: 14px;
    background: #f8fafc;
    border-left: 4px solid #0984e3;
}
.teacher-explanation h3 { color: #0984e3; margin-bottom: 8px; }
.record-panel {
    background: #fff;
    border: 1px solid #edf0f2;
    margin-bottom: 32px;
}
.record-panel summary {
    cursor: pointer;
    padding: 14px 16px;
    font-weight: 700;
    color: #2d3436;
    background: #f8fafc;
}
.record-panel table { margin-bottom: 0; border-radius: 0; }
.ranking-note {
    margin: -4px 0 14px;
    color: #636e72;
    font-size: 13px;
}
.compact-empty { padding: 20px; }

/* ─── 进度页 ─── */
.stats-table { margin-bottom: 32px; }
.wrong-list { display: flex; flex-direction: column; gap: 12px; }
.wrong-item {
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    border-left: 3px solid #d63031;
}
.wrong-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 13px;
    color: #636e72;
    margin-bottom: 8px;
}
.model-tag {
    background: #dfe6e9;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}
.review-hearts {
    background: #fff7ed;
    color: #9a3412;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}
.wrong-text { font-size: 15px; margin-bottom: 8px; }
.wrong-link {
    display: block;
    color: #2d3436;
    text-decoration: none;
}
.wrong-link:hover { color: #0984e3; text-decoration: underline; }
.wrong-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 6px;
    margin: 10px 0;
    font-size: 14px;
}
.wrong-options div,
.option-list-static .right,
.option-list-static .picked {
    border-radius: 8px;
    padding: 7px 9px;
}
.wrong-options div {
    background: #f8fafc;
    border: 1px solid #edf0f2;
}
.wrong-options .right,
.option-list-static .right {
    background: #e8f8f0;
    border: 1px solid #a7f3d0;
}
.wrong-options .picked,
.option-list-static .picked {
    background: #fde8e8;
    border: 1px solid #fecaca;
}
.wrong-solution { font-size: 13px; color: #0984e3; }
.detail-link {
    display: inline-block;
    margin-top: 6px;
    color: #0984e3;
    font-size: 14px;
    text-decoration: none;
    font-weight: 600;
}
.detail-link:hover { text-decoration: underline; }
.time { font-size: 12px; }

/* ─── 通用 ─── */
.empty {
    text-align: center;
    padding: 40px;
    color: #636e72;
}
h3 { margin-bottom: 12px; }

/* ─── 手机适配 ─── */
@media (max-width: 640px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        padding: 10px 12px;
    }
    .user-info a {
        display: inline-block;
        margin: 6px 10px 0 0;
    }
    .container { padding: 14px 10px; }
    .login-box {
        margin: 36px auto;
        padding: 28px 20px;
    }
    .model-grid { grid-template-columns: 1fr; }
    .review-entry,
    .quiz-header,
    .next-actions {
        align-items: stretch;
        flex-direction: column;
    }
    .review-entry .btn,
    .next-actions .btn { width: 100%; }
    .quiz-body {
        padding: 16px 12px;
        border-radius: 10px;
    }
    .quiz-image { grid-template-columns: 1fr; }
    .quiz-image img { max-height: 240px; }
    .question-text {
        font-size: 16px;
        line-height: 1.7;
    }
    .option { padding: 13px 12px; }
    .option .text { font-size: 15px; }
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        font-size: 13px;
    }
    th, td { padding: 8px 6px; }
}
