/* Immersion Reader — lesson template stylesheet
   Design DNA transplanted from prototype-v01 (V-PASS aesthetic baseline):
   warm paper palette × glass morphism × serif reading column × ambient halo. */

:root {
  --fs: 20px;
  --maxw: min(1120px, 92vw);
  --serif: ui-serif, "New York", "Charter", "Georgia", "Songti SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --bg1: #f5f3ee;
  --bg2: #eceef5;
  --paper: #fffdf9;
  --ink: #23221f;
  --ink-soft: #5f5c55;
  --ink-faint: #78746a; /* 4.59:1 on --paper — keeps small hint text at WCAG AA */
  --line: #e6e1d6;
  --brand: #3b5bdb;
  --brand-deep: #3151c6;
  --brand-soft: #eef1fc;
  --accent: #c2410c;
  --term-bg: #fde7b8;
  --term-line: #e0a93a;
  --word-bg: #dfe7ff;
  --word-line: #7d95e8;
  --idiom-bg: #d7f0df;
  --idiom-line: #69b585;
  --gold: #d6a23a;
  --ok: #15803d;
  --diff-add: #dafbe1;
  --diff-del: #ffebe9;
  --glass: rgba(252, 251, 247, .72);
  --shadow-s: 0 1px 2px rgba(35, 34, 31, .04), 0 4px 14px rgba(35, 34, 31, .05);
  --shadow-m: 0 2px 6px rgba(35, 34, 31, .05), 0 12px 32px rgba(35, 34, 31, .09);
  --r: 16px;
}

* { box-sizing: border-box; }

/* 逐词高亮: 朗读跟随, accent 橙低透明底, 与 hard 三色/选区蓝区分 */
::highlight(karaoke) {
  background-color: rgba(194, 65, 12, .16);
}

::selection {
  background: var(--word-bg);
  color: var(--ink);
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(165deg, var(--bg1) 0%, var(--bg2) 100%) fixed;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#halo {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
}

button { font: inherit; color: inherit; }

.hidden { display: none !important; }

.app-shell {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px 150px;
}

/* ---------- topbar (floating glass island) ---------- */

.topbar {
  position: sticky;
  top: 10px;
  z-index: 60;
  margin-top: 14px;
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border: 1px solid rgba(230, 225, 214, .9);
  box-shadow: var(--shadow-s);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px 7px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--ink-soft);
  white-space: nowrap;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--accent));
}

.brand-cn { color: var(--ink-faint); font-weight: 500; }

.toolbar {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}

.tool:hover { background: rgba(255, 255, 255, .85); border-color: var(--line); color: var(--ink); }
.tool.on { background: var(--brand-soft); color: var(--brand); border-color: rgba(59, 91, 219, .25); }
.tool.danger:hover { background: var(--diff-del); color: #b42318; border-color: rgba(180, 35, 24, .25); }
.tool.primary { background: var(--brand); color: #fff; font-weight: 600; }
.tool.primary:hover { background: var(--brand-deep); color: #fff; border-color: transparent; }

.tool-progress {
  font-size: 12.5px;
  color: var(--ink-faint);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .6);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.tool-progress.hit { background: var(--idiom-bg); color: var(--ok); border-color: rgba(21, 128, 61, .3); }

/* ---------- hero ---------- */

.hero { padding: 54px 4px 6px; }

.kicker {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--brand);
}

.hero h1 {
  margin: 0 0 14px;
  max-width: 18em;
  font-family: var(--serif);
  font-size: clamp(30px, 4.6vw, 46px);
  line-height: 1.14;
  letter-spacing: -.01em;
  font-weight: 700;
}

.title-zh {
  margin: 8px 0 0;
  font-size: 16px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.segnav-popover { max-width: 372px; }

.segnav-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segnav-chips .blind-chip {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.p-now { cursor: pointer; }

.source { margin: 0; color: var(--ink-faint); font-size: 14px; }
.source a {
  color: var(--brand);
  text-decoration: none;
  border-bottom: 1px solid rgba(59, 91, 219, .3);
}
.source a:hover { border-bottom-color: var(--brand); }

.audio-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 7px 14px;
  background: #fff7e6;
  border: 1px solid rgba(214, 162, 58, .45);
  border-radius: 999px;
  color: #8a5b13;
  font-size: 13px;
}

/* ---------- study card ---------- */

.study-card {
  margin: 28px 0 36px;
  padding: 20px 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-m);
}

.study-top {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.study-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--accent);
}

.study-line { display: flex; gap: 8px; flex-wrap: wrap; }

.pill {
  font-size: 12.5px;
  padding: 3px 11px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

.pill.main {
  background: var(--brand-soft);
  border-color: rgba(59, 91, 219, .3);
  color: var(--brand);
  font-weight: 600;
}

.study-values {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 6px 20px;
  margin: 14px 0 16px;
  padding: 0;
  list-style: none;
}

.study-values li {
  position: relative;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.6;
}

.study-values li::before {
  content: "▸";
  position: absolute;
  left: 2px;
  color: var(--brand);
}

.study-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px dashed var(--line);
  padding-top: 14px;
}

.study-suggest { font-family: var(--serif); font-size: 17px; }

.study-suggest span {
  display: block;
  margin-top: 3px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-faint);
}

.study-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.study-actions .primary,
.primary-btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 18px;
  background: linear-gradient(180deg, #4565e4, var(--brand-deep));
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(59, 91, 219, .28);
  transition: transform .15s ease, box-shadow .15s ease;
}

.study-actions .primary:hover,
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(59, 91, 219, .34); }

.study-actions .secondary {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 16px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 14px;
  cursor: pointer;
  transition: all .15s ease;
}

.study-actions .secondary:hover { border-color: rgba(59, 91, 219, .45); color: var(--brand); }

/* ---------- segments ---------- */

.segments { display: grid; gap: 18px; }

.seg {
  position: relative;
  padding: 18px 22px 18px 26px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-s);
}

.seg::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, rgba(59, 91, 219, .6), rgba(59, 91, 219, .12));
}

.seg:hover { box-shadow: var(--shadow-m); }

.seg.active {
  border-color: rgba(59, 91, 219, .5);
  animation: breathe 2.8s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { box-shadow: var(--shadow-s), 0 0 0 1px rgba(59, 91, 219, .1); }
  50% { box-shadow: var(--shadow-m), 0 0 0 4px rgba(59, 91, 219, .14); }
}

.seg.jump-highlight {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(194, 65, 12, .22);
}

.seg-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
}

.seg-id {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--ink-faint);
}

.seg.active .seg-id { color: var(--brand); }

.seg-spk {
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

.seg-flex { flex: 1; }

.seg-actions { display: flex; gap: 4px; }

/* 五个图标全部常显 (2026-06-11 ray.w拍板, 对齐 V1/V2 基线) */
.icbtn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  border-radius: 9px;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .16s ease, transform .16s ease;
}

.icbtn:hover { background: var(--brand-soft); transform: translateY(-1px); }

.primary-play { color: var(--brand); font-size: 15px; }

.icbtn.copied {
  background: var(--brand-soft);
  color: var(--brand);
  box-shadow: 0 0 0 1px rgba(59, 91, 219, .25);
}

.seg-body {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 6px 28px;
  margin-top: 10px;
}

.en {
  margin: 0;
  font-family: var(--serif);
  font-size: calc(var(--fs) * 1.04);
  line-height: 1.74;
  overflow-wrap: break-word;
}

.zh {
  margin: 0;
  align-self: start;
  /* 长段时中文大意跟随滚动, 右栏不再大片空白 (76px = 顶栏+呼吸) */
  position: sticky;
  top: 76px;
  padding-left: 16px;
  border-left: 2px solid var(--line);
  color: var(--ink-faint);
  font-size: calc(var(--fs) * .72);
  line-height: 1.78;
}

.hide-zh .zh { display: none; }

.train-slot { grid-column: 1 / -1; }

.train-slot:not(:empty) {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

/* keep the last segment's training controls clear of the fixed bottom player */
.segments .seg:last-of-type .train-slot:not(:empty) { padding-bottom: 72px; }

/* ---------- inline term marks (3-color: word / term / idiom) ---------- */

mark.hl {
  padding: 0 3px;
  border-radius: 5px;
  background: var(--word-bg);
  box-shadow: inset 0 -2px var(--word-line);
  color: inherit;
  cursor: pointer;
  transition: box-shadow .15s ease, filter .15s ease;
}

mark.hl.term { background: var(--term-bg); box-shadow: inset 0 -2px var(--term-line); }
mark.hl.idiom { background: var(--idiom-bg); box-shadow: inset 0 -2px var(--idiom-line); }
mark.hl:hover { filter: brightness(.96); }
mark.hl.seen { box-shadow: inset 0 -2px var(--word-line), 0 0 0 1.5px var(--gold); }
mark.hl.term.seen { box-shadow: inset 0 -2px var(--term-line), 0 0 0 1.5px var(--gold); }
mark.hl.idiom.seen { box-shadow: inset 0 -2px var(--idiom-line), 0 0 0 1.5px var(--gold); }
mark.hl:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* ---------- learning blocks ---------- */

.learning-block {
  margin-top: 30px;
  padding: 22px 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-s);
}

.learning-block h2 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
}

.block-sub { margin: 0 0 16px; color: var(--ink-faint); font-size: 13px; }

/* chunks */

.chunks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.chunk {
  display: grid;
  gap: 5px;
  text-align: left;
  padding: 13px 15px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.chunk:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-s);
  border-color: rgba(59, 91, 219, .4);
}

.chunk b { font-family: var(--serif); font-size: 16.5px; }
.chunk .c-cn { color: var(--ink-soft); font-size: 13px; }
.chunk .c-eg { color: var(--ink-faint); font-size: 13px; font-style: italic; line-height: 1.55; }
.chunk.seen { box-shadow: 0 0 0 1.5px var(--gold); }
.chunk.seen:hover { box-shadow: 0 0 0 1.5px var(--gold), var(--shadow-s); }

/* patterns */

.patterns { display: grid; gap: 10px; }

.pattern {
  display: grid;
  gap: 4px;
  padding: 13px 15px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.pattern b { font-family: var(--serif); font-size: 16px; }
.pattern span { color: var(--ink-soft); font-size: 13.5px; }

/* output (retell / transfer) */

.output-card {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.output-card h3 { margin: 0; font-family: var(--serif); font-size: 17px; }
.output-card .task-text { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.7; }
.output-card .task-hint { margin: 0; color: var(--ink-faint); font-size: 12.5px; }

textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  font: inherit;
  line-height: 1.6;
  resize: vertical;
}

textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 91, 219, .12);
}

.save-flash { font-size: 12px; color: var(--ok); min-height: 16px; }

.output-card .primary-btn { justify-self: start; }

/* week check-in */

.week { display: flex; gap: 10px; flex-wrap: wrap; }

.day {
  flex: 1;
  min-width: 64px;
  display: grid;
  gap: 2px;
  place-items: center;
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink-faint);
  cursor: pointer;
  transition: all .15s ease;
}

.day .dn { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.day .dl { font-size: 11px; }
.day:hover { border-color: rgba(59, 91, 219, .4); }
.day.on { background: #eaf6ee; border-color: var(--ok); color: var(--ok); }
.day.on .dn { color: var(--ok); }
.day.on .dl::after { content: " ✓"; }

/* basket */

.basket-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.basket-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-wrap: anywhere;
}

.b-type {
  flex: none;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--word-bg);
  color: #33508f;
  font-weight: 600;
}

.b-type.seg { background: var(--idiom-bg); color: #1f6b3d; }
.b-text { flex: 1; min-width: 0; font-size: 14px; }

.b-del {
  flex: none;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
}

.b-del:hover { background: var(--diff-del); color: #b42318; }

/* heat strip */

.heat-strip { display: flex; gap: 5px; }

.heat-cell {
  flex: 1;
  min-width: 0;
  height: 24px;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  transition: transform .12s ease;
}

.heat-cell:hover { transform: scaleY(1.15); }

/* ---------- blind mode ---------- */

.blind .study-card,
.blind .segments,
.blind .learning-block { display: none; }

.blind-grid {
  margin: 30px 0;
  padding: 26px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-m);
}

.blind-head { display: grid; gap: 4px; margin-bottom: 18px; }
.blind-title { font-family: var(--serif); font-size: 21px; font-weight: 700; }
.blind-sub { color: var(--ink-faint); font-size: 13px; }

.blind-chips { display: flex; flex-wrap: wrap; gap: 10px; }

.blind-chip {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 14px;
  cursor: pointer;
  transition: all .15s ease;
}

.blind-chip:hover { border-color: rgba(59, 91, 219, .45); color: var(--brand); }

.blind-chip.current {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
  animation: chip-pulse 1.6s ease-in-out infinite;
}

@keyframes chip-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 91, 219, .25); }
  50% { box-shadow: 0 0 0 6px rgba(59, 91, 219, 0); }
}

.blind-chip.done {
  color: var(--ok);
  border-color: rgba(21, 128, 61, .35);
  background: #f2faf4;
}

.reveal-all { margin-top: 18px; }

/* ---------- recording / dictation (train-slot content) ---------- */

.recording-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #dc2626;
  animation: rec-pulse 1.1s ease-in-out infinite;
}

@keyframes rec-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.8); }
}

.rec-label { font-size: 13px; color: var(--ink-soft); }

.pill-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13.5px;
  cursor: pointer;
  transition: all .15s ease;
}

.pill-btn:hover { border-color: rgba(59, 91, 219, .45); color: var(--brand); }
.pill-btn.ghost { background: transparent; color: var(--ink-faint); }

.dict-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.dict-hint { font-size: 12.5px; color: var(--ink-faint); }

.dict-input {
  min-height: 110px;
  font-family: var(--serif);
  font-size: calc(var(--fs) * .95);
}

.dict-note { margin: 0 0 10px; font-size: 13px; color: var(--ink-faint); }

.dict-diff {
  margin-bottom: 4px;
  font-family: var(--serif);
  font-size: calc(var(--fs) * .95);
  line-height: 1.9;
  overflow-wrap: anywhere;
}

.diff-del {
  background: var(--diff-del);
  text-decoration: line-through;
  border-radius: 4px;
  padding: 0 2px;
}

.diff-add { background: var(--diff-add); border-radius: 4px; padding: 0 2px; }

/* ---------- fixed bottom player (glass) ---------- */

.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-top: 1px solid rgba(230, 225, 214, .9);
}

.player-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.p-main {
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #4565e4, var(--brand-deep));
  color: #fff;
  font-size: 16px;
  box-shadow: 0 6px 16px rgba(59, 91, 219, .3);
  cursor: pointer;
  transition: transform .15s ease;
}

.p-main:hover { transform: scale(1.06); }

.p-step {
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, .7);
  color: var(--ink-soft);
  font-size: 12px;
  cursor: pointer;
}

.p-step:hover { color: var(--brand); border-color: rgba(59, 91, 219, .4); }

.p-ab {
  width: auto;
  min-width: 32px;
  padding: 0 10px;
  border-radius: 16px;
  font-size: 11px;
  letter-spacing: .02em;
  white-space: nowrap;
}

.p-ab.on {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--brand-soft);
  font-weight: 600;
}

.pop-count { font-size: 14px; font-weight: 600; }

.p-now {
  flex: 1;
  min-width: 0;
  display: grid;
  line-height: 1.35;
}

#pNow1 {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#pNow2 {
  font-family: var(--serif);
  font-size: 12px;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p-rate {
  flex: none;
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, .55);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}

.rate {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12.5px;
  color: var(--ink-faint);
  cursor: pointer;
}

.rate.on { background: var(--brand); color: #fff; }

.basket-chip {
  flex: none;
  border: 1px solid rgba(214, 162, 58, .5);
  background: #fff7e6;
  color: #8a5b13;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

/* ---------- term popover ---------- */

.term-popover {
  position: fixed;
  z-index: 70;
  max-width: 330px;
  display: grid;
  gap: 8px;
  padding: 13px 15px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-m);
  animation: pop-in .18s ease;
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

.pop-head { display: flex; align-items: baseline; gap: 9px; }
.pop-word { font-family: var(--serif); font-size: 18px; font-weight: 700; }

.pop-type {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.pop-type.term { background: var(--term-bg); color: #7c4a03; }
.pop-type.word { background: var(--word-bg); color: #33508f; }
.pop-type.idiom { background: var(--idiom-bg); color: #1f6b3d; }
.pop-type.chunk { background: var(--brand-soft); color: var(--brand); }

.pop-def { font-size: 14px; color: var(--ink-soft); line-height: 1.65; }

.pop-ask {
  border: 1px solid rgba(59, 91, 219, .3);
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.pop-ask:hover { background: #e2e8fb; }
.pop-sub { font-size: 11.5px; color: var(--ink-faint); }

.pop-speak {
  margin-left: auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease;
}

.pop-speak:hover {
  color: var(--brand);
  border-color: rgba(59, 91, 219, .35);
}

.pop-ipa {
  font-size: 12.5px;
  color: var(--ink-faint);
  letter-spacing: .01em;
}

.pop-eg {
  font-size: 12.5px;
  color: var(--ink-faint);
  font-style: italic;
  line-height: 1.55;
}

.pop-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  font-size: 12px;
  color: var(--ink-faint);
}

.pop-dot { color: var(--line); }

.pop-seglink {
  border: 0;
  padding: 0 2px;
  background: transparent;
  color: var(--brand);
  font-size: 12px;
  cursor: pointer;
}

.pop-seglink:hover { text-decoration: underline; }

.pop-ask.ghost-ask {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-soft);
  font-weight: 500;
}

.pop-ask.ghost-ask:hover {
  background: var(--brand-soft);
  border-color: rgba(59, 91, 219, .3);
  color: var(--brand);
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translate(-50%, 16px);
  z-index: 80;
  padding: 9px 18px;
  background: rgba(35, 34, 31, .92);
  color: #fdfcf9;
  font-size: 13.5px;
  border-radius: 999px;
  box-shadow: var(--shadow-m);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- entrance stagger (IntersectionObserver adds .in) ---------- */

.study-card,
.seg,
.learning-block {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .55s ease, transform .55s ease, box-shadow .25s ease, border-color .25s ease;
}

.study-card.in,
.seg.in,
.learning-block.in { opacity: 1; transform: none; }

/* ---------- motion / transparency preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .study-card, .seg, .learning-block { opacity: 1; transform: none; transition: none; }
  .seg.active { animation: none; box-shadow: var(--shadow-m); }
  .blind-chip.current, .rec-dot { animation: none; }
  .toast, .term-popover, .icbtn, .chunk, .p-main, .primary-btn { transition: none; animation: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar, .player {
    background: #faf8f3;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* ---------- responsive ---------- */

@media (max-width: 960px) {
  .seg-body { grid-template-columns: 1fr; gap: 10px; }
  .zh { padding: 10px 0 0; border-left: 0; border-top: 1px dashed var(--line); }
  .study-foot { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 640px) {
  .app-shell { padding: 0 14px 150px; }
  .hero { padding-top: 38px; }
  .hero h1 { font-size: 30px; }
  .brand-cn { display: none; }
  .topbar-inner { padding: 6px 8px 6px 14px; gap: 6px; }
  .tool { padding: 4px 9px; font-size: 12.5px; }
  .tool-progress { font-size: 11.5px; padding: 3px 8px; }
  #pNow2 { display: none; }
  .player-inner { gap: 7px; }
  .p-rate { padding: 2px; }
  .rate { padding: 4px 8px; font-size: 12px; }
  .seg { padding: 16px 18px 16px 22px; }
  .study-values { grid-template-columns: 1fr; }
  .chunks { grid-template-columns: 1fr; }
}

@media (max-width: 440px) {
  .player-inner { flex-wrap: wrap; }
  .p-now { order: -1; flex-basis: 100%; }
  .seg { padding: 14px 14px 14px 18px; }
  .blind-chip { width: 42px; height: 42px; }
}
