@font-face {
  font-family: "WenKai";
  src: url("/fonts/lxgw-wenkai-subset-v2.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f2ecdf;
  --paper-2: #f8f4ea;
  --sheet: #fbf8f1;
  --ink: #1b221d;
  --ink-2: #3b463f;
  --muted: #6d796f;
  --line: #ded4c2;
  --line-2: #cbbfa9;
  --green: #2e5b44;
  --green-2: #4d7a63;
  --green-wash: #e6efe6;
  --clay: #a8543d;
  --clay-wash: #f3e3dc;
  --gold: #9b7c45;
  --serif: "WenKai", "Songti SC", "Iowan Old Style", "Palatino Linotype", "Source Han Serif SC", serif;
  --serif-latin: "Iowan Old Style", "Palatino Linotype", "Georgia", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --radius: 22px;
  --shadow: 0 1px 0 rgba(27, 34, 29, .03), 0 18px 40px -28px rgba(27, 34, 29, .35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  min-height: 100dvh;
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  background-color: var(--paper);
  background-image:
    radial-gradient(rgba(27, 34, 29, .032) 1px, transparent 1px),
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, .55), transparent 46%);
  background-size: 5px 5px, 100% 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, label { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.kicker {
  margin: 0;
  font: 600 10.5px/1.5 var(--sans);
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--muted);
}

.boot {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.boot-text { margin: 0; color: var(--muted); font-size: 13px; letter-spacing: .08em; }

/* 登录 */
.login {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  padding: clamp(24px, 6vw, 80px);
}
.login-inner { width: min(640px, 100%); }
.login-title {
  margin: 20px 0 0;
  font: 400 clamp(38px, 7.4vw, 66px)/1.16 var(--serif);
  letter-spacing: .01em;
}
.login-sub {
  margin: 20px 0 0;
  max-width: 30em;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.85;
}
.login-form { margin-top: clamp(36px, 7vh, 66px); max-width: 360px; }
.field { display: block; }
.field-label { display: block; font-size: 11px; letter-spacing: .2em; color: var(--muted); }
.field input {
  width: 100%;
  margin-top: 10px;
  padding: 8px 2px 12px;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: 400 26px/1.2 var(--serif);
  letter-spacing: .28em;
  outline: none;
}
.field input::placeholder { color: var(--line-2); }
.field input:focus { border-bottom-color: var(--green); }

.btn {
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .02em;
  transition: transform .18s ease, background .2s ease, color .2s ease;
}
.btn:active { transform: translateY(1px) scale(.995); }
.btn-ink { width: 100%; margin-top: 26px; background: var(--ink); color: var(--sheet); }
.btn-ink:hover { background: #0d120f; }
.btn.is-copied { background: var(--green); }

.error { min-height: 20px; margin: 12px 0 0; color: var(--clay); font-size: 13px; }
.login-foot {
  margin-top: clamp(40px, 9vh, 92px);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .1em;
}

/* 应用外框 */
.app {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 40px) clamp(16px, 4vw, 32px) 128px;
}
.masthead { margin-bottom: 26px; }
.masthead-line { display: flex; justify-content: space-between; align-items: center; }
.link-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .12em;
  padding: 6px 0;
  transition: color .2s ease;
}
.link-btn:hover { color: var(--ink); }
.masthead-main { margin-top: 14px; }
.date-title {
  margin: 0;
  font: 400 clamp(44px, 10vw, 72px)/1.04 var(--serif);
  letter-spacing: .01em;
}
.date-title .num { font-family: var(--serif-latin); font-size: .94em; letter-spacing: -.01em; }
.date-meta {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .1em;
}
.masthead-rule {
  margin-top: 20px;
  height: 4px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line);
}
.masthead-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}
.date-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 12px;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}
.date-control:hover { background: var(--paper-2); border-color: var(--line-2); }
.date-control svg { opacity: .55; }
.date-control input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* 卡片 */
.sheet {
  position: relative;
  margin-bottom: 16px;
  padding: clamp(18px, 3.6vw, 28px);
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: rise .5s cubic-bezier(.2, .7, .2, 1) both;
}
.sheet:nth-of-type(2) { animation-delay: .06s; }
.sheet:nth-of-type(3) { animation-delay: .12s; }
.sheet:nth-of-type(4) { animation-delay: .18s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.sheet-head .kicker { display: flex; align-items: center; gap: 8px; }
.sheet-head .kicker::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--clay);
  display: inline-block;
}
.sheet-meta {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: .12em;
  white-space: nowrap;
}

/* 今日词表 */
.word-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  columns: 1;
  column-gap: 34px;
}
.word-list li {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid rgba(222, 212, 194, .7);
  break-inside: avoid;
}
.word-no {
  flex: none;
  width: 26px;
  color: var(--muted);
  font: 400 11px/1 var(--serif-latin);
  letter-spacing: .06em;
}
.word-zh { font: 400 clamp(19px, 4.6vw, 22px)/1.5 var(--serif); }
.sheet-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 0 4px; }
.sheet-actions .btn { padding: 10px 18px; }
.sheet-actions .btn-ink, .empty .btn-ink { width: auto; margin-top: 0; }
.empty .btn-ink { margin-top: 24px; }
.hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .02em;
  line-height: 1.6;
}

@media (min-width: 620px) {
  .word-list { columns: 2; }
}

/* 照片 */
.photo-frame {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}
.photo { display: block; width: 100%; }
.photo-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 176px;
  margin-top: 16px;
  border: 1px dashed var(--line-2);
  border-radius: 14px;
  background: rgba(255, 255, 255, .35);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .06em;
}
.photo-empty svg { opacity: .55; }
.upload-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 13px;
  letter-spacing: .04em;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
}
.upload-zone:hover { background: var(--paper-2); border-color: var(--line-2); }
.upload-zone input { display: none; }

/* 批改 */
.score-line {
  margin: 0;
  font: 400 clamp(30px, 7vw, 42px)/1 var(--serif-latin);
  color: var(--ink);
}
.score-line span { color: var(--muted); font-size: .55em; }
.grade-bar {
  appearance: none;
  width: 100%;
  height: 6px;
  margin-top: 18px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--line);
}
.grade-bar::-webkit-progress-bar { background: var(--line); }
.grade-bar::-webkit-progress-value { background: var(--green); border-radius: 999px; }
.grade-bar::-moz-progress-bar { background: var(--green); border-radius: 999px; }
.grade-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: .04em;
}
.wrong-list { list-style: none; margin: 8px 0 0; padding: 0; }
.wrong-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 14px;
  padding: 13px 0;
  border-bottom: 1px solid rgba(222, 212, 194, .7);
}
.wrong-list li:last-child { border-bottom: 0; }
.wrong-zh { font-size: 12.5px; color: var(--muted); }
.wrong-expected {
  text-align: right;
  font: 400 20px/1.3 var(--serif);
  color: var(--clay);
}
.wrong-student { grid-column: 1 / -1; font-size: 11.5px; color: var(--muted); }
.wrong-student s { color: var(--clay); text-decoration-thickness: 1px; }
.all-correct { margin: 16px 0 0; color: var(--green); font: 400 18px/1.4 var(--serif); }

/* 台账 */
.ledger-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px 0 18px;
  border-bottom: 1px solid var(--line);
}
.ledger-summary div {
  text-align: center;
  padding: 8px 6px;
  border-right: 1px solid var(--line);
}
.ledger-summary div:last-child { border-right: 0; }
.ledger-summary b { display: block; font: 400 clamp(26px, 6vw, 34px)/1.1 var(--serif-latin); }
.ledger-summary span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: .12em;
}
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 4px; }
.pill {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.pill.active { border-color: var(--ink); color: var(--ink); background: var(--paper-2); }
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(222, 212, 194, .7);
}
.ledger li:last-child { border-bottom: 0; }
.ledger-main { display: flex; flex-direction: column; min-width: 0; }
.ledger-word { font: 400 20px/1.3 var(--serif); }
.ledger-zh { display: block; margin-top: 2px; color: var(--muted); font-size: 11.5px; }
.ledger-right { display: flex; align-items: center; gap: 10px; }
.status { font-size: 10.5px; letter-spacing: .08em; white-space: nowrap; }
.status-review { color: var(--clay); }
.status-passed { color: var(--muted); }
.status-mastered { color: var(--green); }
.streak { display: flex; gap: 4px; }
.streak i { width: 6px; height: 6px; border-radius: 50%; border: 1px solid var(--line-2); }
.streak i.on { background: var(--green); border-color: var(--green); }
.ledger-wrong { min-width: 30px; text-align: right; color: var(--muted); font-size: 10.5px; }

/* 周报 */
.report-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.report-num {
  margin: 12px 0 0;
  font: 400 clamp(54px, 13vw, 84px)/1 var(--serif-latin);
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.report-num .pct { margin-left: 2px; color: var(--muted); font-size: .36em; }
.report-sub { margin: 8px 0 0; color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.ring { flex: none; width: clamp(92px, 24vw, 120px); height: auto; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring-bg { stroke: var(--line); }
.ring-fg {
  stroke: var(--green);
  stroke-linecap: round;
  transition: stroke-dashoffset .9s cubic-bezier(.2, .7, .2, 1);
}
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.stat-grid div { text-align: center; padding: 6px; border-right: 1px solid var(--line); }
.stat-grid div:last-child { border-right: 0; }
.stat-grid b { display: block; font: 400 clamp(22px, 5vw, 30px)/1.1 var(--serif-latin); }
.stat-grid span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: .1em;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 11px 4px; border-bottom: 1px solid rgba(222, 212, 194, .7); }
th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .14em;
}
td:last-child, th:last-child { text-align: right; }
td[colspan] { text-align: left; }
tr:last-child td { border-bottom: 0; }

/* 空状态 */
.empty { text-align: center; padding: clamp(30px, 8vw, 62px) 12px; }
.empty-title { margin: 0; font: 400 clamp(24px, 6vw, 32px)/1.3 var(--serif); }
.empty-sub { margin: 10px auto 0; max-width: 26em; color: var(--muted); font-size: 13px; line-height: 1.8; }
.empty .btn { margin-top: 24px; }

/* 底部导航 */
.dock-fade {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  height: 112px;
  background: linear-gradient(to top, var(--paper) 40%, rgba(242, 236, 223, 0));
  pointer-events: none;
}
.dock {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 10;
  display: flex;
  gap: 4px;
  padding: 6px;
  transform: translateX(-50%);
  background: rgba(251, 248, 241, .9);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 18px 40px -20px rgba(27, 34, 29, .5);
  backdrop-filter: blur(14px);
}
.dock-btn {
  display: flex;
  flex: none;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 15px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: .04em;
  transition: background .2s ease, color .2s ease;
}
.dock-btn span { white-space: nowrap; }
.dock-btn.active { background: var(--ink); color: var(--sheet); }

/* 提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 20;
  max-width: calc(100vw - 40px);
  padding: 10px 16px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--sheet);
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: .04em;
  text-align: center;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .5);
  animation: toastIn .25s ease both;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }
.copy-fallback {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: 13px/1.7 var(--sans);
  resize: vertical;
}

:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
input:focus-visible { outline: none; }

@media (max-width: 420px) {
  .login-foot { flex-direction: column; gap: 6px; }
  .masthead-tools { flex-wrap: wrap; }
  .dock-btn { padding: 10px 13px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
