:root {
  --bg: #f4f1ea;
  --paper: #fffdf8;
  --paper-2: #fbf8f1;
  --ink: #23201c;
  --ink-2: #4a443b;
  --muted: #7b7264;
  --line: #e3dccd;
  --line-2: #d6ccb9;
  --accent: #b5462f;
  --accent-soft: #f7e8e2;
  --accent-ink: #8e3323;
  --green: #2f5d50;
  --green-soft: #e6efeb;
  --amber: #9a6b1f;
  --amber-soft: #f8efd9;
  --blue: #35566d;
  --shadow: 0 1px 2px rgba(35, 32, 28, .04), 0 8px 24px -12px rgba(35, 32, 28, .14);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Songti SC", "Source Han Serif SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: #f3d3c8; }

/* ---------------------------------------------------------------- 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 26px;
  background: rgba(244, 241, 234, .9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }

.logo {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: #fff8ee;
  font-family: var(--serif);
  font-size: 21px;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15);
}

.brand-text h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .04em;
}

.brand-text p {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .08em;
}

.brand-text .sep { margin: 0 6px; opacity: .5; }

.tabs {
  display: flex;
  gap: 2px;
  margin-left: 14px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
}

.tab {
  border: 0;
  background: transparent;
  padding: 7px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--ink-2);
  transition: background .18s, color .18s;
  white-space: nowrap;
}

.tab:hover { background: #f0eadc; }

.tab.is-active {
  background: var(--ink);
  color: #fdf9f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-right: 6px;
}

.status .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #b9b0a1;
  box-shadow: 0 0 0 3px rgba(185, 176, 161, .18);
}

.status.ok .dot { background: #3f7d5f; box-shadow: 0 0 0 3px rgba(63, 125, 95, .16); }
.status.bad .dot { background: var(--accent); box-shadow: 0 0 0 3px rgba(181, 70, 47, .14); }

/* ---------------------------------------------------------------- 按钮 */
.ghost, .primary, .link, .mini, .icon-btn {
  border: 1px solid transparent;
  border-radius: 9px;
  transition: background .16s, border-color .16s, transform .06s;
}

.ghost {
  padding: 7px 13px;
  background: var(--paper);
  border-color: var(--line);
  font-size: 13px;
  color: var(--ink-2);
}

.ghost:hover { background: #f6f1e6; border-color: var(--line-2); }

.primary {
  padding: 10px 22px;
  background: var(--ink);
  color: #fdf9f0;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .04em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .1) inset, 0 6px 16px -10px rgba(0, 0, 0, .5);
}

.primary:hover { background: #35302a; }
.primary:active { transform: translateY(1px); }
.primary:disabled { opacity: .55; cursor: progress; }

.link {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 13px;
  padding: 8px 6px;
  text-decoration: underline;
  text-decoration-color: var(--line-2);
  text-underline-offset: 4px;
}

.link:hover { color: var(--accent); }

.mini {
  padding: 3px 9px;
  border-color: var(--line);
  background: var(--paper);
  font-size: 11.5px;
  color: var(--muted);
  border-radius: 7px;
}

.mini:hover { color: var(--accent); border-color: #e4bcae; background: var(--accent-soft); }

.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  font-size: 14px;
  border-radius: 8px;
}

.icon-btn:hover { background: #efe8d9; color: var(--ink); }

.danger { color: var(--accent); border-color: #eccabc; }
.danger:hover { background: var(--accent-soft); }

/* ---------------------------------------------------------------- 布局 */
main { padding: 22px 26px 60px; max-width: 1560px; margin: 0 auto; }

.pane { display: none; }
.pane.is-active { display: block; animation: fade .25s ease; }

@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.layout {
  display: grid;
  grid-template-columns: minmax(360px, 420px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.composer {
  position: sticky;
  top: 78px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  box-shadow: var(--shadow);
}

.composer-head h2 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .03em;
}

.composer-head p {
  margin: 0 0 16px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
}

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field { display: block; margin-bottom: 13px; }

.label, .field > .label {
  display: block;
  font-size: 11.5px;
  letter-spacing: .12em;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.label-row .label { margin: 0; }

.counter, .hint { font-size: 11.5px; color: #a1968a; }

.hint { display: block; margin-top: 5px; line-height: 1.5; }

textarea, input[type="password"], input[type="text"], select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper-2);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.65;
  transition: border-color .16s, background .16s, box-shadow .16s;
}

textarea { resize: vertical; min-height: 68px; }

textarea#w-answer, textarea#t-answer { font-family: var(--serif); font-size: 14px; }

textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: #cba97a;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(203, 169, 122, .14);
}

textarea::placeholder { color: #b0a696; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%237b7264' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.checkbox-field .check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-2);
  padding: 9px 0;
}

.check input { accent-color: var(--accent); width: 15px; height: 15px; }

.composer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

/* ---------------------------------------------------------------- 输出区 */
.output { min-height: 420px; }

.empty {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 420px;
  padding: 40px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, .7), transparent 60%),
    var(--paper-2);
}

.empty-mark {
  width: 54px; height: 54px;
  display: grid; place-items: center;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  font-family: var(--serif);
  font-size: 24px;
  color: var(--accent);
  background: var(--paper);
}

.empty h3 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
}

.empty p { margin: 0; font-size: 13px; color: var(--muted); max-width: 340px; line-height: 1.7; }

/* 加载 */
.loading {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 26px;
  box-shadow: var(--shadow);
}

.loading-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 14px;
  color: var(--ink-2);
}

.spinner {
  width: 15px; height: 15px;
  border: 2px solid var(--line-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-steps { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }

.loading-steps li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--muted);
  opacity: .45;
  transition: opacity .4s;
}

.loading-steps li.on { opacity: 1; color: var(--ink-2); }

.loading-steps li::before {
  content: "○";
  font-size: 11px;
  color: var(--line-2);
}

.loading-steps li.on::before { content: "●"; color: var(--accent); animation: pulse 1.4s infinite; }

@keyframes pulse { 50% { opacity: .35; } }

.skel {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #efe9dc 25%, #f7f2e7 50%, #efe9dc 75%);
  background-size: 300% 100%;
  animation: shimmer 1.4s infinite;
  margin-top: 10px;
}

@keyframes shimmer { to { background-position: -300% 0; } }

/* ---------------------------------------------------------------- 结果通用 */
.result {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.result-hero {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fdfaf3, var(--paper));
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: start;
}

.score-block { text-align: center; min-width: 116px; }

.score-num {
  font-family: var(--serif);
  font-size: 52px;
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--ink);
  font-variant-numeric: lining-nums;
  white-space: nowrap;
}

.score-num small { font-size: 20px; color: var(--muted); letter-spacing: 0; }

.score-label {
  font-size: 11px;
  letter-spacing: .16em;
  color: var(--muted);
  margin-top: 8px;
  text-transform: uppercase;
}

.band-pill {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border: 1px solid #efd3c8;
  max-width: 220px;
  line-height: 1.5;
}

.hero-right { min-width: 0; }

.verdict {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.55;
  margin: 0 0 14px;
  color: var(--ink);
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 14px;
}

.meta-line .sep { opacity: .4; }

.dims { display: grid; gap: 8px; }

.dim {
  display: grid;
  grid-template-columns: 74px 1fr 54px;
  gap: 10px;
  align-items: center;
  font-size: 12.5px;
}

.dim-name { color: var(--ink-2); white-space: nowrap; }

.dim-bar { display: block; height: 6px; background: #ece5d6; border-radius: 999px; overflow: hidden; }

.dim-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #c9744f, var(--accent));
  transition: width .6s cubic-bezier(.2, .8, .2, 1);
}

.dim-fill.good { background: linear-gradient(90deg, #5d8f76, var(--green)); }
.dim-fill.warn { background: linear-gradient(90deg, #d0a24a, #b8862f); }

.dim-score { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }

.result-body { padding: 4px 24px 24px; }

.section { padding: 20px 0; border-bottom: 1px dashed var(--line); }
.section:last-child { border-bottom: 0; padding-bottom: 4px; }

.section-title {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin: 0 0 13px;
  font-family: var(--serif);
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: .02em;
}

.section-title .num {
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--accent);
  font-family: var(--sans);
}

.section-title .aside { margin-left: auto; font-size: 11.5px; color: var(--muted); font-family: var(--sans); font-weight: 400; }

.prose { font-size: 14px; line-height: 1.85; color: var(--ink-2); }
.prose p { margin: 0 0 10px; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--ink); font-weight: 600; }

/* 句子对照 */
.st-row {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid #f0eadd;
}

.st-row:last-child { border-bottom: 0; }

.st-no { font-size: 11px; color: #b3a897; padding-top: 3px; font-variant-numeric: tabular-nums; }

.st-body { min-width: 0; display: grid; gap: 4px; }

.st-line { display: grid; grid-template-columns: 44px 1fr; gap: 8px; font-size: 13px; line-height: 1.65; }

.st-tag { font-size: 10.5px; color: var(--muted); letter-spacing: .06em; padding-top: 3px; }

.st-src { font-family: var(--serif); color: var(--ink); }
.st-you { font-family: var(--serif); color: var(--ink-2); }
.st-ref { font-family: var(--serif); color: var(--green); }
.st-comment { font-size: 12.5px; color: var(--muted); line-height: 1.7; padding-top: 3px; }

.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 10.5px;
  letter-spacing: .04em;
  vertical-align: 1px;
  white-space: nowrap;
}

.lv-ok { background: var(--green-soft); color: var(--green); }
.lv-mid { background: var(--amber-soft); color: var(--amber); }
.lv-bad { background: var(--accent-soft); color: var(--accent-ink); }
.lv-miss { background: #eee6da; color: var(--muted); }

/* 错误清单 */
.err-item {
  display: grid;
  grid-template-columns: 66px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f0eadd;
  font-size: 13px;
}

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

.err-type {
  font-size: 11px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 5px;
  padding: 2px 0;
  text-align: center;
  height: fit-content;
  letter-spacing: .04em;
}

.err-wrong { color: #a94a3a; font-family: var(--serif); text-decoration: line-through; text-decoration-color: #ddb6aa; }
.err-right { color: var(--green); font-family: var(--serif); }
.err-why { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.7; }
.err-arrow { color: #b9ac9a; margin: 0 6px; }

/* 评分理由 */
.reason-list { display: grid; gap: 2px; margin-top: 12px; }

.reason-item {
  display: grid;
  grid-template-columns: 84px 58px 1fr;
  gap: 10px;
  align-items: baseline;
  font-size: 12.5px;
  padding: 7px 0;
  border-bottom: 1px solid #f4eee2;
}

.reason-item:last-child { border-bottom: 0; }
.reason-name { color: var(--ink); }
.reason-score { color: var(--accent-ink); font-variant-numeric: tabular-nums; font-size: 12px; }
.reason-text { color: var(--muted); line-height: 1.7; }

/* 逐句解析 */
.sent-block { padding: 13px 0; border-bottom: 1px solid #f0eadd; }
.sent-block:last-child { border-bottom: 0; }

.sent-head { display: flex; gap: 9px; align-items: baseline; flex-wrap: wrap; }

.sent-no {
  font-size: 11px;
  color: #b3a897;
  font-variant-numeric: tabular-nums;
  min-width: 15px;
}

.sent-text {
  font-family: var(--serif);
  font-size: 14.5px;
  color: var(--ink);
  line-height: 1.65;
  flex: 1 1 240px;
}

.sent-issues { margin: 9px 0 0 24px; display: grid; gap: 8px; }

.sent-your {
  margin: 7px 0 0 24px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 8px;
  font-size: 13px;
  line-height: 1.65;
}

.sent-issue { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 9px; }

.issue-type {
  font-size: 10.5px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 5px;
  padding: 1px 0;
  text-align: center;
  height: fit-content;
  letter-spacing: .04em;
}

.sent-better {
  margin: 9px 0 0 24px;
  padding: 7px 11px;
  background: #f2f8f4;
  border-left: 2px solid #b7d2c3;
  border-radius: 0 7px 7px 0;
  font-family: var(--serif);
  font-size: 13.5px;
  color: var(--green);
  line-height: 1.7;
}

.sent-better-tag {
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: .08em;
  color: #6b8f7d;
  margin-right: 8px;
  white-space: nowrap;
}

.sent-note { margin: 7px 0 0 24px; font-size: 12px; color: var(--muted); line-height: 1.7; }

/* 拼写与大小写 */
.spell-list { display: flex; flex-wrap: wrap; gap: 7px; }

.spell-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 7px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  font-size: 12.5px;
}

.spell-type {
  font-size: 10px;
  color: var(--muted);
  border-right: 1px solid var(--line);
  padding-right: 6px;
}

.spell-wrong {
  font-family: var(--serif);
  color: #a94a3a;
  text-decoration: line-through;
  text-decoration-color: #ddb6aa;
}

.spell-right { font-family: var(--serif); color: var(--green); }

/* 优化建议分组标题 */
.opt-label {
  font-size: 10.5px;
  letter-spacing: .14em;
  color: var(--muted);
  margin: 16px 0 6px;
}

.opt-label:first-child { margin-top: 0; }

/* 知识点 */
.k-item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid #d9c9a8;
  border-radius: 8px;
  background: var(--paper-2);
  margin-bottom: 9px;
}

.k-item:last-child { margin-bottom: 0; }

.k-point { font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.k-text { font-size: 13px; color: var(--ink-2); line-height: 1.8; }
.k-example {
  margin-top: 7px;
  padding: 7px 10px;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 6px;
  font-family: var(--serif);
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.7;
}

/* 文章正文与可点击句 */
.article {
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.95;
  color: #2b2720;
  padding: 16px 18px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.sentence {
  cursor: pointer;
  border-radius: 4px;
  padding: 1px 2px;
  transition: background .15s;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.sentence:hover { background: #f6e3d2; }
.sentence.is-open { background: #f3ddc8; }

.article-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
  margin: 8px 0 0;
}

.sentence-panel {
  margin: 10px 0 4px;
  padding: 14px 16px;
  border: 1px solid #e8d6bd;
  background: #fffaf0;
  border-radius: 10px;
  font-family: var(--sans);
  font-size: 13px;
  animation: fade .2s ease;
}

.chunk {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid #f1e6d4;
  font-size: 12.5px;
}

.chunk:last-child { border-bottom: 0; }
.chunk-text { font-family: var(--serif); font-size: 13.5px; color: var(--ink); }
.chunk-type { font-size: 10.5px; color: var(--accent-ink); background: var(--accent-soft); padding: 1px 6px; border-radius: 4px; margin-right: 6px; vertical-align: 1px; }
.chunk-note { color: var(--muted); line-height: 1.65; }

/* 词汇 */
.vocab-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.vocab-card {
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper-2);
}

.vocab-word { font-family: var(--serif); font-size: 15px; font-weight: 600; color: var(--ink); display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.vocab-phon { font-family: var(--mono); font-size: 11px; color: var(--muted); font-weight: 400; }
.vocab-pos { font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.vocab-meaning { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.vocab-ctx { font-family: var(--serif); font-size: 12.5px; color: var(--green); margin-top: 3px; }
.vocab-note { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.6; }

/* 结构 */
.struct-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #f0eadd;
  font-size: 13px;
}

.struct-row:last-child { border-bottom: 0; }
.struct-part { font-size: 12px; color: var(--accent-ink); white-space: nowrap; }
.struct-job { font-weight: 600; color: var(--ink); margin-bottom: 2px; font-size: 13px; }
.struct-detail { color: var(--muted); font-size: 12.5px; line-height: 1.7; }

/* 长难句 */
.ls-item { margin-bottom: 11px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper-2); }
.ls-item:last-child { margin-bottom: 0; }
.ls-text { font-family: var(--serif); font-size: 14px; color: var(--ink); line-height: 1.75; }
.ls-why, .ls-trans { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.75; }
.ls-trans { color: var(--green); }

/* 题目 */
.q-item { padding: 13px 0; border-bottom: 1px solid #f0eadd; }
.q-item:last-child { border-bottom: 0; }
.q-stem { font-size: 13.5px; color: var(--ink); line-height: 1.7; margin-bottom: 7px; }
.q-opt {
  display: flex;
  gap: 8px;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  font-family: var(--serif);
  transition: background .15s;
}
.q-opt:hover { background: #f4eee2; }
.q-opt.is-right { background: var(--green-soft); color: var(--green); }
.q-opt.is-wrong { background: var(--accent-soft); color: var(--accent-ink); }
.q-explain {
  margin-top: 8px;
  padding: 9px 11px;
  background: var(--paper-2);
  border-left: 2px solid var(--line-2);
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.75;
  display: none;
}
.q-item.revealed .q-explain { display: block; }

/* 修改稿 / 范文 */
.compare-tabs { display: flex; gap: 4px; margin-bottom: 10px; }

.ctab {
  padding: 5px 12px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  border-radius: 7px;
  font-size: 12px;
  color: var(--muted);
}

.ctab.is-active { background: var(--ink); color: #fdf9f0; border-color: var(--ink); }

.doc-text {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 2;
  color: #2b2720;
  white-space: pre-wrap;
  padding: 15px 17px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.doc-text em { background: #fbe9c8; font-style: normal; padding: 0 1px; border-radius: 2px; }

.diff-grid { display: grid; gap: 8px; margin-top: 11px; }
.diff-line { display: grid; grid-template-columns: 60px 1fr; gap: 10px; font-size: 12.5px; }
.diff-key { color: var(--accent-ink); }
.diff-val { color: var(--ink-2); line-height: 1.75; }

/* 变化清单 */
.change {
  display: grid;
  grid-template-columns: 66px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f0eadd;
  font-size: 13px;
}
.change:last-child { border-bottom: 0; }
.change-type { font-size: 10.5px; color: var(--blue); background: #e8eef3; border-radius: 5px; padding: 2px 0; text-align: center; height: fit-content; }
.change-before { color: #a94a3a; font-family: var(--serif); }
.change-after { color: var(--green); font-family: var(--serif); }
.change-reason { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.7; }

/* 升级词句 */
.word-row { display: grid; grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr); gap: 8px; font-size: 13px; padding: 6px 0; border-bottom: 1px solid #f4eee2; }
.word-row:last-child { border-bottom: 0; }
.word-basic { font-family: var(--serif); color: var(--muted); text-decoration: line-through; text-decoration-color: #d8cdbd; }
.word-better { font-family: var(--serif); color: var(--green); font-weight: 600; }
.word-note { grid-column: 1 / -1; font-size: 11.5px; color: var(--muted); }
.word-arrow { color: #c3b6a3; text-align: center; }

.pattern-item { padding: 9px 0; border-bottom: 1px solid #f0eadd; }
.pattern-item:last-child { border-bottom: 0; }
.pattern-code { font-family: var(--mono); font-size: 12.5px; color: var(--ink); background: #f4eee2; padding: 2px 7px; border-radius: 5px; }
.pattern-use { font-size: 12px; color: var(--muted); margin-top: 4px; }
.pattern-eg { font-family: var(--serif); font-size: 13px; color: var(--green); margin-top: 3px; }

/* 下一步 */
.steps { margin: 0; padding-left: 20px; font-size: 13px; color: var(--ink-2); line-height: 1.9; }
.steps li { margin-bottom: 3px; }
.steps li::marker { color: var(--accent); }

/* 附加信息条 */
.extra-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--amber-soft);
  border: 1px solid #ecd9ae;
  font-size: 12.5px;
  color: #6d5117;
  line-height: 1.65;
  margin-bottom: 14px;
}

.result-foot {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 24px;
  border-top: 1px solid var(--line);
  background: var(--paper-2);
  font-size: 11.5px;
  color: var(--muted);
}

.result-foot .spacer { margin-left: auto; }

/* ---------------------------------------------------------------- 追问 */
.chat {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fdfaf3, var(--paper));
}

.chat-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-family: var(--serif);
}

.chat-head h3 { margin: 0; font-size: 14px; font-weight: 600; font-family: var(--serif); }
.chat-head p { margin: 0; font-size: 11.5px; color: var(--muted); }

.chat-log { padding: 16px 20px 4px; max-height: 520px; overflow-y: auto; }

.msg { display: flex; gap: 10px; margin-bottom: 14px; }
.msg-avatar {
  width: 24px; height: 24px; flex: 0 0 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px;
  margin-top: 2px;
}
.msg.ai .msg-avatar { background: var(--green-soft); color: var(--green); }
.msg.user .msg-avatar { background: #efe7d8; color: var(--muted); }
.msg-bubble {
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--ink-2);
  min-width: 0;
  flex: 1;
}
.msg.user .msg-bubble { color: var(--ink); }

.msg-bubble p { margin: 0 0 9px; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3, .msg-bubble h4 {
  font-family: var(--serif);
  font-size: 14.5px;
  margin: 14px 0 6px;
  color: var(--ink);
}
.msg-bubble ul, .msg-bubble ol { margin: 6px 0 9px; padding-left: 20px; }
.msg-bubble li { margin-bottom: 4px; }
.msg-bubble code {
  font-family: var(--mono);
  font-size: 12px;
  background: #f2ebdd;
  padding: 1px 5px;
  border-radius: 4px;
}
.msg-bubble strong { color: var(--ink); font-weight: 600; }
.msg-bubble em { color: var(--accent-ink); }
.msg-bubble blockquote {
  margin: 8px 0;
  padding: 4px 12px;
  border-left: 2px solid var(--line-2);
  color: var(--muted);
}
.msg-bubble hr { border: 0; border-top: 1px dashed var(--line); margin: 12px 0; }
.msg-bubble table { border-collapse: collapse; font-size: 12.5px; margin: 8px 0; }
.msg-bubble th, .msg-bubble td { border: 1px solid var(--line); padding: 4px 9px; }
.msg-bubble th { background: var(--paper-2); }

.typing::after {
  content: "▍";
  color: var(--accent);
  animation: blink 1s steps(2) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.chat-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 12px 20px 16px;
  border-top: 1px dashed var(--line);
}

.chat-form textarea {
  flex: 1;
  min-height: 44px;
  max-height: 140px;
  resize: none;
  font-size: 13px;
  background: var(--paper-2);
}

.chat-form .primary { padding: 10px 18px; flex: 0 0 auto; }

.chat-hint { font-size: 11px; color: #a89d8d; padding: 0 20px 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 20px 8px; }

.chip {
  border: 1px solid var(--line);
  background: var(--paper-2);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 11.5px;
  color: var(--muted);
}
.chip:hover { color: var(--accent-ink); border-color: #e6c3b5; background: var(--accent-soft); }

/* ---------------------------------------------------------------- 弹窗 */
.modal {
  border: 1px solid var(--line-2);
  border-radius: 16px;
  padding: 0;
  width: min(520px, calc(100vw - 32px));
  background: var(--paper);
  box-shadow: 0 30px 70px -20px rgba(30, 25, 18, .45);
  color: var(--ink);
}

.modal.wide { width: min(680px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(35, 30, 22, .35); backdrop-filter: blur(2px); }

.modal-inner { padding: 22px 24px 20px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-head h3 { margin: 0; font-family: var(--serif); font-size: 18px; font-weight: 600; }
.modal-note { font-size: 12.5px; color: var(--muted); line-height: 1.75; margin: 0 0 16px; }
.modal-note code { font-family: var(--mono); font-size: 11.5px; background: #f2ebdd; padding: 1px 5px; border-radius: 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-actions .danger { margin-right: auto; }

.history-list { display: grid; gap: 8px; max-height: 55vh; overflow-y: auto; }

.history-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper-2);
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.history-item:hover { border-color: #d8c6a6; background: #fdf7ea; }
.history-type { font-size: 10.5px; padding: 2px 7px; border-radius: 5px; background: #eee6d8; color: var(--muted); white-space: nowrap; }
.history-title { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-date { font-size: 11px; color: var(--muted); white-space: nowrap; }
.history-score { font-family: var(--serif); font-size: 14px; color: var(--accent-ink); white-space: nowrap; }

/* 访问码门 */
.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(244, 241, 234, .995);
  backdrop-filter: blur(8px);
}

.gate[hidden] { display: none; }

.gate-card {
  width: min(360px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px 24px 20px;
  text-align: center;
  box-shadow: 0 24px 60px -24px rgba(35, 30, 22, .4);
}

.gate-mark {
  width: 44px; height: 44px;
  margin: 0 auto 12px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff8ee;
  font-family: var(--serif);
  font-size: 26px;
  display: grid; place-items: center;
}

.gate-card h2 { margin: 0 0 6px; font-family: var(--serif); font-size: 19px; font-weight: 600; }
.gate-card p { margin: 0 0 14px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.gate-card input { text-align: center; font-size: 16px; margin-bottom: 10px; }
.gate-card .primary { width: 100%; }
.gate-hint { margin-top: 12px !important; font-size: 11px !important; color: #a89d8d !important; }

/* 设置里的手机地址 */
.phone-box {
  margin-top: 4px;
  padding: 11px 13px;
  border: 1px dashed var(--line-2);
  border-radius: 10px;
  background: var(--paper-2);
}

.phone-label { font-size: 11px; color: var(--muted); margin-bottom: 4px; letter-spacing: .04em; }

.phone-url {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--green);
  word-break: break-all;
  line-height: 1.5;
  white-space: pre-line;
}

/* 提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 18px);
  background: var(--ink);
  color: #fdf9f0;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  z-index: 90;
  max-width: min(560px, calc(100vw - 40px));
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .4);
  line-height: 1.5;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #8e3323; }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 1fr; }
  .composer { position: static; }
  .topbar { flex-wrap: wrap; gap: 12px; }
  .tabs { order: 3; width: 100%; margin-left: 0; justify-content: center; }
  .top-actions { margin-left: auto; }
}

@media (max-width: 720px) {
  main { padding: 14px 12px 40px; }
  .topbar { padding: 10px 14px; }
  .brand-text p { display: none; }
  .status span:not(.dot) { display: none; }
  .ghost { padding: 6px 10px; font-size: 12px; }
  .layout { gap: 14px; }
  .composer { padding: 16px 14px 12px; }
  .result-hero { grid-template-columns: 1fr; gap: 14px; padding: 18px 16px; }
  .score-block { display: flex; align-items: center; gap: 14px; min-width: 0; flex-wrap: wrap; }
  .score-num { font-size: 40px; }
  .score-label, .band-pill { margin-top: 0; }
  .result-body, .chat-log, .chat-form { padding-left: 14px; padding-right: 14px; }
  .result-foot { padding: 10px 14px; flex-wrap: wrap; }
  .st-line { grid-template-columns: 38px 1fr; }
  .reason-item { grid-template-columns: 1fr auto; }
  .reason-text { grid-column: 1 / -1; }
  .sent-issues, .sent-better, .sent-note, .sent-your { margin-left: 0; }
  .chunk { grid-template-columns: 1fr; }
  .vocab-grid { grid-template-columns: 1fr; }
  .word-row { grid-template-columns: 1fr 16px 1fr; }
  .row-2 { grid-template-columns: 1fr; }
  .dim { grid-template-columns: 64px 1fr 44px; }
  .chip { font-size: 11px; }
  /* iOS 上输入框字号小于 16px 会在聚焦时自动放大页面 */
  textarea, input[type="password"], input[type="text"], select { font-size: 16px; }
}
