/* 基础样式 */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { font-family: -apple-system, 'Segoe UI', 'PingFang SC', Roboto, sans-serif; background: #f6f9fc; color: #1a2332; min-height: 100vh; padding: 16px 12px 30px; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); cursor: default !important; }
.app-container { max-width: 800px; margin: 0 auto; background: #fff; border-radius: 24px; box-shadow: 0 8px 30px rgba(0, 20, 40, 0.06); padding: 20px 16px 30px; cursor: default !important; }
h1, h2, h3, h4, p, .section-title, .hint, .text-sm, .q-text, .progress-text, .footer-tech, .file-name, .file-types-hint, .result-badge, .explanation, .sa-reference, .sa-user-answer, .author-credit, .time-badge, .status-badge, .step { cursor: default !important; }
.app-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 2px solid #edf2f7; }
.app-header h1 { font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.app-header h1 span { background: #eef4ff; color: #2a5cff; font-size: 12px; font-weight: 600; padding: 2px 12px; border-radius: 40px; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.header-actions .btn { padding: 6px 14px; font-size: 13px; }
.status-badge { font-size: 12px; background: #e8ecf1; padding: 4px 12px; border-radius: 40px; color: #3d4a5c; font-weight: 500; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.status-badge .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.idle { background: #94a3b8; }
.dot.generating { background: #f59e0b; animation: pulse 0.8s infinite; }
.dot.ready { background: #22c55e; }
.dot.error { background: #ef4444; }
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:0.5;transform:scale(0.85)} }
.steps { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: #94a3b8; background: #f1f4f8; padding: 4px 12px 4px 8px; border-radius: 40px; transition: 0.2s; }
.step .num { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: #dce2ea; color: #4b5a6e; font-weight: 700; font-size: 11px; }
.step.active { background: #eef4ff; color: #1a3c8f; }
.step.active .num { background: #2a5cff; color: #fff; }
.step.done { background: #dcfce7; color: #166534; }
.step.done .num { background: #22c55e; color: #fff; }
.section { margin-bottom: 20px; }
.section-title { font-size: 16px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section-title .hint { font-weight: 400; font-size: 13px; color: #6b7a8e; }
textarea { width: 100%; min-height: 140px; padding: 14px 16px; border: 2px solid #e2e8f0; border-radius: 16px; font-size: 15px; line-height: 1.6; font-family: inherit; resize: vertical; background: #fafcff; }
textarea:focus { outline: none; border-color: #2a5cff; box-shadow: 0 0 0 4px rgba(42,92,255,0.08); background: #fff; }
.file-upload-area { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.file-upload-area span { cursor: default; }
.file-upload-area label { background: #f1f4f8; padding: 8px 16px; border-radius: 40px; font-weight: 500; font-size: 13px; cursor: pointer; border: 2px dashed #d0d9e6; display: inline-flex; align-items: center; gap: 6px; }
.file-upload-area label:active { background: #e8edf5; }
.file-upload-area input[type="file"] { display: none; }
.file-name { font-size: 13px; color: #3d4a5c; background: #f1f4f8; padding: 4px 14px; border-radius: 40px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-types-hint { font-size: 11px; color: #5b7a9e; background: #eef4ff; padding: 3px 10px; border-radius: 20px; font-weight: 500; white-space: nowrap; }
.btn { padding: 10px 24px; border: none; border-radius: 40px; font-weight: 600; font-size: 14px; cursor: pointer; transition: 0.15s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: #e8ecf1; color: #3d4a5c; min-height: 44px; touch-action: manipulation; }
.btn:active { transform: scale(0.96); }
.btn-primary { background: #2a5cff; color: #fff; box-shadow: 0 4px 12px rgba(42,92,255,0.25); }
.btn-primary:active { background: #1a4adf; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-success:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-success { background: #22c55e; color: #fff; }
.btn-success:active { background: #16a34a; }
.btn-outline { background: transparent; border: 2px solid #d0d9e6; }
.btn-outline:active { background: #f1f4f8; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:active { background: #dc2626; }
.config-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding: 12px 16px; background: #f8fafc; border-radius: 14px; }
.config-row label { font-weight: 500; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.config-row input[type="number"] { width: 64px; padding: 6px 8px; border: 2px solid #e2e8f0; border-radius: 10px; font-size: 15px; text-align: center; font-weight: 600; }
.config-row input[type="number"]:focus { outline: none; border-color: #2a5cff; }
.text-sm { font-size: 13px; color: #6b7a8e; line-height: 1.5; }
.text-sm a { color: #2a5cff; }

/* 答题区 */
.quiz-area { margin-top: 6px; }
.question-card { background: #fafcff; border: 2px solid #eef2f7; border-radius: 18px; padding: 18px 16px; margin-bottom: 14px; }
.question-card.correct { border-color: #86efac; background: #f0fdf4; }
.question-card.wrong { border-color: #fca5a5; background: #fef2f2; }
.question-card .q-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.question-card .q-number { font-weight: 700; font-size: 14px; color: #2a5cff; background: #eef4ff; padding: 2px 12px; border-radius: 40px; }
.question-card .q-text { font-size: 16px; font-weight: 500; line-height: 1.6; margin-bottom: 14px; }
.question-card .options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.question-card .option { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 2px solid #eef2f7; cursor: pointer; background: #fff; font-size: 15px; min-height: 48px; touch-action: manipulation; }
.question-card .option:active:not(.disabled) { transform: scale(0.98); }
.question-card .option.disabled { cursor: default; opacity: 0.9; }
.question-card .option.selected { border-color: #2a5cff; background: #eef4ff; }
.question-card .option.correct-answer { border-color: #22c55e; background: #dcfce7; }
.question-card .option.wrong-answer { border-color: #ef4444; background: #fee2e2; }
.question-card .option .marker { width: 26px; height: 26px; border-radius: 50%; background: #f1f4f8; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: #4b5a6e; flex-shrink: 0; }
.question-card .option.selected .marker { background: #2a5cff; color: #fff; }
.question-card .option.correct-answer .marker { background: #22c55e; color: #fff; }
.question-card .option.wrong-answer .marker { background: #ef4444; color: #fff; }
.question-card .explanation { margin-top: 10px; padding: 12px 16px; background: #f1f6fd; border-radius: 12px; border-left: 4px solid #2a5cff; font-size: 14px; line-height: 1.6; display: none; }
.question-card .explanation.show { display: block; }
.question-card .result-badge { font-weight: 600; font-size: 13px; padding: 2px 14px; border-radius: 40px; }
.result-badge.correct { color: #166534; background: #dcfce7; }
.result-badge.wrong { color: #991b1b; background: #fee2e2; }
.quiz-nav { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin: 16px 0 10px; padding: 10px 14px; background: #f8fafc; border-radius: 16px; }
.quiz-nav .progress-text { font-size: 14px; font-weight: 500; color: #3d4a5c; }
.quiz-nav .nav-buttons { display: flex; gap: 10px; }
.quiz-nav .nav-buttons .btn { padding: 8px 18px; font-size: 14px; min-height: 40px; }
.stats { display: flex; flex-wrap: wrap; gap: 12px 24px; background: #f8fafc; border-radius: 16px; padding: 14px 18px; margin-top: 18px; align-items: center; }
.stats .stat-item { display: flex; align-items: baseline; gap: 4px; font-size: 14px; }
.stats .stat-item .num { font-weight: 700; font-size: 20px; color: #1a2332; }
.stats .stat-item .num.green { color: #22c55e; }
.stats .stat-item .num.red { color: #ef4444; }
.stats .stat-item .num.blue { color: #2a5cff; }

/* 历史记录 */
.history-page { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: center; z-index: 1000; padding: 12px; }
.history-content { background: #fff; border-radius: 24px; max-width: 700px; width: 100%; max-height: 90vh; padding: 20px 18px 24px; overflow-y: auto; box-shadow: 0 20px 50px rgba(0,0,0,0.25); }
.history-content h2 { display: flex; justify-content: space-between; align-items: center; font-size: 20px; margin-bottom: 16px; border-bottom: 2px solid #edf2f7; padding-bottom: 12px; }
.history-content h2 span { font-size: 14px; font-weight: 400; color: #6b7a8e; }
.history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.history-table th { text-align: left; padding: 8px 6px; background: #f1f4f8; border-radius: 6px; font-weight: 600; }
.history-table td { padding: 8px 6px; border-bottom: 1px solid #edf2f7; }
.history-empty { text-align: center; color: #94a3b8; padding: 30px 0; }
.history-actions { display: flex; gap: 10px; margin-top: 16px; justify-content: flex-end; }
.history-actions .btn { min-height: 40px; padding: 8px 18px; font-size: 13px; }
.hidden { display: none !important; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 3px solid rgba(42,92,255,0.15); border-top: 3px solid #2a5cff; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 响应式 */
@media (max-width: 480px) {
    .app-container { padding: 14px 12px 20px; border-radius: 16px; }
    .app-header h1 { font-size: 18px; }
    .question-card { padding: 14px 12px; }
    .question-card .q-text { font-size: 15px; }
    .question-card .option { font-size: 14px; padding: 10px 12px; min-height: 44px; }
    .config-row { flex-direction: column; align-items: stretch; }
    .stats { flex-direction: column; align-items: stretch; gap: 6px; }
    .quiz-nav { flex-direction: column; align-items: stretch; gap: 10px; }
    .quiz-nav .nav-buttons { justify-content: center; }
    .history-content { padding: 16px 12px; }
    .history-table { font-size: 12px; }
    .history-table th, .history-table td { padding: 6px 4px; }
}

/* 页脚 */
.app-footer { margin-top: 24px; padding-top: 16px; border-top: 2px solid #edf2f7; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12px; color: #8a9aae; }
.footer-tech { display: flex; gap: 12px; }

/* 作者署名 */
.author-credit {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: #2a5cff;
    opacity: 0.65;
    transition: opacity 0.3s;
    cursor: default;
    user-select: none;
}
.author-credit::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    background: #2a5cff;
    border-radius: 50%;
    margin-right: 7px;
    vertical-align: middle;
    opacity: 0.45;
}
.author-credit:hover { opacity: 1; }

/* 时间标记 */
.time-badge {
    font-weight: 600;
    color: #2a5cff;
    margin-left: 6px;
    background: #eef4ff;
    padding: 0 10px;
    border-radius: 12px;
    font-size: 13px;
}

/* 题型选择器 */
.type-selector { display: flex; gap: 0; border-radius: 12px; overflow: hidden; border: 2px solid #e2e8f0; }
.type-btn { padding: 6px 16px; font-size: 13px; font-weight: 500; cursor: pointer; background: #fff; color: #6b7a8e; border: none; transition: 0.15s; }
.type-btn:first-child { border-right: 1px solid #e2e8f0; }
.type-btn.active { background: #2a5cff; color: #fff; }
.type-btn:active { transform: scale(0.96); }

/* 简答题样式 */
.sa-textarea { width: 100%; min-height: 100px; padding: 12px 14px; border: 2px solid #e2e8f0; border-radius: 12px; font-size: 15px; line-height: 1.6; font-family: inherit; resize: vertical; background: #fafcff; margin-bottom: 12px; }
.sa-textarea:focus { outline: none; border-color: #2a5cff; box-shadow: 0 0 0 4px rgba(42,92,255,0.08); background: #fff; }
.sa-submit-row { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.sa-reference { margin-top: 12px; padding: 14px 16px; background: #f0fdf4; border-radius: 12px; border: 2px solid #86efac; font-size: 14px; line-height: 1.6; }
.sa-reference strong { color: #166534; }
.sa-keywords { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sa-keyword-tag { background: #dcfce7; color: #166534; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.sa-user-answer { margin-top: 10px; padding: 12px 16px; background: #f1f6fd; border-radius: 12px; border-left: 4px solid #2a5cff; font-size: 14px; line-height: 1.6; }
.sa-self-eval { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.sa-self-eval .eval-btn { padding: 8px 16px; border-radius: 20px; border: 2px solid #e2e8f0; background: #fff; font-size: 13px; font-weight: 500; cursor: pointer; transition: 0.15s; }
.sa-self-eval .eval-btn:active { transform: scale(0.96); }
.sa-self-eval .eval-btn.correct { border-color: #22c55e; color: #166534; }
.sa-self-eval .eval-btn.correct:hover { background: #dcfce7; }
.sa-self-eval .eval-btn.partial { border-color: #f59e0b; color: #92400e; }
.sa-self-eval .eval-btn.partial:hover { background: #fef3c7; }
.sa-self-eval .eval-btn.wrong { border-color: #ef4444; color: #991b1b; }
.sa-self-eval .eval-btn.wrong:hover { background: #fee2e2; }

/* 生成中状态：表单冻结 */
textarea:disabled,
input[type="number"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.type-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.file-upload-area label.locked {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}
