/* 妙笔 UI v2：置于既有样式之后，无需构建。 */
:root {
  --c-brand-100: #e8f1ed;
  --c-brand-500: #24736b;
  --c-brand-700: #155b55;
  --c-ink-900: #24332f;
  --c-ink-700: #475b55;
  --c-ink-500: #68756f;
  --c-line: #dedfd6;
  --c-page: #f7f3eb;
  --c-surface: #fffdf8;
  --c-success: #287052;
  --c-warn: #9a4b2e;
  --c-danger: #b43e35;
  --c-accent: #c66543;
  --c-accent-soft: #f7e9df;
  --c-violet: #9b6651;
  --c-primary: var(--c-brand-700);
  --c-primary-press: #0e4742;
  --c-primary-soft: var(--c-brand-100);
  --c-text: var(--c-ink-900);
  --c-text-sub: var(--c-ink-700);
  --c-text-weak: var(--c-ink-500);
  --c-border: var(--c-line);
  --c-bg: var(--c-page);
  --c-card: var(--c-surface);
  --c-focus: #a84e31;
  --fs-body: 17px;
  --lh-body: 1.7;
  --g1: var(--c-brand-700);
  --g2: var(--c-brand-500);
  --grad: var(--c-brand-700);
  --orange: var(--c-accent);
  --mint: var(--c-success);
  --ink: var(--c-ink-900);
  --navy: var(--c-ink-900);
  --sub: var(--c-ink-500);
  --bg: var(--c-page);
  --card: var(--c-surface);
  --line: var(--c-line);
  --sh-1: 0 1px 2px rgba(36, 51, 47, .06);
  --sh-2: 0 14px 36px rgba(36, 51, 47, .12);
  --sh-soft: 0 2px 8px rgba(36, 51, 47, .045);
  --sh-brand: 0 4px 12px rgba(21, 91, 85, .16);
  --paper-rule: #e8e2d7;
  --flow-max: 1080px;
}

html {
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  max-width: 100%;
  overflow-x: clip;
  overscroll-behavior-x: none;
}

body {
  background: var(--c-page);
  color: var(--c-text);
  font-size: var(--fs-body);
  line-height: 1.7;
}

#app {
  max-width: 100%;
  background: var(--c-bg);
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
[role="button"],
select,
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]) {
  min-height: 44px;
}

button,
[role="button"],
a,
select,
label,
input,
textarea {
  touch-action: manipulation;
}

button,
[role="button"] {
  white-space: normal;
}

p,
h1,
h2,
h3,
h4,
li,
button,
a,
label,
td,
th,
.stage-title,
.stage-lead {
  overflow-wrap: anywhere;
}

.hidden,
[hidden] {
  display: none !important;
}

:where(a, button, input, select, textarea, [tabindex], [role="button"]):focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 3px;
}

::selection {
  color: var(--c-ink-900);
  background: #efd4bd;
}

/* 既有组件：保留结构，以纸面、分隔线和少量阴影建立层级。 */
.btn,
.chatbar .send {
  color: #fff;
  background: var(--c-brand-700);
  box-shadow: none;
}

.btn:hover,
.chatbar .send:hover {
  background: var(--c-primary-press);
}

.btn.ghost {
  color: var(--c-brand-700);
  background: var(--c-brand-100);
}

.btn:disabled,
.btn[aria-busy="true"] {
  color: var(--c-ink-500);
  background: var(--c-line);
}

.card,
.paperbox,
.essay {
  border: 1px solid var(--c-line);
  box-shadow: none;
}

.card,
.paperbox {
  background: var(--c-surface);
}

input[type="text"],
textarea,
select,
.libsel,
.grsel {
  color: var(--c-text);
  background-color: var(--c-surface);
  border-color: var(--c-line);
}

input::placeholder,
textarea::placeholder {
  color: #78837d;
  opacity: 1;
}

textarea {
  line-height: 1.7;
}

input[type="text"]:focus,
textarea:focus {
  border-color: var(--c-brand-500);
}

.aibar,
.libhead,
.pagehead {
  color: var(--c-text);
}

.aibar {
  background: rgba(247, 243, 235, .96);
  border-bottom: 1px solid rgba(222, 223, 214, .8);
}

.aibar .back,
.map-close,
.vc-close,
.sheet .sh span,
.chat-toggle {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chip,
.qtitle,
.segw,
.segmy .myq {
  min-height: 44px;
  height: auto;
  color: var(--c-ink-700);
  background: var(--c-surface);
  border-color: var(--c-line);
  white-space: normal;
}

.chip.on,
.cat.on,
.segprog i.now {
  border-color: var(--c-brand-700);
  background: var(--c-brand-700);
}

.cat {
  box-shadow: none;
}

.cat.on {
  color: var(--c-brand-700);
  background: var(--c-brand-100);
  box-shadow: none;
}

.essay {
  background: transparent;
  border-width: 0 0 1px;
  border-radius: 0;
}

.es-t,
.es-good li {
  color: var(--c-ink-700);
  line-height: 1.8;
}

.es-good {
  background: var(--c-surface);
  border-left: 3px solid var(--c-accent);
}

.samnav {
  background: var(--c-surface);
  border-color: var(--c-line);
}

.samnav button.on {
  color: var(--c-brand-700);
}

.score .num {
  color: var(--c-brand-700);
  background: none;
  -webkit-text-fill-color: currentColor;
}

/* 新流程头部与进度。 */
.flow-header {
  position: sticky;
  top: 0;
  z-index: 60;
  width: 100%;
  padding: 12px 16px 10px;
  color: var(--c-text);
  background: rgba(247, 243, 235, .97);
  border-bottom: 1px solid var(--c-line);
}

.flow-progress {
  display: block;
  width: 100%;
  height: 5px;
  margin-top: 8px;
  overflow: hidden;
  color: var(--c-brand-700);
  background: var(--c-line);
  border: 0;
  border-radius: 999px;
  appearance: none;
  -webkit-appearance: none;
}

.flow-progress::-webkit-progress-bar {
  background: var(--c-line);
  border-radius: 999px;
}

.flow-progress::-webkit-progress-value {
  background: var(--c-brand-700);
  border-radius: 999px;
}

.flow-progress::-moz-progress-bar {
  background: var(--c-brand-700);
  border-radius: 999px;
}

.flow-progress > span,
.flow-progress > i,
.flow-progress [role="progressbar"] {
  display: block;
  height: 100%;
  max-width: 100%;
  background: var(--c-brand-700);
  border-radius: inherit;
}

.flow-stage {
  display: none;
  width: 100%;
  max-width: var(--flow-max);
  min-width: 0;
  margin: 0 auto;
  padding: 22px 16px calc(144px + env(safe-area-inset-bottom, 0px));
}

.flow-stage.active,
.flow-stage.is-active,
.flow-stage.on,
.flow-stage[aria-hidden="false"],
.flow-stage[data-active="true"] {
  display: block;
}

.flow-stage[aria-hidden="true"] {
  display: none !important;
}

.stage-head {
  min-width: 0;
  margin-bottom: 20px;
}

.stage-kicker {
  margin-bottom: 5px;
  color: var(--c-accent);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: .08em;
}

.stage-title {
  margin: 0;
  color: var(--c-ink-900);
  font-size: clamp(25px, 7vw, 34px);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -.01em;
}

.stage-lead {
  max-width: 42em;
  margin: 9px 0 0;
  color: var(--c-ink-700);
  font-size: 16px;
  line-height: 1.75;
}

.coach-panel,
.work-panel,
.resource-panel,
.practice-panel {
  min-width: 0;
  margin: 0 0 16px;
  padding: 16px;
  line-height: 1.75;
}

.coach-panel {
  color: var(--c-ink-700);
  background: var(--c-brand-100);
  border-left: 0;
  border-radius: 12px;
}

.coach-panel > :last-child,
.work-panel > :last-child,
.resource-panel > :last-child,
.practice-panel > :last-child {
  margin-bottom: 0;
}

.work-panel {
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: 12px;
  box-shadow: 0 3px 14px rgba(36, 51, 47, .04);
}

.work-panel textarea {
  min-height: 7em;
  background-color: var(--c-paper, #fff);
  background-image: none;
  line-height: 1.7;
}
.work-panel textarea[data-text] {
  /* 6 行 × 32px 行高 + 上下 14px padding，正好是整数行，底部不会留半条格线 */
  min-height: 220px;
  padding: 14px;
  background-color: var(--c-surface);
  /* 格线用固定 px 与 line-height 严格对齐：
     原来格线是 2em、行高是 2（相对字号），手机系统放大字号时两者会错开，
     格线就跑到字中间、几条挤在一起。固定 32px 行高 + 32px 格线，永远严丝合缝。 */
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 31px,
    var(--paper-rule) 31px,
    var(--paper-rule) 32px
  );
  /* origin 和 clip 必须同为 content-box，否则 padding 区会露出去一条错位格线 */
  background-origin: content-box;
  background-clip: content-box;
  background-attachment: local;
  font-size: 16px;
  line-height: 32px;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

.resource-panel {
  color: var(--c-ink-700);
  background: transparent;
  border-top: 1px solid var(--c-line);
  border-bottom: 1px solid var(--c-line);
}

.resource-panel h2,
.resource-panel h3,
.practice-panel h2,
.practice-panel h3 {
  color: var(--c-ink-900);
  line-height: 1.5;
}

.practice-panel {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: 12px;
}

.flow-actions {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 65;
  display: flex;
  gap: 10px;
  width: min(100%, 600px);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: rgba(255, 253, 248, .98);
  border-top: 1px solid var(--c-line);
  box-shadow: 0 -6px 20px rgba(36, 51, 47, .07);
}

.action-back,
.action-primary {
  min-width: 0;
  min-height: 48px;
  padding: 11px 18px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  white-space: normal;
  cursor: pointer;
}

.action-back {
  flex: 0 1 auto;
  color: var(--c-brand-700);
  background: transparent;
  border: 1px solid var(--c-brand-500);
}

.action-primary {
  flex: 1 1 auto;
  color: #fff;
  background: var(--c-brand-700);
  border: 1px solid var(--c-brand-700);
}

.action-primary:hover {
  background: var(--c-primary-press);
}

.action-back:disabled,
.action-primary:disabled {
  color: var(--c-ink-500);
  background: var(--c-line);
  border-color: var(--c-line);
  cursor: not-allowed;
}

.issue-list,
.sentence-list {
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.issue-item {
  min-width: 0;
  padding: 14px 0;
  color: var(--c-ink-700);
  border-bottom: 1px solid var(--c-line);
  line-height: 1.75;
}

.issue-item:first-child {
  padding-top: 0;
}

.issue-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.issue-item::marker {
  color: var(--c-accent);
}

.score-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  color: var(--c-ink-700);
  background: var(--c-surface);
  font-size: 15px;
  line-height: 1.6;
}

.score-table caption {
  padding: 0 0 10px;
  color: var(--c-ink-900);
  font-size: 17px;
  text-align: left;
}

.score-table th,
.score-table td {
  min-width: 0;
  padding: 11px 8px;
  border-bottom: 1px solid var(--c-line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.score-table th {
  color: var(--c-ink-900);
  background: var(--c-brand-100);
  font-weight: 500;
}

.score-table tr:last-child td {
  border-bottom: 0;
}

.sentence-list > li,
.sentence-list > p {
  position: relative;
  margin: 0;
  padding: 12px 0 12px 16px;
  color: var(--c-ink-700);
  border-left: 2px solid var(--c-accent);
  line-height: 1.8;
}

.sentence-list > li + li,
.sentence-list > p + p {
  margin-top: 8px;
}

/* 弹层内部独立滚动，小屏和横屏也能触达关闭按钮。 */
.sheet,
.map-mask,
.voice-mask {
  overscroll-behavior: contain;
}

.sheet .box,
.map-inner,
.voice-sheet {
  max-width: 100%;
  max-height: min(86vh, 860px);
  max-height: min(86dvh, 860px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.sheet .box {
  padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
}

.sheet .list,
.wk-open .body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 359px) {
  .flow-header {
    padding-right: 12px;
    padding-left: 12px;
  }

  .flow-stage {
    padding-right: 12px;
    padding-left: 12px;
  }

  .stage-title {
    font-size: 24px;
  }

  .coach-panel,
  .work-panel,
  .resource-panel,
  .practice-panel {
    padding: 14px 12px;
  }

  .flow-actions {
    gap: 8px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .action-back,
  .action-primary {
    padding-right: 12px;
    padding-left: 12px;
    font-size: 15px;
  }

  .score-table {
    font-size: 14px;
  }

  .score-table th,
  .score-table td {
    padding: 9px 5px;
  }
}

@media (min-width: 768px) {
  .flow-header {
    padding: 16px 28px 12px;
  }

  .flow-stage {
    padding: 30px 28px 48px;
  }

  .flow-stage.active,
  .flow-stage.is-active,
  .flow-stage.on,
  .flow-stage[aria-hidden="false"],
  .flow-stage[data-active="true"] {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(260px, .85fr);
    gap: 0 28px;
    align-items: start;
  }

  .stage-head {
    grid-column: 1 / -1;
    margin-bottom: 24px;
  }

  .work-panel {
    grid-column: 1;
    grid-row: 2 / span 3;
    padding: 24px;
  }

  .coach-panel,
  .resource-panel {
    grid-column: 2;
  }

  .coach-panel {
    grid-row: 2;
  }

  .resource-panel {
    grid-row: 3;
  }

  .practice-panel,
  .issue-list,
  .score-table {
    grid-column: 1 / -1;
  }

  .flow-actions {
    position: sticky;
    left: auto;
    bottom: 16px;
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 8px;
    padding: 12px 0;
    transform: none;
    background: rgba(247, 243, 235, .97);
    box-shadow: none;
  }

  .action-back {
    flex-grow: 0;
  }

  .action-primary {
    flex-grow: 0;
    min-width: 180px;
    margin-left: auto;
  }
}

@media (min-width: 1100px) {
  .flow-header {
    padding-right: 40px;
    padding-left: 40px;
  }

  .flow-stage {
    padding-right: 40px;
    padding-left: 40px;
  }
}

/* 全流程 v2：根页面覆盖旧三栏规则，任一时刻只有一个主阶段。
   底部留出固定操作栏的高度——之前 padding 归零，手机上的「发送」是 fixed，
   会把输入框压在自己下面，家长只能手动上滑才找得到。 */
#p-write.v2-page,
#p-review.v2-page { max-width: none; padding: 0 0 calc(84px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 768px) {
  #p-write.v2-page,
  #p-review.v2-page { padding-bottom: 8px; }
}
#p-write.v2-page.on,
#p-review.v2-page.on { display: block; }
.v2-top { display: flex; align-items: center; gap: 10px; max-width: var(--flow-max); margin: 0 auto; }
.v2-top > div { flex: 1; min-width: 0; }
.v2-top b,.v2-top span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2-top b { font-size: 15px; font-weight: 600; }
.v2-top span { color: var(--c-ink-500); font-size: 13px; }
.v2-icon,.v2-home { min-width: 44px; min-height: 44px; border: 0; background: transparent; color: var(--c-brand-700); cursor: pointer; }
.v2-icon { font-size: 34px; line-height: 1; }
.v2-home { font-size: 14px; }
.v2-steps { display: flex; max-width: var(--flow-max); margin: 10px auto 0; justify-content: space-between; gap: 4px; }
.v2-step { display: flex; align-items: center; gap: 4px; color: var(--c-ink-500); font-size: 12px; white-space: nowrap; }
.v2-step i { display: inline-flex; align-items: center; justify-content: center; width: 19px; height: 19px; border: 1px solid var(--c-line); border-radius: 50%; font-size: 11px; font-style: normal; }
.v2-step.now { color: var(--c-brand-700); font-weight: 600; }
.v2-step.now i,.v2-step.done i { color: #fff; background: var(--c-brand-700); border-color: var(--c-brand-700); }
.v2-label { display: block; margin: 0 0 16px; color: var(--c-ink-700); font-weight: 600; }
.v2-label input,.v2-label select,.v2-label textarea,.work-panel > textarea,.practice-panel textarea { display: block; box-sizing: border-box; width: 100%; margin-top: 7px; padding: 12px 14px; border: 1px solid var(--c-line); border-radius: 10px; }
.v2-note { color: var(--c-ink-500); font-size: 14px; line-height: 1.75; }
.read-feedback-label { margin-top: 18px; }
.read-feedback-label textarea { min-height: 9em; line-height: 1.8; resize: vertical; background-image: none; }
.v2-title-list,.v2-chips,.v2-tools,.v2-mode { display: flex; flex-wrap: wrap; gap: 8px; }
.v2-title-list button,.v2-chips button,.v2-tools button,.v2-mode button { min-height: 44px; padding: 8px 13px; color: var(--c-brand-700); background: var(--c-brand-100); border: 1px solid transparent; border-radius: 9px; cursor: pointer; }
.v2-mode { margin-bottom: 16px; border-bottom: 1px solid var(--c-line); }
.v2-mode button { background: transparent; border-radius: 0; border-bottom: 2px solid transparent; }
.v2-mode button.on { border-bottom-color: var(--c-brand-700); }
.v2-link { min-height: 44px; padding: 6px 0; color: var(--c-brand-700); background: none; border: 0; text-align: left; text-decoration: underline; cursor: pointer; }
.v2-alert { margin: 0 0 16px; padding: 12px 14px; color: #83372e; background: #f9e9e3; border-left: 4px solid var(--c-danger); }
.v2-talk-error { margin: 0 0 12px; padding: 10px 12px; color: #83372e; background: #f9e9e3; border-left: 4px solid var(--c-danger); border-radius: 8px; font-size: 14px; line-height: 1.65; }
.v2-alert button { color: inherit; background: none; border: 0; text-decoration: underline; }
.v2-chat { display: grid; gap: 9px; max-height: 42vh; margin-top: 12px; overflow-y: auto; }
/* 「回到最新」：翻旧消息时浮在聊天区右下角，点一下跳回最新一条 */
.v2-jump-latest {
  position: sticky;
  bottom: 6px;
  align-self: end;
  justify-self: end;
  z-index: 3;
  margin: -38px 6px 6px 0;
  padding: 7px 14px;
  border: 1px solid var(--c-line, #dbe3d2);
  border-radius: 999px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 3px 12px rgba(36, 51, 47, .16);
  color: var(--c-brand-700, #3c5a40);
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
}
.v2-jump-latest[hidden] { display: none; }
.v2-jump-latest:active { background: #eef4e9; }
/* 这一段的词句：直接摆在写作框下面，一眼能看到 */
.seg-resource { margin-top: 14px; }
.seg-resource .word-item { position: relative; padding-bottom: 34px; }
.seg-resource .word-item .copy-line { position: absolute; right: 10px; bottom: 8px; }
/* 语音按钮和生成词条是两组操作，留出明确间距，避免小屏贴成一整块。 */
.v2-chips { margin-top: 16px; }
.v2-msg { max-width: 88%; padding: 9px 12px; border-radius: 10px; background: var(--c-surface); white-space: pre-wrap; }
.v2-msg.me { margin-left: auto; background: var(--c-accent-soft); }
.v2-count { margin-top: 14px; color: var(--c-ink-500); font-size: 14px; line-height: 1.7; }
.v2-wait { margin-left: 6px; font-variant-numeric: tabular-nums; color: var(--c-brand-700); }
/* 审题流式草稿：模型还在写的时候，先把已经写好的句子贴出来。
   这几秒从"一个转圈按钮"变成"字在一行行长出来"，感知等待时间差一大截。 */
.v2-stream { margin-top: 14px; padding: 12px 14px; background: #fff; border: 1px solid var(--c-line); border-radius: 12px; }
.v2-stream span { display: block; margin-top: 7px; color: var(--c-ink-700); font-size: 14px; line-height: 1.65; }
.v2-stream span:first-child { margin-top: 0; }
.v2-stream span:last-of-type::after { content: ''; }
.v2-caret { display: inline-block; width: 2px; height: 13px; margin-left: 2px; background: var(--c-brand-700); vertical-align: -2px; animation: v2-blink .9s steps(1) infinite; }
@keyframes v2-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .v2-caret { animation: none; } }
.v2-materials { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--c-line); }
.v2-materials b,.v2-materials span { display: block; margin-top: 6px; }
.v2-materials span { color: var(--c-ink-700); font-size: 14px; }
.v2-stances { display: grid; gap: 12px; }
.v2-stances > button:not(.v2-link) { padding: 14px; color: var(--c-text); background: var(--c-page); border: 2px solid transparent; border-radius: 10px; text-align: left; }
.v2-stances > button.selected { background: var(--c-brand-100); border-color: var(--c-brand-700); }
.v2-stances b,.v2-stances span { display: block; margin-bottom: 5px; }
.v2-center { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--c-line); }
.v2-center span,.v2-center b { display: block; }
.v2-center span { color: var(--c-accent); font-size: 13px; }
.v2-outline-seg { padding: 14px 0; border-bottom: 1px solid var(--c-line); }
.v2-outline-seg > div { display: flex; justify-content: space-between; gap: 10px; }
.v2-outline-seg em { color: var(--c-ink-500); font-size: 13px; font-style: normal; }
.v2-segcount { color: var(--c-accent); font-size: 14px; }
.v2-word { display: inline-block; margin: 4px; padding: 5px 8px; background: var(--c-brand-100); border-radius: 6px; font-size: 14px; }
.resource-panel summary { min-height: 44px; color: var(--c-brand-700); cursor: pointer; }
.resource-panel blockquote { margin: 12px 0; padding-left: 12px; border-left: 3px solid var(--c-accent); }
.v2-sentences { display: grid; gap: 8px; }
.v2-sentences button { padding: 12px; color: var(--c-text); background: transparent; border: 1px solid var(--c-line); border-radius: 8px; text-align: left; line-height: 1.7; }
.v2-sentences button.selected { background: var(--c-brand-100); border-color: var(--c-brand-700); }
.v2-fulltext { white-space: pre-wrap; line-height: 1.9; }
.v2-check { padding: 12px 0; border-bottom: 1px solid var(--c-line); }
.v2-score { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
.v2-score b { color: var(--c-brand-700); font-size: 52px; font-weight: 500; }
.v2-score span { color: var(--c-ink-500); }
.issue-item button { margin-top: 6px; }
body.on-write .samnav,body.on-review .samnav { display: none; }
body.on-write .flow-actions,body.on-review .flow-actions { bottom: 0; }
@media (min-width:768px) {
  #p-write.v2-page.on,#p-review.v2-page.on { display: block; }
  .flow-stage > .work-panel,.flow-stage > .coach-panel,.flow-stage > .resource-panel,.flow-stage > .practice-panel,.flow-stage > .stage-lead { grid-column: 1 / -1; grid-row: auto; }
  .flow-stage.active { display: block; max-width: 820px; }
  .v2-step { font-size: 14px; }
}
@media (max-width:359px) {
  .v2-step { flex-direction: column; gap: 2px; font-size: 11px; }
  .v2-home { font-size: 12px; }
}

/* 复评后的精简复盘。 */
.recap-sections { border-top: 1px solid var(--c-line); }
.recap-item { display: grid; grid-template-columns: 30px 1fr; gap: 12px; padding: 18px 0; border-bottom: 1px solid var(--c-line); }
.recap-item > span { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; color: #fff; background: var(--c-brand-700); border-radius: 50%; font-size: 13px; }
.recap-item h2 { margin: 1px 0 5px; font-size: 19px; }
.recap-item p { margin: 0; color: var(--c-ink-700); }
.recap-item blockquote { margin: 10px 0 0; padding: 9px 12px; color: var(--c-ink-700); background: var(--c-surface); border-left: 3px solid var(--c-accent); font-size: 14px; }
.recap-item blockquote small { display: block; margin-top: 4px; color: var(--c-ink-500); }
.next-time { margin-top: 20px; padding: 20px; background: var(--c-brand-100); border-radius: 10px; }
.next-time h2 { margin: 0; color: var(--c-brand-700); font-size: 20px; }
.next-time ol { margin: 12px 0; padding-left: 24px; }
.next-time li { padding: 5px 0 5px 4px; }
.next-time > p { margin: 0; color: var(--c-ink-500); font-size: 13px; }

/* 可选篇章手法与词句资源。 */
.technique-panel { margin: 0 0 16px; padding: 18px 0; border-top: 1px solid var(--c-line); border-bottom: 1px solid var(--c-line); }
.technique-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.technique-head b { color: var(--c-brand-700); }
.technique-head span,.technique-panel > p { color: var(--c-ink-500); font-size: 13px; }
.technique-panel > p { margin: 5px 0 12px; }
.technique-list { display: grid; gap: 12px; }
.technique-list article { padding: 14px 16px; background: var(--c-surface); border-left: 3px solid var(--c-accent); }
.technique-list h3 { margin: 0 0 7px; font-size: 18px; }
.technique-list p { margin: 5px 0; color: var(--c-ink-700); font-size: 14px; }
.technique-list article.selected { background: var(--c-brand-100); border-left-color: var(--c-brand-700); }
.technique-choice { min-height: 44px; margin-top: 10px; padding: 9px 14px; color: var(--c-brand-700); background: var(--c-brand-100); border: 1px solid transparent; border-radius: 9px; cursor: pointer; }
.technique-list article.selected .technique-choice { color: var(--c-brand-700); background: var(--c-surface); border-color: var(--c-brand-500); }
.v2-technique-reminder { margin: 10px 0 12px; padding: 10px 12px; color: var(--c-ink-700); background: var(--c-brand-100); border-left: 3px solid var(--c-brand-700); border-radius: 8px; font-size: 14px; }
.v2-look { margin-bottom: 12px; }
.v2-shot { display: block; max-width: 100%; max-height: 240px; margin: 0 auto 10px; border-radius: 10px; }
.v2-talk-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.v2-speaker { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; color: var(--c-brand-700); background: transparent; border: 0; border-radius: 50%; cursor: pointer; }
.v2-speaker svg { width: 22px; height: 22px; }
.v2-speaker.on { color: #fff; background: var(--c-brand-700); }
.v2-voice { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 46px; margin-top: 10px; padding: 10px 14px; color: var(--c-brand-700); background: var(--c-brand-100); border: 1px solid transparent; border-radius: 12px; cursor: pointer; touch-action: none; }
.v2-voice svg { width: 22px; height: 22px; }
.v2-voice .v2-voice-label { font-size: 15px; }
.v2-voice.holding { color: #fff; background: var(--c-brand-700); animation: pulse 1s infinite; }
.v2-voice.cancel { background: #b84435; animation: none; }
.v2-voice-tip { position: fixed; left: 50%; bottom: 104px; z-index: 120; padding: 9px 16px; color: #fff; background: rgba(24,43,32,.88); border-radius: 999px; font-size: 13px; opacity: 0; visibility: hidden; transform: translate(-50%, 8px); transition: opacity .15s ease, transform .15s ease; pointer-events: none; }
.v2-voice-tip.on { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.55} }
.word-resource .resource-intro { margin: 18px 0 10px; }
.resource-intro p { margin: 3px 0; color: var(--c-ink-500); font-size: 13px; }
.word-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(145px,1fr)); gap: 8px; }
.word-item { padding: 11px 12px; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 8px; }
.word-item > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.word-item > div span { padding: 1px 5px; color: var(--c-accent); background: var(--c-accent-soft); border-radius: 4px; font-size: 11px; }
.word-item p { margin: 4px 0 0; color: var(--c-ink-700); font-size: 13px; line-height: 1.65; }
.word-item .word-py { color: var(--c-ink-500); font-size: 12px; }
.rhetoric-group { margin-top: 20px; }
.rhetoric-group h3 { display: flex; align-items: baseline; gap: 7px; margin: 0 0 8px; color: var(--c-brand-700); font-size: 17px; }
.rhetoric-group h3 span { color: var(--c-ink-500); font-size: 12px; font-weight: 400; }
.quote-line { padding: 13px 0; border-top: 1px solid var(--c-line); }
.quote-line p { margin: 0; color: var(--c-text); line-height: 1.8; }
.quote-line small { display: block; margin-top: 4px; color: var(--c-ink-500); line-height: 1.6; }
.copy-line { min-height: 44px; margin-top: 6px; padding: 7px 12px; color: var(--c-brand-700); background: var(--c-brand-100); border: 0; border-radius: 7px; }
.resource-match { color: var(--c-accent); font-size: 13px; }

/* 素材书架：分类、书目、阅读三个层级，不在列表里铺全文。 */
#p-lib { max-width: 1120px; }
#p-lib .libhead { display: flex; align-items: center; gap: 12px; }
#p-lib .libhead > div { flex: 1; min-width: 0; }
#p-lib .libhead h1 { margin: 0; }
#p-lib .libhead p { margin: 3px 0 0; }
#p-lib .favn { flex: 0 0 auto; padding: 8px 4px; color: var(--c-brand-700); background: transparent; border: 0; }
.lib-back { flex: 0 0 44px; width: 44px; padding: 0; color: var(--c-brand-700); background: var(--c-brand-100); border: 0; border-radius: 50%; font-size: 30px; line-height: 1; }
.bookshelf { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 20px 0; }
.shelf-category { position: relative; display: grid; grid-template-columns: 70px 1fr; gap: 16px; min-height: 150px; padding: 22px 18px 18px; overflow: hidden; color: var(--c-text); background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 12px; text-align: left; box-shadow: none; }
.shelf-category::after { content: ''; position: absolute; right: 0; bottom: 10px; left: 0; height: 2px; background: var(--c-line); }
.shelf-category:hover { border-color: var(--c-brand-500); }
.shelf-books { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 88px; padding-bottom: 8px; border-bottom: 3px solid var(--c-line); }
.shelf-books i { display: block; width: 15px; height: 65px; background: var(--c-brand-700); border-radius: 3px 3px 0 0; }
.shelf-books i:nth-child(2) { height: 76px; background: var(--c-accent); transform: rotate(4deg); }
.shelf-books i:nth-child(3) { height: 58px; background: var(--c-ink-500); }
.shelf-copy,.shelf-copy b,.shelf-copy span,.shelf-copy em { display: block; }
.shelf-copy b { margin-bottom: 6px; font-size: 22px; font-weight: 600; }
.shelf-copy span { color: var(--c-ink-700); font-size: 14px; line-height: 1.7; }
.shelf-copy em,.shelf-favorite em { margin-top: 10px; color: var(--c-brand-700); font-size: 13px; font-style: normal; }
.shelf-favorite { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 12px 16px; color: var(--c-text); background: var(--c-brand-100); border: 1px solid transparent; border-radius: 10px; text-align: left; }
.shelf-favorite span { flex: 1; color: var(--c-ink-700); font-size: 14px; }
.shelf-favorite em { margin: 0; }
.shelf-guide { padding: 14px 0; color: var(--c-ink-700); border-top: 1px solid var(--c-line); }
.shelf-guide b,.shelf-guide span { display: block; }
.shelf-guide span { margin-top: 4px; font-size: 14px; }
.book-list { border-top: 1px solid var(--c-line); }
.book-row { position: relative; display: grid; grid-template-columns: 1fr 48px; gap: 8px; padding: 18px 0; border-bottom: 1px solid var(--c-line); }
.book-open { min-width: 0; padding: 0 8px 0 0; color: var(--c-text); background: transparent; border: 0; text-align: left; }
.book-open h2 { margin: 4px 0 6px; font-size: 20px; font-weight: 600; }
.book-open p { display: -webkit-box; margin: 0; overflow: hidden; color: var(--c-ink-700); font-size: 14px; line-height: 1.75; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.book-meta,.book-read { color: var(--c-ink-500); font-size: 13px; }
.book-read { display: inline-block; margin-top: 8px; color: var(--c-brand-700); }
.book-fav { align-self: start; width: 44px; padding: 0; color: var(--c-accent); background: transparent; border: 0; font-size: 25px; }
.reader-page { display: grid; grid-template-columns: minmax(0,1fr); gap: 22px; padding-top: 8px; }
.reader-main { min-width: 0; padding: 24px 20px; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 10px; }
.reader-heading { padding-bottom: 18px; border-bottom: 1px solid var(--c-line); }
.reader-heading span { color: var(--c-ink-500); font-size: 13px; }
.reader-heading h2 { margin: 8px 0 0; font-family: 'Noto Serif SC','Songti SC',serif; font-size: clamp(25px,6vw,34px); font-weight: 600; line-height: 1.45; }
.reader-body { padding-top: 12px; font-family: 'Noto Serif SC','Songti SC',serif; font-size: 18px; line-height: 2.05; }
.reader-body p { margin: 1em 0; text-indent: 2em; }
.reader-notes { min-width: 0; padding: 20px; background: var(--c-brand-100); border-top: 3px solid var(--c-brand-500); }
.reader-note-head b,.reader-note-head span { display: block; }
.reader-note-head span { margin-top: 5px; color: var(--c-ink-700); font-size: 13px; }
.reader-notes ol { margin: 18px 0; padding: 0; list-style: none; }
.reader-notes li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 13px 0; border-top: 1px solid rgba(21,91,85,.15); }
.reader-notes li > span { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; color: #fff; background: var(--c-brand-700); border-radius: 50%; font-size: 12px; }
.reader-notes li p { margin: 0; color: var(--c-ink-700); font-size: 14px; line-height: 1.8; }
.reader-reminder { color: var(--c-ink-700); font-size: 13px; }
.fv-open { display: block; width: 100%; padding: 6px 0; color: var(--c-text); background: transparent; border: 0; text-align: left; }
.fv-open .t,.fv-open .m { display: block; }
@media (min-width:680px) {
  .bookshelf { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .shelf-favorite { grid-column: 1 / -1; }
}
@media (min-width:900px) {
  .reader-page { grid-template-columns: minmax(0,1.65fr) minmax(280px,.85fr); align-items: start; }
  .reader-main { padding: 34px 40px; }
  .reader-notes { position: sticky; top: 20px; border-top: 0; border-left: 3px solid var(--c-brand-500); border-radius: 0 10px 10px 0; }
}
@media (max-width:359px) {
  .shelf-category { grid-template-columns: 52px 1fr; gap: 12px; padding: 18px 13px; }
  .shelf-copy b { font-size: 20px; }
  .reader-main { padding: 20px 15px; }
  .reader-body { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ===================== 对话页 · 微信式布局 =====================
   聊天消息区占满头部以下的整屏、自己滚动；输入栏固定在屏幕最底下，
   和微信一样：[上一步] [按住说话] [输入框(随字数长高)] [发送]。 */
.flow-stage[data-stage="talk"] {
  position: fixed;
  left: 0; right: 0;
  top: var(--talkTop, 150px);
  bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* 输入栏是 fixed，必须按 --talkBar（实测高度）留出底部空间，
     否则最后一条消息和"可以这样说"的词条会滑到它下面，看不见也点不到。 */
  padding: 0 14px calc(var(--talkBar, 76px) + 8px);
  margin: 0;
  background: var(--c-page);
  z-index: 40;
}
.flow-stage[data-stage="talk"] .stage-head { display: none; }   /* 聊天不需要大标题，把屏幕留给对话 */
.flow-stage[data-stage="talk"] .coach-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; margin-top: 8px; }
.flow-stage[data-stage="talk"] .v2-chat { flex: 1; max-height: none; overflow-y: auto; -webkit-overflow-scrolling: touch; align-content: start; }

/* 气泡加头像：妙妙在左（绿底白字），孩子在右 */
.flow-stage[data-stage="talk"] .v2-msg { position: relative; max-width: 80%; padding: 9px 12px 9px 12px; }
.flow-stage[data-stage="talk"] .v2-msg.ai { margin-left: 40px; background: #fff; }
.flow-stage[data-stage="talk"] .v2-msg.me { margin-right: 40px; margin-left: auto; padding-right: 12px; }
.flow-stage[data-stage="talk"] .v2-msg::before {
  position: absolute; top: 2px;
  width: 31px; height: 31px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
}
.flow-stage[data-stage="talk"] .v2-msg.ai::before { content: '妙'; left: -40px; background: var(--c-brand-500, #4e7d52); }
/* 妙妙"正在读…"：就是一条普通白气泡，三个点跳着，文案只有一句 */
.flow-stage[data-stage="talk"] .v2-msg-typing { display: flex; align-items: center; gap: 8px; justify-self: start; }
.v2-msg-typing .v2-wait { margin-left: 0; font-size: 14px; color: #6f7f68; }
.v2-typing { display: inline-flex; align-items: center; gap: 3px; flex: none; }
.v2-typing i { width: 5px; height: 5px; border-radius: 50%; background: #9db392; animation: v2dot 1.15s infinite ease-in-out; }
.v2-typing i:nth-child(2) { animation-delay: .16s; }
.v2-typing i:nth-child(3) { animation-delay: .32s; }
@keyframes v2dot { 0%,80%,100% { opacity: .28; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .v2-typing i { animation: none; opacity: .7; } }
.flow-stage[data-stage="talk"] .v2-msg.me::before { content: '我'; right: -40px; left: auto; background: #b8c9b0; }

/* 固定输入栏：错误提示 / 素材条 / 快捷词条 / 输入行，全部收进底部一条 */
.flow-actions.talk-bar {
  position: fixed; left: 50%; bottom: 0;
  transform: translateX(-50%);
  display: block;
  width: min(100%, 600px);
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 253, 248, .98);
  border-top: 1px solid var(--c-line, #e5e8dd);
  box-shadow: 0 -8px 24px rgba(48, 73, 45, .06);
  backdrop-filter: blur(12px);
  z-index: 66;
}
.flow-actions.talk-bar .v2-talk-error { margin: 0 0 8px; }

/* 建议词条：长在聊天流里（妙妙那条消息下方），不占输入栏 */
.v2-chips-inline { margin: 6px 0 4px 40px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.v2-chips-inline span { font-size: 12px; color: #7c8a76; }
.v2-chips-inline button { padding: 7px 14px; border: 1px solid var(--c-line, #dbe3d2); border-radius: 16px; background: #fff; font-size: 14px; color: #3c5a40; white-space: normal; max-width: 100%; text-align: left; }
.v2-chips-inline button:active { background: #eef3e8; }

/* 聊天流顶部的轻量计数，跟着消息一起滚，不占固定空间 */
.v2-sysline { text-align: center; font-size: 12px; color: #97a68f; padding: 4px 0 8px; }
.v2-inputrow { display: flex; align-items: flex-end; gap: 8px; }
.v2-inputrow .v2-icon { flex: none; margin-bottom: 3px; }
.v2-inputrow .v2-voice { flex: none; margin-bottom: 3px; }
.v2-inputrow #v2Answer {
  flex: 1; min-height: 42px; max-height: 120px;
  padding: 10px 14px; border: 0; border-radius: 18px;
  background: #f2f5ec; font-size: 16px; line-height: 1.45;
  resize: none; outline: none; box-sizing: border-box;
  font-family: inherit;
}
.v2-inputrow .action-primary { flex: none; min-height: 42px; min-width: 76px; padding: 0 18px; border-radius: 18px; font-size: 15px; margin-bottom: 0; }
/* 等待中按钮只该显示"稍等…"。万一以后又被塞了长文案，这里兜住，不许它挤占输入框。 */

/* 桌面宽屏同样保持底部输入条（theme 里旧规则会把 flow-actions 变 static，这里压回 fixed） */
@media (min-width: 768px) {
  .flow-actions.talk-bar { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); }
  .flow-stage[data-stage="talk"] { max-width: 720px; margin: 0 auto; left: 0; right: 0; }
}

/* 输入行里的语音键收成圆形图标（原样式是全宽长条，会把 flex 行撑爆） */
.v2-inputrow .v2-voice { flex: none; width: 42px; min-width: 42px; min-height: 42px; margin: 0 0 3px; padding: 0; border-radius: 50%; background: #eef3e8; color: #41563f; }
.v2-inputrow .v2-voice .v2-voice-label { display: none; }
.v2-inputrow .v2-voice svg { width: 20px; height: 20px; }
.v2-inputrow .v2-voice.holding { background: var(--c-brand-700); color: #fff; }
.v2-inputrow .v2-voice.cancel { background: #b84435; color: #fff; }
.v2-inputrow #v2Answer { min-width: 72px; }   /* 再窄就一个字一行了，宁可让按钮少占点 */

/* 家长（监护人）同意：激活前必须勾选，未勾选时抖动提示 */
.guard-consent { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 10px; padding: 10px 12px; border: 1px solid var(--c-line, #e0e6d8); border-radius: var(--r-md, 12px); background: #f7faf3; font-size: 13px; line-height: 1.55; color: #41563f; }
.guard-consent input { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.guard-consent b { color: #2f4a34; }
.guard-consent a { color: var(--c-primary, #4e7d52); text-decoration: underline; }
.guard-consent.shake { animation: guardShake .45s ease; border-color: #c0563f; }
@keyframes guardShake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }
mark.todo { background: #fff3c4; color: #7a5a00; padding: 1px 6px; border-radius: 4px; }
