/* =========================================================
   新概念英语 第一册 · 精读课堂
   温暖人文 · 印刷读物质感
   ========================================================= */

:root {
  --paper:        #FBF6ED;
  --paper-2:      #F5EEE1;
  --paper-3:      #EFE6D6;
  --card:         #FFFDF8;

  --ink:          #231E19;
  --ink-2:        #564C41;
  --ink-3:        #8B8074;
  --ink-4:        #B3A899;

  --line:         #E5D9C6;
  --line-soft:    #EFE7DA;

  --accent:       #B9501E;
  --accent-2:     #D97642;
  --accent-soft:  #F7E4D7;
  --accent-wash:  #FBEFE7;

  --good:         #2F6A4E;
  --good-soft:    #E0EDE4;

  --warn:         #A9761C;
  --warn-soft:    #F7EBD2;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
           Georgia, "Songti SC", "Source Han Serif SC", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
           "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono:  "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;

  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;

  --shadow-s: 0 1px 2px rgba(60, 44, 24, .05);
  --shadow-m: 0 2px 10px -2px rgba(60, 44, 24, .10), 0 1px 2px rgba(60, 44, 24, .05);
  --shadow-l: 0 18px 44px -22px rgba(60, 44, 24, .28), 0 2px 8px rgba(60, 44, 24, .05);

  --topbar-h: 62px;
  --maxw: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  background-color: var(--paper);
  background-image:
    radial-gradient(1100px 620px at 12% -8%,  rgba(217, 118, 66, .10), transparent 60%),
    radial-gradient(900px 520px at 92% 4%,   rgba(120, 150, 120, .08), transparent 58%),
    radial-gradient(700px 700px at 50% 110%, rgba(185, 80, 30, .05), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 纸张颗粒 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .35;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/><feColorMatrix type='saturate' values='0'/></filter><rect width='140' height='140' filter='url(%23n)' opacity='.045'/></svg>");
}

::selection { background: var(--accent-soft); color: var(--ink); }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

/* ---------------- 顶栏 ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  background: rgba(251, 246, 237, .82);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.topbar__inner {
  max-width: var(--maxw);
  height: 100%;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 30px;
}

.brand { display: flex; align-items: center; gap: 11px; flex: none; }

.brand__mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  line-height: 1;
  padding-bottom: 1px;
  box-shadow: inset 0 -1px 0 rgba(255,255,255,.18);
}

.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__text b {
  font-family: var(--serif);
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: .04em;
}
.brand__text i {
  font-style: normal;
  font-size: 10px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-family: var(--mono);
}

.topnav { display: flex; gap: 4px; }

.topnav a {
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--ink-2);
  transition: background .18s ease, color .18s ease;
}
.topnav a:hover { background: var(--paper-3); color: var(--ink); }
.topnav a.is-active { background: var(--ink); color: var(--paper); }

.topbar__meter {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.meter__track {
  width: 88px; height: 4px;
  background: var(--paper-3);
  border-radius: 999px;
  overflow: hidden;
}
.meter__track i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: inherit;
  transition: width .5s cubic-bezier(.22,.61,.36,1);
}
.meter__value { color: var(--ink-2); min-width: 30px; text-align: right; }

/* 与一之空间的同步状态 */
.sync-chip {
  margin-right: 14px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: var(--paper-2);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .05em;
  white-space: nowrap;
  transition: color .16s, border-color .16s, background .16s;
}
.sync-chip:hover { color: var(--ink); border-color: var(--line); }
.sync-chip.is-on {
  color: var(--good);
  background: var(--good-soft);
  border-color: #CDE2D5;
}

/* ---------------- 布局 ---------------- */

.view {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px 90px;
  outline: none;
}

.foot {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px 56px;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.7;
}
.foot p { margin: 0; }
.foot__muted { color: var(--ink-4); margin-top: 4px !important; }

/* ---------------- 通用元件 ---------------- */

.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.eyebrow::before {
  content: "";
  width: 22px; height: 1px;
  background: currentColor;
  opacity: .55;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 17px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 13.5px;
  cursor: pointer;
  transition: transform .14s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
  box-shadow: var(--shadow-s);
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink-4); }
.btn:active { transform: translateY(1px); }

.btn--solid {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.btn--solid:hover { background: #332b23; border-color: #332b23; }

.btn--accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFF6EF;
}
.btn--accent:hover { background: #a8461a; border-color: #a8461a; }

.btn--ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--paper-3); border-color: transparent; }

.btn--sm { padding: 6px 12px; font-size: 12.5px; }

.btn[disabled] { opacity: .45; cursor: not-allowed; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .06em;
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip--accent { background: var(--accent-wash); border-color: var(--accent-soft); color: var(--accent); }
.chip--good   { background: var(--good-soft); border-color: #CDE2D5; color: var(--good); }
.chip--warn   { background: var(--warn-soft); border-color: #EEDDB8; color: var(--warn); }

.rule {
  height: 1px;
  background: var(--line-soft);
  border: 0;
  margin: 0;
}

/* ---------------- 课程库 · 头图 ---------------- */

.hero {
  padding: 62px 0 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 48px;
  align-items: end;
  border-bottom: 1px solid var(--line-soft);
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(38px, 5.4vw, 62px);
  line-height: 1.06;
  letter-spacing: -.015em;
  font-weight: 500;
  margin: 0 0 6px;
  color: var(--ink);
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
  letter-spacing: 0;
}

.hero__latin {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  color: var(--ink-3);
  margin: 0 0 22px;
  letter-spacing: .01em;
}

.hero__lede {
  max-width: 52ch;
  margin: 0;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.85;
}

.hero__panels { display: flex; gap: 12px; align-items: stretch; }

.statcard {
  min-width: 104px;
  padding: 15px 17px 13px;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-s);
}
.statcard b {
  display: block;
  font-family: var(--serif);
  font-size: 27px;
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -.02em;
}
.statcard span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---------------- 课程库 · 筛选条 ---------------- */

.toolbar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  background: linear-gradient(var(--paper) 62%, rgba(251,246,237,0));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.search {
  position: relative;
  flex: 1;
  max-width: 330px;
}
.search input {
  width: 100%;
  padding: 9px 14px 9px 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.search input::placeholder { color: var(--ink-4); }
.search input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-wash); }
.search svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--ink-4);
  pointer-events: none;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  gap: 2px;
}
.segmented button {
  border: 0;
  background: transparent;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .16s, color .16s, box-shadow .16s;
}
.segmented button:hover { color: var(--ink); }
.segmented button.is-on {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-s);
  font-weight: 500;
}

/* ---------------- 单元卡 ---------------- */

.library { padding-top: 8px; display: flex; flex-direction: column; gap: 14px; }

.unit {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 0;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-l);
  overflow: hidden;
  box-shadow: var(--shadow-s);
  transition: box-shadow .22s ease, border-color .22s ease, transform .22s ease;
}
.unit:hover { box-shadow: var(--shadow-m); border-color: var(--line); transform: translateY(-1px); }

.unit__no {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 22px 8px;
  background: linear-gradient(180deg, var(--paper-2), var(--paper-3));
  border-right: 1px solid var(--line-soft);
  text-align: center;
}
.unit__no small {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.unit__no b {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--ink);
}

.unit__body { padding: 15px 20px 16px; min-width: 0; }

.lesson-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 9px 10px 9px 6px;
  margin: 0 -10px 0 -6px;
  border-radius: var(--radius-s);
  transition: background .16s ease;
}
.lesson-row + .lesson-row { border-top: 1px solid var(--line-soft); }
.lesson-row:hover { background: var(--accent-wash); }

.lesson-row__n {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  text-align: right;
  letter-spacing: .02em;
}

.lesson-row__main { min-width: 0; }

.lesson-row__en {
  display: block;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.35;
  color: var(--ink);
  letter-spacing: -.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lesson-row__zh {
  display: block;
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-row__meta { display: flex; align-items: center; gap: 8px; }

.dot-state {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--line);
  flex: none;
}
.dot-state[data-state="done"] { background: var(--good); }
.dot-state[data-state="doing"] { background: var(--accent-2); }

/* ---------------- 课程详情 ---------------- */

.lesson-view {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 44px;
  align-items: start;
  padding-top: 34px;
}

.rail {
  position: sticky;
  top: calc(var(--topbar-h) + 22px);
  font-size: 13px;
}

.rail__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
  font-family: var(--mono);
  letter-spacing: .06em;
  margin-bottom: 20px;
  transition: color .16s;
}
.rail__back:hover { color: var(--accent); }

.rail__group { margin-bottom: 22px; }
.rail__label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin: 0 0 7px;
  padding-left: 10px;
}

.rail__link {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-s);
  color: var(--ink-2);
  transition: background .16s, color .16s;
  border-left: 2px solid transparent;
}
.rail__link:hover { background: var(--paper-2); color: var(--ink); }
.rail__link.is-on {
  background: var(--card);
  border-left-color: var(--accent);
  color: var(--ink);
  box-shadow: var(--shadow-s);
}
.rail__link i {
  font-family: var(--mono);
  font-style: normal;
  font-size: 10.5px;
  color: var(--ink-4);
  padding-top: 1px;
}
.rail__link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
}

/* 课程头部 */
.lesson-head { border-bottom: 1px solid var(--line-soft); padding-bottom: 24px; margin-bottom: 8px; }

.lesson-head__unit {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 12px;
}

.lesson-head h2 {
  font-family: var(--serif);
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.12;
  font-weight: 500;
  letter-spacing: -.018em;
  margin: 0 0 8px;
}
.lesson-head__zh {
  font-size: 15px;
  color: var(--ink-2);
  margin: 0 0 16px;
}

.lesson-head__tags { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }

/* 选项卡 */
.tabs {
  display: flex;
  gap: 4px;
  margin: 22px 0 26px;
  border-bottom: 1px solid var(--line-soft);
}
.tabs button {
  position: relative;
  border: 0;
  background: none;
  padding: 9px 14px 12px;
  margin-bottom: -1px;
  font-size: 13.5px;
  color: var(--ink-3);
  cursor: pointer;
  transition: color .16s;
  border-bottom: 1.5px solid transparent;
}
.tabs button:hover { color: var(--ink); }
.tabs button.is-on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 500; }
.tabs button small {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-4);
  margin-left: 5px;
  letter-spacing: .06em;
}

.panel { animation: fade-up .3s cubic-bezier(.22,.61,.36,1) both; }

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

/* ---- 课文 ---- */
.dialog { display: flex; flex-direction: column; gap: 2px; }

.dialog__toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.dialog__hint {
  font-size: 12px;
  color: var(--ink-4);
  margin-left: auto;
  font-family: var(--mono);
  letter-spacing: .04em;
}

.line {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  gap: 14px;
  align-items: start;
  padding: 13px 14px;
  border-radius: var(--radius-m);
  transition: background .18s ease;
}
.line:hover { background: var(--paper-2); }
.line.is-speaking { background: var(--accent-wash); }

.line__spk {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .02em;
  background: var(--paper-3);
  color: var(--ink-2);
  border: 1px solid var(--line-soft);
  margin-top: 2px;
}
.line__spk[data-who="B"] { background: var(--accent-soft); color: var(--accent); border-color: #EDD2C1; }

/* 教材原文的排版：没有说话人就整行铺开，有说话人就左侧小标签 */
.line--plain { grid-template-columns: minmax(0, 1fr) 30px; }
.line--named { grid-template-columns: 58px minmax(0, 1fr) 30px; }

.line__who {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding-top: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-q {
  margin: 0 0 16px;
  padding: 10px 14px;
  background: var(--paper-2);
  border-radius: var(--radius-s);
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.7;
}

.dialog__actions { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }

.audio-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.audio-track {
  flex: 1;
  min-width: 110px;
  height: 4px;
  background: var(--paper-3);
  border-radius: 999px;
  overflow: hidden;
}
.audio-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: inherit;
}
.audio-time {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-4);
  letter-spacing: .02em;
  white-space: nowrap;
}

.translation {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}
.translation h3 {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin: 0 0 10px;
}
.translation p {
  font-size: 13px;
  line-height: 1.9;
  color: var(--ink-2);
  margin: 0 0 4px;
}

.pair-note {
  font-size: 14px;
  line-height: 1.9;
  color: var(--ink-2);
  margin: 0 0 20px;
  max-width: 52ch;
}

.line__text { min-width: 0; }

.line__en {
  display: block;
  font-family: var(--serif);
  font-size: 18.5px;
  line-height: 1.5;
  color: var(--ink);
  letter-spacing: -.003em;
}
.line__zh {
  display: block;
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 4px;
  line-height: 1.6;
  transition: opacity .2s ease, max-height .2s ease;
}
.dialog--hide-zh .line__zh { display: none; }

.line__say {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink-4);
  opacity: .34;
  transition: opacity .18s, background .18s, color .18s;
  margin-top: 1px;
}
.line:hover .line__say, .line__say:focus-visible { opacity: 1; }
.line__say:hover { background: var(--paper-3); color: var(--accent); }

.dialog-note {
  margin-top: 26px;
  padding: 16px 18px;
  background: var(--paper-2);
  border-left: 2px solid var(--accent-2);
  border-radius: 0 var(--radius-m) var(--radius-m) 0;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.75;
}
.dialog-note b { color: var(--ink); }

/* ---- 单词 ---- */
.words {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  gap: 11px;
}

.word {
  position: relative;
  min-height: 104px;
  padding: 15px 16px;
  border-radius: var(--radius-m);
  border: 1px solid var(--line-soft);
  background: var(--card);
  cursor: pointer;
  text-align: left;
  transition: border-color .18s, box-shadow .18s, transform .16s;
  box-shadow: var(--shadow-s);
  overflow: hidden;
}
.word:hover { border-color: var(--line); box-shadow: var(--shadow-m); transform: translateY(-1px); }
.word.is-known { border-color: #CDE2D5; background: linear-gradient(180deg, #FBFDFB, var(--good-soft)); }

.word__en {
  display: block;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: -.005em;
}
.word__ph {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  margin-top: 3px;
  letter-spacing: .01em;
}
.word__zh {
  display: block;
  margin-top: 9px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.5;
}
.word__mark {
  position: absolute;
  top: 11px; right: 11px;
  width: 17px; height: 17px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  display: grid; place-items: center;
  color: transparent;
  transition: all .18s;
}
.word.is-known .word__mark { background: var(--good); border-color: var(--good); color: #fff; }
.word__t {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: .04em;
  margin-right: 6px;
}

/* ---- 语法 ---- */
.grammar { display: flex; flex-direction: column; gap: 22px; }

.gcard {
  padding: 22px 24px;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-s);
}
.gcard h3 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -.01em;
}
.gcard__sub {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin: 0 0 16px;
}

.gpoints { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.gpoints li {
  position: relative;
  padding-left: 22px;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--ink-2);
}
.gpoints li::before {
  content: "";
  position: absolute;
  left: 4px; top: 9px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent-2);
}
.gpoints code, .gpoints b {
  font-family: var(--serif);
  font-size: 14.5px;
  color: var(--ink);
  background: var(--paper-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
}

.examples { margin-top: 20px; border-top: 1px dashed var(--line); padding-top: 16px; display: flex; flex-direction: column; gap: 2px; }
.example {
  display: grid;
  grid-template-columns: minmax(0,1fr) 30px;
  gap: 10px;
  align-items: center;
  padding: 7px 0;
}
.example__en {
  font-family: var(--serif);
  font-size: 15.5px;
  color: var(--ink);
  line-height: 1.5;
}
.example__zh { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.example__say {
  width: 26px; height: 26px;
  border: 1px solid var(--line-soft);
  background: var(--card);
  border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--ink-4);
  transition: color .16s, border-color .16s;
}
.example__say:hover { color: var(--accent); border-color: var(--accent-soft); }

/* ---- 练习 ---- */
.quiz { display: flex; flex-direction: column; gap: 14px; max-width: 720px; }

.qcard {
  padding: 20px 22px;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-s);
  transition: border-color .2s;
}
.qcard[data-result="right"] { border-color: #C6DFCF; }
.qcard[data-result="wrong"] { border-color: #EBCDBD; }

.qcard__top {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.qcard__no {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  color: var(--ink-4);
}
.qcard__q {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  margin: 0;
  white-space: pre-line;
}
.qcard__q u {
  text-decoration: none;
  border-bottom: 1.5px solid var(--accent-2);
  padding: 0 14px;
  color: var(--accent);
}

.opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.opt {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 14px;
  cursor: pointer;
  transition: all .16s ease;
  font-family: var(--serif);
}
.opt:hover:not(:disabled) { border-color: var(--ink-4); background: var(--card); }
.opt:disabled { cursor: default; }
.opt.is-right { background: var(--good-soft); border-color: var(--good); color: var(--good); font-weight: 600; }
.opt.is-wrong { background: #F9E6DE; border-color: var(--accent); color: var(--accent); text-decoration: line-through; text-decoration-thickness: 1px; }

.qwhy {
  margin-top: 13px;
  padding: 11px 14px;
  border-radius: var(--radius-s);
  background: var(--paper-2);
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.7;
  animation: fade-up .24s ease both;
}
.qwhy b { color: var(--ink); }

.quiz__result {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 22px;
  margin-top: 6px;
  border-radius: var(--radius-l);
  background: linear-gradient(135deg, var(--ink), #3a3028);
  color: var(--paper);
  animation: fade-up .3s ease both;
}
.quiz__result b {
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: -.02em;
}
.quiz__result span { font-size: 13px; opacity: .78; line-height: 1.6; }
.quiz__result .btn { margin-left: auto; background: transparent; border-color: rgba(251,246,237,.35); color: var(--paper); }
.quiz__result .btn:hover { background: rgba(251,246,237,.12); }

/* ---------------- 复习本 ---------------- */

.review-head { padding: 56px 0 26px; border-bottom: 1px solid var(--line-soft); }
.review-head h1 {
  font-family: var(--serif);
  font-size: clamp(30px, 4.2vw, 44px);
  font-weight: 500;
  letter-spacing: -.02em;
  margin: 0 0 8px;
}
.review-head p { margin: 0; color: var(--ink-2); font-size: 14px; max-width: 56ch; }

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin: 26px 0 34px;
}
.rcard {
  padding: 17px 19px;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-s);
}
.rcard b {
  display: block;
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1.1;
  font-weight: 500;
}
.rcard span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.review-section { margin-bottom: 40px; }
.review-section h2 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  margin: 0 0 4px;
}
.review-section__sub { font-size: 12.5px; color: var(--ink-3); margin: 0 0 16px; }

.empty {
  padding: 46px 24px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius-l);
  color: var(--ink-3);
  font-size: 13.5px;
  line-height: 1.8;
  background: rgba(255,253,248,.5);
}
.empty b { display: block; font-family: var(--serif); font-size: 17px; color: var(--ink-2); margin-bottom: 5px; font-weight: 600; }

/* ---------------- 背单词（课程内） ---------------- */

.vocab-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.vocab-bar__count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--ink-3);
}

.vocab-stage { max-width: 640px; }

.flash {
  position: relative;
  min-height: 268px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 44px 30px 38px;
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-m);
  cursor: pointer;
  text-align: center;
  transition: box-shadow .2s ease, border-color .2s ease;
  user-select: none;
}
.flash:hover { box-shadow: var(--shadow-l); border-color: var(--line); }

.flash__n {
  position: absolute;
  top: 16px; left: 20px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  color: var(--ink-4);
}

.flash__say {
  position: absolute;
  top: 12px; right: 14px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 50%;
  color: var(--ink-4);
  cursor: pointer;
  transition: background .16s, color .16s;
}
.flash__say:hover { background: var(--paper-2); color: var(--accent); }

.flash__en {
  font-family: var(--serif);
  font-size: clamp(38px, 6.5vw, 60px);
  line-height: 1.08;
  letter-spacing: -.02em;
  color: var(--ink);
  word-break: break-word;
}

.flash__hint {
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--ink-4);
  font-family: var(--mono);
  letter-spacing: .05em;
}

.flash__back {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  animation: fade-up .26s cubic-bezier(.22,.61,.36,1) both;
}
.flash__ph {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-4);
  letter-spacing: .01em;
}
.flash__zh {
  font-size: 16.5px;
  color: var(--ink-2);
  line-height: 1.7;
  max-width: 34ch;
}
.flash__src {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .06em;
  color: var(--ink-4);
}
.flash__src a { color: var(--accent); border-bottom: 1px solid var(--accent-soft); }

.vocab-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.vocab-actions .btn {
  flex: 1;
  padding: 13px 18px;
  font-size: 14.5px;
}

.btn--know {
  background: var(--good-soft);
  border-color: #C6DFCF;
  color: var(--good);
}
.btn--know:hover { background: #D3E8DB; border-color: var(--good); }

.btn--dunno { background: var(--card); border-color: var(--line); color: var(--ink-2); }
.btn--dunno:hover { border-color: var(--accent-2); color: var(--accent); }

.vocab-progress {
  height: 4px;
  margin-top: 20px;
  background: var(--paper-3);
  border-radius: 999px;
  overflow: hidden;
}
.vocab-progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: inherit;
  transition: width .3s cubic-bezier(.22,.61,.36,1);
}

.vocab-done {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-s);
  padding: 46px 30px;
  text-align: center;
}
.vocab-done b {
  display: block;
  font-family: var(--serif);
  font-size: 46px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -.02em;
  margin-bottom: 6px;
}
.vocab-done p { margin: 0 0 22px; color: var(--ink-3); font-size: 13.5px; }
.vocab-done .btn { margin: 0 4px; }

/* ---------------- 课文笔记（IMA 同步内容） ---------------- */

.note-body {
  background: var(--card);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-s);
  padding: 30px 34px 38px;
  min-height: 300px;
}
.note-body__head {
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 18px;
  margin-bottom: 22px;
}
.note-body__head h2 {
  font-family: var(--serif);
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 500;
  letter-spacing: -.015em;
  line-height: 1.22;
  margin: 0 0 12px;
  color: var(--ink);
}

.note-text {
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.9;
  color: var(--ink-2);
  word-break: break-word;
}
.note-text > :first-child { margin-top: 0; }
.note-text h1, .note-text h2, .note-text h3, .note-text h4, .note-text h5 {
  font-family: var(--sans);
  color: var(--ink);
  letter-spacing: -.01em;
  line-height: 1.45;
  margin: 1.7em 0 .5em;
}
.note-text h1 { font-size: 21px; }
.note-text h2 { font-size: 18px; }
.note-text h3 { font-size: 16px; }
.note-text h4, .note-text h5 { font-size: 14.5px; }
.note-text p { margin: 0 0 .78em; }
.note-text ul, .note-text ol { margin: 0 0 .9em; padding-left: 1.35em; }
.note-text li { margin: 0 0 .35em; }
.note-text li::marker { color: var(--ink-4); }
.note-text strong { color: var(--ink); font-weight: 600; }
.note-text a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.note-text code {
  font-family: var(--mono);
  font-size: .86em;
  background: var(--paper-2);
  padding: 1px 5px;
  border-radius: 4px;
}
.note-text pre {
  background: var(--paper-2);
  padding: 12px 14px;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.65;
}
.note-text pre code { background: none; padding: 0; }
.note-text blockquote {
  margin: 0 0 .9em;
  padding: 2px 0 2px 14px;
  border-left: 2px solid var(--accent-soft);
  color: var(--ink-3);
}
.note-text hr {
  border: 0;
  border-top: 1px solid var(--line-soft);
  margin: 1.5em 0;
}
.note-callout {
  background: var(--accent-wash);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 0 0 .9em;
}
.note-task { font-family: var(--sans); font-size: 14px; }

.note-table { overflow-x: auto; margin: 0 0 1.1em; }
.note-table table {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.6;
}
.note-table th, .note-table td {
  border: 1px solid var(--line-soft);
  padding: 8px 11px;
  text-align: left;
  vertical-align: top;
}
.note-table th {
  background: var(--paper-2);
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}
.note-table tr:nth-child(even) td { background: rgba(245, 238, 225, .35); }

/* ---------------- 提示条 ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 20px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  box-shadow: var(--shadow-l);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s cubic-bezier(.22,.61,.36,1);
  z-index: 90;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 响应式 ---------------- */

@media (max-width: 980px) {
  .lesson-view { grid-template-columns: 1fr; gap: 20px; }
  .rail { position: static; display: none; }
  .hero { grid-template-columns: 1fr; gap: 28px; align-items: start; padding-top: 44px; }
  .note-body { padding: 22px 20px 28px; }
}

@media (max-width: 720px) {
  .topbar__inner { padding: 0 18px; gap: 14px; }
  .brand__text i { display: none; }
  .topbar__meter { display: none; }
  .view { padding: 0 18px 70px; }
  .foot { padding: 0 18px 44px; }

  .topnav { gap: 2px; }
  .topnav a { padding: 6px 10px; font-size: 12.5px; }

  .toolbar { flex-wrap: wrap; }
  .search { max-width: none; flex-basis: 100%; }

  .unit { grid-template-columns: 1fr; }
  .unit__no {
    flex-direction: row;
    justify-content: flex-start;
    gap: 8px;
    padding: 10px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }
  .unit__no b { font-size: 17px; }
  .unit__body { padding: 10px 14px 12px; }

  .lesson-row { grid-template-columns: 30px minmax(0,1fr) auto; gap: 10px; }
  .lesson-row__en { font-size: 15px; }

  .line { grid-template-columns: 24px minmax(0,1fr) 26px; gap: 10px; padding: 11px 8px; }
  .line--plain { grid-template-columns: minmax(0,1fr) 26px; }
  .line--named { grid-template-columns: 44px minmax(0,1fr) 26px; }
  .line__who { font-size: 8.5px; }
  .line__say { opacity: .5; }
  .line__en { font-size: 17px; }

  .words { grid-template-columns: 1fr 1fr; gap: 9px; }
  .word { min-height: 96px; padding: 12px 13px; }
  .word__en { font-size: 17px; }

  .gcard { padding: 18px 17px; }
  .qcard { padding: 16px 16px; }

  .tabs button { padding: 8px 10px 11px; font-size: 13px; }
  .tabs button small { display: none; }

  .flash { min-height: 230px; padding: 40px 20px 32px; }
  .vocab-actions .btn { padding: 12px 12px; font-size: 14px; }
  /* 触屏没有键盘，隐藏快捷键提示 */
  .vocab-bar__count { display: none; }
}

@media (max-width: 420px) {
  .words { grid-template-columns: 1fr; }
}

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

/* 打印 */
@media print {
  .topbar, .rail, .foot, .tabs, .dialog__toolbar, .line__say, .vocab-actions { display: none !important; }
  body { background: #fff; }
  body::before { display: none; }
  .line__zh { display: block !important; }
}
