/* ═══════════════════════════════════════════════════════
   作文课
   ═══════════════════════════════════════════════════════ */
.essay-page { max-width: 1180px; margin: 0 auto; }
.essay-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.essay-head h1 { font-size: 26px; letter-spacing: .5px; }
.essay-head .sub { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.essay-history {
  padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); font-size: 13.5px; max-width: 220px;
}
.essay-prompt {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px 20px; box-shadow: var(--shadow-sm); margin-bottom: 16px;
}
.essay-prompt.compact { padding: 12px 16px; }
.essay-label { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink-2); margin: 12px 0 6px; }
.essay-prompt .essay-label { margin-top: 0; }
.essay-prompt textarea, .essay-input {
  width: 100%; padding: 11px 14px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--surface-2);
  line-height: 1.7; resize: vertical; outline: none; transition: .15s;
}
.essay-prompt textarea:focus, .essay-input:focus { border-color: var(--brand); background: var(--surface); }
.essay-prompt-ops { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.essay-file { cursor: pointer; }
.essay-words {
  width: 190px; padding: 9px 13px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface-2);
}
.essay-words:focus { border-color: var(--brand); outline: none; }
.essay-samples { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.essay-samples .chip { font-size: 12.5px; }

/* 步骤条 */
.essay-steps { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-bottom: 18px; }
.essay-step {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; text-align: left; transition: .15s;
}
.essay-step:hover:not(:disabled) { border-color: var(--muted-2); }
.essay-step .num {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); color: var(--muted); font-size: 12.5px; font-weight: 700;
}
.essay-step .name { font-size: 14px; font-weight: 600; }
.essay-step .hint { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.essay-step.on { border-color: var(--brand); background: var(--brand-softer); }
.essay-step.on .num { background: var(--brand); color: #fff; }
.essay-step.done .num { background: var(--brand-soft); color: var(--brand-dark); }
.essay-step.locked { opacity: .45; cursor: not-allowed; }

/* 主体 */
.essay-body { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 18px; align-items: start; }
.essay-main { min-width: 0; }
.essay-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px 20px; box-shadow: var(--shadow-sm); margin-bottom: 14px;
}
.essay-card h2 { font-size: 20px; margin-bottom: 8px; }
.essay-card h3 { font-size: 15.5px; margin-bottom: 8px; }
.essay-lead p { margin: 0 0 8px; color: var(--ink-2); }
.essay-lead .btn { margin-top: 8px; }
.essay-lead-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.essay-summary { font-size: 16.5px; line-height: 1.75; color: var(--ink); }
.essay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.essay-grid .essay-card { margin-bottom: 0; }
.essay-focus { font-size: 18px; font-weight: 600; color: var(--brand-dark); line-height: 1.6; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips .chip { cursor: default; }
.essay-list { margin: 0; padding-left: 18px; }
.essay-list li { margin: 4px 0; color: var(--ink-2); }
.essay-warn { border-color: color-mix(in srgb, var(--accent) 28%, var(--line)); background: var(--accent-soft); }
.essay-warn h3 { color: var(--accent); }
.essay-score-table .row {
  display: grid; grid-template-columns: 70px 1fr; gap: 10px;
  padding: 7px 0; border-bottom: 1px dashed var(--line);
}
.essay-score-table .row:last-child { border-bottom: 0; }
.essay-score-table b { color: var(--brand-dark); }
.essay-score-table span { color: var(--ink-2); font-size: 14px; }
.essay-question { border-left: 4px solid var(--brand); }
.essay-question p { font-size: 16px; margin: 4px 0 10px; }
.essay-next { display: flex; justify-content: flex-end; margin: 6px 0 8px; }

/* 立意 / 选材 */
.essay-ideas, .essay-materials { display: grid; gap: 14px; }
.essay-idea, .essay-material { margin-bottom: 0; }
.essay-idea.on, .essay-material.on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft), var(--shadow-sm); }
.essay-idea-top { display: flex; align-items: center; gap: 8px; }
.essay-idea-top h3 { flex: 1; margin: 0; }
.essay-thesis { font-size: 17px; font-weight: 600; color: var(--brand-dark); margin: 6px 0 10px; line-height: 1.6; }
.essay-scene { font-size: 15.5px; margin: 6px 0 10px; color: var(--ink); }
.essay-idea p.small, .essay-material p.small { margin: 4px 0; }
.essay-risk { color: var(--accent) !important; }
.essay-idea .btn, .essay-material .btn { margin-top: 10px; }

/* 提纲 */
.essay-outline-body { padding: 10px 0; border-top: 1px dashed var(--line); margin-top: 6px; }
.essay-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.essay-progress {
  display: flex; gap: 14px; align-items: baseline; margin-top: 8px;
  padding-top: 10px; border-top: 1px dashed var(--line);
}
.essay-progress b { font-size: 22px; color: var(--brand-dark); }

/* 动笔 */
.essay-draft-sec textarea { min-height: 90px; }
.essay-draft-sec .essay-actions { margin-top: 8px; }

/* 范文 */
.essay-model {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px 24px; box-shadow: var(--shadow-sm); margin-bottom: 14px;
}
.essay-model-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.essay-model-text {
  font-family: var(--serif); font-size: 17px; line-height: 2; color: var(--ink);
  background: var(--surface-2); border-radius: var(--r-md); padding: 18px 22px;
  max-height: 62vh; overflow: auto;
}
.essay-model-text p { margin: 0 0 14px; text-indent: 2em; }
.essay-model-points { margin-top: 16px; padding: 14px 18px; border-radius: var(--r-md); background: var(--brand-softer); }
.essay-model-points h3 { color: var(--brand-dark); }
.essay-notes { margin-top: 14px; }
.essay-note {
  display: grid; grid-template-columns: 64px 1fr; gap: 10px;
  padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px;
}
.essay-note b { color: var(--brand-dark); }

/* 升格 */
.essay-band-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.essay-score { font-size: 30px; font-weight: 700; color: var(--brand-dark); }
.essay-score small { font-size: 13px; color: var(--muted); font-weight: 500; }
.essay-upgrade-item { padding: 12px 0; border-bottom: 1px dashed var(--line); }
.essay-up-orig b, .essay-up-new b { font-size: 12px; letter-spacing: 1px; color: var(--muted); }
.essay-up-orig p { margin: 4px 0 10px; color: var(--muted); text-decoration: line-through; line-height: 1.7; }
.essay-up-new p { margin: 4px 0 8px; color: var(--brand-dark); font-weight: 500; line-height: 1.7; }
.essay-upgrade-item .btn { margin-top: 4px; }

/* 对话 */
.essay-chat {
  position: sticky; top: 78px; height: calc(100vh - 108px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.essay-chat-head {
  display: flex; align-items: baseline; gap: 8px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.essay-msgs { flex: 1; overflow: auto; padding: 12px 14px; }
.essay-msgs .msg { margin: 10px 0; }
.essay-msgs .msg .bubble { font-size: 14.5px; line-height: 1.7; }
.essay-chat-empty { color: var(--muted); text-align: center; padding: 28px 10px; }
.essay-chat-empty p { margin: 6px 0; }
.essay-dock {
  display: flex; gap: 8px; align-items: center; padding: 10px 12px;
  border-top: 1px solid var(--line); background: var(--surface-2);
}
.essay-dock .mic { width: 44px; height: 44px; flex: none; }
.essay-dock input {
  flex: 1; min-width: 0; padding: 10px 13px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); outline: none;
}
.essay-dock input:focus { border-color: var(--brand); }
.essay-err { color: var(--danger); }

.essay-empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.essay-empty .big { font-size: 44px; }
.essay-empty h2 { color: var(--ink); margin: 10px 0 8px; }

/* 五步法 */
.essay-method {
  margin-top: 14px; padding: 12px 16px; border-radius: var(--r-md);
  border: 1px dashed var(--line-strong); background: var(--surface-2);
}
.essay-method summary { cursor: pointer; font-weight: 600; color: var(--brand-dark); }
.essay-method ol { margin: 10px 0 6px; padding-left: 20px; }
.essay-method li { margin: 6px 0; color: var(--ink-2); line-height: 1.7; }

/* 作文批改（单独上传写好的作文） */
.review-item { padding: 12px 0; border-bottom: 1px dashed var(--line); }
.review-item:last-child { border-bottom: 0; }
.review-item .name { font-weight: 700; color: var(--brand-dark); margin-bottom: 4px; }
.review-item p { margin: 0 0 6px; }
.review-item .advice { color: var(--ink-2); font-size: 14px; }
.review-next { background: var(--brand-softer); border-color: var(--brand-soft); }
.review-orig { line-height: 1.9; font-size: 14.5px; color: var(--ink-2); }
.review-coach-cta {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--brand-softer); border-color: var(--brand-soft);
}
.review-coach-cta h2 { margin: 0 0 6px; }
.review-coach-cta p { margin: 0; }

/* 作文讲评：一段一段过 */
.coach-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.coach-progress { font-weight: 700; color: var(--brand-dark); }
.coach-done {
  font-size: 12px; padding: 2px 9px; border-radius: 999px;
  background: var(--brand); color: #fff;
}
.coach-paras { line-height: 2; font-size: 15px; color: var(--ink); }
.coach-para {
  position: relative; margin: 0 0 12px; padding: 10px 14px 10px 42px;
  border-radius: var(--r-md); border: 1px solid transparent; text-indent: 2em;
  transition: background .25s, border-color .25s, opacity .25s;
}
.coach-para .pn {
  position: absolute; left: 11px; top: 11px; width: 21px; height: 21px;
  border-radius: 50%; background: var(--surface-2); color: var(--muted);
  font-size: 12px; font-weight: 700; text-indent: 0;
  display: flex; align-items: center; justify-content: center;
}
.coach-para.on { background: var(--brand-softer); border-color: var(--brand-soft); }
.coach-para.on .pn { background: var(--brand); color: #fff; }
.coach-para.past { opacity: .55; }
.coach-para.past .pn { background: var(--brand-soft); color: var(--brand-dark); }
.coach-route ol { margin: 10px 0 4px; padding-left: 20px; }
.coach-route li { margin: 6px 0; color: var(--ink-2); line-height: 1.7; }
.coach-route li b { color: var(--brand-dark); margin-right: 2px; }

/* 作文作业单：词汇 / 句式 / 重写 / 交作业 / 检查 */
.coach-hw-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.coach-hw-head b { color: var(--brand-dark); }
.hw-empty p { margin: 0 0 10px; color: var(--ink-2); line-height: 1.8; }
.hw-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hw-focus {
  margin: 0 0 12px; padding: 10px 13px; border-radius: var(--r-md);
  background: var(--brand-softer); border: 1px solid var(--brand-soft); color: var(--brand-dark); font-weight: 600;
}
.hw-sec { margin-top: 16px; }
.hw-sec h4 { margin: 0 0 8px; font-size: 14.5px; color: var(--ink); }
.hw-words, .hw-patterns { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.hw-words li, .hw-patterns li {
  padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line);
}
.hw-word { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.hw-word b { font-size: 15px; color: var(--brand-dark); }
.hw-ex { margin-top: 5px; font-family: Georgia, "Times New Roman", serif; font-size: 14.5px; color: var(--ink); line-height: 1.65; }
.hw-why { margin-top: 4px; color: var(--muted); }
.hw-pat b { color: var(--brand-dark); }
.hw-frame {
  margin-top: 5px; padding: 7px 10px; border-radius: 8px;
  background: var(--surface); border: 1px dashed var(--line-strong);
  font-family: Georgia, "Times New Roman", serif; font-size: 14.5px; line-height: 1.6;
}
.hw-task { margin-top: 5px; font-size: 14px; color: var(--ink-2); }
.hw-check-items { margin: 8px 0; padding-left: 20px; color: var(--ink-2); line-height: 1.75; }
.hw-self { margin-top: 8px; }
.hw-self summary { cursor: pointer; color: var(--brand-dark); font-size: 14px; }
.hw-self ul { margin: 8px 0 0; padding-left: 20px; color: var(--ink-2); line-height: 1.7; }
.hw-submit-sec textarea {
  width: 100%; margin-top: 8px; padding: 11px 13px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--surface); outline: none; resize: vertical;
  font: inherit; line-height: 1.7;
}
.hw-submit-sec textarea:focus { border-color: var(--brand); }
.hw-submit-sec .hw-actions { margin-top: 9px; }
.hw-check { margin-top: 6px; padding: 13px 15px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); }
.hw-check.ok { border-color: color-mix(in srgb, var(--success, #12a150) 45%, var(--line)); background: color-mix(in srgb, var(--success, #12a150) 6%, var(--surface)); }
.hw-check.warn { border-color: color-mix(in srgb, var(--warning, #e0a100) 45%, var(--line)); background: color-mix(in srgb, var(--warning, #e0a100) 7%, var(--surface)); }
.hw-check-h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.hw-check-h b { color: var(--ink); }
.hw-check p { margin: 6px 0; line-height: 1.75; }
.hw-check-list { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hw-check-list li { line-height: 1.7; }
.hw-check-list li b { margin-right: 6px; color: var(--ink); }
.hw-check-list .hw-tick { display: inline-block; width: 18px; font-weight: 700; }
.hw-check-list li.ok .hw-tick { color: var(--success, #12a150); }
.hw-check-list li.no .hw-tick { color: var(--danger, #d03b3b); }
.hw-fixes { margin: 8px 0; display: flex; flex-direction: column; gap: 7px; }
.hw-fix { padding: 8px 11px; border-radius: 8px; background: var(--surface-2); line-height: 1.7; }
.hw-fix s { color: var(--muted); }
.hw-next { color: var(--brand-dark); }
.hw-history { margin-top: 12px; }
.hw-history summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.hw-pass { margin-top: 14px; color: var(--muted); }

@media (max-width: 980px) {
  .essay-body { grid-template-columns: 1fr; }
  .essay-chat { position: static; height: 60vh; }
  .essay-steps { grid-template-columns: repeat(4, 1fr); }
  .essay-grid { grid-template-columns: 1fr; }
  .essay-head .spacer { display: none; }
}
@media (max-width: 620px) {
  .essay-steps { grid-template-columns: repeat(2, 1fr); }
  .essay-step .hint { display: none; }
  .essay-prompt-ops { gap: 8px; }
  .essay-words { width: 100%; }
}
