:root {
  --paper: #f4ede1;
  --paper-2: #efe6d6;
  --paper-3: #fbf7ef;
  --ink: #211d18;
  --ink-soft: #4a4238;
  --muted: #8b8174;
  --line: rgba(33, 29, 24, 0.11);
  --line-strong: rgba(33, 29, 24, 0.2);
  --seal: #9e2b25;
  --seal-dark: #84211d;
  --green: #4f7c38;
  --teal: #2f806c;
  --gold: #b5842c;
  --danger: #b72f2a;
  --shadow: 0 10px 34px rgba(33, 29, 24, 0.1);
  --soft-shadow: 0 4px 18px rgba(33, 29, 24, 0.07);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", SimSun, serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.app-shell {
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.paper-grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.48;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}

.app-topbar,
.app-main,
.login-screen {
  position: relative;
  z-index: 1;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto minmax(210px, 1fr);
  align-items: center;
  gap: 22px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 237, 225, 0.88);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.seal-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  background: var(--seal);
  color: #f7efe2;
  font-weight: 800;
  font-size: 23px;
  letter-spacing: 0;
  box-shadow: 0 5px 18px rgba(158, 43, 37, 0.3), inset 0 0 0 2px rgba(255, 255, 255, 0.14);
}

.seal-mark.large {
  width: 64px;
  height: 64px;
  border-radius: 13px;
  font-size: 35px;
}

.brand-title {
  display: block;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.brand-subtitle {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dir-switch {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  background: rgba(33, 29, 24, 0.06);
}

.dir-tab {
  min-width: 116px;
  padding: 8px 18px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #7a7064;
  text-align: center;
  text-decoration: none;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.dir-tab:hover {
  background: rgba(255, 255, 255, 0.42);
}

.dir-tab.on {
  background: #fff;
  color: var(--seal);
  box-shadow: 0 2px 8px rgba(33, 29, 24, 0.12);
}

.dir-name {
  display: block;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.dir-en {
  display: block;
  margin-top: 1px;
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.58;
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.app-main {
  width: min(1440px, calc(100% - 56px));
  margin: 0 auto;
  padding: 26px 0 56px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.kicker {
  color: var(--seal);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.page-title {
  margin: 7px 0 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.12;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.page-desc {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.btn,
.ghost-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 9px 17px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
}

.btn {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #f3ece1;
  box-shadow: 0 7px 22px rgba(33, 29, 24, 0.2);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(33, 29, 24, 0.24);
}

.ghost-btn {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.18);
  color: var(--ink-soft);
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.42);
}

.danger-btn {
  border: 1px solid var(--seal);
  background: var(--seal);
  color: #f7efe2;
}

.danger-btn:hover {
  background: var(--seal-dark);
}

.top-actions form {
  margin: 0;
}

.panel,
.report-panel,
.upload-card,
.stat-strip,
.sample-card,
.match-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: var(--soft-shadow);
}

.panel {
  padding: 22px;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  margin-bottom: 22px;
}

.stat-item {
  min-height: 116px;
  padding: 22px 26px;
  border-right: 1px solid var(--line);
}

.stat-item:last-child {
  border-right: 0;
}

.stat-label {
  color: var(--seal);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.stat-value {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-top: 8px;
  color: var(--green);
  font-size: 48px;
  line-height: 1;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.stat-value small {
  color: var(--ink-soft);
  font-size: 18px;
}

.stat-note {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.status-chip,
.grade-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 25px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.48);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-chip::before,
.score-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.status-pending::before {
  background: var(--gold);
}

.status-running::before {
  background: var(--teal);
}

.status-failed::before {
  background: var(--danger);
}

.status-done::before {
  background: var(--green);
}

.score-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.score-dot.bad::before {
  background: var(--danger);
}

.score-dot.warn::before {
  background: var(--gold);
}

.score-dot.good::before {
  background: var(--green);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}

.data-table th {
  padding: 0 14px 7px;
  color: var(--muted);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

.data-table td {
  padding: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.52);
  vertical-align: middle;
}

.data-table td:first-child {
  border-left: 1px solid var(--line);
  border-radius: 12px 0 0 12px;
}

.data-table td:last-child {
  border-right: 1px solid var(--line);
  border-radius: 0 12px 12px 0;
  text-align: right;
}

.job-name {
  font-weight: 800;
  letter-spacing: 0.04em;
}

.meta-text {
  color: var(--muted);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 12px;
}

.empty-state {
  padding: 42px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.32);
  text-align: center;
}

.empty-state strong {
  display: block;
  font-size: 19px;
  letter-spacing: 0.06em;
}

.empty-state p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.8;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr);
  gap: 18px;
  align-items: start;
}

/* 样本库：上传表单 + 样本网格 并排，网格紧挨表单 */
.library-layout {
  --scard: 160px;          /* 单个样本卡宽度 */
  --sgap: 14px;            /* 样本卡间隔 */
  display: grid;
  /* 表单宽 = 两个样本卡宽 + 一个间隔 */
  grid-template-columns: calc(var(--scard) * 2 + var(--sgap)) minmax(0, 1fr);
  gap: var(--sgap);
  align-items: stretch;    /* 表单与样本网格等高 */
}

.upload-card {
  position: relative;
  padding: 14px 16px;
}

.upload-card h3,
.panel h3,
.report-panel h3 {
  margin: 0 0 6px;
  font-size: 20px;
  letter-spacing: 0.06em;
}

.upload-card p,
.panel p,
.report-panel p {
  color: var(--muted);
  line-height: 1.8;
}

.form-panel {
  display: grid;
  gap: 17px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label,
.form-panel p label,
.match-card label {
  color: var(--ink-soft);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.form-panel input,
.form-panel select,
.match-card input[type="text"],
.match-card input[type="file"],
.login-field input {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid rgba(33, 29, 24, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  outline: none;
}

.field input:focus,
.field select:focus,
.form-panel input:focus,
.form-panel select:focus,
.match-card input:focus,
.login-field input:focus {
  border-color: var(--seal);
  box-shadow: 0 0 0 3px rgba(158, 43, 37, 0.1);
}

.form-panel p {
  display: grid;
  gap: 8px;
  margin: 0;
}

/* 「上传范本 / 加入样本库」卡片：更紧凑 */
.upload-card h3 {
  font-size: 16px;
  margin-bottom: 3px;
}

.upload-card > p {
  font-size: 12.5px;
  line-height: 1.55;
  margin: 0 0 12px;
}

.upload-card .form-panel {
  gap: 10px;
}

.upload-card .form-panel input,
.upload-card .form-panel select {
  min-height: 28px;
  padding: 3px 8px;
}

.upload-card .btn {
  margin-top: 20px;
  padding: 8px 14px;
}

.errorlist {
  margin: 0;
  padding: 0;
  color: var(--danger);
  list-style: none;
  font-size: 13px;
}

.sample-grid,
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

/* 样本库并排布局内：样本卡固定宽，使「两个卡宽 + 间隔」= 表单宽 */
.library-layout .sample-grid {
  grid-template-columns: repeat(auto-fill, var(--scard));
  gap: var(--sgap);
  justify-content: start;
}

.sample-card,
.char-card {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.54);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--soft-shadow);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.sample-card:hover,
.char-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.sample-preview,
.char-preview {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 247, 239, 0.78);
}

/* 列表样本图框：固定高度并加高，让样本网格高度接近上传卡 */
.sample-preview {
  aspect-ratio: auto;
  height: 220px;
}

.sample-preview img,
.char-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
}

.char-symbol {
  font-size: 76px;
  font-weight: 900;
  color: var(--green);
}

.sample-caption,
.char-caption {
  display: grid;
  gap: 6px;
  padding: 12px 13px;
}

.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 24px;
  align-items: start;
}

.report-panel {
  padding: 24px;
}

.seal-doc {
  position: sticky;
  top: 96px;
  background: rgba(255, 252, 246, 0.78);
}

.seal-doc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.seal-stamp {
  color: var(--seal);
  border: 2px solid var(--seal);
  border-radius: 7px;
  padding: 2px 9px;
  font-size: 14px;
  font-weight: 800;
  transform: rotate(-7deg);
}

.feedback-text {
  color: var(--ink-soft);
  line-height: 2;
  white-space: pre-wrap;
}

.progress-box {
  display: grid;
  gap: 12px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.5);
}

/* === 对临评阅 · 范本选择器（替代下拉框） === */
.ref-card { gap: 14px; }

.ref-current {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(251, 247, 239, 0.92);
}
.ref-current--empty {
  justify-content: center;
  border-style: dashed;
  color: var(--muted);
}
.ref-current-hint { font-size: 14px; }
.ref-current-img {
  flex: 0 0 96px;
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-3);
}
.ref-current-img img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.ref-current-info { display: grid; gap: 4px; }
.ref-current-kicker {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--seal);
}
.ref-current-char { font-size: 26px; font-weight: 800; line-height: 1.1; color: var(--ink); }
.ref-current-from { font-size: 13px; color: var(--ink-soft); }
.ref-to-page { margin-top: 6px; justify-self: start; padding: 5px 12px; font-size: 13px; }

.ref-groups {
  display: grid;
  gap: 14px;
  max-height: 1000px;
  overflow-y: auto;
  padding-right: 4px;
}
.ref-group { display: grid; gap: 8px; }
.ref-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.ref-group-head:hover { border-color: var(--line-strong); }
.ref-group-head.on { border-color: var(--seal); background: rgba(158, 43, 37, 0.07); }
.ref-group-title { font-weight: 700; color: var(--ink); }
.ref-group-meta { font-size: 12px; color: var(--muted); }

.ref-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  gap: 8px;
}
.ref-tile {
  display: grid;
  gap: 2px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
  font: inherit;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.ref-tile:hover { transform: translateY(-1px); border-color: var(--line-strong); box-shadow: var(--soft-shadow); }
.ref-tile.on { border-color: var(--seal); background: rgba(158, 43, 37, 0.06); box-shadow: 0 0 0 2px rgba(158, 43, 37, 0.25); }
.ref-tile img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: var(--paper-3);
  border-radius: 7px;
}
.ref-tile-sym {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  font-size: 30px;
  font-weight: 800;
  color: var(--green);
  background: var(--paper-3);
  border-radius: 7px;
}
.ref-tile-label { font-size: 12px; text-align: center; color: var(--ink-soft); }
.ref-tile.on .ref-tile-label { color: var(--seal); font-weight: 700; }
.ref-empty { padding: 4px 2px; }

/* === 单字页：tab 切换 === */
.char-head-main { flex: 1; min-width: 0; }
.title-row {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px 18px;
}
.char-back-btn { margin-left: auto; }
.tab-nav {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  border-radius: 12px;
  background: rgba(33, 29, 24, 0.06);
}
.title-row .tab-nav { margin-bottom: 4px; }
.tab-btn {
  padding: 8px 20px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #7a7064;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}
.tab-btn:hover { background: rgba(255, 255, 255, 0.42); }
.tab-btn.on { background: #fff; color: var(--seal); box-shadow: 0 2px 8px rgba(33, 29, 24, 0.12); }
.tab-pane[hidden] { display: none; }

/* 分数色带 */
.band-good { --bc: var(--green); }
.band-warn { --bc: var(--gold); }
.band-bad  { --bc: var(--seal); }

/* === 临作对比 === */
.lz-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  margin-bottom: 18px;
}
.lz-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.1em;
}
.lz-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}
.lz-chip:hover { transform: translateY(-1px); box-shadow: var(--soft-shadow); }
.lz-chip.on {
  background: #fff;
  border-color: rgba(158, 43, 37, 0.45);
  box-shadow: 0 0 0 1px rgba(158, 43, 37, 0.28), 0 4px 12px rgba(158, 43, 37, 0.1);
  transform: translateY(-1px);
}
.lz-chip-char { font-size: 26px; font-weight: 800; line-height: 1; }
.lz-chip.on .lz-chip-char { color: var(--seal); }
.lz-chip-py { font-size: 12px; color: var(--muted); }
.lz-chip-score,
.lz-stroke-score {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--bc, var(--muted));
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.lz-chip-score::before,
.lz-stroke-score::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--bc, var(--muted));
}

.lz-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(230px, 0.9fr);
  gap: 18px;
  align-items: stretch;
}
.lz-frame {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.45);
  padding: 14px;
  box-shadow: var(--soft-shadow);
}
.lz-frame-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.lz-frame-title { font-size: 16px; font-weight: 800; color: var(--ink); }
.mizige {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background-color: var(--paper-3);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg stroke='%23b6452f' stroke-width='0.5' stroke-dasharray='3 3' opacity='0.35' fill='none'%3E%3Cline x1='50' y1='0' x2='50' y2='100'/%3E%3Cline x1='0' y1='50' x2='100' y2='50'/%3E%3Cline x1='0' y1='0' x2='100' y2='100'/%3E%3Cline x1='100' y1='0' x2='0' y2='100'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 100% 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.mizige img { width: 100%; height: 100%; object-fit: contain; padding: 8%; }

.stroke-stage {
  position: relative;
  width: 100%;
  height: 100%;
}

.stroke-stage img {
  display: block;
}

.stroke-overlay {
  position: absolute;
  inset: 8%;
  width: auto;
  height: auto;
  pointer-events: none;
  overflow: visible;
}

.stroke-anim-path {
  fill: none;
  stroke: var(--seal);
  stroke-width: var(--stroke-width, 12);
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.96;
  filter: drop-shadow(0 2px 5px rgba(158, 43, 37, 0.34));
}

.stroke-anim-path.playing {
  animation: stroke-draw 1.35s cubic-bezier(0.2, 0.78, 0.22, 1) forwards;
}

@keyframes stroke-draw {
  to { stroke-dashoffset: 0; }
}

.lz-strokes-cell { position: relative; min-height: 0; }
.lz-strokes {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.45);
  padding: 14px;
  box-shadow: var(--soft-shadow);
}
.lz-strokes-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.lz-stroke-list { display: grid; gap: 8px; flex: 1; min-height: 0; overflow-y: auto; }
.lz-stroke {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.lz-stroke:hover { border-color: var(--line-strong); }
.lz-stroke.on { border-color: var(--seal); background: rgba(158, 43, 37, 0.06); }
.lz-stroke-no {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(33, 29, 24, 0.07);
  font-size: 12px; font-weight: 700; color: var(--ink-soft);
}
.lz-stroke-body { display: grid; gap: 2px; min-width: 0; }
.lz-stroke-name { font-weight: 800; color: var(--ink); }
.lz-stroke-desc {
  font-size: 12px; color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.lz-advice {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(251, 247, 239, 0.8);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
}

.lz-whole { margin-top: 18px; }
.lz-whole-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}
.lz-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 40px;
}
.lz-metric {
  display: grid;
  grid-template-columns: 72px 1fr 34px;
  align-items: center;
  gap: 12px;
}
.lz-metric-label { font-size: 13px; color: var(--ink-soft); font-weight: 700; }
.lz-bar {
  height: 9px;
  border-radius: 999px;
  background: rgba(33, 29, 24, 0.08);
  overflow: hidden;
}
.lz-bar-fill {
  display: block;
  width: var(--v, 0%);
  height: 100%;
  border-radius: 999px;
  background: var(--bc, var(--green));
}
.lz-metric-val { color: var(--bc, var(--ink)); font-weight: 800; font-variant-numeric: tabular-nums; }
.lz-diagnosis {
  margin-top: 20px;
  padding-left: 16px;
  border-left: 3px solid var(--seal);
}
.lz-diagnosis ul { margin: 8px 0 0; padding-left: 18px; }
.lz-diagnosis li { color: var(--ink-soft); line-height: 1.9; }

@media (max-width: 900px) {
  .lz-main { grid-template-columns: 1fr; }
  .lz-metrics { grid-template-columns: 1fr; }
  .lz-strokes-cell { position: static; }
  .lz-strokes { position: static; inset: auto; }
  .lz-stroke-list { flex: none; max-height: 430px; }
}

/* === 切字 · 配对校对页 === */
.review-panel { padding: 18px 20px; }
.review-head,
.rv-row {
  display: grid;
  grid-template-columns: 1fr 44px 1fr minmax(180px, auto);
  align-items: center;
  gap: 14px;
}
.review-head {
  padding: 0 4px 10px;
  border-bottom: 1px solid var(--line);
}
.review-col-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--seal);
  text-transform: uppercase;
}
.review-rows { display: grid; gap: 10px; margin-top: 12px; }
.rv-row {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
}
.rv-row.ok { border-color: rgba(79, 124, 56, 0.5); background: rgba(79, 124, 56, 0.06); }
.rv-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--paper-3);
}
.rv-cell img { width: 60px; height: 60px; object-fit: contain; }
.rv-sym { font-size: 40px; font-weight: 800; color: var(--green); }
.rv-tag { font-size: 12px; color: var(--ink-soft); }
.rv-empty { justify-content: center; color: var(--muted); background: rgba(33, 29, 24, 0.03); }
.rv-unwritten { border: 1px dashed var(--line-strong); }
.rv-link { text-align: center; color: var(--muted); font-size: 18px; }
.rv-row.ok .rv-link { color: var(--green); }
.rv-acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.rv-act {
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.rv-act:hover { border-color: var(--seal); background: rgba(158, 43, 37, 0.06); }
.rv-act.rv-danger { color: var(--danger); }
.rv-act.rv-danger:hover { border-color: var(--danger); background: rgba(183, 47, 42, 0.08); }
.review-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 18px;
}

/* 学生临作：上传后即时预览 */
.stu-preview[hidden] { display: none; }
.stu-preview {
  display: grid;
  gap: 6px;
  margin: 2px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-3);
}
.stu-preview img {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 8px;
}
.stu-preview figcaption { text-align: center; word-break: break-all; }

.progress-track {
  overflow: hidden;
  height: 11px;
  border-radius: 99px;
  background: rgba(33, 29, 24, 0.09);
}

.progress-fill {
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--seal));
}

.char-stage {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: start;
  margin-top: 18px;
  padding: 24px;
  border-radius: 18px;
  background: radial-gradient(circle at 50% 26%, #2b261f, #1c1915 75%);
  color: #f3ece1;
}

.char-stage .kicker {
  color: #e0b3ac;
}

.overlay-stage {
  grid-template-columns: minmax(0, 1fr) minmax(460px, 1.25fr);
  align-items: stretch;
}

.overlay-review-column {
  display: grid;
  align-content: start;
  min-width: 0;
  width: 100%;
}

.overlay-review-column .ai-review-card {
  width: 100%;
}

.dark-card {
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  padding: 18px 20px;
}

.dark-card p,
.dark-card .meta-text {
  color: rgba(243, 236, 225, 0.66);
}

.big-score {
  color: #d89a2c;
  font-size: 66px;
  line-height: 1;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.metric-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.metric-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 38px;
  gap: 10px;
  align-items: center;
  color: rgba(243, 236, 225, 0.85);
  font-size: 13px;
}

.meter {
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.14);
}

.meter span {
  display: block;
  width: var(--value, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3e8a6a, #c9a23d);
}

.lightbox-stage {
  display: grid;
  gap: 16px;
  max-width: 500px;
  margin-inline: auto;
}

.image-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.glyph-frame {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.18);
}

.glyph-frame.paper {
  border-color: rgba(33, 29, 24, 0.12);
  background: rgba(251, 247, 239, 0.82);
}

.glyph-frame img {
  width: 100%;
  max-height: 560px;
  object-fit: contain;
  padding: 18px;
}

.glyph-caption {
  position: absolute;
  left: 16px;
  top: 16px;
  border-radius: 999px;
  background: rgba(158, 43, 37, 0.92);
  color: #fff;
  padding: 5px 12px;
  font-size: 12px;
}

.stroke-list {
  display: grid;
  gap: 8px;
  max-height: 376px;
  overflow: auto;
  padding-right: 4px;
}

.stroke-row {
  width: 100%;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.06);
  color: #f3ece1;
  text-align: left;
  cursor: pointer;
}

.stroke-row:hover,
.stroke-row.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(224, 179, 172, 0.36);
}

.stroke-index {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(243, 236, 225, 0.82);
  font-size: 12px;
}

.stroke-name {
  font-weight: 800;
  letter-spacing: 0.04em;
}

.stroke-meta {
  display: block;
  margin-top: 3px;
  color: rgba(243, 236, 225, 0.58);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  line-height: 1.4;
}

.advice-box {
  min-height: 86px;
  margin-top: 16px;
  color: rgba(243, 236, 225, 0.78);
  line-height: 1.9;
}

.ai-review-card {
  display: grid;
  gap: 14px;
}

.ai-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-review-btn {
  width: 100%;
  border-color: rgba(243, 236, 225, 0.28);
  background: #f0dfc6;
  color: #2f261d;
}

.ai-review-text {
  max-height: none;
  overflow: visible;
  color: rgba(243, 236, 225, 0.86);
  line-height: 1.95;
  white-space: normal;
}

.ai-review-error {
  padding: 11px 12px;
  border: 1px solid rgba(224, 120, 110, 0.38);
  border-radius: 10px;
  background: rgba(190, 55, 45, 0.12);
  color: #ffd8d2;
  line-height: 1.7;
}

.ai-review-empty {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f3ece1;
}

.warning-box,
.error-box {
  margin: 12px 0;
  padding: 13px 15px;
  border-radius: 11px;
  line-height: 1.7;
}

.warning-box {
  border: 1px solid rgba(181, 132, 44, 0.32);
  background: rgba(181, 132, 44, 0.1);
  color: #7b5618;
}

.error-box {
  border: 1px solid rgba(183, 47, 42, 0.28);
  background: rgba(183, 47, 42, 0.08);
  color: #8c251f;
}

.match-list {
  display: grid;
  gap: 12px;
}

.match-card {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) 90px minmax(220px, 0.9fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
}

.match-card img {
  width: 86px;
  height: 86px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-3);
  object-fit: contain;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}

.login-hero {
  position: relative;
  display: grid;
  align-items: center;
  overflow: hidden;
  padding: 60px 64px;
  background: radial-gradient(circle at 30% 25%, #2f2922, #1c1915 78%);
}

.login-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.5;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

.login-hero-inner {
  position: relative;
  z-index: 2;
  max-width: 500px;
}

.login-hero h1 {
  margin: 30px 0 18px;
  color: #f3ece1;
  font-size: clamp(38px, 5vw, 60px);
  line-height: 1.22;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.login-hero p {
  margin: 0;
  color: rgba(243, 236, 225, 0.72);
  font-size: 15px;
  line-height: 2.1;
  letter-spacing: 0.04em;
}

.login-watermark {
  position: absolute;
  right: -54px;
  bottom: -102px;
  z-index: 1;
  color: rgba(224, 179, 172, 0.07);
  font-size: min(31vw, 400px);
  line-height: 1;
  font-weight: 900;
  user-select: none;
}

.login-stats {
  display: flex;
  gap: 30px;
  margin-top: 42px;
}

.login-stats strong {
  display: block;
  color: #e0b3ac;
  font-size: 24px;
}

.login-stats span {
  display: block;
  margin-top: 5px;
  color: rgba(243, 236, 225, 0.56);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.login-pane {
  display: grid;
  place-items: center;
  padding: 40px;
}

.login-card {
  width: min(100%, 410px);
  padding: 38px 36px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 18px 54px rgba(33, 29, 24, 0.12);
  backdrop-filter: blur(8px);
}

.login-card h2 {
  margin: 0;
  font-size: 25px;
  letter-spacing: 0.06em;
}

.login-card .page-desc {
  margin-bottom: 24px;
}

.login-field {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
}

.login-field span {
  color: var(--muted);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.login-submit {
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  border: 0;
  border-radius: 11px;
  background: var(--ink);
  color: #f3ece1;
  font-weight: 800;
  letter-spacing: 0.1em;
  cursor: pointer;
  box-shadow: 0 7px 22px rgba(33, 29, 24, 0.22);
}

.login-submit:hover {
  transform: translateY(-1px);
}

.login-note {
  margin-top: 22px;
  color: #b3a892;
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

@media (max-width: 1100px) {
  .app-topbar {
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .dir-switch {
    width: 100%;
    overflow-x: auto;
  }

  .report-layout,
  .char-stage,
  .form-grid,
  .library-layout {
    grid-template-columns: 1fr;
  }

  .seal-doc {
    position: static;
  }

  .stat-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .match-card {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .match-card .btn {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .app-main {
    width: min(100% - 28px, 1440px);
    padding-top: 18px;
  }

  .app-topbar {
    padding: 12px 14px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .stat-strip,
  .image-compare {
    grid-template-columns: 1fr;
  }

  .stat-item {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stat-item:last-child {
    border-bottom: 0;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
  }

  .data-table thead {
    display: none;
  }

  .data-table td {
    border: 0;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    border-radius: 0;
  }

  .data-table td:first-child {
    border-top: 1px solid var(--line);
    border-radius: 12px 12px 0 0;
  }

  .data-table td:last-child {
    border-bottom: 1px solid var(--line);
    border-radius: 0 0 12px 12px;
    text-align: left;
  }

  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-hero {
    min-height: 360px;
    padding: 38px 30px;
  }

  .login-pane {
    padding: 26px 18px 42px;
  }
}

/* 样本逐字索引页 */
.char-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.char-fields {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.char-del {
  width: 100%;
  margin-top: 8px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(183, 47, 42, 0.06);
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.char-del:hover {
  background: rgba(183, 47, 42, 0.12);
  border-color: var(--seal);
}

.char-review {
  display: block;
  margin-top: 6px;
  padding: 6px;
  text-align: center;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: rgba(79, 124, 56, 0.08);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.char-review:hover {
  background: rgba(79, 124, 56, 0.18);
}

/* 低置信(≤0.7)未确认的字：红框 + 闪烁 60 秒提示复核（确认后该 class 不再出现） */
.char-card.needs-review {
  border-color: var(--danger);
  animation: review-blink 1s ease-in-out 0s 60;   /* 闪 60 次 ≈ 60 秒，之后停在红框 */
}

@keyframes review-blink {
  0%, 100% {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(183, 47, 42, 0.45);
  }
  50% {
    border-color: rgba(183, 47, 42, 0.25);
    box-shadow: 0 0 0 3px rgba(183, 47, 42, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .char-card.needs-review { animation: none; box-shadow: 0 0 0 2px rgba(183, 47, 42, 0.4); }
}

/* 样本卡片标题行：标题(加粗) + 日期 同一行 */
.sample-titlerow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.sample-title {
  font-weight: 800;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sample-titlerow .meta-text {
  flex: 0 0 auto;
}

/* 样本卡片上的字预览：字|字|字等N字 */
.sample-chars {
  font-size: 13px;
  font-weight: 700;
  color: var(--green);
  line-height: 1.45;
  word-break: break-all;
}

/* 样本详情页：双击可改的标题 */
.editable-title {
  cursor: text;
  border-radius: 6px;
  padding: 0 4px;
  transition: background 0.15s ease;
}

.editable-title:hover {
  background: rgba(158, 43, 37, 0.08);
}

.editable-title[contenteditable="true"] {
  background: #fff;
  outline: 2px solid var(--seal);
}

.charidx-input {
  width: 52px;
  flex: 0 0 auto;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--green);
  padding: 6px 4px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper-3);
}

.charidx-script {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink-soft);
}

.charidx-input:focus,
.charidx-script:focus {
  outline: none;
  border-color: var(--seal);
}

.save-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(251, 247, 239, 0.92);
  box-shadow: var(--soft-shadow);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.save-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;   /* 两个按钮靠右 */
}
