/*
 * 旧版维护页（index.html）的人工维护样式源文件。
 * 浏览器实际加载 styles-runtime-*.css；修改后需要运行 bump-web-version.mjs。
 * 样式按 Header、Home、Quiz、Reading、Listening、Chat、Responsive 等标题分区。
 */

/* ── 全局重置、主题变量与无障碍基础 ───────────────────────────────────── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #4f46e5;
  --secondary: #7c3aed;
  --bg: #ffffff;
  --text: #1e1b4b;
  --muted: #6b7280;
  --border: #e5e7eb;
  --chat-viewport-height: 100vh;
  --chat-dock-width: clamp(360px, 29vw, 430px);
  --popup-glass-bg:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.38), transparent 42%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.22), rgba(236, 250, 243, 0.07));
  --popup-glass-border: rgba(255, 255, 255, 0.50);
  --popup-glass-shadow:
    0 24px 60px rgba(35, 52, 42, 0.18),
    0 6px 18px rgba(35, 52, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.64),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08);
}

body {
  font-family: 'Inter', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:where(button, textarea, [role="button"], input[type="range"]):focus-visible {
  outline: 3px solid rgba(79,70,229,0.38);
  outline-offset: 2px;
}

.screen-focus-title:focus {
  outline: none;
}

.storage-warning {
  position: fixed;
  top: 76px;
  left: 50%;
  z-index: 1200;
  width: min(440px, calc(100vw - 28px));
  max-width: none;
  margin: 0;
  padding: 11px 15px;
  border: 1px solid #f59e0b;
  border-radius: 10px;
  background: #fffbeb;
  color: #92400e;
  box-shadow: 0 8px 24px rgba(146,64,14,0.16);
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -8px);
  transition: opacity 0.18s, transform 0.18s;
}
.storage-warning.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── Layout ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 120px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 24px;
  align-items: start;
}

/* ── Card ── */
.card {
  background: white;
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 8px 28px rgba(0,0,0,0.07);
  border: 1px solid rgba(229,231,235,0.7);
}

.sticky-card {
  position: sticky;
  top: 88px;
}

/* 阅读时题目继续向下滚动，文章栏始终留在视口内。文章较长时只滚动文章栏本身。 */
@media (min-width: 861px) {
  .reading-passage-card {
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 112px);
    max-height: calc(100dvh - 112px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }
}

/* ── Section label ── */
.section-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 20px;
}

.section-label::before {
  content: '';
  width: 3px;
  height: 17px;
  background: linear-gradient(to bottom, var(--primary), var(--secondary));
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Passage ── */
.passage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.hint-pills {
  display: flex;
  gap: 8px;
}

.hint-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--muted);
  background: #f9fafb;
  border: 1px solid var(--border);
  padding: 4px 11px;
  border-radius: 20px;
}

.hint-pill span {
  font-size: 13px;
}

.passage-text {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 16px;
  line-height: 2.3;
  color: #111827;
  user-select: text;
  cursor: text;
}

.passage-text p {
  margin-bottom: 22px;
}
.passage-text p:last-child {
  margin-bottom: 0;
}
.passage-text ::selection {
  background: rgba(79,70,229,0.18);
}

/* clickable word spans */
#passageText .w,
#scriptText .w,
.reading-agent-material .w,
.text-grammar-material .w,
.jp-lookup-text .w {
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.1s;
}
#passageText .w.word-hover,
#scriptText .w.word-hover,
.jp-lookup-text .w.word-hover {
  background: rgba(79,70,229,0.1);
}
.reading-agent-material .w.word-hover,
.text-grammar-material .w.word-hover {
  background: rgba(255,255,255,0.92);
  color: #3730a3;
  box-shadow: 0 0 0 2px rgba(79,70,229,0.72), 0 2px 6px rgba(79,70,229,0.18);
}
#passageText .w:focus-visible,
#scriptText .w:focus-visible,
.reading-agent-material .w:focus-visible,
.text-grammar-material .w:focus-visible,
.jp-lookup-text .w:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  background: rgba(79,70,229,0.1);
}

#passageText mark.key-hl-wrap,
#scriptText mark.key-hl-wrap {
  background: rgba(59,130,246,0.22);
  border-radius: 4px;
  color: inherit;
  padding: 1px 0;
  animation: hlPulse 0.5s ease;
}

/* 关键句已经高亮时，单词悬停只显示下划线，避免叠成两层蓝色方块。 */
#passageText mark.key-hl-wrap .w.word-hover,
#scriptText mark.key-hl-wrap .w.word-hover,
#passageText mark.key-hl-wrap .w:focus-visible,
#scriptText mark.key-hl-wrap .w:focus-visible {
  background: transparent;
  box-shadow: inset 0 -2px #4f46e5;
}

.listening-instruction {
  font-size: 15px;
  color: #374151;
  background: #f3f4f6;
  border-radius: 10px;
  padding: 10px 12px;
}

.listening-question-picture {
  position: relative;
  width: min(100%, 680px);
  margin: 16px auto 18px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.listening-question-picture img {
  display: block;
  width: 100%;
  height: auto;
}

.listening-question-picture.situation-picture {
  width: min(100%, 720px);
}

.listening-question-picture.choice-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  aspect-ratio: 1;
}

.listening-picture-tile {
  position: relative;
  display: block;
  min-width: 0;
  aspect-ratio: 1;
  overflow: hidden;
  background: #f8fafc;
  padding: 0;
  border: 0;
  color: inherit;
  cursor: pointer;
  transition: filter 0.16s ease;
}

.listening-picture-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border: 0 solid transparent;
  background: transparent;
  pointer-events: none;
  transition: border-color 0.15s, border-width 0.15s, background 0.15s;
}

/* 图片作答后的中心结果标识。边框保留为辅助，中心符号让对错一眼可见。 */
.listening-picture-tile::before {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 50%;
  display: grid;
  width: clamp(42px, 22%, 68px);
  aspect-ratio: 1;
  place-items: center;
  border-radius: 999px;
  transform: translate(-50%, -50%) scale(0.82);
  box-shadow: 0 7px 20px rgba(15, 23, 42, 0.22);
  color: #fff;
  font-family: Inter, "Noto Sans JP", sans-serif;
  font-size: clamp(28px, 8vw, 46px);
  font-weight: 700;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.2s cubic-bezier(.2, .9, .25, 1.2);
}

.listening-picture-tile:hover:not(:disabled),
.listening-picture-tile:focus-visible {
  z-index: 2;
  outline: none;
}

.listening-picture-tile:hover:not(:disabled)::after,
.listening-picture-tile:focus-visible::after {
  border-width: 4px;
  border-color: #a5b4fc;
  background: rgba(238, 242, 255, 0.14);
}

.listening-picture-tile.selected::after {
  border-width: 6px;
  border-color: #4f46e5;
  background: rgba(238, 242, 255, 0.18);
}

.listening-picture-tile.correct::after {
  border-width: 6px;
  border-color: #16a34a;
  background: rgba(240, 253, 244, 0.18);
}

.listening-picture-tile.correct::before {
  content: "✓";
  background: rgba(22, 163, 74, 0.94);
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.listening-picture-tile.wrong::after {
  border-width: 6px;
  border-color: #dc2626;
  background: rgba(255, 241, 242, 0.18);
}

.listening-picture-tile.wrong::before {
  content: "×";
  background: rgba(220, 38, 38, 0.94);
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.listening-picture-tile.wrong {
  filter: saturate(0.82);
}

.listening-picture-tile:disabled {
  cursor: default;
}

.picture-answer-submit-row {
  width: min(100%, 680px);
  margin: 0 auto 14px;
}

.picture-answer-submit {
  padding: 13px 15px;
}

.listening-question-picture.choice-board .listening-picture-tile img {
  position: absolute;
  width: 200%;
  max-width: none;
  height: 200%;
  left: 0;
  top: 0;
}

.listening-picture-number {
  position: absolute;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(17, 24, 39, 0.9);
  color: #fff;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.listening-picture-tile .listening-picture-number {
  left: 10px;
  top: 10px;
  z-index: 4;
}

.listening-picture-number.n1 { left: 2.5%; top: 2.5%; }
.listening-picture-number.n2 { left: 52.5%; top: 2.5%; }
.listening-picture-number.n3 { left: 2.5%; top: 52.5%; }
.listening-picture-number.n4 { left: 52.5%; top: 52.5%; }

.listening-script-line {
  display: grid;
  grid-template-columns: 44px 62px minmax(0, 1fr);
  align-items: start;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.16s ease, box-shadow 0.16s ease;
}

.listening-script-line:hover,
.listening-script-line:focus-visible {
  background: #eef6ff;
  outline: none;
  box-shadow: inset 0 0 0 2px #93c5fd;
}

.listening-script-line.active {
  background: #dbeafe;
  box-shadow: inset 3px 0 0 #2563eb;
}

.listening-script-time {
  color: #6b7280;
  font-variant-numeric: tabular-nums;
}

.listening-script-speaker {
  color: #1d4ed8;
  font-weight: 700;
}

.listening-script-text {
  min-width: 0;
  line-height: 1.75;
}

#listeningQuestionsCard .option:has(.option-jp-text:empty) {
  justify-content: center;
  min-height: 54px;
}

#listeningQuestionsCard .option:has(.option-jp-text:empty) .opt-letter {
  margin: 0;
}

@media (max-width: 640px) {
  .listening-script-line {
    grid-template-columns: 40px minmax(0, 1fr);
  }
  .listening-script-speaker,
  .listening-script-text {
    grid-column: 2;
  }
}

/* ── Quiz Agent V1 internal trace console ─────────────────────────────── */
#agentDebugEntryBtn {
  position: fixed;
  left: 178px;
  bottom: 24px;
  z-index: 9001;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  color: #475569;
  padding: 8px 13px;
  font: 600 12px/1.2 inherit;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .12);
  cursor: pointer;
}
#agentDebugEntryBtn:hover,
#agentDebugEntryBtn:focus-visible { border-color: #6366f1; color: #4338ca; }
.agent-debug-wrap {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 80px;
  color: #1e293b;
}
.agent-debug-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.agent-debug-head h1 { margin: 0 0 6px; font-size: clamp(24px, 3vw, 34px); }
.agent-debug-head p { margin: 0; color: #64748b; }
.agent-debug-head button {
  border: 0; border-radius: 10px; background: #4f46e5; color: #fff;
  padding: 10px 18px; font-weight: 700; cursor: pointer;
}
.agent-debug-kpis {
  display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px; margin: 24px 0;
}
.agent-debug-kpis span,
.agent-debug-card,
.agent-debug-section {
  border: 1px solid #e2e8f0; border-radius: 14px; background: #fff;
  box-shadow: 0 5px 18px rgba(15, 23, 42, .05);
}
.agent-debug-kpis span { padding: 14px; color: #64748b; }
.agent-debug-kpis b { display: block; margin-top: 5px; color: #0f172a; font-size: 22px; }
.agent-debug-section { margin-top: 16px; padding: 20px; }
.agent-debug-section h2 { margin: 0 0 14px; font-size: 18px; }
.agent-debug-card { padding: 14px; margin: 10px 0; box-shadow: none; }
.agent-debug-card strong { color: #4338ca; }
.agent-debug-card span { margin-left: 10px; color: #64748b; font: 600 12px/1.2 ui-monospace, monospace; }
.agent-debug-card p { margin: 8px 0; }
.agent-debug-card small { color: #64748b; overflow-wrap: anywhere; }
.agent-debug-card .agent-debug-execution { display: block; margin-top: 6px; }
.agent-debug-table-wrap { overflow: auto; }
.agent-debug-section table { width: 100%; border-collapse: collapse; font-size: 13px; }
.agent-debug-section th,
.agent-debug-section td { border-bottom: 1px solid #e2e8f0; padding: 10px; text-align: left; vertical-align: top; }
.agent-debug-section code { display: block; max-width: 620px; white-space: pre-wrap; overflow-wrap: anywhere; color: #334155; }
.agent-debug-section pre {
  max-height: 420px; overflow: auto; margin: 0; padding: 14px; border-radius: 10px;
  background: #0f172a; color: #dbeafe; white-space: pre-wrap; overflow-wrap: anywhere;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.ki-tabs {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 8px;
  padding: 7px; border: 1px solid #e2e8f0; border-radius: 14px; background: #f8fafc;
}
.ki-tab, .ki-button, .ki-link-button {
  border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; color: #334155;
  padding: 9px 12px; font: 700 12px/1.2 inherit; cursor: pointer;
}
.ki-tab:hover, .ki-button:hover, .ki-link-button:hover { border-color: #6366f1; color: #4338ca; }
.ki-tab.active { border-color: #4f46e5; background: #4f46e5; color: #fff; }
.ki-workspace { margin-top: 18px; }
.ki-coverage-grid { grid-template-columns: repeat(5, minmax(130px, 1fr)); }
.ki-detail-kpis { grid-template-columns: repeat(3, minmax(120px, 1fr)); margin: 12px 0 18px; }
.ki-editor-layout {
  display: grid; grid-template-columns: minmax(230px, 300px) minmax(0, 1fr); gap: 16px; align-items: start;
}
.ki-list-pane, .ki-detail-pane {
  border: 1px solid #e2e8f0; border-radius: 14px; background: #fff;
  padding: 16px; box-shadow: 0 5px 18px rgba(15, 23, 42, .05);
}
.ki-list-pane { position: sticky; top: 16px; display: grid; gap: 9px; max-height: calc(100vh - 40px); overflow: auto; }
.ki-list-pane input, .ki-list-pane select, .ki-field input, .ki-field select, .ki-field textarea, .ki-json-area {
  width: 100%; box-sizing: border-box; border: 1px solid #cbd5e1; border-radius: 9px;
  background: #fff; color: #0f172a; padding: 9px 10px; font: 13px/1.45 inherit;
}
.ki-field textarea, .ki-json-area { resize: vertical; }
.ki-tree, .ki-question-list { display: grid; gap: 4px; }
.ki-tree-item, .ki-question-item {
  width: 100%; border: 0; border-radius: 8px; background: transparent; color: #334155;
  padding: 8px 9px 8px calc(9px + var(--ki-depth, 0) * 14px); text-align: left; cursor: pointer;
}
.ki-tree-item:hover, .ki-question-item:hover, .ki-tree-item.active, .ki-question-item.active { background: #eef2ff; color: #4338ca; }
.ki-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.ki-field { display: grid; gap: 6px; align-content: start; color: #64748b; font-size: 12px; font-weight: 700; }
.ki-field:has(textarea) { grid-column: span 2; }
.ki-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.ki-related-box, .ki-options { margin-top: 18px; border-top: 1px solid #e2e8f0; padding-top: 16px; }
.ki-related-box pre, .ki-json-area { background: #0f172a; color: #dbeafe; border-radius: 10px; padding: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ki-question-prompt { border-radius: 10px; background: #f8fafc; padding: 13px; font-size: 16px; font-weight: 650; }
.ki-mapping-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ki-mapping-head h2, .ki-mapping-head .ki-actions { margin: 0; }
.ki-mapping-context { margin: 12px 0 16px; padding: 13px; border: 1px solid #c7d2fe; border-radius: 10px; background: #eef2ff; }
.ki-mapping-context p { margin: 5px 0; overflow-wrap: anywhere; }
.ki-warning { padding: 10px 12px; border-radius: 9px; background: #fff7ed; color: #c2410c; }
.ki-approve { border-color: #22c55e; color: #15803d; }
.ki-reject { border-color: #fb7185; color: #be123c; }
.ki-curation-table td, .ki-curation-table th { min-width: 110px; white-space: pre-wrap; }
.ki-curation-table td:first-child { min-width: 210px; }
.ki-option-row { display: grid; grid-template-columns: 90px minmax(0, 1fr) minmax(130px, .8fr); gap: 10px; padding: 10px; border-bottom: 1px solid #e2e8f0; }
.ki-option-row small { color: #7c3aed; overflow-wrap: anywhere; }
.ki-notice { margin-bottom: 12px; border-radius: 9px; background: #ecfdf5; color: #047857; padding: 11px 13px; white-space: pre-wrap; }
.ki-notice.error, .ki-fail { background: #fff1f2; color: #be123c; }
.ki-pass { border-color: #86efac; }
.ki-link-button { padding: 6px 9px; }
@media (max-width: 900px) {
  .ki-editor-layout { grid-template-columns: 1fr; }
  .ki-list-pane { position: static; max-height: 340px; }
  .ki-form-grid { grid-template-columns: 1fr; }
  .ki-field:has(textarea) { grid-column: span 1; }
  .ki-coverage-grid { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
}
@media (max-width: 860px) {
  .agent-debug-kpis { grid-template-columns: repeat(2, 1fr); }
  #agentDebugEntryBtn { left: 156px; bottom: 24px; }
}

@keyframes hlPulse {
  0% {
    background: rgba(59,130,246,0.55);
  }
  100% {
    background: rgba(59,130,246,0.22);
  }
}

/* ── Translation section ── */
.trans-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed #e5e7eb;
  cursor: pointer;
  color: #059669;
  font-size: 13px;
  font-weight: 600;
  user-select: none;
  width: fit-content;
  background: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  font-family: inherit;
  text-align: left;
}

.trans-toggle:hover {
  color: #047857;
}
.trans-toggle .arrow {
  font-size: 11px;
  transition: transform 0.2s;
}
.trans-toggle.open .arrow {
  transform: rotate(180deg);
}

.trans-body {
  display: none;
  margin-top: 14px;
  padding: 16px 18px;
  background: #f0fdf9;
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  font-size: 14px;
  line-height: 2;
  color: #065f46;
}

.trans-body.show {
  display: block;
  animation: fadeIn 0.2s ease;
}
.trans-body p {
  margin-bottom: 12px;
}
.trans-body p:last-child {
  margin-bottom: 0;
}

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

/* Question translation inside questions */
.q-trans-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #059669;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 10px;
  user-select: none;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  text-align: left;
}

.q-trans-toggle:hover {
  color: #047857;
}
.q-trans-toggle .arrow {
  font-size: 10px;
  transition: transform 0.2s;
}
.q-trans-toggle.open .arrow {
  transform: rotate(180deg);
}

.q-trans-body {
  display: none;
  margin-bottom: 10px;
  padding: 12px 14px;
  background: #f0fdf9;
  border: 1px solid #a7f3d0;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.9;
  color: #065f46;
}

.q-trans-body.show {
  display: block;
  animation: fadeIn 0.2s ease;
}

.q-trans-opt {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.q-trans-opt-l {
  font-weight: 700;
  min-width: 16px;
}

/* ── Questions ── */
.question-item {
  padding: 18px 0;
  border-bottom: 1px solid #f3f4f6;
}

.question-item:first-child {
  padding-top: 0;
}
.question-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.q-num {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 7px;
}

.q-text {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 14px;
  line-height: 1.85;
  color: #374151;
  font-weight: 500;
  margin-bottom: 10px;
}

.q-text,
.option-jp-text {
  user-select: text;
}

.vocabulary-target-prompt {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: -2px 0 10px;
  padding: 5px 9px;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
  font-size: 11.5px;
  line-height: 1.5;
}

.vocabulary-target-prompt strong {
  color: #b45309;
  font-family: 'Noto Sans JP', sans-serif;
}

.jp-lookup-text .vocabulary-target-word,
.q-text .vocabulary-target-word {
  padding: 1px 2px;
  border-radius: 4px;
  background: #fde68a !important;
  box-shadow: inset 0 -3px #f59e0b, 0 0 0 1px rgba(245, 158, 11, 0.18);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  color: #92400e;
  font-weight: 800;
}

.jp-lookup-text .vocabulary-target-word .w,
.q-text .vocabulary-target-word .w {
  color: inherit;
  font-weight: inherit;
}

.jp-lookup-text .vocabulary-target-word .w.word-hover,
.q-text .vocabulary-target-word .w.word-hover,
.jp-lookup-text .vocabulary-target-word .w:focus-visible,
.q-text .vocabulary-target-word .w:focus-visible {
  background: transparent;
  box-shadow: inset 0 -2px rgba(146, 64, 14, 0.58);
}

.option-jp-text {
  min-width: 0;
}

.option-jp-text .option-word {
  cursor: pointer;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 13px;
  border-radius: 9px;
  cursor: pointer;
  border: 1.5px solid transparent;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 13px;
  line-height: 1.65;
  color: #4b5563;
  transition: all 0.15s ease;
  background: #fafafa;
  width: 100%;
  text-align: left;
  appearance: none;
}

.option:not([data-answered="true"]):hover {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: var(--primary);
}
.option.correct {
  background: #f0fdf4;
  border-color: #22c55e;
  color: #15803d;
}
.option.wrong {
  background: #fef2f2;
  border-color: #f87171;
  color: #dc2626;
}
.option:disabled,
.option[data-answered="true"] {
  opacity: 1;
  cursor: default;
}

.opt-letter {
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  min-width: 16px;
}

.btn-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.ask-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: white;
  border: none;
  padding: 7px 15px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(79,70,229,0.28);
  transition: all 0.18s ease;
  font-family: 'Noto Sans JP', 'Inter', sans-serif;
}

.ask-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(79,70,229,0.38);
}
.ask-btn:active {
  transform: translateY(0);
}

/* 每题右下角的题目反馈入口：不干扰作答，但始终在题目边缘可见。 */
.question-item,
.quiz-q-card {
  position: relative;
}
.question-item {
  padding-right: 54px;
  padding-bottom: 52px;
}
.question-item:last-child { padding-bottom: 52px; }
.quiz-q-card { padding-bottom: 58px; }
.quiz-ai-explain-btn {
  position: absolute;
  left: 18px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 31px;
  padding: 5px 10px;
  border: 1px solid #c7bcff;
  border-radius: 9px;
  color: #4b3eb5;
  background: #f5f3ff;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}
.quiz-ai-explain-btn:hover { border-color: #9f8dff; background: #ede9fe; }
.quiz-ai-explain-btn:focus-visible { outline: 3px solid rgba(99, 82, 236, .22); outline-offset: 2px; }
.question-report-btn {
  /* 题目反馈是针对当前题目的全局入口，不占用题卡底部；所有题型都
     固定在视口右下，长材料或滚动页面也能随时提交。 */
  position: fixed;
  right: 22px;
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 125;
  width: 31px;
  height: 31px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #f0c88a;
  border-radius: 9px;
  color: #b66916;
  background: #fff9ed;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.question-report-btn svg { width: 17px; height: 17px; }
.question-report-btn:hover { transform: translateY(-1px); background: #fff1d5; border-color: #df9c48; }
.question-report-btn:focus-visible { outline: 3px solid rgba(217, 119, 6, .25); outline-offset: 2px; }

@media (max-width: 700px) {
  .question-report-btn {
    right: 14px;
    bottom: max(14px, env(safe-area-inset-bottom));
  }
}

.assistant-inline-mascot {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  object-fit: cover;
}

.ans-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: white;
  color: #059669;
  border: 1.5px solid #6ee7b7;
  padding: 7px 15px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: 'Inter', sans-serif;
}

.ans-btn:hover {
  background: #f0fdf4;
  border-color: #34d399;
  transform: translateY(-1px);
}
.ans-btn:active {
  transform: translateY(0);
}
.ans-btn.open {
  background: #f0fdf4;
  border-color: #34d399;
}

.ans-panel {
  display: none;
  margin-top: 10px;
  padding: 14px 16px;
  background: #f0fdf9;
  border: 1px solid #a7f3d0;
  border-radius: 11px;
  font-size: 13px;
  line-height: 1.85;
  color: #065f46;
  animation: fadeIn 0.18s ease;
}

.ans-panel.show {
  display: block;
}
.ans-panel strong {
  color: #047857;
}

/* ── Word tooltip ── */
.word-tip {
  position: absolute;
  z-index: 250;
  background: white;
  border: 1.5px solid #ede9fe;
  border-radius: 12px;
  padding: 12px 16px 12px 14px;
  box-shadow: 0 6px 24px rgba(79,70,229,0.15), 0 2px 8px rgba(0,0,0,0.08);
  display: none;
  min-width: 220px;
  max-width: 340px;
  animation: popIn 0.15s cubic-bezier(0.34,1.56,0.64,1);
}

.word-tip.show {
  display: block;
}

.word-tip-jp {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 5px;
}

.word-tip-zh {
  font-size: 13px;
  color: #374151;
  line-height: 1.6;
}

.word-tip-analysis {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid #ede9fe;
}

.word-tip-analysis-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  font-size: 12px;
  line-height: 1.55;
}

.word-tip-analysis-row span {
  color: #64748b;
  font-weight: 650;
}

.word-tip-analysis-row strong {
  color: #4338ca;
  font-family: 'Noto Sans JP', 'Inter', sans-serif;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.word-tip-close {
  position: absolute;
  top: 7px;
  right: 9px;
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
  padding: 2px;
}

.word-tip-close:hover {
  color: #6b7280;
}

.word-tip-tag {
  display: inline-block;
  background: #f0fdf4;
  color: #059669;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
}

/* ── Selection popup ── */
.sel-popup {
  position: fixed;
  z-index: 200;
  display: none;
  flex-direction: column;
  align-items: center;
}

.sel-popup.show {
  display: flex;
}

.sel-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, #4338ca, #7c3aed);
  color: white;
  border: none;
  padding: 9px 18px;
  border-radius: 26px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(79,70,229,0.45);
  white-space: nowrap;
  animation: popIn 0.15s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(5px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.sel-arrow {
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 7px solid #7c3aed;
}

/* ── Chat panel ── */
.chat-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 390px;
  height: min(540px, calc(100vh - 48px));
  height: min(540px, calc(100dvh - 48px));
  background: white;
  border-radius: 22px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.16), 0 2px 8px rgba(0,0,0,0.06);
  border: 1px solid rgba(229,231,235,0.5);
  flex-direction: column;
  overflow: hidden;
  z-index: 300;
  transform: translateY(16px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  /* display:none 是关闭状态的默认值——之前用 visibility:hidden 顺延隐藏，
     实测 Safari 阅读器的内容判断还是能抓到这段文字，说明它认的不是
     visibility，得用 display:none 才能彻底把这段欢迎语从页面里摘掉。
     display 没法配合 transition 做动画（不是能插值的属性），所以展开/收起
     的时机改成 event-router.js 里用 JS 控制：先切 display:flex 再触发
     opacity/transform 过渡，收起动画播完再切回 display:none。 */
  display: none;
  transition: transform 0.24s cubic-bezier(0.34,1.56,0.64,1), opacity 0.2s ease;
}

.chat-panel.open {
  display: flex;
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

.chat-head {
  background: linear-gradient(135deg, #4338ca, #7c3aed);
  padding: 15px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-head-left {
  display: flex;
  align-items: center;
  gap: 11px;
}

.chat-avatar {
  width: 38px;
  height: 38px;
  background: rgba(255,255,255,0.2);
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 1px solid rgba(255,255,255,0.25);
  overflow: hidden;
}
.chat-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }

.chat-title {
  color: white;
  font-size: 15px;
  font-weight: 600;
}
.chat-subtitle {
  color: rgba(255,255,255,0.65);
  font-size: 12px;
}

.close-btn {
  width: 30px;
  height: 30px;
  background: rgba(255,255,255,0.18);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.close-btn:hover {
  background: rgba(255,255,255,0.28);
}

.chat-msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.chat-msgs::-webkit-scrollbar {
  width: 4px;
}
.chat-msgs::-webkit-scrollbar-thumb {
  background: #ddd6fe;
  border-radius: 2px;
}

.msg {
  display: flex;
  gap: 8px;
  animation: msgIn 0.2s ease;
}
.msg.user {
  flex-direction: row-reverse;
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg-avatar {
  width: 29px;
  height: 29px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  overflow: hidden;
}

.msg-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }

.msg.ai .msg-avatar {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
}
.msg.user .msg-avatar {
  background: #f3f4f6;
}

.msg-bubble {
  max-width: 82%;
  padding: 10px 14px;
  font-size: 13.5px;
  line-height: 1.75;
  font-family: 'Noto Sans JP', sans-serif;
}

.msg.ai .msg-bubble {
  background: #f8f7ff;
  border: 1px solid #ede9fe;
  border-radius: 4px 14px 14px 14px;
  color: #1f2937;
}

.msg.user .msg-bubble {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: white;
  border-radius: 14px 4px 14px 14px;
}

.typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 4px 0;
}
.dot {
  width: 6px;
  height: 6px;
  background: #a78bfa;
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.dot:nth-child(2) {
  animation-delay: 0.2s;
}
.dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

.welcome {
  text-align: center;
  padding: 24px 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.9;
}
.welcome-icon {
  width: 70px;
  height: 70px;
  margin-right: auto;
  margin-left: auto;
  margin-bottom: 10px;
  overflow: hidden;
  border: 2px solid rgba(124, 58, 237, .28);
  border-radius: 23px;
  box-shadow: 0 8px 24px rgba(79, 70, 229, .16);
}
.welcome-icon img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ── Quick chips ── */
.chip-row {
  padding: 8px 14px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  background: #f5f3ff;
  border: 1.5px solid #ddd6fe;
  color: #5b21b6;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  font-family: 'Inter', sans-serif;
}

.chip:hover {
  background: #ede9fe;
  border-color: #a78bfa;
}
.chip:active {
  transform: scale(0.96);
}

.chat-input-row {
  padding: 12px 15px;
  border-top: 1px solid #f3f4f6;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
  background: white;
}

.chat-input {
  flex: 1;
  border: 1.5px solid #e5e7eb;
  border-radius: 13px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-family: 'Noto Sans JP', 'Inter', sans-serif;
  resize: none;
  outline: none;
  transition: border-color 0.15s;
  max-height: 80px;
  line-height: 1.5;
  color: #111827;
}

.chat-input:focus {
  border-color: var(--primary);
}
.chat-input::placeholder {
  color: #9ca3af;
}

.send-btn {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border: none;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(79,70,229,0.32);
  transition: all 0.15s;
}

.send-btn:hover {
  transform: scale(1.07);
  box-shadow: 0 4px 14px rgba(79,70,229,0.42);
}
.send-btn:disabled {
  opacity: 0.45;
  transform: none;
  cursor: not-allowed;
}

.fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border-radius: 16px;
  border: none;
  padding: 3px;
  color: white;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 22px rgba(79,70,229,0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 299;
  transition: all 0.2s ease;
}

.fab img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 13px;
  object-fit: cover;
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(79,70,229,0.52);
}
.fab.hidden {
  display: none;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sticky-card {
    position: static;
  }
  .chat-panel {
    width: min(390px, calc(100vw - 32px));
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    height: min(540px, calc(100vh - 32px));
    height: min(540px, calc(100dvh - 32px));
  }
}

@media (max-width: 600px) {
  .reading-material-nav,
  .listening-material-tabs {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
  }
  .reading-material-tab,
  .listening-material-tab {
    flex: 0 0 min(190px, 70vw);
    scroll-snap-align: start;
  }
  .listening-inline-guide {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  body.chat-open {
    overflow: hidden;
  }

  .chat-panel {
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    width: auto;
    height: calc(var(--chat-viewport-height) - 16px - env(safe-area-inset-top) -
      env(safe-area-inset-bottom));
    max-height: none;
    border-radius: 18px;
  }

  .chat-head {
    padding: 12px 14px;
  }
  .chat-msgs {
    padding: 12px;
    gap: 10px;
  }
  .msg-bubble {
    max-width: 86%;
    padding: 9px 12px;
    font-size: 13px;
  }
  .chip-row {
    max-height: 76px;
    overflow-y: auto;
    padding: 7px 11px 0;
  }
  .chat-input-row {
    padding: 10px 11px;
  }
  .fab {
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
  }
}

/* 横屏手机或高度很小的窗口：压缩非必要区域，保住消息列表和输入框。 */
@media (max-height: 600px) {
  body.chat-open {
    overflow: hidden;
  }

  .chat-panel {
    top: max(8px, env(safe-area-inset-top));
    bottom: max(8px, env(safe-area-inset-bottom));
    height: auto;
    max-height: none;
  }
  .chat-head {
    padding: 8px 12px;
  }
  .chat-avatar {
    width: 30px;
    height: 30px;
    font-size: 16px;
    border-radius: 8px;
  }
  .chat-subtitle {
    display: none;
  }
  .chat-msgs {
    padding: 8px 10px;
    gap: 8px;
  }
  .chip-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
    padding: 5px 10px 0;
    scrollbar-width: none;
  }
  .chip-row::-webkit-scrollbar {
    display: none;
  }
  .chat-input-row {
    padding: 8px 10px;
  }
  .chat-input {
    padding: 8px 11px;
    max-height: 54px;
  }
  .send-btn {
    width: 38px;
    height: 38px;
  }
}

/* ── Screens ── */
.screen {
  display: none;
}
.screen.active {
  display: block;
}

/* ── Home screen ── */
.home-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 44px 24px 100px;
}
.home-hero {
  text-align: center;
  margin-bottom: 40px;
}
.home-hero h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.home-hero p {
  color: var(--muted);
  font-size: 14px;
}
.bank-update {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  margin-top: 14px;
  padding: 8px 14px;
  border: 1px solid #c4b5fd;
  border-radius: 999px;
  background: #f5f3ff;
  color: #5b21b6;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}
.live-mode {
  width: fit-content;
  max-width: 100%;
  margin: 8px auto 0;
  color: #9a3412;
  font-size: 11px;
  font-weight: 700;
}
.live-mode.active {
  color: #15803d;
}

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

.level-card {
  background: white;
  border-radius: 18px;
  padding: 22px 22px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 6px 22px rgba(0,0,0,0.06);
}

.level-badge {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  color: white;
  margin-bottom: 12px;
}

.level-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.level-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  margin-bottom: 14px;
}
.type-btns {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.pending-tag {
  margin-left: 6px;
  font-size: 9px;
  font-weight: 700;
  color: #b45309;
  white-space: nowrap;
}

.practice-only-container {
  max-width: 980px;
}
.practice-only-card {
  width: 100%;
}
.question-material-tag {
  display: inline-flex;
  align-items: center;
  margin: 0 0 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #5b21b6;
  font-size: 11px;
  font-weight: 700;
}

.text-grammar-material {
  margin: 0 0 16px;
  padding: 15px 16px;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  background: linear-gradient(145deg, #f8faff 0%, #f5f3ff 100%);
  color: #263445;
}

.text-grammar-material.translated {
  margin-bottom: 12px;
  border-color: #a7f3d0;
  background: #ecfdf5;
  color: #065f46;
}

.text-grammar-material-title {
  margin-bottom: 8px;
  color: #4f46e5;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.text-grammar-material.translated .text-grammar-material-title {
  color: #047857;
}

.text-grammar-material-body {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 14px;
  line-height: 1.95;
}

.text-grammar-material-body p {
  margin: 0;
}

.text-grammar-material-body p + p {
  margin-top: 8px;
}

/* 学习库的阅读练习是 Agent 逐题会话：文章属于当前题，而不是待选择的列表。 */
.reading-agent-material {
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid #dbe7ff;
  border-radius: 14px;
  background: linear-gradient(145deg, #f8fbff 0%, #f5f9ff 100%);
  color: #263445;
}

.reading-agent-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.reading-agent-layout.translation-open {
  grid-template-columns: minmax(0, 1.12fr) minmax(260px, 0.88fr);
  align-items: start;
}

.reading-agent-material-body {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 15px;
  line-height: 2;
}

.reading-agent-material-body p {
  margin: 0;
}

.reading-agent-material-body p + p {
  margin-top: 9px;
}

/* 逐句联动只在离线审校缓存存在时启用。只有悬停中文译文才短暂标出中日对应，
   日文正文本身不抢占鼠标事件，保证词块查词始终优先。 */
.reading-sentence {
  border-radius: 5px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background .14s ease, box-shadow .14s ease;
}

.reading-sentence.is-translation-linked {
  background: rgba(191, 219, 254, .62);
  box-shadow: inset 0 0 0 1.5px rgba(59, 130, 246, .78);
}

.reading-agent-trans-toggle {
  margin: 14px 0 0;
}

.reading-agent-trans-body {
  margin: 0;
  background: rgba(255,255,255,0.86);
  border-color: #c7d2fe;
  color: #334155;
  box-shadow: 0 8px 18px rgba(71,85,105,0.07);
  font-size: 17px;
  line-height: 1.9;
}

.reading-agent-trans-body p { margin: 0; }
.reading-agent-trans-body p + p { margin-top: 8px; }
.reading-translation-paragraph { white-space: normal; }

.reading-translation-segment {
  display: inline;
  border-radius: 7px;
  padding: 1px 2px;
  cursor: pointer;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background .14s ease, box-shadow .14s ease, color .14s ease;
}

.reading-translation-segment.is-translation-linked {
  background: rgba(219, 234, 254, .82);
  color: #1e3a8a;
  box-shadow: inset 0 0 0 1.5px rgba(59, 130, 246, .72);
}

@media (max-width: 900px) {
  .reading-agent-layout.translation-open { grid-template-columns: minmax(0, 1fr); }
}

/* AI 侧栏打开后，正文区变窄；改回上下布局，避免中日两列过窄。 */
body.chat-open .reading-agent-layout.translation-open {
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.text-grammar-blank {
  padding: 1px 4px;
  border-radius: 5px;
  background: #e0e7ff;
  color: #4338ca;
  font-weight: 800;
}

/* 四处填空同时显示、可任意顺序作答，不存在"当前正在做的那一空"，
   所以不再把其中一空标成黄色——未填、"当前"与已填统一归入同一套
   蓝色语义，避免黄色被误解成答案状态或警告（手机端已经是这样）。 */
.text-grammar-blank.active {
  background: #e0e7ff;
  color: #4338ca;
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, .18);
}
.text-grammar-blank.filled {
  background: #dbeafe;
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, .34);
}
.text-grammar-blank-answer {
  display: inline-block;
  min-width: 2.4em;
  margin-left: 2px;
  text-align: center;
  font-size: 1.06em;
  font-weight: 800;
}

/* 词汇/语法单空题答完之后，把正确答案拼回题干、给补完的那个词加框——跟
   上面 .text-grammar-blank.filled 同一套蓝色配色（同一个"刚揭晓的答案"
   语义），不用黄色（黄色是 .vocabulary-target-word 的"这是考点词"含义，
   两者不能混用，见 japanese-tokenizer.js 里 blankAnswerMarkup 的说明）。 */
.blank-answer-highlight {
  padding: 1px 3px;
  border-radius: 5px;
  background: #dbeafe;
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, .34);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* One JLPT article has four linked blanks.  Keep the answer choices compact
   enough to judge the whole passage at a glance, then write each choice back
   into its matching blank above. */
.text-grammar-group { margin-top: 4px; }
.text-grammar-group-heading { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; }
.text-grammar-group-heading strong { color: #1f2937; font-size: 15px; }
.text-grammar-group-heading span { color: #6b7280; font-size: 12px; }
/* 标题的中文翻译默认隐藏，跟选项中文释义共用同一个"查看中文翻译"开关
   （见 event-router.js 的 toggleTrans() 给 .text-grammar-group 切换的
   .show-zh class）。 */
.text-grammar-group-heading span.text-grammar-group-heading-zh { display: none; }
.text-grammar-group.show-zh .text-grammar-group-heading span.text-grammar-group-heading-zh { display: inline; }
.text-grammar-group-heading span.text-grammar-group-heading-zh { font-size: 15px; }
.text-grammar-group-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.text-grammar-choice-card { padding: 11px; border: 1px solid #dbe2ea; border-radius: 12px; background: #fbfcfe; }
.text-grammar-choice-card-title { display: flex; align-items: center; gap: 7px; margin: 0 0 9px; color: #334155; font-size: 15px; font-weight: 800; }
.text-grammar-choice-card-title > span { overflow: hidden; color: #64748b; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.text-grammar-choice-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.text-grammar-choice { display: flex; flex-wrap: wrap; align-items: center; min-width: 0; gap: 7px; padding: 8px 9px; border: 1px solid #dbe2ea; border-radius: 8px; background: #fff; color: #334155; font: inherit; font-family: 'Noto Sans JP', sans-serif; font-size: 15px; line-height: 1.3; cursor: pointer; transition: background .14s ease, border-color .14s ease, box-shadow .14s ease; }
.text-grammar-choice-key { display: inline-grid; place-items: center; width: 20px; height: 20px; flex: 0 0 20px; border-radius: 6px; background: #eef2f7; color: #64748b; font-family: inherit; font-size: 11px; font-weight: 800; }
/* 中文释义默认不显示——跟文章原文的"查看中文翻译"共用同一个开关，见
   event-router.js 的 toggleTrans()；展开时挤到第二行（flex-basis:100%），
   不跟第一行的序号+日语选项挤在同一行。 */
.text-grammar-choice-zh { display: none; flex-basis: 100%; padding-left: 27px; font-size: 12.5px; color: #64748b; }
.text-grammar-group.show-zh .text-grammar-choice-zh { display: block; }
.text-grammar-choice:hover { border-color: #8c92ff; background: #f7f8ff; }
.text-grammar-choice.selected,
.text-grammar-choice.selected:hover { border-color: #575ce9; background: #eef0ff; color: #3730a3; box-shadow: 0 0 0 2px rgba(87,92,233,.12); }
.text-grammar-choice.selected .text-grammar-choice-key { background: #575ce9; color: #fff; }
/* 提交后跟 .quiz-opt.correct/.incorrect 同一套配色：正确选项恒定标绿，
   学生选中的错误项标红。 */
.text-grammar-choice.correct { border-color: #16a34a; background: #f0fdf4; color: #14532d; }
.text-grammar-choice.correct .text-grammar-choice-key { background: #16a34a; color: #fff; }
.text-grammar-choice.incorrect { border-color: #dc2626; background: #fff1f2; color: #7f1d1d; }
.text-grammar-choice.incorrect .text-grammar-choice-key { background: #dc2626; color: #fff; }
.text-grammar-choice[aria-disabled="true"] { cursor: default; }
.text-grammar-result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.text-grammar-result-row { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; row-gap: 8px; align-items: center; padding: 16px 18px; border: 1px solid #dbe2ea; border-radius: 12px; color: #334155; font-size: 15px; }
.text-grammar-result-row small { grid-column: 2; color: #64748b; font-size: 12.5px; line-height: 1.5; margin-left: 8px; }
.text-grammar-result-explanation { grid-column: 1 / -1; margin: 6px 0 0; padding-top: 12px; border-top: 1px solid rgba(148, 163, 184, .22); color: #475569; font-size: 13px; line-height: 1.75; }
/* 正确答案解析下面接着列其它三个选项的日语+中文翻译（不需要完整推理句），
   跟上面正确答案解析共享同一条分隔线，两段之间不再重复加线。 */
.text-grammar-result-wrongs { grid-column: 1 / -1; margin: 8px 0 0; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.text-grammar-result-wrong-pair { display: flex; justify-content: space-between; gap: 12px; color: #475569; }
.text-grammar-result-wrong-pair .jp { font-weight: 600; }
.text-grammar-result-wrong-pair .zh { color: #64748b; text-align: right; }
/* 整张卡片不再跟着对错变色——跟单题反馈卡片(.quiz-fb-card)同一个逻辑：
   卡片背景恒定中性色，只有"回答正确"/"正确答案：X"这行小字变色，跟
   .quiz-fb-label.correct/.incorrect 一样只改文字颜色，不改整块背景。 */
.text-grammar-result-row.correct small { color: #16a34a; font-weight: 700; }
.text-grammar-result-row.incorrect small { color: #dc2626; font-weight: 700; }

/* Four-blank group detailed analysis (rendered inside the shared
   .reading-side-analysis panel, same top-toggle + left-column layout as
   reading): one block per blank, all four options listed either way. */
.text-grammar-detail-block { padding: 16px 0; border-bottom: 1px solid rgba(148, 163, 184, .22); }
.text-grammar-detail-block:first-child { padding-top: 0; }
.text-grammar-detail-block:last-child { border-bottom: none; padding-bottom: 0; }
.text-grammar-detail-heading { font-weight: 800; color: #1f2937; font-size: 15px; margin-bottom: 10px; }
@media (max-width: 900px) {
  .text-grammar-group-grid, .text-grammar-result-grid { grid-template-columns: 1fr; }
  .text-grammar-group-heading { display: block; }
  .text-grammar-group-heading span { display: block; margin-top: 3px; }
  /* 上面这条通用 span 规则的选择器权重（1 class + 1 元素）比只写
     .text-grammar-group-heading-zh 单个 class 更高，必须同样叠上
     span 元素选择器才能盖过去，不然手机端标题中文翻译会一直显示、
     不跟随查看中文翻译开关。 */
  .text-grammar-group-heading span.text-grammar-group-heading-zh { display: none; }
  .text-grammar-group.show-zh .text-grammar-group-heading span.text-grammar-group-heading-zh { display: block; margin-top: 3px; }
}
.question-item.key-card-highlight {
  outline: 3px solid rgba(59, 130, 246, 0.3);
  outline-offset: 3px;
  border-radius: 10px;
}
.material-section + .material-section {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}
.material-section-title {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
}
.reading-material-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: -4px 0 20px;
}
.listening-material-nav {
  display: block;
  margin-bottom: 14px;
}
.listening-material-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.listening-all-tabs {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.listening-all-tabs .listening-material-tab {
  min-height: 58px;
  padding: 7px 6px;
  font-size: 11px;
}
.listening-all-tabs .listening-material-tab span {
  font-size: 9px;
}
.listening-inline-guide {
  display: grid;
  grid-template-columns: minmax(150px, auto) 1fr;
  align-items: center;
  gap: 10px 20px;
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 1px solid #c4b5fd;
  border-radius: 14px;
  background: #f5f3ff;
}
.listening-inline-guide div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: #312e81;
}
.listening-inline-guide p {
  margin: 0;
  color: #4b5563;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.65;
}
.listening-inline-kicker {
  color: #6d28d9;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
}
.reading-material-tab {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafafa;
  color: #4b5563;
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.reading-material-tab span {
  display: block;
  margin-bottom: 2px;
  color: #9ca3af;
  font-size: 10px;
}
.reading-material-tab:hover {
  border-color: #a78bfa;
  color: var(--primary);
}
.reading-material-tab.active {
  border-color: #8b5cf6;
  background: #f5f3ff;
  color: #5b21b6;
  box-shadow: inset 0 0 0 1px #c4b5fd;
}
.reading-material-tab.active span {
  color: #7c3aed;
}
.listening-material-tab {
  text-align: center;
}

.type-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border-radius: 9px;
  border: 1.5px solid var(--border);
  background: #fafafa;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #374151;
  transition: all 0.15s;
  text-align: left;
}
.type-btn:not(:disabled):hover {
  background: #f5f3ff;
  border-color: #a78bfa;
  color: var(--primary);
  transform: translateX(3px);
}
.type-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.type-icon {
  font-size: 16px;
}
.coming-tag {
  font-size: 10px;
  font-weight: 700;
  background: #f3f4f6;
  color: #9ca3af;
  padding: 2px 6px;
  border-radius: 5px;
  margin-left: auto;
}

/* ── Audio player ── */
.audio-player {
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
  border: 1.5px solid #c4b5fd;
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 20px;
}
.player-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.play-btn {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 12px rgba(79,70,229,0.38);
  transition: transform 0.15s, box-shadow 0.15s;
}
.play-btn:hover {
  transform: scale(1.07);
  box-shadow: 0 5px 18px rgba(79,70,229,0.48);
}
.player-info {
  flex: 1;
  min-width: 0;
}
.player-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.player-status {
  font-size: 11.5px;
  color: var(--muted);
}
.speed-btns {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}
.speed-btn {
  padding: 4px 9px;
  border-radius: 7px;
  border: 1.5px solid #c4b5fd;
  background: white;
  font-size: 11px;
  font-weight: 700;
  color: #6d28d9;
  cursor: pointer;
  transition: all 0.12s;
}
.speed-btn:hover {
  background: #ede9fe;
}
.speed-btn.active,
.speed-btn[aria-pressed="true"] {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
}
.progress-bar-wrap {
  --progress: 0%;
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
  height: 18px;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
.progress-bar-wrap::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #4f46e5 0 var(--progress), #ddd6fe
    var(--progress) 100%);
}
.progress-bar-wrap::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -5px;
  border: 2px solid white;
  border-radius: 50%;
  background: #4f46e5;
  box-shadow: 0 1px 5px rgba(79,70,229,0.45);
}
.progress-bar-wrap::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: #ddd6fe;
}
.progress-bar-wrap::-moz-range-progress {
  height: 6px;
  border-radius: 3px;
  background: #4f46e5;
}
.progress-bar-wrap::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid white;
  border-radius: 50%;
  background: #4f46e5;
  box-shadow: 0 1px 5px rgba(79,70,229,0.45);
}
.player-time {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
}

/* ── 生词本入口（首页） ── */
.wb-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  font-family: inherit;
  text-align: left;
  background: white;
  border-radius: 14px;
  padding: 14px 20px;
  margin-bottom: 24px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 14px rgba(0,0,0,0.06);
  border: 1.5px solid #ede9fe;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  transition: all 0.15s;
}
.wb-entry:hover {
  background: #f5f3ff;
  border-color: #a78bfa;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
.wb-badge {
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}
.wb-arrow {
  margin-left: auto;
  color: var(--muted);
  font-size: 18px;
}

/* ── 气泡"加入生词本"按钮 ── */
.tip-add-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid #f3f4f6;
  border-left: none;
  border-right: none;
  border-bottom: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: color 0.15s;
}
.tip-add-btn:hover {
  color: var(--secondary);
}
.tip-add-btn.saved {
  color: #059669;
}

/* ── 生词本界面 ── */
.wordbook-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 24px 100px;
}
.wordbook-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.wordbook-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.wordbook-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}
.word-list-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  margin: -12px 0 20px;
  border: 1px solid #dce8e1;
  border-radius: 12px;
  background: #f4f8f6;
}
.word-list-tab {
  min-width: 96px;
  padding: 9px 18px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #607068;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  transition: color .15s, background .15s, box-shadow .15s;
}
.word-list-tab:hover { color: #146c45; }
.word-list-tab.active {
  color: #146c45;
  background: #fff;
  box-shadow: 0 2px 8px rgba(18,95,61,.1);
}
.wordbook-empty {
  text-align: center;
  padding: 64px 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 2.2;
}
.wordbook-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.word-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.word-card {
  background: white;
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 14px rgba(0,0,0,0.06);
  border: 1px solid rgba(229,231,235,0.8);
  position: relative;
}
.word-card-jp {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 19px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}
.word-card-zh {
  font-size: 13px;
  color: #4b5563;
  line-height: 1.6;
}
.word-card-reading {
  color: #708078;
  font-size: 12px;
  margin: -2px 0 6px;
}
.word-card-date {
  font-size: 10.5px;
  color: #9ca3af;
  margin-top: 8px;
}
.word-card-del {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: #d1d5db;
  font-size: 15px;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
  transition: color 0.15s;
}
.word-card-del:hover {
  color: #f87171;
}
/* T-D10: word-card 升级 */
.word-card-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 4px;
  align-items: center;
}
.word-card-dict {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.word-card-dict:hover { opacity: 1; }
.word-card--linked { border-color: #c4b5fd; }
.word-card-mastery {
  font-size: 10px;
  font-weight: 600;
  color: #7c3aed;
  margin-left: 6px;
  vertical-align: middle;
}

/* ── 词典入口按钮（生词本页头部）── */
.dict-nav-btn {
  font-size: 13px;
  font-weight: 600;
  color: #146c45;
  background: #e8f6ee;
  border: 1px solid #b9dfc9;
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.dict-nav-btn:hover { background: #d8f0e2; }

/* ── T-D08: dictSearchScreen ── */
.dict-search-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 24px 100px;
}
.dict-search-head {
  margin-bottom: 20px;
}
.dict-search-head h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.dict-search-sub {
  min-height: 18px;
  color: #708078;
  font-size: 13px;
}
.dict-search-sub:empty { display: none; }
.dict-search-bar-wrap {
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}
.dict-search-input {
  width: 100%;
  box-sizing: border-box;
  font-size: 16px;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  background: white;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dict-search-input:focus { border-color: #19985b; box-shadow: 0 0 0 4px rgba(25,152,91,.12); }
.dict-search-submit {
  min-width: 88px;
  border: 1px solid #178653;
  border-radius: 12px;
  background: #178653;
  color: #fff;
  font-weight: 750;
  padding: 0 20px;
}
.dict-search-submit:hover { background: #126d44; border-color: #126d44; }
.dict-history-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 26px;
  margin: -8px 2px 10px;
}
.dict-results-back,
.dict-history-clear {
  border: 0;
  background: transparent;
  color: #708078;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 0;
}
.dict-results-back {
  color: #146c45;
  cursor: pointer;
}
.dict-results-back:hover { color: #0c5334; }
.dict-history-clear:hover { color: #b42318; }
.dict-result-list { display: flex; flex-direction: column; gap: 8px; }
.dict-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: #fff;
  border: 1px solid #dfe8e3;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dict-result-item:hover {
  border-color: #47ad78;
  background: #f7fcf9;
  box-shadow: 0 4px 14px rgba(23,134,83,.1);
}
.dict-result-item.latest { border-left: 4px solid #27a768; }
.dict-result-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dict-result-save-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid #9bd1b3;
  background: #fff;
  color: #178653;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, border-color .15s, color .15s;
}
.dict-result-save-btn:hover { background: #eef9f3; border-color: #47ad78; }
.dict-result-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.dict-result-jp {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: #146c45;
}
.dict-match-keyword {
  color: #111827;
  background: transparent;
  padding: 0;
  font-weight: 850;
}
.dict-result-reading {
  font-size: 13px;
  color: #6b7280;
}
.dict-result-pos {
  font-size: 11px;
  color: #9ca3af;
  background: #f3f4f6;
  border-radius: 4px;
  padding: 1px 6px;
}
.dict-result-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-align: right;
}
.dict-result-zh {
  font-size: 13px;
  color: #4b5563;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dict-result-pct {
  font-size: 11px;
  font-weight: 700;
  color: #178653;
  white-space: nowrap;
}
.dict-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  font-size: 14px;
}

/* ── T-D09: dictEntryScreen ── */
.dict-entry-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 24px 100px;
}
.dict-entry-header {
  padding: 24px 20px;
  background: linear-gradient(135deg, #f2fbf6 0%, #e5f6ec 100%);
  border-radius: 16px;
  margin-bottom: 20px;
  border: 1px solid #c3e6d1;
}
.dict-entry-jp-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}
.dict-entry-jp {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: #125f3d;
}
.dict-entry-reading {
  font-size: 16px;
  color: #24865a;
}
.dict-entry-pos {
  font-size: 13px;
  color: #39815e;
  margin-bottom: 8px;
  font-weight: 600;
}
.dict-entry-body { display: flex; flex-direction: column; gap: 16px; }
.dict-entry-section {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 18px 20px;
}
.dict-entry-section-title {
  font-size: 12px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}
.dict-entry-meaning {
  font-size: 15px;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 4px;
}
.dict-entry-note {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}
.dict-entry-meaning-en {
  font-size: 13.5px;
  color: #6b7280;
  line-height: 1.6;
  margin-top: 2px;
  margin-bottom: 4px;
}
.dict-entry-example {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f3f4f6;
}
.dict-entry-example:last-child { margin-bottom: 0; border-bottom: none; padding-bottom: 0; }
.dict-entry-ex-jp {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 14px;
  color: #1f2937;
  line-height: 1.8;
  margin-bottom: 2px;
}
.dict-entry-ex-zh {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.6;
}
/* linked questions */
.dict-entry-qlist { display: flex; flex-direction: column; gap: 6px; }
.dict-entry-qitem {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 6px 10px;
  background: #f9fafb;
  border-radius: 7px;
}
.dict-entry-qid { font-family: monospace; color: #178653; font-weight: 600; }
.dict-entry-qstat { color: #6b7280; font-size: 12px; }
/* action buttons */
.dict-entry-actions {
  display: flex;
  padding-top: 4px;
}
.dict-favorite-btn,
.dict-save-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color .15s, color .15s;
}
.dict-favorite-btn {
  color: #146c45;
  background: #fff;
  border: 1px solid #9bd1b3;
}
.dict-favorite-btn:hover { background: #eef9f3; border-color: #47ad78; }
.dict-favorite-btn.saved { background: #e6f7ed; border-color: #47ad78; }
.dict-save-btn {
  color: white;
  background: #178653;
  border: 1px solid #178653;
}
.dict-save-btn:hover { background: #126d44; }
.dict-save-btn.saved { background: #10b981; }
.dict-save-btn.saved:hover { background: #059669; }

/* ── Tip 词典详情按钮 ── */
.tip-dict-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 9px 16px;
  background: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #ddd6fe;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
}
.tip-dict-btn:hover { background: #ede9fe; }

/* ── 练习进度与成绩 ── */
.practice-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -6px 0 8px;
  padding: 10px 12px;
  background: #f8f7ff;
  border: 1px solid #ede9fe;
  border-radius: 10px;
}
.practice-progress {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}
.practice-progress-group {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}
.practice-lookup-hint {
  margin: -2px 0 8px;
  padding: 8px 10px;
  border: 1px solid #ddd6fe;
  border-radius: 9px;
  background: #faf5ff;
  color: #6d28d9;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.55;
}
.practice-scope {
  color: #6b7280;
  font-size: 10.5px;
  font-weight: 600;
}
.retry-btn {
  border: 1px solid #c4b5fd;
  background: white;
  color: #6d28d9;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.retry-btn:hover {
  background: #ede9fe;
}
.practice-result {
  display: none;
  margin: 12px 0 4px;
  padding: 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  border: 1px solid #c4b5fd;
}
.practice-result.show {
  display: block;
  animation: fadeIn 0.2s ease;
}
.result-score {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
}
.result-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.result-mistakes {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.8;
  color: #4b5563;
}
.progress-tag {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 8px;
  background: #ede9fe;
  color: #6d28d9;
}
.progress-tag.complete {
  background: #dcfce7;
  color: #15803d;
}

/* ── 错题本 ── */
.mistake-cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mistake-card {
  background: white;
  border-radius: 14px;
  padding: 18px 20px;
  border: 1px solid #fecaca;
  box-shadow: 0 4px 14px rgba(0,0,0,0.05);
}
.mistake-card.learning {
  border-color: #fde68a;
}
.mistake-card.mastered {
  border-color: #bbf7d0;
}
.mistake-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.mistake-type {
  font-size: 10px;
  font-weight: 800;
  color: #dc2626;
  background: #fef2f2;
  padding: 3px 8px;
  border-radius: 8px;
}
.mistake-stage {
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.mistake-stage.review {
  color: #dc2626;
  background: #fef2f2;
}
.mistake-stage.learning {
  color: #a16207;
  background: #fef9c3;
}
.mistake-stage.mastered {
  color: #15803d;
  background: #dcfce7;
}
.mistake-question {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 14px;
  line-height: 1.8;
  color: #1f2937;
}
.mistake-answer {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.8;
  color: #6b7280;
}
.mistake-answer .wrong-text {
  color: #dc2626;
}
.mistake-answer .correct-text {
  color: #059669;
}
.mistake-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #e5e7eb;
  font-size: 11px;
  color: #6b7280;
}
.mistake-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.mistake-remove-btn {
  border: 1px solid #fecaca;
  background: #fff;
  color: #dc2626;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.mistake-remove-btn:hover {
  background: #fef2f2;
}


/* ═══════════════════════════════════════════════════════════
   Desktop dashboard home screen  (v2 – refactored)
   ═══════════════════════════════════════════════════════════ */

/* ── Design tokens (dashboard only, scoped with .home-full) ── */
body.at-home {
  --dp: #18A95B;
  --dp-dark: #108B49;
  --dp-soft: #EAF8F0;
  --dp-bg: #ffffff;
  --dp-surface: #FFFFFF;
  --dp-text: #151515;
  --dp-muted: #6F7379;
  --dp-border: #E9EBE9;
  --dp-black-card: #141414;
  --dp-warning: #F5A800;
  --dp-reading: #60A5FA;
  --dp-listening: #F04444;
}

/* ── Home screen: full viewport shell ── */
#homeScreen.active {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.home-full {
  display: flex;
  width: 100%;
  height: 100%;
  background: var(--dp-bg, #ffffff);
  font-family: Inter, "Noto Sans SC", "Noto Sans JP", system-ui, sans-serif;
}

/* ══════════════════════════
   Sidebar
══════════════════════════ */
.dash-sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--dp-surface, #fff);
  border-right: 1px solid var(--dp-border, #E9EBE9);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.dash-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 22px 18px 18px;
  border-bottom: 1px solid var(--dp-border, #E9EBE9);
}

.dash-logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #18A95B, #0E7A41);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dash-logo-name {
  font-size: 15px;
  font-weight: 700;
  color: #151515;
  letter-spacing: -0.2px;
}

.dash-logo-sub {
  font-size: 10.5px;
  color: #9CA3AF;
  margin-top: 1px;
}

.dash-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 10px;
  flex: 1;
}

.dash-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #6F7379;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s, box-shadow 0.12s;
  position: relative;
  font-family: inherit;
}

.dash-nav-item:hover:not(:disabled) {
  background: #F3F4F6;
  color: #151515;
}

.dash-nav-item.active {
  background: #EAF8F0;
  color: #18A95B;
  font-weight: 600;
}

.dash-nav-item.active .nav-icon { stroke: #18A95B; }

.dash-nav-item:disabled {
  opacity: 0.4;
  cursor: default;
}

.nav-icon {
  flex-shrink: 0;
  stroke: currentColor;
}

.dash-badge {
  margin-left: auto;
  background: #60A5FA;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
  line-height: 1.6;
}

/* ══════════════════════════
   Main area
══════════════════════════ */
.home-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Top bar ── */
.home-topbar {
  height: 64px;
  flex-shrink: 0;
  background: var(--dp-surface, #fff);
  border-bottom: 1px solid var(--dp-border, #E9EBE9);
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 14px;
}

.home-topbar-title {
  font-size: 30px;
  font-weight: 700;
  color: #151515;
  flex: 1;
  margin: 0;
  letter-spacing: -0.5px;
  line-height: 1;
}

.home-topbar-right {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.level-dropdown {
  -webkit-appearance: none;
  appearance: none;
  background: #F3F4F6 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 10 7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236F7379' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid var(--dp-border, #E9EBE9);
  border-radius: 20px;
  padding: 6px 28px 6px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #151515;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.12s;
}

.level-dropdown:focus {
  border-color: #18A95B;
  outline: none;
  box-shadow: 0 0 0 3px rgba(24,169,91,0.12);
}

.streak-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #FFF7ED;
  border: 1px solid #FED7AA;
  border-radius: 20px;
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 700;
  color: #C2410C;
  white-space: nowrap;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s, transform 0.12s;
}
.streak-badge:hover {
  border-color: #FDBA74;
  background: #FFF3E4;
  transform: translateY(-1px);
}
.streak-badge:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.14);
}
.streak-badge.is-active {
  border-color: #FDBA74;
  background: #FFF1E2;
  color: #B9380A;
}
.streak-badge-flame {
  font-size: 15px;
  line-height: 1;
  transform: translateY(-0.5px);
}

.streak-panel {
  position: absolute;
  z-index: 120;
  top: calc(100% + 12px);
  right: 44px;
  width: 320px;
  padding: 18px;
  border: 1px solid #F1E4D8;
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.98);
  color: #2B211B;
  box-shadow: 0 18px 50px rgba(71, 45, 25, 0.17), 0 3px 12px rgba(71, 45, 25, 0.07);
  animation: streak-panel-in 0.16s ease-out both;
  transform-origin: top right;
}
.streak-panel-arrow {
  position: absolute;
  top: -7px;
  right: 34px;
  width: 13px;
  height: 13px;
  transform: rotate(45deg);
  border-top: 1px solid #F1E4D8;
  border-left: 1px solid #F1E4D8;
  background: #FFFFFF;
}
@keyframes streak-panel-in {
  from { opacity: 0; transform: translateY(-5px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.streak-panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.streak-panel-flame {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  border-radius: 13px;
  background: #FFF1E2;
  color: #E85D04;
  font-size: 22px;
}
.streak-panel-title { font-size: 13px; font-weight: 700; color: #8A5A3B; }
.streak-panel-count { margin-top: 1px; font-size: 24px; font-weight: 800; color: #2A1B12; line-height: 1.15; }
.streak-panel-status {
  margin: 14px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #FFF8F1;
  color: #8A4B27;
  font-size: 12px;
  line-height: 1.45;
}
.streak-calendar {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #F0E7E0;
  border-radius: 13px;
  background: #FFFDFC;
}
.streak-calendar-head {
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  align-items: center;
  margin-bottom: 8px;
}
.streak-calendar-head strong { text-align: center; color: #443126; font-size: 13px; }
.streak-calendar-head button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0 0 2px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #986B4F;
  font: inherit;
  font-size: 22px;
  cursor: pointer;
}
.streak-calendar-head button:hover:not(:disabled) { background: #FFF1E2; color: #D94D00; }
.streak-calendar-head button:disabled { opacity: 0.24; cursor: default; }
.streak-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}
.streak-calendar-weekday {
  padding: 3px 0 5px;
  color: #A28E81;
  font-size: 9.5px;
  font-weight: 700;
  text-align: center;
}
.streak-calendar-day {
  position: relative;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #66554B;
  font-size: 11px;
  font-weight: 650;
}
.streak-calendar-day.outside { color: #D2C8C1; }
.streak-calendar-day.future { color: #D8D0CB; }
.streak-calendar-day.today {
  box-shadow: inset 0 0 0 1.5px #F59E5B;
  color: #C2410C;
}
.streak-calendar-day.studied {
  background: #FFF1E2;
  color: #B9380A;
}
.streak-calendar-day.studied.today { background: #FFE7CF; }
.streak-calendar-day i {
  position: absolute;
  right: 1px;
  bottom: 0;
  font-style: normal;
  font-size: 8px;
  line-height: 1;
}
.streak-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}
.streak-stat {
  padding: 10px 12px;
  border: 1px solid #F0EBE7;
  border-radius: 10px;
  background: #FCFBFA;
}
.streak-stat strong { display: block; color: #35271F; font-size: 17px; }
.streak-stat span { display: block; margin-top: 2px; color: #9A887C; font-size: 10.5px; }
.streak-rule { margin: 12px 1px 0; color: #9A887C; font-size: 10.5px; line-height: 1.5; }

.user-avatar-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  padding: 0;
  background: #eaf8f0;
  border: 1.5px solid #d7f0e2;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #149451;
  overflow: hidden;
  transition: background 0.12s, border-color 0.12s, transform 0.12s;
  flex-shrink: 0;
}

.user-avatar-btn:hover { background: #dcf5e7; border-color: #b8e7cd; transform: translateY(-1px); }
.user-avatar-mark { display: grid; place-items: center; width: 100%; height: 100%; }
.user-avatar-mark img,
.backend-user-initial img { width: 100%; height: 100%; object-fit: cover; }

/* ── Home body ── */
.home-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 32px 48px;
  background: var(--dp-bg, #ffffff);
}

.dash-inner {
  max-width: 1280px;
  margin: 0 auto;
}

/* ── Dashboard 2-col grid ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 20px;
  align-items: start;
}

.dash-col-left,
.dash-col-right {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

/* ── Dash card base ── */
.dash-card {
  background: var(--dp-surface, #fff);
  border-radius: 16px;
  padding: 14px 18px;
  border: 1px solid var(--dp-border, #E9EBE9);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 2px 8px rgba(0,0,0,0.04);
  text-align: left;
  font-family: inherit;
  color: #151515;
}

.dash-card-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #9CA3AF;
}

.dash-card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  font-size: 12px;
  font-weight: 500;
  color: #18A95B;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.section-more-btn:hover { text-decoration: underline; }

/* ══════════════════════════
   Mastery card (JS-rendered)
══════════════════════════ */
.mastery-card { padding: 24px; }

.mastery-hd {
  display: flex;
  align-items: center;
  gap: 28px;
}

/* 掌握度左边的大数字和右边的趋势图之前各自用 flex:1/固定宽度撑在卡片
   两端，卡片本身又是首页 3fr 宽列，中间就空出一大片留白，看起来很散。
   现在让左边只占内容自身宽度，趋势图接在它右边紧跟着占满剩余空间，
   两块视觉上连成一组，卡片多出来的宽度体现在趋势图变宽，而不是变成
   中间的空白。 */
.mastery-hd-left { flex: 0 0 auto; min-width: 0; }

.mastery-card-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #9CA3AF;
  margin-bottom: 6px;
}

.mastery-pct {
  font-size: 84px;
  font-weight: 700;
  color: #60A5FA;
  line-height: 1;
  letter-spacing: -2px;
  margin-bottom: 5px;
  font-family: Inter, system-ui, sans-serif;
}

/* 掌握度锁定态：用一条蓝色虚线代替"0%"数字（非会员往往已经免费做了不少
   题，写死"0%"会被误读成真实成绩就是0）。整块高度跟 .mastery-pct 的 84px
   字号占用的行高对齐，保证锁定态/空状态/真实数据三种卡片高度一致不跳动，
   虚线本身在这份高度里竖直居中。第一版用了30px高的粗色块，用户反馈"太丑"，
   改成6px的细线，粗细上更接近右边.mastery-empty-chart那几条虚线的观感。 */
.mastery-pct-locked-bar {
  height: 84px;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
}
.mastery-pct-locked-bar::before {
  content: "";
  display: block;
  width: 132px;
  height: 6px;
  border-radius: 3px;
  background: repeating-linear-gradient(90deg, #60A5FA 0 20px, transparent 20px 32px);
}

/* 之前用固定宽度+上限百分比，图右边到卡片边框的距离就是"剩下多少算多少"，
   跟左边数字到图的固定 28px 间距（.mastery-hd 的 gap）没有关系，宽屏下
   右边空得明显比左边多。改成 flex:1 让图自动撑满到卡片内边距为止，右边
   实际间距 = 卡片自己的 24px padding，再加 4px 的 margin-right 凑成 28px，
   跟左边的 28px 间距对齐。 */
.mastery-chart-wrap {
  flex: 1;
  min-width: 0;
  margin-right: 4px;
}

/* 高度固定写死，不再跟着 aspect-ratio 随宽度联动——图要拉宽的时候如果
   还用 aspect-ratio，宽度一变高度也会跟着变。SVG 上的
   preserveAspectRatio="none"（见 dashboard.js）配合这个固定高度，让
   曲线在变宽的框里横向拉伸，纵向高度不受影响。 */
.mastery-chart {
  width: 100%;
  height: 130px;
  overflow: visible;
  display: block;
}

/* Mastery empty state：数字直接用 .mastery-pct 本身样式显示"0%"，占同样
   84px 大字号的高度，两种状态切换卡片不会跳动。

   图占位区尺寸完全对齐 .mastery-chart（同样 100% 宽、130px 高）。 */
.mastery-empty-chart {
  position: relative;
  width: 100%;
  height: 130px;
}

.mastery-empty-chart > span {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: repeating-linear-gradient(90deg, #E5E7EB 0 4px, transparent 4px 8px);
}
/* 4条线加上下两段留白一共切成5等份，包括顶部/底部留白在内间距都一样——
   之前顶部留白只有12px、中间三段间距却有36px，肉眼看就是不均匀。 */
.mastery-empty-chart > span:nth-child(1) { top: 20%; }
.mastery-empty-chart > span:nth-child(2) { top: 40%; }
.mastery-empty-chart > span:nth-child(3) { top: 60%; }
.mastery-empty-chart > span:nth-child(4) { top: 80%; }

/* 掌握度趋势锁定态（会员权益，见 server/api/router.mjs 的 /student/overview
   非会员分支 + 程序文件/student/dashboard.js）。主体骨架直接复用上面的
   .mastery-empty-chart 空状态视觉（0% + 虚线占位图），不单独加锁图标或
   醒目色块——首版用黄底黑框+锁图标在深色卡片上太突兀，改成卡片底部一行
   不抢视觉的小字说明，跟卡片其余部分同一种克制的视觉重量。 */
.mastery-locked-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: #9CA3AF;
}
.mastery-locked-link {
  background: none;
  border: none;
  padding: 0;
  margin-left: 4px;
  color: #60A5FA;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ══════════════════════════
   Today card
══════════════════════════ */
.today-card {
  background: var(--dp-black-card, #141414);
  border-color: var(--dp-black-card, #141414);
  padding: 20px 22px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  width: 100%;
}

.today-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.22);
}

.today-card:focus-visible {
  outline: 2px solid #18A95B;
  outline-offset: 3px;
}

.today-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.today-icon-wrap {
  width: 34px;
  height: 34px;
  background: rgba(24,169,91,0.15);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.today-header-text { flex: 1; }

.today-title {
  font-size: 15px;
  font-weight: 700;
  color: white;
  margin-bottom: 3px;
}

.today-meta {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
}

.today-mascot { display: none; }


.today-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.today-tag {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  white-space: nowrap;
}

.today-tag em {
  font-style: normal;
  color: rgba(255,255,255,0.9);
  font-weight: 600;
}

/* ══════════════════════════
   Library covers
══════════════════════════ */
.lib-section-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.lib-section-title {
  font-size: 16px;
  font-weight: 700;
  color: #151515;
}

.lib-covers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.lib-cover-card {
  border: 1px solid var(--dp-border, #E9EBE9);
  border-radius: 14px;
  overflow: hidden;
  background: white;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  padding: 0;
  transition: transform 0.13s, box-shadow 0.13s;
  position: relative;
  /* Portrait card — image fills the whole card */
  aspect-ratio: 3/4;
}

.lib-cover-card:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
}

.lib-cover-card:disabled {
  opacity: 0.55;
  cursor: default;
}

/* Full-bleed image */
.lib-cover-art {
  position: absolute;
  inset: 0;
}

.lib-cover-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

/* Text sits in the natural soft/empty upper area of each image */
.lib-cover-footer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px 14px 12px;
}

.lib-cover-title {
  font-size: 15px;
  font-weight: 700;
  color: #2d2d2d;
  margin-bottom: 3px;
  line-height: 1.2;
}

.lib-cover-desc {
  font-size: 11px;
  color: rgba(0,0,0,0.45);
  line-height: 1.4;
}

/* ══════════════════════════
   Ability analysis (1×4 row)
══════════════════════════ */
.ability-card { padding: 20px 22px 22px; }
.ability-card .dash-card-hd { margin-bottom: 18px; }

.ability-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.ability-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.ability-circle-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
}

.ability-circle-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}

.ability-grade-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #151515;
  letter-spacing: -0.5px;
}

.ability-name-text {
  font-size: 12px;
  color: #6F7379;
  font-weight: 500;
  text-align: center;
}

.ability-sample-text {
  min-height: 14px;
  font-size: 10px;
  line-height: 1.3;
  color: #9CA3AF;
  text-align: center;
  white-space: nowrap;
}

.ability-item.no-data .ability-grade-text { color: #9CA3AF; }

/* ══════════════════════════
   Full learning analysis
══════════════════════════ */
.analysis-page {
  width: min(1060px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 100px;
  color: #1D2939;
}

.analysis-hero,
.analysis-section,
.analysis-next-step {
  border: 1px solid #E8ECEB;
  background: #FFF;
  box-shadow: 0 2px 12px rgba(25, 42, 35, 0.045);
}

.analysis-hero {
  padding: 30px;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 90% 0%, rgba(86, 184, 137, 0.12), transparent 30%),
    #FFF;
}

.analysis-hero-top,
.analysis-section-heading,
.analysis-next-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.analysis-eyebrow {
  margin: 0 0 6px;
  color: #18A95B;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.analysis-hero h2,
.analysis-section h3,
.analysis-next-step h3 {
  margin: 0;
  color: #182018;
  letter-spacing: -0.035em;
}

.analysis-hero h2 { font-size: clamp(28px, 4vw, 38px); }
.analysis-caption {
  margin: 10px 0 0;
  color: #7A8480;
  font-size: 14px;
}

.analysis-hero-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.analysis-level-chip,
.analysis-primary-action,
.analysis-next-button {
  border-radius: 12px;
  min-height: 42px;
  padding: 0 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}
.analysis-level-chip { background: #FFF; border: 1px solid #DFE6E1; color: #53605A; }
.analysis-primary-action,
.analysis-next-button { border: 1px solid #182018; background: #182018; color: #FFF; }
.analysis-level-chip:hover { border-color: #8CA497; color: #182018; }
.analysis-primary-action:hover,
.analysis-next-button:hover { background: #2B3B31; }

.analysis-overview-grid {
  display: grid;
  grid-template-columns: minmax(160px, 0.85fr) minmax(260px, 1.7fr) minmax(150px, 0.8fr);
  gap: 14px;
  margin-top: 30px;
}

.analysis-overall,
.analysis-trend-card,
.analysis-data-summary {
  min-height: 150px;
  padding: 20px;
  border: 1px solid #EDF1EE;
  border-radius: 18px;
  background: rgba(250, 253, 251, 0.82);
}
.analysis-overall,
.analysis-data-summary { display: flex; flex-direction: column; justify-content: center; }
.analysis-overall > span,
.analysis-data-summary > span,
.analysis-trend-heading span { color: #77827C; font-size: 13px; font-weight: 650; }
.analysis-overall strong { margin-top: 5px; color: #18A95B; font-size: 47px; letter-spacing: -0.06em; line-height: 1; }
.analysis-overall small,
.analysis-data-summary small,
.analysis-trend-heading small { margin-top: 8px; color: #98A19C; font-size: 12px; line-height: 1.5; }
.analysis-data-summary strong { margin-top: 8px; color: #25312A; font-size: 36px; letter-spacing: -0.05em; line-height: 1; }

.analysis-trend-card { display: flex; flex-direction: column; }
.analysis-trend-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.analysis-trend-heading small { margin: 0; text-align: right; }
.analysis-trend-line {
  flex: 1;
  min-height: 76px;
  display: flex;
  align-items: flex-end;
  gap: 7px;
  margin-top: 14px;
  padding: 0 2px 4px;
  border-bottom: 1px dashed #D6E5DB;
}
.analysis-trend-line i { display: block; flex: 1; height: var(--trend-height); min-height: 8px; max-height: 100%; border-radius: 7px 7px 2px 2px; background: linear-gradient(180deg, #4CC47F, #D9F4E4); }
.analysis-trend-line em { align-self: center; color: #A4ADA7; font-size: 13px; font-style: normal; }

.analysis-section { margin-top: 18px; padding: 28px; border-radius: 24px; }
.analysis-section-heading { margin-bottom: 20px; }
.analysis-section h3 { font-size: 21px; }
.analysis-subject-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.analysis-subject-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid #E7ECE9;
  border-radius: 17px;
  background: #FFF;
  color: #26332B;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.analysis-subject-card:hover { transform: translateY(-2px); border-color: var(--analysis-color); box-shadow: 0 9px 20px rgba(32, 62, 44, 0.09); }
.analysis-subject-card.is-priority { border-color: color-mix(in srgb, var(--analysis-color) 58%, #FFF); background: color-mix(in srgb, var(--analysis-color) 7%, #FFF); }
.analysis-subject-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.analysis-subject-name { font-size: 15px; font-weight: 800; }
.analysis-priority { padding: 3px 6px; border-radius: 999px; background: rgba(24, 169, 91, 0.12); color: #159053; font-size: 10px; font-weight: 800; white-space: nowrap; }
.analysis-subject-value { display: block; margin-top: 16px; color: var(--analysis-color); font-size: 31px; line-height: 1; letter-spacing: -0.055em; }
.analysis-subject-hint { display: block; min-height: 35px; margin-top: 10px; color: #818A85; font-size: 11.5px; line-height: 1.5; }
.analysis-meter { display: block; height: 7px; overflow: hidden; margin-top: 15px; border-radius: 999px; background: #EDF1EE; }
.analysis-meter i { display: block; width: var(--analysis-value); height: 100%; border-radius: inherit; background: var(--analysis-color); }
.analysis-practice-link { display: block; margin-top: 15px; color: #44534A; font-size: 12px; font-weight: 750; }
.analysis-practice-link b { color: var(--analysis-color); font-size: 15px; }

.analysis-next-step { margin-top: 18px; padding: 24px 28px; border-radius: 22px; background: linear-gradient(110deg, #F3FCF6, #FFF); }
.analysis-next-icon { flex: 0 0 auto; display: grid; width: 40px; height: 40px; place-items: center; border-radius: 13px; background: #DBF4E5; color: #159053; font-size: 19px; }
.analysis-next-step > div:nth-child(2) { flex: 1; }
.analysis-next-step h3 { font-size: 19px; }
.analysis-next-step p:last-child { max-width: 700px; margin: 8px 0 0; color: #657169; font-size: 13px; line-height: 1.7; }

@media (max-width: 760px) {
  .analysis-page { width: min(100% - 28px, 620px); padding-top: 22px; }
  .analysis-hero, .analysis-section { padding: 21px; border-radius: 18px; }
  .analysis-hero-top, .analysis-next-step { align-items: flex-start; flex-direction: column; }
  .analysis-hero-actions { width: 100%; }
  .analysis-hero-actions button { flex: 1; }
  .analysis-overview-grid { grid-template-columns: 1fr 1fr; }
  .analysis-trend-card { grid-column: 1 / -1; min-height: 135px; }
  .analysis-subject-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analysis-next-step { padding: 22px; }
  .analysis-next-button { width: 100%; }
}

@media (max-width: 430px) {
  .analysis-page { width: calc(100% - 22px); }
  .analysis-overview-grid { grid-template-columns: 1fr; }
  .analysis-trend-card { grid-column: auto; }
  .analysis-subject-grid { gap: 9px; }
  .analysis-subject-card { padding: 14px; }
  .analysis-subject-value { font-size: 27px; }
}

/* ══════════════════════════
   Mock exam card
══════════════════════════ */
.mock-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--dp-border, #E9EBE9);
  width: 100%;
}

.mock-card-soon { background: #FCFDFC; }

.mock-art { flex-shrink: 0; }

.mock-body { flex: 1; min-width: 0; }

.mock-title {
  font-size: 15px;
  font-weight: 700;
  color: #151515;
}

.mock-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.mock-soon-badge {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 650;
  color: #A95E1C;
  background: #FFF1E2;
}

.mock-status {
  margin: 0;
  font-size: 12.5px;
  color: #7A7E84;
}

/* ══════════════════════════
   Daily sentence card
══════════════════════════ */
.sentence-card { padding: 20px 22px; }

.sentence-hd-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sentence-daily-tag {
  font-size: 11px;
  background: #EAF8F0;
  color: #18A95B;
  border-radius: 999px;
  padding: 2px 8px;
  font-weight: 600;
}

.sentence-jp {
  font-size: 17px;
  color: #151515;
  font-family: "Noto Sans JP", "Noto Sans SC", sans-serif;
  line-height: 1.8;
  margin-bottom: 8px;
  margin-top: 4px;
}

.sentence-zh {
  font-size: 13px;
  color: #6F7379;
  margin-bottom: 16px;
  line-height: 1.6;
}

.sentence-footer {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sentence-play-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #EAF8F0;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s;
}

.sentence-play-btn:hover { background: #D1F0E0; }

.sentence-breakdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1.5px solid #18A95B;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: #18A95B;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
}

.sentence-breakdown-btn:hover { background: #EAF8F0; }

/* ══════════════════════════
   Responsive
══════════════════════════ */
@media (max-width: 1100px) {
  .dashboard-grid { grid-template-columns: 55% 1fr; }
  .lib-covers { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 900px) {
  .dash-sidebar { width: 60px; }
  .dash-logo-text, .dash-nav-item > span:not(.dash-badge) { display: none; }
  .dash-nav-item { justify-content: center; padding: 11px; }
  .dash-badge { position: absolute; top: 4px; right: 4px; margin: 0; }
  .home-topbar { padding: 0 18px; }
  .home-topbar-title { font-size: 22px; }
  .home-body { padding: 18px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .lib-covers { grid-template-columns: repeat(2, 1fr); }
  .ability-row { grid-template-columns: repeat(4, 1fr); }
}

/* 独立手机入口（mobile-preview.html）：不是在电脑页面里嵌套预览框，
   而是同一套学习页面以固定手机画布直接运行。 */
html[data-mobile-view="true"] { background: #edf1ef; }
html[data-mobile-view="true"] body {
  width: min(390px, 100vw);
  min-height: 844px;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
  background: var(--dp-bg, #fff);
  box-shadow: 0 0 0 1px rgba(21, 33, 26, .08), 0 20px 50px rgba(21, 33, 26, .18);
}
html[data-mobile-view="true"] .dash-sidebar { width: 60px; }
html[data-mobile-view="true"] .dash-logo { padding: 18px 10px; justify-content: center; }
html[data-mobile-view="true"] .dash-logo-text,
html[data-mobile-view="true"] .dash-nav-item > span:not(.dash-badge) { display: none; }
html[data-mobile-view="true"] .dash-nav-item { justify-content: center; padding: 11px; }
html[data-mobile-view="true"] .home-topbar { padding: 0 18px; }
html[data-mobile-view="true"] .home-topbar-title { font-size: 22px; }
html[data-mobile-view="true"] .home-body { padding: 18px; }
html[data-mobile-view="true"] .dashboard-grid { grid-template-columns: 1fr; }
html[data-mobile-view="true"] .lib-covers { grid-template-columns: repeat(2, 1fr); }
html[data-mobile-view="true"] .ability-row { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 390px) {
  html[data-mobile-view="true"] body { width: 100vw; box-shadow: none; }
}

@media (max-width: 600px) {
  .lib-covers { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════════════════════════════════════════════════════════
   Today Detail Screen
══════════════════════════════════════════════════════════════════ */

#todayScreen.active {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* 单词、词典与词条详情沿用首页左栏；只有进入实际做题流程才隐藏导航。 */
#wordbookScreen.active,
#dictSearchScreen.active,
#dictEntryScreen.active,
#appearanceScreen.active {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.persistent-dashboard-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: var(--dp-bg, #fff);
}

/* ── Back button in topbar ── */
.tday-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.tday-back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px 6px 8px;
  background: none;
  border: 1px solid var(--dp-border, #E9EBE9);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #6F7379;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
  flex-shrink: 0;
}
.tday-back-btn:hover { background: #F3F4F6; color: #151515; }
.tday-back-btn:focus-visible { outline: 2px solid #18A95B; outline-offset: 2px; }

/* ── Content wrapper ── */
.today-content {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 24px;
}

/* ── Plan card ── */
.tday-plan-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.tday-plan-title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.tday-plan-title {
  font-size: 17px;
  font-weight: 700;
  color: #151515;
  margin-bottom: 4px;
}
.tday-plan-meta {
  font-size: 13px;
  color: #6F7379;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tday-skip-info {
  font-size: 12px;
  color: #F5A800;
  background: #FFF7ED;
  border: 1px solid #FED7AA;
  border-radius: 999px;
  padding: 1px 8px;
}
.tday-plan-tag {
  font-size: 12px;
  color: #18A95B;
  background: #EAF8F0;
  border: 1px solid rgba(24,169,91,0.18);
  border-radius: 999px;
  padding: 5px 13px;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 500;
}

/* ── Plan items list ── */
/* 2-column card grid */
.tday-items {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.tday-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--dp-border, #E9EBE9);
  border-radius: 10px;
  transition: background 0.1s;
}
.tday-item:hover { background: #FAFAFA; }
.tday-item--skipped { opacity: 0.38; }
.tday-item--skipped .tday-item-name { text-decoration: line-through; }

.tday-item-top {
  display: flex;
  align-items: center;
  gap: 7px;
}
.tday-item-icon {
  color: #9CA3AF;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.tday-item-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #151515;
}
/* student.html（today-plan.js）已经不再渲染这个元素——理由文字移到了
   "为什么这样安排？"卡片里；这条规则留着是因为本地版 app.js 的今日推荐
   是独立实现，仍然渲染同名的 .tday-item-reason，两边共用这份样式表。 */
.tday-item-reason {
  font-size: 11.5px;
  color: #9CA3AF;
  line-height: 1.4;
}
.tday-item-bottom {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #6B7280;
}
.tday-item-dot { color: #D1D5DB; }
.tday-item-count { font-weight: 600; color: #374151; }
.tday-item-time {
  font-size: 12px;
  color: #9CA3AF;
  white-space: nowrap;
}
.tday-skip-btn {
  font-size: 11px;
  color: #9CA3AF;
  background: none;
  border: 1px solid var(--dp-border, #E9EBE9);
  border-radius: 5px;
  padding: 2px 7px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
  flex-shrink: 0;
}
.tday-skip-btn:hover { background: #F3F4F6; color: #374151; border-color: #D1D5DB; }

/* ── Section label ── */
.tday-card-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #9CA3AF;
  margin-bottom: 16px;
}

/* ── Adjust card ── */
.tday-adjust-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.tday-adjust-key {
  font-size: 14px;
  font-weight: 650;
  color: #374151;
  white-space: nowrap;
}
.tday-duration-choice {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
}
.tday-duration-control { position: relative; }
.tday-duration-trigger {
  min-width: 132px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 13px;
  border: 1.5px solid #DDE1DE;
  border-radius: 11px;
  background: #FFFFFF;
  color: #151515;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.tday-duration-trigger.muted { color: #747A76; background: #F8FAF8; }
.tday-duration-trigger:hover,
.tday-duration-trigger:focus-visible {
  border-color: #55B97D;
  box-shadow: 0 0 0 3px rgba(24, 169, 91, 0.09);
  outline: none;
}
.tday-duration-trigger-label { font-size: 14px; font-weight: 700; }
.tday-duration-trigger-chevron { color: #7C837F; font-size: 16px; line-height: 1; }

.tday-unlimited-choice {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0 0 3px;
  border: 1.5px solid #DDE1DE;
  border-radius: 11px;
  background: #FFFFFF;
  color: #747A76;
  font-family: Georgia, serif;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: color 0.12s, border-color 0.12s, background 0.12s, box-shadow 0.12s, transform 0.12s;
}
.tday-unlimited-choice:hover {
  color: #168B4E;
  border-color: #8ACFA5;
  transform: translateY(-1px);
}
.tday-unlimited-choice.active {
  border-color: #3AB873;
  background: #ECF9F1;
  color: #138149;
  box-shadow: 0 0 0 3px rgba(24, 169, 91, 0.10);
}

.tday-duration-popover {
  position: absolute;
  z-index: 80;
  top: calc(100% + 11px);
  left: 50%;
  width: 258px;
  transform: translateX(-50%);
  padding: 0;
  border: 1px solid var(--popup-glass-border);
  border-radius: 18px;
  background: var(--popup-glass-bg);
  color: #151515;
  box-shadow: var(--popup-glass-shadow);
  -webkit-backdrop-filter: blur(38px) saturate(180%) contrast(108%);
  backdrop-filter: blur(38px) saturate(180%) contrast(108%);
  animation: tday-duration-popover-in 0.16s ease-out both;
  transform-origin: top center;
}
.tday-duration-popover[hidden] { display: none; }
.tday-duration-popover-arrow {
  position: absolute;
  top: -7px;
  left: 50%;
  width: 13px;
  height: 13px;
  transform: translateX(-50%) rotate(45deg);
  border-top: 1px solid rgba(255, 255, 255, 0.74);
  border-left: 1px solid rgba(255, 255, 255, 0.74);
  background: rgba(251, 255, 253, 0.22);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
@keyframes tday-duration-popover-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-5px) scale(0.97); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
.tday-duration-dialog-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px 10px;
  border-bottom: 1px solid rgba(210, 223, 216, 0.54);
  background: rgba(255, 255, 255, 0.08);
}
.tday-duration-dialog-head strong { font-size: 13px; text-align: left; }
.tday-duration-dialog-head button {
  padding: 4px 0;
  border: 0;
  background: none;
  color: #6F7379;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.tday-duration-dialog-head button.confirm {
  color: #168B4E;
  font-weight: 750;
}
.tday-duration-wheel-wrap {
  position: relative;
  margin: 4px 18px 0;
}
.tday-duration-wheel-wrap::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 0;
  right: 0;
  height: 44px;
  transform: translateY(-50%);
  border-top: 1px solid rgba(183, 214, 196, 0.54);
  border-bottom: 1px solid rgba(183, 214, 196, 0.54);
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(230, 248, 238, 0.24), rgba(255, 255, 255, 0.14), rgba(230, 248, 238, 0.24));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62);
  pointer-events: none;
}
.tday-duration-wheel {
  position: relative;
  z-index: 1;
  height: 176px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 70%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 70%, transparent);
}
.tday-duration-wheel::-webkit-scrollbar { display: none; }
.tday-wheel-spacer { height: 66px; }
.tday-wheel-option {
  width: 100%;
  height: 44px;
  display: block;
  scroll-snap-align: center;
  border: 0;
  background: transparent;
  color: #8B918D;
  font: inherit;
  font-size: 17px;
  cursor: pointer;
  transition: color 0.12s, font-size 0.12s, font-weight 0.12s;
}
.tday-wheel-option.selected { color: #151515; font-size: 20px; font-weight: 750; }
.tday-duration-hint {
  padding: 3px 16px 12px;
  color: #8B918D;
  font-size: 11.5px;
  text-align: center;
}

.tday-unlimited-timer {
  position: fixed;
  z-index: 1200;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(21, 21, 21, 0.92);
  color: #FFFFFF;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 12px;
  white-space: nowrap;
}
.tday-unlimited-timer strong {
  min-width: 68px;
  color: #8EE5B0;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.4px;
}

.tday-mode-notice-backdrop {
  position: fixed;
  z-index: 1300;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.4);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}
.tday-mode-notice {
  width: min(390px, 100%);
  padding: 24px;
  border-radius: 18px;
  background: #FFFFFF;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.25);
  text-align: center;
}
.tday-mode-notice-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 14px;
  background: #EDF9F2;
  color: #168B4E;
  font-size: 28px;
}
.tday-mode-notice-title { margin-bottom: 18px; color: #151515; font-size: 17px; font-weight: 750; }
.tday-mode-notice button {
  width: 100%;
  padding: 11px 16px;
  border: 0;
  border-radius: 11px;
  background: #151515;
  color: #FFFFFF;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.tday-agent-advice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  max-width: 290px;
  padding: 7px 11px;
  border: 1px solid #D7EFE1;
  border-radius: 9px;
  background: #F7FCF9;
  color: #177A48;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.tday-agent-advice span { font-size: 12px; font-weight: 700; }
.tday-agent-advice small { color: #6B8F79; font-size: 10.5px; line-height: 1.35; }
.tday-agent-advice.active { border-color: #69C88E; background: #EFFAF3; }
/* ── Mode selection ── */
.tday-mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.tday-mode-card {
  position: relative;
  text-align: left;
  background: #FAFAFA;
  border: 1.5px solid var(--dp-border, #E9EBE9);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.12s, background 0.12s;
}
.tday-mode-card:hover:not(.selected) { border-color: #D1D5DB; background: #F5F5F5; }
.tday-mode-card.selected { border-color: #18A95B; background: #F0FDF6; }
.tday-mode-card.unavailable {
  opacity: 0.56;
  cursor: not-allowed;
  border-style: dashed;
}
.tday-mode-card.unavailable:hover { border-color: var(--dp-border, #E9EBE9); background: #FAFAFA; }
.tday-mode-check {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 22px;
  height: 22px;
  background: #EAF8F0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tday-mode-icon {
  display: block;
  color: #9CA3AF;
  margin-bottom: 6px;
}
.tday-mode-card.selected .tday-mode-icon { color: #18A95B; }
.tday-mode-name {
  font-size: 14px;
  font-weight: 700;
  color: #151515;
  margin-bottom: 6px;
}
.tday-mode-desc {
  font-size: 12.5px;
  color: #6F7379;
  line-height: 1.55;
}

/* ── Why card: one natural Agent response instead of four repeated mode cards ── */
.tday-why-card { padding-bottom: 14px; }
.tday-why-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}
.tday-why-head .tday-card-label { margin-bottom: 0; }
.tday-ai-refresh-btn {
  flex-shrink: 0;
  padding: 5px 12px;
  border: 1px solid #DCEFE4;
  border-radius: 999px;
  background: #F7FCF9;
  color: #177A48;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.tday-ai-refresh-btn:hover:not(:disabled) { background: #EAF7EF; border-color: #B9E0C9; }
.tday-ai-refresh-btn:disabled { opacity: 0.6; cursor: default; }
.tday-ai-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #FBF7EC;
  color: #8A6D1F;
  font-size: 12px;
  line-height: 1.5;
}
.tday-ai-note button {
  flex-shrink: 0;
  padding: 3px 10px;
  border: 1px solid #E3C876;
  border-radius: 999px;
  background: #fff;
  color: #8A6D1F;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}
/* 整块之前是绿色渐变底+绿色边框，加上下面每行理由的模式名也是绿色，
   叠在一起绿得太满；按用户要求收窄成只留"Suno的安排说明"这一行绿色
   作为品牌点缀，卡片本身和逐项理由都改回中性灰白，跟页面其它卡片
   同一个基调。 */
.tday-agent-summary {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px 16px;
  border: 1px solid #EDF1EE;
  border-radius: 12px;
  background: #F9FAFB;
}
.tday-agent-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 9px;
  object-fit: cover;
}
.tday-agent-message {
  min-width: 0;
  color: #4B5563;
  font-size: 12.5px;
  line-height: 1.65;
}
.tday-agent-name {
  margin-bottom: 4px;
  color: #177A48;
  font-size: 12px;
  font-weight: 750;
}
.tday-agent-message p { margin: 0; }
.tday-agent-message p + p { margin-top: 5px; }

/* 每项安排的具体理由（原来贴在四张卡片上）集中列在这里，跟上面的总体
   说明用一条虚线隔开，每行"模式名 + 一句理由"。 */
.tday-agent-breakdown {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #E5E9E7;
}
.tday-agent-breakdown-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.tday-agent-breakdown-row strong {
  flex: 0 0 auto;
  min-width: 50px;
  color: #374151;
  font-size: 11.5px;
  font-weight: 700;
}
.tday-agent-breakdown-row span {
  min-width: 0;
  color: #4B5563;
  font-size: 12px;
  line-height: 1.55;
}

/* ── CTA bar ── */
.tday-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 2px 0 4px;
}
.tday-cta-meta {
  font-size: 13px;
  color: #9CA3AF;
}
.tday-start-btn {
  background: #151515;
  color: white;
  border: none;
  border-radius: 14px;
  padding: 16px 0;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, transform 0.12s, box-shadow 0.12s;
  width: 100%;
  max-width: 420px;
  letter-spacing: -0.2px;
}
.tday-start-btn:hover {
  background: #2d2d2d;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
}
.tday-start-btn:focus-visible { outline: 2px solid #18A95B; outline-offset: 3px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .tday-plan-hd { flex-direction: column; gap: 10px; }
  .tday-plan-tag { align-self: flex-start; }
  .tday-mode-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .tday-item-time { display: none; }
  .tday-item { padding: 10px; gap: 4px; }
  .tday-start-btn { border-radius: 12px; font-size: 15px; }
  .tday-adjust-row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .tday-agent-summary { padding: 12px; }
}

/* 手机版今日计划：先让用户看懂安排和完成关键选择，说明性内容后置。 */
html[data-mobile-view="true"] #todayScreen .home-full { padding-bottom: 0; }
html[data-mobile-view="true"] #todayScreen .home-topbar {
  height: 64px;
  min-height: 64px;
  padding: 0 14px;
}
html[data-mobile-view="true"] #todayScreen .tday-topbar-left { flex: 0 0 auto; }
html[data-mobile-view="true"] #todayScreen .tday-back-btn {
  min-height: 34px;
  padding: 6px 11px 6px 7px;
  border-radius: 10px;
}
html[data-mobile-view="true"] #todayScreen .home-topbar-right {
  margin-left: auto;
  padding-right: 0;
}
html[data-mobile-view="true"] #todayScreen .home-body {
  padding: 12px 12px 178px;
  background: var(--dp-bg, #fff);
}
html[data-mobile-view="true"] #todayScreen .today-content {
  gap: 9px;
  padding-bottom: 16px;
}
html[data-mobile-view="true"] #todayScreen .dash-card {
  border-radius: 17px;
  box-shadow: 0 4px 14px rgba(31, 52, 39, .045);
}
html[data-mobile-view="true"] #todayScreen .tday-plan-card { padding: 14px; }
html[data-mobile-view="true"] #todayScreen .tday-plan-hd {
  display: block;
  margin-bottom: 11px;
}
html[data-mobile-view="true"] #todayScreen .tday-plan-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
html[data-mobile-view="true"] #todayScreen .tday-plan-title {
  margin: 0;
  font-size: 17px;
  white-space: nowrap;
}
html[data-mobile-view="true"] #todayScreen .tday-plan-title-row .tday-cta-meta {
  overflow: hidden;
  color: #818a84;
  font-size: 10px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html[data-mobile-view="true"] #todayScreen .tday-plan-tag { display: none; }
html[data-mobile-view="true"] #todayScreen .tday-items {
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
html[data-mobile-view="true"] #todayScreen .tday-item {
  min-width: 0;
  gap: 7px;
  padding: 10px;
  border-radius: 12px;
  background: #fbfcfb;
}
html[data-mobile-view="true"] #todayScreen .tday-item-top { gap: 6px; }
html[data-mobile-view="true"] #todayScreen .tday-item-icon svg {
  width: 15px;
  height: 15px;
}
html[data-mobile-view="true"] #todayScreen .tday-item-name {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html[data-mobile-view="true"] #todayScreen .tday-skip-btn {
  padding: 2px 5px;
  border: 0;
  font-size: 9px;
  background: #f0f3f1;
}
html[data-mobile-view="true"] #todayScreen .tday-item-reason { display: none; }
html[data-mobile-view="true"] #todayScreen .tday-item-bottom {
  gap: 4px;
  padding-left: 21px;
  font-size: 10px;
}
html[data-mobile-view="true"] #todayScreen .tday-item-time {
  display: inline;
  font-size: 10px;
}
html[data-mobile-view="true"] #todayScreen .tday-control-card { padding: 11px 13px; }
html[data-mobile-view="true"] #todayScreen .tday-adjust-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 10px;
}
html[data-mobile-view="true"] #todayScreen .tday-adjust-key {
  font-size: 13px;
  white-space: normal;
}
html[data-mobile-view="true"] #todayScreen .tday-duration-choice { gap: 6px; }
html[data-mobile-view="true"] #todayScreen .tday-duration-trigger {
  min-width: 100px;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 10px;
}
html[data-mobile-view="true"] #todayScreen .tday-duration-trigger-label { font-size: 13px; }
html[data-mobile-view="true"] #todayScreen .tday-unlimited-choice {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 22px;
}
html[data-mobile-view="true"] #todayScreen .tday-agent-advice {
  grid-column: 1 / -1;
  max-width: none;
  padding: 7px 9px;
  border: 0;
  border-radius: 9px;
}
html[data-mobile-view="true"] #todayScreen .tday-agent-advice span { font-size: 11px; }
html[data-mobile-view="true"] #todayScreen .tday-agent-advice small {
  overflow: hidden;
  width: 100%;
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html[data-mobile-view="true"] #todayScreen .tday-mode-grid {
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
html[data-mobile-view="true"] #todayScreen .tday-mode-card {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-height: 47px;
  padding: 9px 10px;
  border-radius: 11px;
}
html[data-mobile-view="true"] #todayScreen .tday-mode-icon {
  width: 17px;
  height: 17px;
  margin: 0;
}
html[data-mobile-view="true"] #todayScreen .tday-mode-name {
  margin: 0;
  font-size: 12px;
}
html[data-mobile-view="true"] #todayScreen .tday-mode-desc { display: none; }
html[data-mobile-view="true"] #todayScreen .tday-mode-check {
  top: 5px;
  right: 5px;
  width: 17px;
  height: 17px;
}
html[data-mobile-view="true"] #todayScreen .tday-mode-check svg {
  width: 10px;
  height: 10px;
}
html[data-mobile-view="true"] #todayScreen .tday-cta {
  position: fixed;
  z-index: 490;
  right: max(12px, calc((100vw - 402px) / 2 + 12px));
  bottom: calc(max(10px, env(safe-area-inset-bottom)) + 75px);
  left: max(12px, calc((100vw - 402px) / 2 + 12px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 1.25fr);
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(220, 227, 222, .9);
  border-radius: 16px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 9px 25px rgba(25, 43, 33, .15);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  backdrop-filter: blur(18px) saturate(145%);
}
html[data-mobile-view="true"] #todayScreen .tday-cta-meta {
  font-size: 10px;
  line-height: 1.4;
  text-align: center;
}
html[data-mobile-view="true"] #todayScreen .tday-start-btn {
  min-height: 46px;
  padding: 11px 12px;
  border-radius: 12px;
  font-size: 14px;
}
html[data-mobile-view="true"] #todayScreen .tday-why-card { margin-top: 1px; }

:root[data-theme="dark"][data-mobile-view="true"] #todayScreen .tday-item,
:root[data-theme="dark"][data-mobile-view="true"] #todayScreen .tday-skip-btn {
  background: #17211b;
}
:root[data-theme="dark"][data-mobile-view="true"] #todayScreen .tday-cta {
  border-color: rgba(66, 82, 72, .88);
  background: rgba(15, 22, 18, .9);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .34);
}

/* ── Quiz Screen ─────────────────────────────────────────── */
#todayStartScreen.active {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #f4f5f7;
}

.quiz-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
  /* 默认整块禁止划词选中——之前没有这条，页面标题("语法练习")、"一键解析"
     按钮这类纯UI文字意外被拖拽选中后，会被"划词问AI"当成学生真的选中了
     一段日语内容，弹出"你划选了「一键解析」，有什么想问的？"这种没有意义
     的追问。只有题干原文和选项才需要能划词问AI，下面几条显式开回
     user-select:text，其余标题/按钮/徽章/反馈文案维持不可选中。 */
  user-select: none;
}
.quiz-shell .quiz-stem,
.quiz-shell .text-grammar-material,
.quiz-shell .text-grammar-choice {
  user-select: text;
}

/* Top bar */
.quiz-topbar {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  gap: 10px;
  background: #ffffff;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.quiz-back-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  color: #374151;
  border-radius: 8px;
  flex-shrink: 0;
  transition: background 0.12s;
}
.quiz-back-btn:hover { background: #f3f4f6; }
.quiz-back-btn:focus-visible { outline: 2px solid rgba(79,70,229,0.4); outline-offset: 2px; }

.quiz-title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  text-align: center;
  outline: none;
}

.session-mobile-meta { display: none; }

.quiz-counter {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
  min-width: 40px;
  text-align: right;
  flex-shrink: 0;
}

/* Progress bar */
.quiz-prog {
  height: 3px;
  background: #e5e7eb;
  flex-shrink: 0;
}
.quiz-prog-fill {
  height: 100%;
  background: #18A95B;
  transition: width 0.35s ease;
}

/* Scrollable body */
.quiz-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 手机版底部导航固定悬浮在画布上方。练习内容必须预留同等高度的
   可滚动安全区，用户滚到底时提交／下一题才能完整停在导航栏上方。 */
html[data-mobile-view="true"] #vocabSessionShell .quiz-body {
  padding-bottom: calc(112px + env(safe-area-inset-bottom));
  scroll-padding-bottom: calc(112px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

/* 手机练习页把等级和题型移进顶部标题位，删去“阅读练习”等重复标题。
   正文中的同一组标签隐藏；解析、复习、听力原文等操作仍留在正文。 */
html[data-mobile-view="true"] .session-responsive-title .session-desktop-title { display: none; }
html[data-mobile-view="true"] .session-responsive-title .session-mobile-meta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
html[data-mobile-view="true"] .session-responsive-title .quiz-tag-level,
html[data-mobile-view="true"] .session-responsive-title .quiz-tag-type {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  box-sizing: border-box;
  padding: 4px 9px;
  font-size: 11px;
  line-height: 1;
}
html[data-mobile-view="true"] #vocabSessionShell .quiz-q-card > .quiz-tags > .quiz-tag-level,
html[data-mobile-view="true"] #vocabSessionShell .quiz-q-card > .quiz-tags > .quiz-tag-type,
html[data-mobile-view="true"] .listening-library-shell .quiz-q-card > .quiz-tags > .quiz-tag-level,
html[data-mobile-view="true"] .listening-library-shell .quiz-q-card > .quiz-tags > .quiz-tag-type {
  display: none;
}
html[data-mobile-view="true"] #vocabSessionShell .quiz-q-card > .quiz-tags.mobile-meta-only,
html[data-mobile-view="true"] .listening-library-shell .quiz-q-card > .quiz-tags.mobile-meta-only {
  display: none;
}

/* Question card */
.quiz-q-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.quiz-tags {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.quiz-tag-level {
  background: #EEF2FF;
  color: #4f46e5;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
}
.quiz-tag-type {
  background: #F0FDF4;
  color: #16a34a;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
}
.quiz-tag-confirm {
  background: #FFF7D6;
  color: #A16207;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
}

.quiz-stem {
  font-size: 16px;
  line-height: 1.75;
  color: #111827;
  font-family: 'Noto Sans JP', sans-serif;
  margin-bottom: 20px;
  font-weight: 500;
}

/* 题目中文翻译：跟阅读"查看解析"按钮同一套绿色胶囊样式，保持答题反馈区
   整体视觉一致。按钮和翻译段落只在答完题、逐选项解析已解锁时才会被渲染
   出来（见 vocab-session.js），这里只负责默认隐藏 + 展开态的显示。 */
.quiz-translation-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: -10px 0 14px;
  padding: 4px 11px;
  border: 1px solid #bbf7d0;
  border-radius: 20px;
  background: #f0fdf4;
  color: #166534;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}
.quiz-translation-toggle:hover { background: #dcfce7; border-color: #86efac; }
.quiz-translation-toggle:focus-visible { outline: 2px solid #22c55e; outline-offset: 2px; }

.quiz-stem-zh {
  display: none;
  font-size: 15px;
  line-height: 1.65;
  color: #6b7280;
  margin: -14px 0 20px;
}
.quiz-q-card.translation-visible .quiz-stem-zh { display: block; }

/* 文章语法题干指令句的固定模板翻译：跟 .quiz-stem-zh 不同，这句不揭示
   任何答案，只是翻译"次の文章の【N】に入るものとして..."这句操作说明，
   所以不跟随"中文翻译"开关隐藏，随时可见。 */
.quiz-stem-instruction-zh {
  font-size: 14px;
  line-height: 1.65;
  color: #6b7280;
  margin: -14px 0 20px;
}

/* Options */
.quiz-opts {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  color: #374151;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.quiz-opt:hover:not([aria-disabled="true"]) {
  border-color: #a5b4fc;
  background: #f8f9ff;
}
.quiz-opt:focus-visible {
  outline: 2px solid rgba(79,70,229,0.4);
  outline-offset: 2px;
}

.quiz-opt-key {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.quiz-opt-txt {
  flex: 1;
  font-family: 'Noto Sans JP', sans-serif;
  /* 选项本身是 <button>，浏览器默认给表单控件加 user-select:none，划词
     选中一个字都选不了，划词问AI的功能因此永远等不到非空的 selection——
     这条不是JS逻辑漏掉了选项，是CSS一直没开放选中权限。跟本地旧版
     app.js 的 .option-jp-text/.q-text 同款规则（程序文件/styles.css里
     "user-select: text;" 那条）保持一致。 */
  user-select: text;
}

/* 选项右侧中文翻译：默认隐藏，点"中文翻译"按钮后跟题干翻译一起出现。
   max-width 只限制这一列自己的宽度，文字超长时在列内换行，不挤压左边的
   日语选项；.quiz-opt 本身没有设固定高度，换行后按钮跟着内容自动变高，
   不需要额外的 JS 去调整尺寸。 */
.quiz-opt-zh {
  display: none;
  flex: 0 1 42%;
  max-width: 42%;
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.4;
  color: #6b7280;
  text-align: right;
  white-space: normal;
}
.quiz-q-card.translation-visible .quiz-opt-zh { display: block; }

/* Selected */
.quiz-opt.selected {
  border-color: #4f46e5;
  background: #eef2ff;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.08);
}
.quiz-opt.selected .quiz-opt-key {
  background: #4f46e5;
  color: #ffffff;
}

/* Correct */
.quiz-opt.correct {
  border-color: #16a34a;
  background: #f0fdf4;
}
.quiz-opt.correct .quiz-opt-key {
  background: #16a34a;
  color: #ffffff;
}

/* Incorrect (user's wrong pick) */
.quiz-opt.incorrect {
  border-color: #dc2626;
  background: #fff1f2;
}
.quiz-opt.incorrect .quiz-opt-key {
  background: #dc2626;
  color: #ffffff;
}

.quiz-opt[aria-disabled="true"] { cursor: default; }

/* Feedback card */
.quiz-fb-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.quiz-fb-card.hidden { display: none; }

.quiz-fb-label {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
}
.quiz-fb-label.correct { color: #16a34a; }
.quiz-fb-label.incorrect { color: #dc2626; }

.quiz-fb-short-exp {
  font-size: 14px;
  line-height: 1.7;
  color: #374151;
  margin-bottom: 16px;
  font-family: 'Noto Sans JP', sans-serif;
}

.grammar-confirmation-note {
  margin: -4px 0 16px;
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  font-weight: 600;
}
.grammar-confirmation-note.pending {
  background: #FFF7D6;
  color: #854D0E;
  border: 1px solid #FDE68A;
}
.grammar-confirmation-note.resolved {
  background: #F0FDF4;
  color: #166534;
  border: 1px solid #BBF7D0;
}

/* Detail section */
.quiz-detail-section {
  display: none;
  flex-direction: column;
  gap: 14px;
  border-top: 1px solid #f0f0f0;
  margin-top: 2px;
  padding-top: 16px;
  margin-bottom: 16px;
}
.quiz-detail-section.open { display: flex; }

.quiz-detail-row { font-size: 14px; line-height: 1.7; color: #374151; font-family: 'Noto Sans JP', sans-serif; }
.quiz-detail-label { font-size: 12px; font-weight: 700; color: #6b7280; margin-bottom: 4px; letter-spacing: 0.03em; text-transform: uppercase; font-family: 'Inter', sans-serif; }

.quiz-wrong-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.quiz-wrong-opt-row { font-size: 13px; color: #6b7280; line-height: 1.65; }
.quiz-wrong-opt-row strong { color: #374151; }

.quiz-action-btn {
  padding: 8px 13px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  border: 1.5px solid #e5e7eb;
  background: #ffffff;
  color: #374151;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.quiz-action-btn:hover { background: #f3f4f6; border-color: #d1d5db; }
.quiz-action-btn:focus-visible { outline: 2px solid rgba(79,70,229,0.4); outline-offset: 2px; }

.quiz-action-btn.next-btn {
  background: #151515;
  color: #ffffff;
  border-color: #151515;
  margin-left: auto;
}
.quiz-action-btn.next-btn:hover { background: #2d2d2d; border-color: #2d2d2d; }

.quiz-action-btn.review-added {
  color: #16a34a;
  border-color: #86efac;
  background: #f0fdf4;
}

.quiz-submit-btn {
  width: 100%;
  padding: 15px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: background 0.12s, transform 0.12s;
  background: #151515;
  color: #ffffff;
}
.quiz-submit-btn:disabled {
  background: #d1d5db;
  color: #9ca3af;
  cursor: not-allowed;
}
.quiz-submit-btn:not(:disabled):hover {
  background: #2d2d2d;
  transform: translateY(-1px);
}
.quiz-submit-btn:focus-visible { outline: 2px solid rgba(79,70,229,0.4); outline-offset: 2px; }

/* ── Completion screen ── */
.quiz-done-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.quiz-done-stats {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.quiz-stat-cell { text-align: center; }
.quiz-stat-val {
  font-size: 30px;
  font-weight: 700;
  color: #111827;
  line-height: 1;
  margin-bottom: 5px;
}
.quiz-stat-val.green { color: #16a34a; }
.quiz-stat-val.red   { color: #dc2626; }
.quiz-stat-val.purple { color: #4f46e5; }
.quiz-stat-lbl { font-size: 12px; color: #6b7280; }

.quiz-done-section {
  background: #ffffff;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.quiz-done-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #6b7280;
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.quiz-wrong-item {
  padding: 12px 0;
  border-bottom: 1px solid #f3f4f6;
}
.quiz-wrong-item:last-child { border-bottom: none; padding-bottom: 0; }

.quiz-wrong-q {
  font-size: 14px;
  color: #111827;
  font-family: 'Noto Sans JP', sans-serif;
  line-height: 1.65;
  margin-bottom: 6px;
}
.quiz-wrong-ans { display: flex; gap: 16px; font-size: 13px; }
.quiz-wrong-your  { color: #dc2626; }
.quiz-wrong-right { color: #16a34a; }

.quiz-done-no-wrong {
  text-align: center;
  padding: 20px 0;
  color: #16a34a;
  font-size: 15px;
  font-weight: 600;
}

.quiz-done-actions {
  display: flex;
  gap: 12px;
  padding-bottom: 4px;
}
.quiz-done-btn {
  flex: 1;
  padding: 14px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: 1.5px solid #e5e7eb;
  background: #ffffff;
  color: #374151;
  cursor: pointer;
  transition: background 0.12s;
  text-align: center;
}
.quiz-done-btn:hover { background: #f3f4f6; }
.quiz-done-btn.primary {
  background: #151515;
  color: #ffffff;
  border-color: #151515;
}
.quiz-done-btn.primary:hover { background: #2d2d2d; border-color: #2d2d2d; }
.quiz-done-btn:focus-visible { outline: 2px solid rgba(79,70,229,0.4); outline-offset: 2px; }

@media (max-width: 480px) {
  .quiz-action-btn.next-btn { margin-left: 0; width: 100%; justify-content: center; }
  .quiz-done-actions { flex-direction: column; }
}

/* quiz completion → reading CTA */
.quiz-done-reading-cta { padding: 0 0 4px; }
.quiz-done-btn.reading-cta {
  background: #f0fdf4;
  color: #16a34a;
  border-color: #86efac;
  width: 100%;
  font-size: 14px;
}
.quiz-done-btn.reading-cta:hover { background: #dcfce7; }

/* Challenge completion actions stack vertically */
.quiz-done-actions.challenge-actions { flex-direction: column; }

/* ── Vocabulary / Grammar / Reading / Listening Home Screens ───── */
#vocabularyScreen.active,
#vocabSessionScreen.active,
#grammarScreen.active,
#readingHomeScreen.active,
#listeningHomeScreen.active {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #fff;
}
.vh-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}
.vh-topbar {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  gap: 10px;
  background: #ffffff;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.vh-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
/* Progress card */
.vh-prog-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.vh-prog-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.vh-prog-text { font-size: 14px; color: #374151; }
.vh-prog-text strong { color: #111827; font-size: 16px; }
.vh-prog-pct { font-size: 13px; color: #6b7280; font-weight: 600; }
.vh-prog-bar {
  height: 6px;
  background: #e5e7eb;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 12px;
}
.vh-prog-fill {
  height: 100%;
  background: #18A95B;
  border-radius: 99px;
  transition: width 0.4s ease;
}
.vh-prog-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}
.vh-pstat {
  font-size: 12px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 20px;
}
.vh-pstat.mastered { background: #d1fae5; color: #065f46; }
.vh-pstat.learning { background: #dbeafe; color: #1e40af; }
.vh-pstat.weak     { background: #fee2e2; color: #991b1b; }
.vh-pstat.untried  { background: #f3f4f6; color: #6b7280; }
/* Mode cards */
.vh-modes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.vh-mode-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 2px solid transparent;
  text-align: left;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.vh-mode-card:hover:not(.disabled) { border-color: #c7d2fe; }
.vh-mode-card.sel { border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
.vh-mode-card.disabled { opacity: 0.45; cursor: not-allowed; }
.listening-section-card {
  padding: 0;
  overflow: hidden;
  cursor: default;
}
.listening-section-select {
  display: block;
  width: 100%;
  padding: 16px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.listening-section-kicker {
  margin-bottom: 3px;
  color: #6d28d9;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
}
.listening-section-guide {
  padding: 14px 16px 16px;
  border-top: 1px solid #e5e7eb;
  background: #fafafa;
}
.listening-section-guide p {
  margin: 0 0 12px;
  color: #4b5563;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.65;
}
.listening-section-start {
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-radius: 10px;
  background: #4f46e5;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.listening-section-start:hover { background: #4338ca; }
.listening-format-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 12px;
  color: #4b5563;
  font-size: 12px;
  font-weight: 700;
}
.listening-home-note {
  margin: -2px 0 12px;
  padding: 11px 14px;
  border-radius: 12px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.55;
}
.vh-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
}
.vh-card-icon { font-size: 22px; flex-shrink: 0; }
.vh-card-body { flex: 1; min-width: 0; }
.vh-card-name { font-size: 15px; font-weight: 600; color: #111827; margin-bottom: 2px; }
.vh-card-desc { font-size: 12px; color: #6b7280; line-height: 1.4; }
.vh-card-count { font-size: 12px; font-weight: 600; color: #4f46e5; flex-shrink: 0; }
.vh-card-count.zero { color: #9ca3af; }
.vh-card-count.done { color: #16a34a; }
.vh-card-count.partial { color: #d97706; }
.vh-empty { text-align: center; color: #9ca3af; padding: 32px 0; font-size: 14px; }
/* Size picker (expands inside selected card) */
.vh-picker {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e5e7eb;
}
.vh-picker-label { font-size: 12px; color: #6b7280; margin-bottom: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.vh-picker-btns { display: flex; gap: 10px; }
.vh-picker-btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1.5px solid #4f46e5;
  background: #4f46e5;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s;
}
.vh-picker-btn:hover { background: #4338ca; border-color: #4338ca; }
.vh-picker-btn:focus-visible { outline: 2px solid rgba(79,70,229,0.4); outline-offset: 2px; }

/* ── Practice home: black cards, white text (applies in both light & dark mode) ── */
/* Shell + body: always white */
.light-home,
.light-home .vh-body { background: #fff; }
/* Topbar stays on white background */
.light-home .vh-topbar  { background: #fff; border-bottom-color: #e5e7eb; }
.light-home .quiz-title { color: #111827; }
.light-home .quiz-back-btn { color: #374151; }
/* Cards: black */
.light-home .vh-prog-card,
.light-home .vh-mode-card {
  background: #111827;
  border-color: transparent;
  box-shadow: none;
}
.light-home .vh-prog-text         { color: rgba(255,255,255,0.75); }
.light-home .vh-prog-text strong  { color: #fff; }
.light-home .vh-prog-pct          { color: rgba(255,255,255,0.5); }
.light-home .vh-prog-bar          { background: rgba(255,255,255,0.15); }
.light-home .vh-card-name         { color: #fff; }
.light-home .vh-card-desc         { color: rgba(255,255,255,0.55); }
.light-home .vh-card-count        { color: #a5b4fc; }
.light-home .vh-card-count.done   { color: #6ee7b7; }
.light-home .vh-card-count.partial{ color: #fcd34d; }
.light-home .vh-card-count.zero   { color: rgba(255,255,255,0.3); }
.light-home .vh-pstat.untried     { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.55); }
.light-home .vh-picker            { border-top-color: rgba(255,255,255,0.15); }
.light-home .vh-mode-card:hover:not(.disabled) { border-color: rgba(255,255,255,0.25); }
.light-home .vh-mode-card.sel     { border-color: #818cf8; box-shadow: 0 0 0 3px rgba(129,140,248,0.25); }
.light-home .vh-empty             { color: rgba(255,255,255,0.4); }

/* Dark mode (generic vh components only — light-home overrides above already win) */
@media (prefers-color-scheme: dark) {
  .vh-prog-card, .vh-mode-card { background: #1f2937; }
  .vh-topbar { background: #111827; border-bottom-color: #374151; }
  .vh-prog-text { color: #d1d5db; }
  .vh-prog-text strong { color: #f3f4f6; }
  .vh-prog-bar { background: #374151; }
  .vh-card-name { color: #f3f4f6; }
  .vh-card-desc { color: #9ca3af; }
  .vh-mode-card:hover:not(.disabled) { border-color: #6366f1; }
  .vh-mode-card.sel { border-color: #818cf8; box-shadow: 0 0 0 3px rgba(129,140,248,0.15); }
  .vh-pstat.untried { background: #374151; color: #9ca3af; }
  .vh-picker { border-top-color: #374151; }
  .vh-card-count.done { color: #4ade80; }
  .vh-card-count.partial { color: #fbbf24; }
  /* All practice + session screens stay white even in dark mode */
  #vocabularyScreen.active, #grammarScreen.active,
  #readingHomeScreen.active, #listeningHomeScreen.active,
  #vocabSessionScreen.active, #readingScreen.active, #listeningScreen.active { background: #fff; }
  .light-home { background: #fff; }
}

/* ── Reading Passage Screen ──────────────────────────────────── */
#readingPassageScreen.active {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #f4f5f7;
}

.rdg-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Top bar */
.rdg-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #ffffff;
  border-bottom: 1px solid #f0f0f0;
}
.rdg-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.rdg-topbar-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.rdg-topbar-label {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
}
.rdg-topbar-meta {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 500;
}
.rdg-q-counter {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Mobile tab bar (hidden on desktop) */
.rdg-tab-bar {
  flex-shrink: 0;
  display: flex;
  background: #ffffff;
  border-bottom: 1px solid #f0f0f0;
}
.rdg-tab {
  flex: 1;
  padding: 10px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.rdg-tab.active { color: #18A95B; border-bottom-color: #18A95B; }
.rdg-tab:focus-visible { outline: 2px solid rgba(79,70,229,0.4); outline-offset: -2px; }

/* Body */
.rdg-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Layout: default is column (mobile) */
.rdg-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  flex: 1;
}

/* Mobile: only active pane shown */
.rdg-pane { display: none; }
.rdg-pane--active { display: block; }

/* Article card */
.rdg-article-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 22px 20px 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.rdg-article-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.rdg-article-meta {
  font-size: 11px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rdg-font-tools { display: flex; gap: 5px; }
.rdg-font-btn {
  padding: 4px 9px;
  border: 1.5px solid #e5e7eb;
  border-radius: 7px;
  background: #ffffff;
  font-size: 12px;
  font-weight: 700;
  color: #374151;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
  line-height: 1.3;
}
.rdg-font-btn:hover { background: #f3f4f6; border-color: #d1d5db; }
.rdg-font-btn:focus-visible { outline: 2px solid rgba(79,70,229,0.4); outline-offset: 2px; }

.rdg-title {
  font-size: 19px;
  font-weight: 700;
  color: #111827;
  font-family: 'Noto Sans JP', sans-serif;
  line-height: 1.55;
  margin-bottom: 22px;
  outline: none;
}

/* Paragraphs */
.rdg-paragraphs {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.rdg-para {
  display: flex;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 10px;
  transition: background 0.25s;
  scroll-margin-top: 12px;
}
.rdg-para--highlighted { background: transparent; }
.rdg-para-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f3f4f6;
  color: #9ca3af;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}
.rdg-para-text {
  font-size: var(--rdg-font-size, 17px);
  line-height: 1.95;
  color: #1a1a2e;
  font-family: 'Noto Sans JP', sans-serif;
  flex: 1;
  min-width: 0;
}

/* Full analysis (collapsed by default) */
.rdg-full-analysis {
  display: none;
  flex-direction: column;
  gap: 24px;
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid #f0f0f0;
}
.rdg-full-analysis.open { display: flex; }

.rdg-fa-section { }
.rdg-fa-title {
  font-size: 11px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f3f4f6;
}
.rdg-analysis-para { margin-bottom: 14px; }
.rdg-analysis-para:last-child { margin-bottom: 0; }
.rdg-analysis-para-num {
  font-size: 11px;
  font-weight: 700;
  color: #9ca3af;
  margin-bottom: 4px;
}
.rdg-analysis-para-trans {
  font-size: 16px;
  line-height: 1.85;
  color: #374151;
}

.rdg-vocab-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 14px;
}
.rdg-vocab-row:last-child { border-bottom: none; }
.rdg-vocab-word { font-weight: 700; color: #111827; font-family: 'Noto Sans JP', sans-serif; }
.rdg-vocab-reading { color: #6b7280; font-family: 'Noto Sans JP', sans-serif; font-size: 13px; }
.rdg-vocab-meaning { color: #374151; margin-left: auto; }

.rdg-grammar-row {
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
}
.rdg-grammar-row:last-child { border-bottom: none; }
.rdg-grammar-pattern {
  font-size: 14px;
  font-weight: 700;
  color: #4f46e5;
  font-family: 'Noto Sans JP', sans-serif;
  margin-bottom: 5px;
}
.rdg-grammar-example {
  font-size: 13px;
  color: #374151;
  font-family: 'Noto Sans JP', sans-serif;
  line-height: 1.65;
  margin-bottom: 3px;
}
.rdg-grammar-exp { font-size: 13px; color: #6b7280; line-height: 1.6; }

/* Question panel */
.rdg-q-panel {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.rdg-q-num {
  font-size: 11px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}
.rdg-q-stem {
  font-size: 15px;
  line-height: 1.75;
  color: #111827;
  font-family: 'Noto Sans JP', sans-serif;
  margin-bottom: 16px;
  font-weight: 500;
}

.rdg-goto-para-wrap { margin-bottom: 14px; }
.rdg-goto-para-btn {
  display: none; /* mobile-only, enabled via @media */
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: #16a34a;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
}
.rdg-goto-para-btn:hover { background: #dcfce7; }

.rdg-submit-bar { margin-top: 16px; }
.rdg-fb-label-mt { margin-top: 16px; }

/* 阅读题的反馈不是一个遥远的“页面底部”。操作栏紧贴在答案下方：
   左边控制解析，右边负责进入下一题；展开后的解析在同一题卡内阅读。 */
.rdg-feedback-summary { margin-top: 16px; }
.rdg-feedback-commandbar {
  position: sticky;
  z-index: 3;
  bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 13px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 8px 20px rgba(15,23,42,.09);
  backdrop-filter: blur(12px);
}
.rdg-feedback-left-actions { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.rdg-detail-toggle { color: #166534; border-color: #bbf7d0; background: #f0fdf4; }
.rdg-detail-toggle:hover { color: #14532d; border-color: #86efac; background: #dcfce7; }
.rdg-next-btn { margin-left: auto; flex: 0 0 auto; min-width: 112px; justify-content: center; }
.rdg-detail-section {
  margin-top: 12px;
  margin-bottom: 0;
  padding: 20px;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
  box-shadow: 0 8px 24px rgba(15,23,42,.06);
}
.rdg-detail-section.open { display: flex; }
.rdg-detail-section .quiz-detail-row { font-size: 15px; line-height: 1.8; }
.rdg-detail-section .quiz-detail-label { font-size: 12px; }
.rdg-detail-heading { font-size: 15px; font-weight: 750; color: #1e293b; margin-bottom: 2px; }

/* 阅读解析：一眼先看题目中文，再逐项比对日文、中文与原文依据。 */
.reading-analysis-intro {
  display: grid;
  gap: 6px;
  padding: 13px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #eff6ff;
}
.reading-analysis-kicker { color: #1d4ed8; font-size: 12px; font-weight: 800; }
.reading-analysis-field-label,
.reading-analysis-option-label {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
}
.reading-analysis-question-jp { color: #1e293b; font-size: 15px; font-weight: 750; line-height: 1.6; }
.reading-analysis-question-zh { color: #475569; font-size: 14px; line-height: 1.65; }
.reading-analysis-list { display: grid; gap: 10px; margin-top: 14px; }
.reading-analysis-option {
  padding: 12px 13px;
  border: 1px solid #d8e1ec;
  border-radius: 12px;
  background: #fff;
}
.reading-analysis-option.correct { border-color: #86efac; background: #f0fdf4; }
.reading-analysis-option.incorrect { border-color: #e2e8f0; }
.reading-analysis-option-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; color: #1e293b; font-size: 14px; line-height: 1.55; }
.reading-analysis-option-head > span:last-child { flex: 0 0 auto; color: #64748b; font-size: 11px; font-weight: 750; }
.reading-analysis-option.correct .reading-analysis-option-head > span:last-child { color: #15803d; }
.reading-analysis-option-jp { margin: 5px 0 9px; color: #1e293b; font-size: 14px; font-weight: 700; line-height: 1.62; }
.reading-analysis-option-zh { margin: 4px 0 9px; color: #475569; font-size: 14px; line-height: 1.6; }
.reading-analysis-option-reason { margin: 4px 0 9px; color: #64748b; font-size: 13px; line-height: 1.62; }
.reading-analysis-option-evidence { margin: 4px 0 0; color: #166534; font-size: 13px; line-height: 1.62; }
.reading-analysis-option.correct .reading-analysis-option-reason { color: #166534; }

/* 学习库 → 阅读使用相同的就近解析布局，避免套用普通题目的左下固定按钮。 */
.reading-session-feedback { margin-top: 16px; }
.reading-feedback-commandbar {
  position: sticky;
  z-index: 3;
  bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 0;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 13px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 8px 20px rgba(15,23,42,.09);
  backdrop-filter: blur(12px);
}
.reading-detail-toggle { color: #166534; border-color: #bbf7d0; background: #f0fdf4; }
.reading-detail-toggle:hover { color: #14532d; border-color: #86efac; background: #dcfce7; }
.reading-next-btn { margin-left: auto; flex: 0 0 auto; min-width: 112px; justify-content: center; }
.reading-detail-section {
  margin: 12px 0 0;
  padding: 22px;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
  box-shadow: 0 8px 24px rgba(15,23,42,.06);
}
.reading-detail-section.open { display: flex; }
.reading-detail-section .quiz-detail-row { font-size: 15px; line-height: 1.82; }
.reading-detail-heading { font-size: 15px; font-weight: 750; color: #1e293b; margin-bottom: 2px; }

/* 学习库 → 阅读：把解析放进文章的左侧辅助栏。开关紧跟等级标签，
   下一题只贴在文章卡右下，避免用户答完后还要找页面底部的操作。 */
.reading-session-shell { max-width: 1020px; }
.reading-session-shell .quiz-body { padding-inline: 20px; }
.reading-top-detail-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
  padding: 3px 9px;
  border: 1px solid #bbf7d0;
  border-radius: 20px;
  background: #f0fdf4;
  color: #166534;
  font: inherit;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}
.reading-top-detail-toggle:hover { background: #dcfce7; border-color: #86efac; }
.reading-top-detail-toggle:focus-visible { outline: 2px solid #22c55e; outline-offset: 2px; }
.session-top-review-btn,
.listening-top-transcript-toggle {
  display: inline-flex;
  align-items: center;
  margin-left: 2px;
  padding: 3px 9px;
  border: 1px solid #d7e0eb;
  border-radius: 20px;
  background: #fff;
  color: #475569;
  font: inherit;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}
.session-top-review-btn:hover,
.listening-top-transcript-toggle:hover { border-color: #94a3b8; background: #f8fafc; color: #1e293b; }
.session-top-review-btn.review-added { color: #15803d; border-color: #86efac; background: #f0fdf4; }
.listening-top-transcript-toggle { color: #166534; border-color: #bbf7d0; background: #f0fdf4; }
.listening-top-transcript-toggle:hover { color: #14532d; border-color: #86efac; background: #dcfce7; }
.reading-study-stage { display: block; }
.reading-study-stage.analysis-open {
  display: grid;
  grid-template-columns: minmax(245px, .72fr) minmax(0, 1.45fr);
  align-items: start;
  gap: 16px;
}
.reading-side-analysis {
  display: none;
  padding: 20px;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  background: #f8fafc;
  box-shadow: 0 8px 24px rgba(15,23,42,.06);
}
.reading-side-analysis.open { display: block; }
.reading-side-analysis-heading { margin-bottom: 12px; color: #1e293b; font-size: 15px; font-weight: 800; }
.reading-side-analysis .quiz-detail-row { font-size: 15px; line-height: 1.82; }
.reading-side-analysis .quiz-detail-row + .quiz-detail-row { margin-top: 16px; }
.reading-article-column { min-width: 0; }
.reading-session-shell .reading-agent-material {
  margin-bottom: 0;
  padding: 24px;
  border-radius: 18px;
}
.reading-session-shell .reading-agent-material-body { font-size: 17px; line-height: 2.04; }
.reading-article-next-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
.reading-article-next-btn { min-width: 118px; justify-content: center; }
.reading-article-submit-btn:disabled {
  opacity: .44;
  cursor: not-allowed;
}

/* 学习库 → 听力：沿用阅读的页面骨架。音频是“材料区”，答题区和
   阅读题共用同一张题目卡及同一套标签、间距与操作位置。 */
.listening-library-shell { max-width: 1020px; }
.listening-library-shell .quiz-body { padding-inline: 20px; }
.listening-question-stage { padding: 24px; }
.listening-study-stage { display: block; }
.listening-agent-material {
  margin-bottom: 0;
  padding: 24px;
  border-radius: 18px;
}
.listening-material-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
  color: #1f2937;
}
.listening-material-heading strong { font-size: 15px; font-weight: 800; }
.listening-agent-material .lst-player-card {
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.listening-agent-material .lst-missing-audio {
  padding: 20px;
  border-radius: 12px;
  box-shadow: none;
  border: 1px dashed #cbd5e1;
}
.listening-library-shell .lst-q-card {
  margin-top: 20px;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.listening-library-shell .lst-q-card .rdg-q-num { margin-bottom: 8px; }
.listening-library-shell .lst-q-card .rdg-q-stem { margin-bottom: 18px; }
.listening-library-shell .listening-article-action-btn { min-width: 118px; }
.listening-study-stage.transcript-open {
  display: grid;
  grid-template-columns: minmax(270px, .86fr) minmax(0, 1.14fr);
  align-items: start;
  gap: 16px;
}
.listening-study-stage.transcript-open .listening-question-column { min-width: 0; }
.listening-study-stage.transcript-open .lst-q-card {
  margin-top: 0;
  min-height: 100%;
}
.listening-library-shell .lst-transcript-card {
  margin-top: 16px;
  padding: 18px 0 0;
  border-radius: 0;
  border-top: 1px solid #e5e7eb;
  box-shadow: none;
  background: transparent;
}

@media (max-width: 520px) {
  .rdg-feedback-commandbar { align-items: stretch; flex-direction: column; }
  .rdg-feedback-left-actions { width: 100%; }
  .rdg-feedback-left-actions .quiz-action-btn { flex: 1; justify-content: center; }
  .rdg-next-btn { width: 100%; }
  .reading-feedback-commandbar { align-items: stretch; flex-direction: column; }
  .reading-next-btn { width: 100%; }
}

/* Done-in-panel (full analysis view, question col) */
.rdg-done-inpanel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 16px;
  text-align: center;
}
.rdg-done-inpanel-title { font-size: 16px; font-weight: 700; color: #111827; }
.rdg-done-inpanel-stat { font-size: 14px; color: #6b7280; }
.rdg-done-inpanel-stat .green { color: #16a34a; font-weight: 600; }

/* Completion screen body */
.rdg-done-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 14px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}
.rdg-done-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.rdg-done-title {
  font-size: 17px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 22px;
  text-align: center;
}
.rdg-done-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}
.rdg-done-stat { text-align: center; }
.rdg-done-stat-val {
  font-size: 28px;
  font-weight: 700;
  color: #111827;
  line-height: 1;
  margin-bottom: 5px;
}
.rdg-done-stat-val.green { color: #16a34a; }
.rdg-done-stat-lbl { font-size: 12px; color: #6b7280; }
.rdg-done-keypoints-title {
  font-size: 11px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}
.rdg-done-keypoints { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.rdg-done-point {
  font-size: 14px;
  color: #374151;
  padding-left: 16px;
  position: relative;
  line-height: 1.65;
}
.rdg-done-point::before { content: '·'; position: absolute; left: 4px; color: #18A95B; font-weight: 700; font-size: 18px; line-height: 1.2; }
.rdg-done-actions { display: flex; gap: 12px; }

/* Desktop layout overrides */
@media (min-width: 769px) {
  .rdg-tab-bar { display: none; }

  .rdg-body { overflow: hidden; }

  .rdg-layout {
    flex-direction: row;
    gap: 20px;
    padding: 16px;
    max-width: 1180px;
    margin: 0 auto;
    width: 100%;
    height: 100%;
    overflow: hidden;
    flex: 1;
  }

  .rdg-article-col {
    flex: 0 0 58%;
    overflow-y: auto;
    min-width: 0;
    height: 100%;
  }
  .rdg-question-col {
    flex: 1;
    overflow-y: auto;
    min-width: 0;
    height: 100%;
  }

  /* Always show both panes */
  .rdg-pane { display: block !important; }

  /* "查看相关段落" only on mobile */
  .rdg-goto-para-btn { display: none !important; }

  .rdg-done-body { max-width: 680px; }
  .rdg-done-actions { flex-direction: row; }
}

@media (max-width: 768px) {
  .rdg-goto-para-btn { display: inline-flex; }
  .rdg-done-actions { flex-direction: column; }
  .rdg-article-card { padding: 18px 16px 20px; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Listening Passage Screen  (#listeningPassageScreen)
   ───────────────────────────────────────────────────────────────────────────── */

#listeningPassageScreen.active {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #f4f5f7;
}

.lst-shell { display: flex; flex-direction: column; height: 100%; overflow: hidden; }

.lst-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.lst-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 14px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Audio player card ── */
.lst-player-card {
  background: #fff;
  border-radius: 16px;
  padding: 18px 18px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.lst-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
}

.lst-scene-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.lst-play-count {
  font-size: 12px;
  color: #9ca3af;
  white-space: nowrap;
  flex-shrink: 0;
}

.lst-player-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.lst-play-btn {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #151515;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.lst-play-btn:hover  { background: #333; }
.lst-play-btn:focus-visible { outline: 2px solid rgba(79,70,229,0.4); outline-offset: 2px; }

.lst-player-right { flex: 1; min-width: 0; }

.lst-time-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.lst-time {
  font-size: 12px;
  color: #6b7280;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  width: 30px;
}
.lst-time-r { text-align: right; }

.lst-prog-bar {
  flex: 1;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  position: relative;
  cursor: pointer;
  touch-action: none;
}

.lst-prog-fill {
  height: 100%;
  background: #151515;
  border-radius: 3px;
  pointer-events: none;
}

.lst-prog-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #151515;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.12);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.lst-prog-bar:hover .lst-prog-thumb,
.lst-prog-bar.dragging .lst-prog-thumb { opacity: 1; }

.lst-controls-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lst-ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.lst-ctrl-btn:hover { background: #f3f4f6; border-color: #d1d5db; }

.lst-speed-btns { display: flex; gap: 4px; margin-left: auto; }

.lst-speed-btn {
  padding: 5px 8px;
  border: 1.5px solid #e5e7eb;
  border-radius: 7px;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
}
.lst-speed-btn.active {
  border-color: #151515;
  color: #151515;
  font-weight: 700;
  background: #f4f5f7;
}
.lst-speed-btn:hover:not(.active) { background: #f9fafb; }

/* ── Missing audio ── */
.lst-missing-audio {
  background: #fff;
  border-radius: 16px;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.lst-missing-title { font-size: 15px; font-weight: 600; color: #374151; }
.lst-missing-desc  { font-size: 13px; color: #6b7280; word-break: break-all; }
.lst-missing-desc code {
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
  color: #374151;
}

/* ── Question card ── */
.lst-q-card {
  background: #fff;
  border-radius: 16px;
  padding: 20px 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.lst-submit-bar {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

/* ── Keyword tags ── */
.lst-keywords { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 3px; }
.lst-keyword {
  display: inline-block;
  background: #eff2ff;
  color: #4338ca;
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
}

/* ── Transcript card ── */
.lst-transcript-card {
  background: #fff;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.lst-transcript-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.lst-transcript-title { font-size: 13px; font-weight: 700; color: #374151; }

.lst-trans-toggle {
  font-size: 12px;
  font-weight: 500;
  color: #4f46e5;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.lst-trans-toggle:hover { text-decoration: underline; }

.lst-sentences { display: flex; flex-direction: column; gap: 2px; }

.lst-sentence {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.2s;
}
.lst-sentence.active { background: rgba(24,169,91,0.06); }

.lst-sentence-play-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #374151;
  margin-top: 3px;
  transition: all 0.15s;
}
.lst-sentence-play-btn:hover { border-color: #9ca3af; background: #f3f4f6; }
.lst-sentence-play-btn.playing {
  border-color: #16a34a;
  background: #f0fdf4;
  color: #16a34a;
}

.lst-sentence-content { min-width: 0; }

.lst-sentence-speaker {
  font-size: 11px;
  font-weight: 700;
  color: #9ca3af;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.lst-sentence-jp {
  font-size: 15px;
  color: #111827;
  line-height: 1.75;
  font-family: 'Noto Sans JP', sans-serif;
}

.lst-sentence-cn { font-size: 13px; color: #6b7280; margin-top: 3px; display: none; }
.lst-sentence-cn.show { display: block; }

/* ── Sentence precision controls ── */
.lst-precision-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
  margin-top: 8px;
  flex-wrap: wrap;
}

.lst-prec-label { font-size: 12px; color: #9ca3af; margin-right: 2px; }

.lst-prec-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
}
.lst-prec-btn:hover:not(:disabled) { background: #f3f4f6; }
.lst-prec-btn:disabled { opacity: 0.38; cursor: not-allowed; }
.lst-prec-btn.active  { border-color: #16a34a; color: #16a34a; background: #f0fdf4; }

/* ── Review mode footer ── */
.lst-review-footer {
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
}

/* ── Responsive tweaks ── */
@media (min-width: 769px) {
  .lst-container { padding: 20px 0 48px; }
}
@media (max-width: 400px) {
  .lst-player-card { padding: 14px 14px 12px; }
  .lst-play-btn { width: 40px; height: 40px; }
  .lst-speed-btn { padding: 4px 6px; }
}

/* ── Loading spinner ── */
@keyframes lst-spin { to { transform: rotate(360deg); } }
.lst-loading-spin { animation: lst-spin 0.8s linear infinite; display: block; }
.lst-play-btn.loading { opacity: 0.65; cursor: wait; }

/* ── Speed toast ── */
.lst-speed-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
  z-index: 9999;
  animation: lst-toast-fade 0.9s ease forwards;
}
@keyframes lst-toast-fade {
  0%   { opacity: 0; transform: translateX(-50%) translateY(5px); }
  18%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  72%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── First-play hint ── */
.lst-play-hint {
  text-align: center;
  font-size: 12px;
  color: #9ca3af;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f3f4f6;
  letter-spacing: 0.01em;
}

/* ── Today completion banner ── */
.tday-complete-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 14px 16px;
  color: #15803d;
}
.tday-complete-banner svg { flex-shrink: 0; color: #16a34a; }
.tday-complete-title { font-weight: 700; font-size: 15px; }
.tday-complete-sub   { font-size: 13px; color: #4ade80; margin-top: 2px; }
@media (prefers-color-scheme: dark) {
  .tday-complete-banner {
    background: linear-gradient(135deg, #052e16, #14532d);
    border-color: #166534;
    color: #86efac;
  }
  .tday-complete-sub { color: #4ade80; }
}

/* ── JLPT saved reviews section (mistakes screen) ── */
.jlpt-rev-section { margin-bottom: 20px; }
.jlpt-rev-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  padding: 0 2px 10px;
}
.jlpt-rev-count {
  background: #e0f2fe;
  color: #0369a1;
  font-size: 12px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
}
.jlpt-rev-cards { display: flex; flex-direction: column; gap: 10px; }
.jlpt-rev-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 14px 10px;
}
.jlpt-rev-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.jlpt-rev-src {
  font-size: 11px;
  font-weight: 600;
  color: #0369a1;
  background: #e0f2fe;
  padding: 2px 8px;
  border-radius: 8px;
}
.jlpt-rev-date { font-size: 11px; color: #9ca3af; }
.jlpt-rev-q {
  font-size: 14px;
  font-weight: 500;
  color: #111827;
  margin-bottom: 8px;
  line-height: 1.55;
}
.jlpt-rev-opts {
  list-style: decimal;
  padding-left: 20px;
  margin: 0 0 8px;
  font-size: 13px;
  color: #374151;
  line-height: 1.7;
}
.jlpt-rev-opts li.jlpt-rev-correct { color: #16a34a; font-weight: 600; }
.jlpt-rev-exp {
  font-size: 12px;
  color: #6b7280;
  background: #f9fafb;
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 10px;
  line-height: 1.6;
}
.jlpt-rev-remove-btn {
  font-size: 12px;
  color: #9ca3af;
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 3px 10px;
  cursor: pointer;
}
.jlpt-rev-remove-btn:hover { color: #ef4444; border-color: #fca5a5; background: #fff5f5; }

/* ══════════════════════════════════════════════
   桌面端首页：绿色 → 黑白（≥861px）
   保留：今日推荐卡片（.today-card）、能力分析（.ability-card）
   移动端完全不受影响
══════════════════════════════════════════════ */
@media (min-width: 861px) {
  /* 侧边栏 Logo 图标 */
  .dash-logo-icon {
    background: linear-gradient(135deg, #374151, #1F2937);
  }

  /* 侧边栏当前选中项 */
  .dash-nav-item.active {
    background: #EFEFEF;
    color: #151515;
  }
  .dash-nav-item.active .nav-icon {
    stroke: #151515;
  }
  .dash-nav-item:focus-visible {
    border-color: #374151;
    box-shadow: 0 0 0 3px rgba(55,65,81,0.12);
  }

  /* "查看全部" / "查看详情" 小链接按钮 */
  .section-more-btn {
    color: #9CA3AF;
  }

  /* 掌握度卡片：桌面端与移动端统一用红色 */
  .mastery-pct {
    color: #60A5FA;
  }

  /* 模拟考试卡片：SVG 插图去色 */
  .mock-art {
    filter: grayscale(1) contrast(0.8) brightness(1.05);
  }

}

@media (prefers-color-scheme: dark) {
  .jlpt-rev-header { color: #d1d5db; }
  .jlpt-rev-card { background: #1f2937; border-color: #374151; }
  .jlpt-rev-q { color: #f3f4f6; }
  .jlpt-rev-opts { color: #d1d5db; }
  .jlpt-rev-exp { background: #111827; color: #9ca3af; }
  .jlpt-rev-remove-btn { border-color: #374151; color: #6b7280; }
}

/* ── 词典系统暗色模式 ── */
@media (prefers-color-scheme: dark) {
  .dict-search-input {
    background: #fff; color: #18251f; border-color: #cbdcd2;
  }
  .dict-search-input:focus { border-color: #19985b; }
  .dict-result-item {
    background: #fff; border-color: #dfe8e3; color: #18251f;
  }
  .dict-result-item:hover { border-color: #47ad78; background: #f7fcf9; }
  .dict-result-reading { color: #708078; }
  .dict-result-pos { background: #eef5f1; color: #708078; }
  .dict-result-zh { color: #42524a; }
  .dict-entry-header {
    background: linear-gradient(135deg, #f2fbf6 0%, #e5f6ec 100%);
    border-color: #c3e6d1;
  }
  .dict-entry-jp { color: #125f3d; }
  .dict-entry-reading { color: #24865a; }
  .dict-entry-pos { color: #39815e; }
  .dict-entry-section { background: #fff; border-color: #dfe8e3; }
  .dict-entry-meaning { color: #18251f; }
  .dict-entry-note { color: #708078; }
  .dict-entry-meaning-en { color: #708078; }
  .dict-entry-ex-jp { color: #18251f; }
  .dict-entry-ex-zh { color: #708078; }
  .dict-entry-example { border-bottom-color: #e8efeb; }
  .dict-entry-qitem { background: #f6faf8; }
  .dict-entry-qstat { color: #708078; }
  .dict-nav-btn {
    background: #e8f6ee; color: #146c45; border-color: #b9dfc9;
  }
  .dict-nav-btn:hover { background: #d8f0e2; }
  .tip-dict-btn {
    background: #1e1b4b; color: #c4b5fd; border-color: #4c1d95;
  }
  .tip-dict-btn:hover { background: #312e81; }
  .word-card--linked { border-color: #4c1d95; }
  .word-card-mastery { color: #a78bfa; }
  /* Quiz completion — keep light */
  .quiz-done-stats { background: #f9fafb; }
  .quiz-stat-val { color: #111827; }
  .quiz-done-section { background: #f9fafb; }
  .quiz-done-section-title { color: #6b7280; }
  .quiz-wrong-item { border-bottom-color: #e5e7eb; }
  .quiz-wrong-q { color: #111827; }
  .quiz-done-btn { background: #fff; color: #111827; border-color: #e5e7eb; }
  .quiz-done-btn:hover { background: #f3f4f6; }
  .quiz-done-btn.primary { background: #111827; color: #fff; border-color: #111827; }
  .quiz-done-btn.primary:hover { background: #1f2937; border-color: #1f2937; }
}

/* ── Sentence Breakdown Screen ───────────────────────────── */
#sentenceBreakdownScreen.active {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: #fff;
  overflow: hidden;
}
.sbd-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.sbd-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid #E9EBE9;
  background: #fff;
  flex-shrink: 0;
}
.sbd-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}
.sbd-refresh-btn {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: #6B7280;
  display: flex;
  align-items: center;
  border-radius: 8px;
  transition: background 0.1s;
}
.sbd-refresh-btn:hover { background: #F3F4F6; color: #111827; }
.sbd-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.sbd-sentence-block {
  background: #F9FAFB;
  border: 1px solid #E9EBE9;
  border-radius: 14px;
  padding: 18px 20px;
}
.sbd-full-jp {
  font-size: 20px;
  font-weight: 600;
  color: #111827;
  line-height: 1.6;
  margin-bottom: 8px;
}
.sbd-full-zh {
  font-size: 14px;
  color: #6B7280;
  line-height: 1.5;
}
.sbd-section-label {
  font-size: 12px;
  font-weight: 700;
  color: #9CA3AF;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.sbd-words {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sbd-word {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
  border: 1px solid #E9EBE9;
  border-radius: 10px;
  padding: 8px 12px;
  min-width: 52px;
  gap: 2px;
}
.sbd-reading {
  font-size: 10px;
  color: #9CA3AF;
  min-height: 14px;
  line-height: 1.2;
}
.sbd-jp {
  font-size: 17px;
  font-weight: 600;
  color: #111827;
  line-height: 1.3;
}
.sbd-pos {
  font-size: 9.5px;
  color: #A5B4FC;
  background: #EEF2FF;
  border-radius: 4px;
  padding: 1px 5px;
  margin-top: 2px;
}
.sbd-zh {
  font-size: 11px;
  color: #6B7280;
  text-align: center;
  line-height: 1.3;
}
.sbd-grammar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sbd-grammar-item {
  background: #fff;
  border: 1px solid #E9EBE9;
  border-radius: 10px;
  padding: 12px 14px;
}
.sbd-grammar-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.sbd-grammar-pattern {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
}
.sbd-grammar-level {
  font-size: 11px;
  font-weight: 600;
  color: #059669;
  background: #D1FAE5;
  border-radius: 4px;
  padding: 1px 6px;
}
.sbd-grammar-meaning {
  font-size: 13px;
  color: #6B7280;
  line-height: 1.5;
}

/* ── Sentence List Screen ── */
#sentenceListScreen.active { display: flex; background: #fff; }

.slst-desc {
  font-size: 13px;
  color: #9CA3AF;
  margin-bottom: 12px;
}
.slst-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.slst-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  background: #F9FAFB;
  border: 1.5px solid #E5E7EB;
  border-radius: 12px;
  padding: 14px 40px 14px 16px;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, background .15s;
}
.slst-card:hover { background: #F3F4F6; border-color: #D1D5DB; }
.slst-card--today { border-color: #7C3AED; background: #FAF5FF; }
.slst-today-badge {
  font-size: 11px;
  font-weight: 600;
  color: #7C3AED;
  background: #EDE9FE;
  border-radius: 6px;
  padding: 1px 7px;
  margin-bottom: 4px;
}
.slst-jp { font-size: 15px; font-weight: 500; color: #111827; line-height: 1.5; }
.slst-zh { font-size: 13px; color: #6B7280; }
.slst-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #9CA3AF;
}

@media (prefers-color-scheme: dark) {
  #sentenceListScreen.active { background: #fff; }
}

.sentence-refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  margin-right: 60px;
  color: #9CA3AF;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color 0.1s, background 0.1s;
}
.sentence-refresh-btn:hover { color: #374151; background: #F3F4F6; }
.sentence-composition-box {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.sentence-composition-help {
  margin: 0;
  color: #667085;
  font-size: 14px;
  line-height: 1.6;
}

.sentence-composition-slots {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.sentence-composition-slot {
  position: relative;
  min-height: 72px;
  padding: 22px 10px 12px;
  border: 2px dashed #cbd2dc;
  border-radius: 14px;
  background: #f8fafc;
  color: #98a2b3;
  font: inherit;
  font-size: 16px;
  line-height: 1.35;
  text-align: center;
  cursor: pointer;
}

.sentence-composition-slot.filled {
  border-style: solid;
  border-color: #7758e8;
  background: #f4f0ff;
  color: #252333;
  font-weight: 700;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.sentence-composition-slot.filled:active {
  cursor: grabbing;
}

.sentence-composition-slot.empty {
  cursor: default;
}

.sentence-composition-slot.dragging {
  opacity: 0.3;
  transform: scale(0.97);
}

.sentence-composition-drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10020;
  margin: 0;
  pointer-events: none;
  cursor: grabbing;
  opacity: 0.97;
  border-style: solid;
  border-color: #6d48dc;
  background: #f4f0ff;
  color: #252333;
  box-shadow:
    0 18px 36px rgba(53, 35, 112, 0.25),
    0 4px 12px rgba(53, 35, 112, 0.18);
  transition: none;
  will-change: transform;
}

.sentence-composition-slot.drag-over {
  border-style: solid;
  border-color: #5b35df;
  background: #ebe4ff;
  box-shadow: 0 0 0 4px rgba(91, 53, 223, 0.13);
}

.sentence-composition-drag-handle {
  position: absolute;
  top: 5px;
  right: 8px;
  color: #8a73d6;
  font-size: 17px;
  line-height: 1;
  pointer-events: none;
}

.sentence-composition-slot.star {
  border-color: #f2b84b;
  background: #fffaf0;
}

.sentence-composition-slot.correct {
  border-style: solid;
  border-color: #18a957;
  background: #ecfbf3;
  color: #137a42;
}

.sentence-composition-slot.incorrect {
  border-style: solid;
  border-color: #e53935;
  background: #fff0f0;
  color: #b42318;
}

.sentence-composition-star {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  color: #d98d00;
  font-size: 18px;
  line-height: 1;
}

.sentence-composition-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f7f8fa;
  color: #20242c;
  font-size: 17px;
  line-height: 1.7;
}

.sentence-composition-preview > span {
  flex: 0 0 auto;
  color: #7b8492;
  font-size: 12px;
  font-weight: 700;
}

.sentence-composition-bank {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.sentence-composition-fragment {
  min-height: 52px;
  padding: 10px 14px;
  border: 1.5px solid #d8dde6;
  border-radius: 12px;
  background: #fff;
  color: #252933;
  font: inherit;
  font-size: 16px;
  font-weight: 650;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease,
    transform 0.16s ease;
}

.sentence-composition-fragment:hover:not(:disabled) {
  border-color: #7758e8;
  background: #f7f4ff;
  transform: translateY(-1px);
}

.sentence-composition-fragment.used {
  background: #f0f2f5;
  color: #a0a7b2;
  opacity: 0.65;
}

.sentence-composition-reset {
  justify-self: end;
  padding: 8px 14px;
  border: 0;
  background: transparent;
  color: #6d48dc;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.sentence-composition-reset:disabled {
  color: #b7bdc7;
  cursor: default;
}

.sentence-composition-answer {
  display: grid;
  gap: 6px;
  margin: 14px 0 4px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #f2fbf6;
  color: #166b40;
  line-height: 1.6;
}

.sentence-composition-answer span {
  font-weight: 700;
}

.sentence-composition-answer small {
  color: #465a50;
  font-size: 14px;
}

@media (max-width: 640px) {
  .sentence-composition-slots {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sentence-composition-bank {
    grid-template-columns: 1fr;
  }

  .sentence-composition-slot {
    min-height: 64px;
  }
}
/* Account entry lives beside the left-side brand, so its panel opens from that edge. */
.backend-account-dialog {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(430px, 100vw);
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0 24px 24px 0;
  padding: 0;
  overflow: hidden;
  color: #1f2937;
  background: #fff;
  box-shadow: 20px 0 70px rgba(15, 23, 42, .18);
}
.backend-account-dialog[open] { animation: backend-account-enter .22s cubic-bezier(.2, .8, .2, 1); }
.backend-account-dialog::backdrop {
  /* 模糊背景会连带把 #storageWarning 这类不在对话框内部的提示也一起
     糊住，看不清字——直接不用模糊，只留深色遮罩。 */
  background: rgba(15, 23, 42, .55);
  animation: backend-account-backdrop .18s ease-out;
}
@keyframes backend-account-enter {
  from { transform: translateX(-42px); opacity: .72; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes backend-account-backdrop { from { opacity: 0; } to { opacity: 1; } }
.backend-account-card {
  display: flex;
  flex-direction: column;
  /* 必须是固定 100%（不是 min-height），面板本身才会被限制在对话框可视高度内，
     内容超出时才会触发下面的 overflow-y:auto 产生内部滚动，而不是把容器
     撑高、被外层 dialog 的 overflow:hidden 直接裁掉、连滚动条都不出现。 */
  height: 100%;
  box-sizing: border-box;
  padding: 30px 28px 26px;
  overflow-y: auto;
  background: linear-gradient(180deg, #fbfdfc 0, #fff 190px);
}
/* 之前的设计是"登录前显示个人中心/学习账号这段说明去引导注册，登录后
   收起"（用 data-signed-in 切换）——2026-08-25用户明确要求反过来：还
   没真正登录/注册成功之前（游客也算"还没进到个人中心"），这块"个人
   中心"标题+头像说明区一律不显示，只留关闭按钮，不区分 data-signed-in
   状态。 */
.backend-account-head {
  position: relative;
  padding: 0;
}
.backend-account-head-info {
  display: none;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  align-items: start;
}
.backend-account-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  color: #149451;
  background: #eaf8f0;
}
.backend-account-eyebrow {
  margin-bottom: 3px;
  color: #149451;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .08em;
}
.backend-account-head h2 { margin: 0 0 7px; color: #171a18; font-size: 25px; letter-spacing: -.02em; }
.backend-account-head p { margin: 0; color: #737b76; font-size: 13px; line-height: 1.65; }
.backend-account-close {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid #e5e9e6;
  border-radius: 12px;
  background: #fff;
  color: #5f6762;
  font-family: inherit;
  font-size: 25px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}
.backend-account-close:hover { background: #f5f7f5; color: #161917; }
.backend-account-view { display: grid; gap: 17px; padding-top: 26px; }
/* 登录后标题说明区收起了（见上面 .backend-account-head[data-signed-in]），
   #backendUserView 还沿用给完整标题区留的 26px 顶部间距，"当前账号"就会
   离顶部关闭按钮很远、显得空。登录态单独给一个小得多的顶部间距。 */
#backendUserView { padding-top: 6px; }
.backend-account-view[hidden], #backendInviteField[hidden] { display: none; }
.backend-region-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(215, 235, 223, .8);
  border-radius: 13px;
  background: rgba(241, 248, 244, .72);
}
.backend-region-picker button {
  min-height: 37px;
  border: 0;
  border-radius: 9px;
  color: #7b837e;
  background: transparent;
  font: 700 12px/1 inherit;
  cursor: pointer;
}
.backend-region-picker button.is-active { color: #147b42; background: rgba(255,255,255,.9); box-shadow: 0 1px 5px rgba(29, 78, 48, .09); }
.backend-region-copy { margin: -9px 1px -2px; color: #77817b; font-size: 11px; line-height: 1.55; }
/* 登录/注册页顶部的品牌区（头像+应用名），仿照参考截图的登录页布局；
   student.html 的登录方式不再按地区拆分，用这个替代原来的地区选择器
   出现在同一个位置。 */
.backend-guest-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px 0 2px; }
/* 图标本身已经带着"JLPT AI+"字样（不再单独用文字标签写一遍），必须完整
   显示不能裁掉——用 width+height:auto 按图片原始比例缩放，不用
   object-fit:cover（cover 为了填满固定宽高会裁边，之前56x56的方形容器
   就是这样把图标和文字挤变形/裁切的），保证不管图片实际比例多少都不会
   丢内容。
   圆角这次不用CSS border-radius画：之前试过在小尺寸下用固定的CSS圆角
   （比如20px）配合图片自身较小比例的留白，圆角弧线会直接啃进"AI+"这
   几个字——换成圆角直接"烧"在图片像素里的版本（v1是从用户提供的纯黑
   四角图用floodfill抠透明；v2在v1基础上，用户反馈内容周围留白太多，
   裁掉多余空白后用PIL重新画了一次圆角遮罩），不管缩放到多小都不会有
   这个问题，所以这里不再需要也不应该再叠加CSS圆角。 */
.backend-guest-logo { width: 116px; height: auto; display: block; }
/* 同意条款从按钮下方的一句提示文字改成复选框行（默认勾选，不阻塞提交，
   纯粹是视觉上更接近参考设计）；.backend-account-card label 的通用规则
   会把它也变成粗体网格布局，这里用更高优先级的选择器覆盖成横向排列。 */
.backend-account-card label.backend-terms-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: -6px 1px 0;
  /* 浅色模式下浅灰字对着浅色对话框背景太淡，看不清——改成纯黑，深色
     模式的覆盖规则不受影响，继续用适合深色背景的浅色。 */
  color: #171a18;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.55;
  cursor: pointer;
}
.backend-terms-row input[type="checkbox"] {
  /* .backend-account-card input 那条通用规则给所有input设了
     min-height:48px+padding:10px 13px（给邮箱/密码这种文本框用的），
     checkbox也是input、会一起被套上——min-height在这里没有被下面这几个
     属性覆盖掉，48px的隐形高度会把checkbox的布局盒子撑得比旁边这行字
     高很多，勾选框看起来往下/往中间偏，跟文字对不齐。这里显式重置
     min-height/padding，让checkbox恢复成16x16的实际大小，靠margin-top
     跟文字第一行对齐。 */
  flex: 0 0 auto; width: 16px; height: 16px; min-height: 16px; padding: 0;
  margin-top: 1px; accent-color: #18A95B; cursor: pointer;
}
.backend-terms-row a { color: #187d45; font-weight: 700; text-decoration: none; }
.backend-terms-row a:hover { text-decoration: underline; }
.backend-auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  background: #f1f3f2;
}
.backend-auth-tabs button {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #747b77;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.backend-auth-tabs button.is-active {
  color: #171a18;
  background: #fff;
  box-shadow: 0 1px 6px rgba(15, 23, 42, .08);
}
.backend-account-card label { display: grid; gap: 8px; color: #343936; font-size: 13px; font-weight: 700; }
.backend-account-card input {
  width: 100%;
  min-height: 48px;
  box-sizing: border-box;
  border: 1px solid #dce2de;
  border-radius: 12px;
  padding: 10px 13px;
  font: inherit;
  background: #fff;
  color: #1f2937;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.backend-account-card input:focus { border-color: #35ad70; box-shadow: 0 0 0 3px rgba(24, 169, 91, .11); }
.backend-account-card input::placeholder { color: #adb4b0; }
.backend-account-primary,
.backend-account-secondary {
  min-height: 49px;
  border-radius: 12px;
  padding: 11px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 750;
  line-height: 1;
  cursor: pointer;
}
.backend-account-primary { border: 1px solid #151816; color: #fff; background: #151816; }
.backend-account-primary:hover { background: #282c29; }
.backend-account-secondary { border: 1px solid #dce2de; color: #424945; background: #fff; }
.backend-account-secondary:hover { background: #f7f9f7; }
.backend-account-dialog[data-busy="1"] button { pointer-events: none; opacity: .62; }
/* 浅色模式下同样把字色改成纯黑，理由同上面 .backend-terms-row。 */
.backend-provider-divider { display: flex; align-items: center; gap: 10px; margin: 1px 0 -3px; color: #171a18; font-size: 11px; }
.backend-provider-divider::before, .backend-provider-divider::after { height: 1px; flex: 1; background: #e9eeeb; content: ""; }
.backend-provider-list { display: grid; gap: 9px; }
.backend-provider-list[hidden] { display: none; }
.backend-provider-list button {
  display: grid;
  grid-template-columns: 29px 1fr auto;
  align-items: center;
  min-height: 45px;
  gap: 10px;
  padding: 7px 11px;
  border: 1px solid #e1e7e3;
  border-radius: 12px;
  color: #59615c;
  background: rgba(255,255,255,.72);
  font: 700 12px/1 inherit;
  text-align: left;
  cursor: pointer;
}
.backend-provider-list button:hover { border-color: #c6dfcf; background: #fbfefc; }
.provider-logo { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; color: #fff; background: #20ad61; font-size: 14px; font-weight: 800; }
.provider-logo.google { background: #4285f4; font-family: Arial, sans-serif; }
.provider-logo.phone { background: #6e7b73; font-size: 13px; }
.provider-pending { color: #9aa29d; font-size: 10px; font-weight: 600; }
.backend-provider-note { margin: -7px 1px 0; color: #171a18; font-size: 10.5px; line-height: 1.55; }
.backend-legal-note { margin: -8px 1px 0; color: #7d8781; font-size: 10.5px; line-height: 1.55; }
.backend-legal-note a, .backend-account-collapsible > a { color: #187d45; font-weight: 700; text-decoration: none; }
.backend-legal-note a:hover, .backend-account-collapsible > a:hover { text-decoration: underline; }
.backend-user-summary {
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 14px 15px;
  border: 1px solid #dfe9e3;
  border-radius: 16px;
  background: rgba(247, 251, 248, .9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .78);
}
.backend-avatar-picker {
  position: relative;
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  overflow: visible;
}
.backend-user-initial {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  overflow: hidden;
  color: #149451;
  background: #eaf8f0;
  border: 1px solid #d7f0e2;
  transition: box-shadow .15s, transform .15s;
}
.backend-avatar-picker:hover .backend-user-initial { box-shadow: 0 0 0 4px rgba(34, 174, 96, .14); transform: translateY(-1px); }
.backend-user-label { margin-bottom: 4px; color: #8a918d; font-size: 12px; }
.backend-user-summary strong { color: #1f2521; font-size: 14px; overflow-wrap: anywhere; }
.backend-identity-section { display: grid; gap: 10px; padding: 15px; border: 1px solid #e5ebe7; border-radius: 14px; background: rgba(249, 252, 250, .75); }
.backend-identity-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #27342d; font-size: 13px; }
.backend-identity-heading span { padding: 4px 7px; border-radius: 7px; color: #518062; background: #eaf8f0; font-size: 10px; font-weight: 700; }
.backend-identity-list { display: grid; gap: 7px; }
.backend-identity-item { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 9px; min-height: 39px; padding: 7px 9px; border-radius: 10px; background: rgba(255,255,255,.7); color: #4e5952; }
.backend-identity-item strong { font-size: 12px; }
.backend-identity-item small { display: block; margin-top: 3px; color: #949d97; font-size: 10px; }
.backend-identity-state { color: #18864b; font-size: 10px; font-weight: 750; }
.backend-identity-state.pending { color: #9aa29d; }
.backend-region-change { justify-self: start; margin-top: 1px; padding: 0; border: 0; color: #278a52; background: transparent; font: 700 11px/1 inherit; cursor: pointer; }
.backend-region-change:hover { color: #126f3c; text-decoration: underline; }
/* 折叠区块：账户与数据、会员兑换码——次要操作默认收起，减少个人中心的
   常驻信息密度；只有"会员"用专门的深色卡片常显，其余次要内容点开才看。 */
.backend-account-collapsible,
.backend-membership-redeem {
  display: grid;
  gap: 9px;
  padding: 13px 15px;
  border: 1px solid #e5ebe7;
  border-radius: 14px;
  background: #fafcfb;
}
.backend-account-collapsible summary,
.backend-membership-redeem summary {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #27342d;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.backend-account-collapsible summary::-webkit-details-marker,
.backend-membership-redeem summary::-webkit-details-marker { display: none; }
.backend-account-collapsible summary::after,
.backend-membership-redeem summary::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-right: 2px solid #9aa39d;
  border-bottom: 2px solid #9aa39d;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .15s ease;
}
.backend-account-collapsible[open] summary::after,
.backend-membership-redeem[open] summary::after { transform: rotate(-135deg) translateY(2px); }
.backend-account-collapsible p,
.backend-membership-redeem p { margin: 0; color: #76817a; font-size: 11px; line-height: 1.55; }
.backend-account-collapsible > a { font-size: 11px; }
.backend-account-data-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.backend-account-data-actions button { min-height: 35px; padding: 7px 11px; border: 1px solid #cde5d7; border-radius: 9px; color: #176d3d; background: #f0faf4; font: 700 12px/1 inherit; cursor: pointer; }
.backend-account-data-actions button:hover { border-color: #86caa2; background: #e7f7ed; }

/* 会员：深色"高级卡"常显状态徽章 + 特权图标网格，兑换码折进下面的
   折叠区——参考 MOJi辞書 会员页的视觉分层，卡片颜色改用本站品牌绿，
   不随亮/暗主题切换（跟随主题反而会稀释"会员卡"本身的辨识度）。 */
.backend-membership-section { display: grid; gap: 10px; }
.backend-membership-card {
  display: grid;
  gap: 13px;
  padding: 18px;
  border-radius: 16px;
  color: #eef5f0;
  background: linear-gradient(160deg, #1a3226 0%, #0e1a14 65%, #101d17 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 10px 26px rgba(8, 16, 12, .28);
}
/* 一张卡里上下摆两级会员（终身在上，Suno会员在下），中间一条细线分隔——
   不拆成两张卡是因为它们共享同一个"会员"整体视觉，只是各自的开通状态、
   到期时间和特权不同，要能同时看到而不是二选一切换。 */
.backend-membership-tier { display: grid; gap: 13px; }
.backend-membership-divider { height: 1px; background: rgba(255, 255, 255, .1); margin: 1px 0; }
/* justify-content 原来是 space-between，是留给"标签在左、已开通徽章在右"
   两个元素用的；现在徽章合并进标签本身，只剩一个元素了，space-between
   对单个元素等于贴左边——改成 flex-end 让这个金框/灰字标签整体挪到卡片
   右侧。 */
.backend-membership-head { display: flex; align-items: flex-start; justify-content: flex-end; gap: 10px; }
/* 不再用单独的"已开通"文字徽章——开通状态直接体现在左上角标签本身：
   未开通是灰字素面，开通了就是原来"已开通"徽章那组金色参数（不透明
   金色渐变 + 深棕字，确认过这组颜色是对的，不透明才是"真金色"，之前
   套绿字/半透明的版本都不对）。 */
.backend-membership-head .backend-account-eyebrow {
  margin-bottom: 0;
  color: #8a998e;
  transition: color .15s ease, background .15s ease;
}
.backend-membership-head .backend-account-eyebrow[data-active="true"] {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  color: #2c1c04;
  background: linear-gradient(135deg, #f6d488, #e0a94c);
}
.backend-membership-perks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
/* 终身会员是一次性付款、只有一档，不像AI会员那样需要一排chip选时长，
   价格直接显示成一行小字，服务器已经按地区格式化好货币符号，前端只管显示。
   已开通时JS会把内容清空（跟下面按钮一起隐藏的逻辑一致），不留空行是靠
   内容为空文本节点自然不占视觉高度，不用额外加[hidden]切换。 */
.backend-membership-price { color: #f6d488; font-size: 15px; font-weight: 700; }
/* 每档下方的"立即开通"——跟卡片本身的金色徽章同一套配色，未开通时是
   邀请点击的强调色；已开通那一档由JS给按钮加hidden隐藏掉，不会显示
   "已经开通了还能再点一次开通"这种矛盾状态。 */
.backend-membership-buy {
  justify-self: start;
  padding: 8px 16px;
  border: 1px solid rgba(230, 190, 120, .55);
  border-radius: 999px;
  color: #f6d488;
  background: rgba(246, 212, 136, .08);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease;
}
.backend-membership-buy:hover { background: rgba(246, 212, 136, .16); }
.backend-membership-buy:disabled { opacity: .6; cursor: default; }
.backend-membership-buy[hidden] { display: none; }
/* AI会员时长选择（1/3/6/12个月）——服务器把档位和格式化好的价格一起
   下发，这里只是一排小按钮，选中的那个用跟"立即开通"同一套金色强调色，
   点击只是切换"立即开通"按钮要提交的档位，不会立刻发起结账。 */
/* 固定三列网格——月付/季付/年付正好三档，一行放完，不用flex自动换行。 */
.backend-membership-tier-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.backend-tier-chip {
  display: grid;
  gap: 2px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 12px;
  color: #d8ded9;
  background: rgba(255, 255, 255, .04);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.backend-tier-chip small { color: #8a998e; font-size: 11px; }
.backend-tier-chip:hover { background: rgba(255, 255, 255, .08); }
.backend-tier-chip.is-selected {
  border-color: rgba(230, 190, 120, .55);
  color: #f6d488;
  background: rgba(246, 212, 136, .1);
}
.backend-tier-chip.is-selected small { color: #e0a94c; }
.backend-membership-perk { display: grid; justify-items: center; gap: 6px; text-align: center; }
.backend-membership-perk-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  color: rgba(238, 245, 240, .38);
  background: rgba(255, 255, 255, .06);
}
.backend-membership-perk-icon svg { width: 18px; height: 18px; }
.backend-membership-perk-label { color: rgba(238, 245, 240, .5); font-size: 10.5px; line-height: 1.3; }
.backend-membership-perk.is-unlocked .backend-membership-perk-icon { color: #8ff2bb; background: rgba(45, 196, 120, .18); }
.backend-membership-perk.is-unlocked .backend-membership-perk-label { color: rgba(238, 245, 240, .88); }
/* 积分卡片跟会员卡同一套暗底金字视觉语言，但结构更简单——没有"开通/
   未开通"两态，只有一个数字(余额)和一排可以直接买的充值包，不需要
   chip选中态那套交互。 */
.backend-credits-card {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 16px;
  color: #eef5f0;
  background: linear-gradient(160deg, #1a3226 0%, #0e1a14 65%, #101d17 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 10px 26px rgba(8, 16, 12, .28);
}
.backend-credits-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13px; color: rgba(238, 245, 240, .7); }
.backend-credits-head strong { font-size: 20px; color: #f6d488; }
.backend-credits-hint { margin: 0; color: rgba(238, 245, 240, .5); font-size: 11px; line-height: 1.55; }
.backend-credits-expiry-note { margin: 0; color: rgba(246, 212, 136, .85); font-size: 11px; line-height: 1.55; }
.backend-credits-packs { display: grid; gap: 8px; }
.backend-credits-pack {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  font-size: 12.5px;
}
.backend-credits-pack-label { color: #d8ded9; }
.backend-credits-pack-price { color: #8a998e; }
.backend-credits-pack-buy {
  padding: 5px 12px;
  border: 1px solid rgba(230, 190, 120, .55);
  border-radius: 999px;
  color: #f6d488;
  background: rgba(246, 212, 136, .08);
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease;
}
.backend-credits-pack-buy:hover { background: rgba(246, 212, 136, .16); }
.backend-credits-pack-buy:disabled { opacity: .6; cursor: default; }
.backend-delete-dialog { width: min(460px, calc(100vw - 32px)); border: 1px solid #d9e2dc; border-radius: 18px; padding: 0; color: #27342d; background: #fff; box-shadow: 0 24px 80px rgba(25, 40, 31, .28); }
.backend-delete-dialog::backdrop { background: rgba(12, 19, 15, .58); }
.backend-delete-card { display: grid; gap: 16px; padding: 24px; }
.backend-delete-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.backend-delete-head h2 { margin: 3px 0 0; font-size: 22px; letter-spacing: -.02em; }
.backend-delete-card > p { margin: 0; color: #68746d; font-size: 13px; line-height: 1.7; }
.backend-delete-card label { display: grid; gap: 7px; color: #343936; font-size: 13px; font-weight: 700; }
.backend-delete-card input { min-height: 42px; border: 1px solid #ccd7d0; border-radius: 10px; padding: 0 12px; color: #202823; background: #fff; font: 500 14px/1.2 inherit; }
.backend-delete-card input:focus { outline: none; border-color: #35ad70; box-shadow: 0 0 0 3px rgba(24, 169, 91, .11); }
.backend-delete-actions { display: flex; justify-content: flex-end; gap: 9px; }
.backend-delete-confirm { min-height: 40px; border: 1px solid #bc2d25; border-radius: 10px; padding: 0 14px; color: #fff; background: #c9362d; font: 700 13px/1 inherit; cursor: pointer; }
.backend-delete-confirm:hover { background: #ad271f; }
.backend-delete-dialog[data-busy="1"] button { pointer-events: none; opacity: .62; }
.backend-account-status {
  min-height: 20px;
  margin: 18px 0 0;
  color: #171a18;
  font-size: 12px;
  line-height: 1.55;
}
.backend-account-status:empty { display: none; }
.backend-account-status[data-error="1"] { color: #b42318; }
@media (max-width: 560px) {
  .backend-account-dialog { width: 100vw; border-radius: 0; }
  .backend-account-card { padding: 22px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .backend-account-dialog[open], .backend-account-dialog::backdrop { animation: none; }
}
.backend-account-status[data-error="1"] { color: #c62828; }

/* ── Unified glass treatment for floating panels and dialogs ── */
.streak-panel,
.word-tip,
.chat-panel,
.tday-mode-notice,
.backend-account-dialog {
  border: 1px solid var(--popup-glass-border);
  background: var(--popup-glass-bg);
  box-shadow: var(--popup-glass-shadow);
  -webkit-backdrop-filter: blur(38px) saturate(180%) contrast(108%);
  backdrop-filter: blur(38px) saturate(180%) contrast(108%);
}

.streak-panel-arrow {
  border-color: var(--popup-glass-border) transparent transparent var(--popup-glass-border);
  background: rgba(255, 250, 245, 0.22);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.streak-panel-status,
.streak-calendar,
.streak-stat,
.backend-auth-tabs {
  background-color: rgba(255, 255, 255, 0.18);
}

.chat-head {
  background: linear-gradient(135deg, rgba(67, 56, 202, 0.80), rgba(124, 58, 237, 0.72));
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
}

.sel-btn {
  border: 1px solid rgba(255, 255, 255, 0.38);
  background: linear-gradient(135deg, rgba(67, 56, 202, 0.78), rgba(124, 58, 237, 0.70));
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
}

.backend-account-card { background: transparent; }
.tday-mode-notice-backdrop {
  background: rgba(15, 23, 42, 0.18);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  backdrop-filter: blur(10px) saturate(120%);
}

.storage-warning {
  background: rgba(255, 251, 235, 0.42);
  -webkit-backdrop-filter: blur(20px) saturate(145%);
  backdrop-filter: blur(20px) saturate(145%);
}

/* ── Appearance settings + night mode ─────────────────────────────── */
.nav-settings { margin-top: auto; }
.appearance-dialog {
  width: min(420px, calc(100vw - 32px));
  border: 1px solid rgba(255,255,255,.52);
  border-radius: 22px;
  padding: 0;
  color: #18251f;
  background: var(--popup-glass-bg);
  box-shadow: var(--popup-glass-shadow);
  -webkit-backdrop-filter: blur(38px) saturate(175%);
  backdrop-filter: blur(38px) saturate(175%);
}
.appearance-dialog::backdrop { background: rgba(15,23,42,.20); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.appearance-card { padding: 26px; }
.appearance-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.appearance-eyebrow { color: #169453; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.appearance-head h2 { margin: 5px 0 6px; color: #18251f; font-size: 25px; letter-spacing: -.02em; }
.appearance-head p { margin: 0; color: #6d7972; font-size: 13px; line-height: 1.6; }
.appearance-close { width: 36px; height: 36px; border: 1px solid #dbe4de; border-radius: 11px; background: rgba(255,255,255,.56); color: #5a665f; font-size: 25px; line-height: 1; cursor: pointer; }
.appearance-close:hover { background: rgba(255,255,255,.86); color: #18251f; }
.appearance-options { display: grid; gap: 10px; margin-top: 24px; }
.appearance-option { display: flex; align-items: center; gap: 13px; width: 100%; padding: 14px; border: 1px solid rgba(205,220,211,.88); border-radius: 14px; background: rgba(255,255,255,.42); color: #27332c; font: inherit; text-align: left; cursor: pointer; transition: border-color .16s, background .16s, transform .16s; }
.appearance-option:hover { border-color: #80d5a5; background: rgba(246,255,250,.72); transform: translateY(-1px); }
.appearance-option.is-selected { border-color: #22a960; background: rgba(231,250,239,.78); box-shadow: 0 0 0 3px rgba(31,169,90,.10); }
.appearance-option-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: #edf8f1; color: #16894d; font-size: 19px; flex-shrink: 0; }
.appearance-option strong, .appearance-option small { display: block; }
.appearance-option strong { font-size: 14px; font-weight: 750; }
.appearance-option small { margin-top: 3px; color: #728078; font-size: 12px; line-height: 1.4; }

/* The chosen value is written to html[data-theme] by app.js.  These colours
   intentionally use dark blue-grey rather than pure black to reduce glare. */
:root[data-theme="dark"] {
  --bg: #10161e;
  --text: #edf2f7;
  --muted: #a6b2c0;
  --border: #2c3744;
  --dp-bg: #10161e;
  --dp-surface: #18212c;
  --dp-border: #2c3744;
  --popup-glass-bg: linear-gradient(145deg, rgba(35,47,61,.92), rgba(18,27,37,.88));
  --popup-glass-border: rgba(182,202,220,.23);
  --popup-glass-shadow: 0 24px 60px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.07);
}
:root[data-theme="dark"] body,
:root[data-theme="dark"] .home-full,
:root[data-theme="dark"] .home-body,
:root[data-theme="dark"] #todayStartScreen.active,
:root[data-theme="dark"] #readingPassageScreen.active,
:root[data-theme="dark"] #listeningPassageScreen.active,
:root[data-theme="dark"] #sentenceBreakdownScreen.active,
:root[data-theme="dark"] #sentenceListScreen.active,
:root[data-theme="dark"] #vocabularyScreen.active,
:root[data-theme="dark"] #grammarScreen.active,
:root[data-theme="dark"] #readingHomeScreen.active,
:root[data-theme="dark"] #listeningHomeScreen.active,
:root[data-theme="dark"] #vocabSessionScreen.active,
:root[data-theme="dark"] #readingScreen.active,
:root[data-theme="dark"] #listeningScreen.active,
:root[data-theme="dark"] .light-home,
:root[data-theme="dark"] .light-home .vh-body { background: #10161e; color: #edf2f7; }
:root[data-theme="dark"] .dash-sidebar,
:root[data-theme="dark"] .home-topbar,
:root[data-theme="dark"] .dash-card,
:root[data-theme="dark"] .quiz-topbar,
:root[data-theme="dark"] .quiz-q-card,
:root[data-theme="dark"] .quiz-fb-card,
:root[data-theme="dark"] .vh-topbar,
:root[data-theme="dark"] .vh-prog-card,
:root[data-theme="dark"] .vh-mode-card,
:root[data-theme="dark"] .rdg-topbar,
:root[data-theme="dark"] .rdg-tab-bar,
:root[data-theme="dark"] .rdg-article-card,
:root[data-theme="dark"] .rdg-question-card,
:root[data-theme="dark"] .rdg-translation-card,
:root[data-theme="dark"] .lst-topbar,
:root[data-theme="dark"] .lst-player-card,
:root[data-theme="dark"] .lst-question-card,
:root[data-theme="dark"] .lst-transcript-card,
:root[data-theme="dark"] .sbd-card,
:root[data-theme="dark"] .sbd-list-card,
:root[data-theme="dark"] .sbd-sentence-block,
:root[data-theme="dark"] .sbd-word,
:root[data-theme="dark"] .sbd-grammar-item,
:root[data-theme="dark"] .slst-card,
:root[data-theme="dark"] .backend-account-dialog,
:root[data-theme="dark"] .appearance-dialog { background: #18212c; border-color: #2d3a48; color: #eaf0f6; }
:root[data-theme="dark"] .dash-logo,
:root[data-theme="dark"] .home-topbar,
:root[data-theme="dark"] .quiz-topbar,
:root[data-theme="dark"] .vh-topbar,
:root[data-theme="dark"] .rdg-topbar,
:root[data-theme="dark"] .rdg-tab-bar { border-color: #2c3744; }
:root[data-theme="dark"] .dash-logo-name,
:root[data-theme="dark"] .home-topbar-title,
:root[data-theme="dark"] .dash-card,
:root[data-theme="dark"] .quiz-title,
:root[data-theme="dark"] .quiz-stem,
:root[data-theme="dark"] .vh-card-name,
:root[data-theme="dark"] .vh-prog-text strong,
:root[data-theme="dark"] .rdg-topbar-label,
:root[data-theme="dark"] .rdg-title,
:root[data-theme="dark"] .appearance-head h2 { color: #edf2f7; }
:root[data-theme="dark"] .dash-logo-sub,
:root[data-theme="dark"] .dash-nav-item,
:root[data-theme="dark"] .quiz-counter,
:root[data-theme="dark"] .vh-prog-text,
:root[data-theme="dark"] .vh-prog-pct,
:root[data-theme="dark"] .vh-card-desc,
:root[data-theme="dark"] .rdg-topbar-meta,
:root[data-theme="dark"] .appearance-head p,
:root[data-theme="dark"] .appearance-option small { color: #a6b2c0; }
:root[data-theme="dark"] .dash-nav-item:hover:not(:disabled),
:root[data-theme="dark"] .dash-nav-item.active { background: #263342; color: #edf2f7; }
:root[data-theme="dark"] .dash-nav-item.active .nav-icon { stroke: #79d9a2; }
:root[data-theme="dark"] .level-dropdown,
:root[data-theme="dark"] .quiz-opt,
:root[data-theme="dark"] .rdg-font-btn,
:root[data-theme="dark"] .appearance-close,
:root[data-theme="dark"] .appearance-option { background-color: #202b37; border-color: #3a4857; color: #e8eef5; }
:root[data-theme="dark"] .quiz-opt:hover:not([aria-disabled="true"]),
:root[data-theme="dark"] .rdg-font-btn:hover { background: #273444; border-color: #70849a; }
:root[data-theme="dark"] .quiz-opt-key,
:root[data-theme="dark"] .rdg-para-num { background: #2b3745; color: #b7c4d1; }
:root[data-theme="dark"] .quiz-opt.selected { background: #292853; border-color: #8784ed; }
:root[data-theme="dark"] .quiz-opt.correct { background: #153c2b; border-color: #32bd72; }
:root[data-theme="dark"] .quiz-opt.incorrect { background: #48262d; border-color: #df6d79; }
:root[data-theme="dark"] .streak-badge { background: #382b22; border-color: #80512d; color: #ffd19a; }
:root[data-theme="dark"] .appearance-option.is-selected { background: #183d2a; border-color: #40bd78; }
:root[data-theme="dark"] .appearance-option-icon { background: #183b2a; color: #79d9a2; }

/* Manual light selection must override older system-dark fallback rules. */
:root[data-theme="light"] .light-home,
:root[data-theme="light"] .light-home .vh-body,
:root[data-theme="light"] #vocabularyScreen.active,
:root[data-theme="light"] #grammarScreen.active,
:root[data-theme="light"] #readingHomeScreen.active,
:root[data-theme="light"] #listeningHomeScreen.active,
:root[data-theme="light"] #vocabSessionScreen.active,
:root[data-theme="light"] #readingScreen.active,
:root[data-theme="light"] #listeningScreen.active { background: #fff; }
:root[data-theme="light"] .vh-topbar { background: #fff; border-bottom-color: #f0f0f0; }
:root[data-theme="light"] .vh-prog-card,
:root[data-theme="light"] .vh-mode-card { background: #fff; }
:root[data-theme="light"] .vh-prog-text { color: #374151; }
:root[data-theme="light"] .vh-prog-text strong,
:root[data-theme="light"] .vh-card-name { color: #111827; }
:root[data-theme="light"] .vh-card-desc,
:root[data-theme="light"] .vh-prog-pct { color: #6b7280; }

/* ── Night mode: readable, low-glare colour hierarchy ───────────────
   Keep the page dark, but never rely on the light theme's near-black text.
   These overrides deliberately sit after the component styles so every screen
   (home, plan, practice, reading and listening) uses the same contrast scale. */
:root[data-theme="dark"] {
  --night-text: #f2f6fb;
  --night-muted: #b8c4d1;
  --night-subtle: #92a1b1;
  --night-panel: #18212c;
  --night-raised: #202b37;
  --night-hover: #283646;
  --night-line: #3a4b5e;
}

/* Shared readable text. */
:root[data-theme="dark"] .lib-section-title,
:root[data-theme="dark"] .ability-grade-text,
:root[data-theme="dark"] .sentence-jp,
:root[data-theme="dark"] .tday-plan-title,
:root[data-theme="dark"] .tday-item-name,
:root[data-theme="dark"] .tday-adjust-key,
:root[data-theme="dark"] .tday-duration-trigger,
:root[data-theme="dark"] .tday-wheel-option.selected,
:root[data-theme="dark"] .tday-mode-name,
:root[data-theme="dark"] .tday-mode-notice-title,
:root[data-theme="dark"] .quiz-fb-short-exp,
:root[data-theme="dark"] .quiz-detail-row,
:root[data-theme="dark"] .quiz-wrong-opt-row strong,
:root[data-theme="dark"] .rdg-title,
:root[data-theme="dark"] .rdg-para-text,
:root[data-theme="dark"] .rdg-vocab-word,
:root[data-theme="dark"] .rdg-vocab-meaning,
:root[data-theme="dark"] .rdg-grammar-example,
:root[data-theme="dark"] .rdg-q-stem,
:root[data-theme="dark"] .rdg-done-inpanel-title,
:root[data-theme="dark"] .lst-missing-title,
:root[data-theme="dark"] .lst-transcript-title,
:root[data-theme="dark"] .lst-sentence-jp { color: var(--night-text); }

:root[data-theme="dark"] .mastery-card-label,
:root[data-theme="dark"] .ability-name-text,
:root[data-theme="dark"] .ability-sample-text,
:root[data-theme="dark"] .sentence-zh,
:root[data-theme="dark"] .section-more-btn,
:root[data-theme="dark"] .tday-plan-meta,
:root[data-theme="dark"] .tday-item-reason,
:root[data-theme="dark"] .tday-item-bottom,
:root[data-theme="dark"] .tday-item-count,
:root[data-theme="dark"] .tday-item-time,
:root[data-theme="dark"] .tday-card-label,
:root[data-theme="dark"] .tday-mode-desc,
:root[data-theme="dark"] .tday-cta-meta,
:root[data-theme="dark"] .quiz-detail-label,
:root[data-theme="dark"] .quiz-wrong-opt-row,
:root[data-theme="dark"] .quiz-stat-lbl,
:root[data-theme="dark"] .rdg-q-counter,
:root[data-theme="dark"] .rdg-article-meta,
:root[data-theme="dark"] .rdg-fa-title,
:root[data-theme="dark"] .rdg-analysis-para-num,
:root[data-theme="dark"] .rdg-analysis-para-trans,
:root[data-theme="dark"] .rdg-vocab-reading,
:root[data-theme="dark"] .rdg-grammar-exp,
:root[data-theme="dark"] .rdg-q-num,
:root[data-theme="dark"] .rdg-done-inpanel-stat,
:root[data-theme="dark"] .lst-missing-desc,
:root[data-theme="dark"] .lst-time,
:root[data-theme="dark"] .lst-sentence-cn,
:root[data-theme="dark"] .lst-prec-label { color: var(--night-muted); }

/* Home cards: informative, not dim or washed out. */
:root[data-theme="dark"] .mastery-empty-chart > span { background: repeating-linear-gradient(90deg, #405166 0 4px, transparent 4px 8px); }
:root[data-theme="dark"] .today-card { background: #141c25; border-color: #334358; }
:root[data-theme="dark"] .today-card-meta { color: #c4ceda; }
:root[data-theme="dark"] .today-chip { background: #263241; border-color: #46566a; color: #e5edf6; }
:root[data-theme="dark"] .sentence-card { border-color: #334357; }

/* Today's plan must not keep bright white blocks in the dark interface. */
:root[data-theme="dark"] .tday-item,
:root[data-theme="dark"] .tday-duration-trigger,
:root[data-theme="dark"] .tday-unlimited-choice,
:root[data-theme="dark"] .tday-mode-card,
:root[data-theme="dark"] .tday-mode-notice,
:root[data-theme="dark"] .tday-duration-popover { background: var(--night-raised); border-color: var(--night-line); }
:root[data-theme="dark"] .tday-item:hover,
:root[data-theme="dark"] .tday-duration-trigger:hover,
:root[data-theme="dark"] .tday-unlimited-choice:hover,
:root[data-theme="dark"] .tday-mode-card:hover:not(.selected) { background: var(--night-hover); border-color: #5a6d82; }
:root[data-theme="dark"] .tday-duration-trigger.muted { background: var(--night-raised); color: var(--night-muted); }
:root[data-theme="dark"] .tday-skip-btn { color: var(--night-muted); border-color: #46566a; background: #263241; }
:root[data-theme="dark"] .tday-mode-card.selected { background: #17392b; border-color: #45c982; }
:root[data-theme="dark"] .tday-agent-summary { background: var(--night-raised); border-color: var(--night-line); }
:root[data-theme="dark"] .tday-agent-message { color: var(--night-muted); }
:root[data-theme="dark"] .tday-agent-name { color: #79d9a2; }
:root[data-theme="dark"] .tday-agent-breakdown { border-top-color: var(--night-line); }
:root[data-theme="dark"] .tday-agent-breakdown-row strong { color: var(--night-text); }
:root[data-theme="dark"] .tday-agent-breakdown-row span { color: var(--night-muted); }
:root[data-theme="dark"] .tday-agent-advice { background: #183d2a; border-color: #397a59; color: #a8e3bd; }
:root[data-theme="dark"] .tday-agent-advice small { color: #b6d8c1; }
:root[data-theme="dark"] .tday-ai-refresh-btn { background: #183d2a; border-color: #397a59; color: #a8e3bd; }
:root[data-theme="dark"] .tday-ai-refresh-btn:hover:not(:disabled) { background: #1f4c35; border-color: #45a172; }
:root[data-theme="dark"] .tday-ai-note { background: #382b13; color: #e3c876; }
:root[data-theme="dark"] .tday-ai-note button { background: #241a09; border-color: #a1802f; color: #e3c876; }

/* 答题反馈区"中文翻译"开关和翻译文字，以及"逐选项详细解析/掌握度趋势"
   会员锁定提示——这三处之前一直是纯光亮主题配色（亮绿胶囊按钮、
   浅灰翻译文字、奶油黄提示框），从来没有过夜间模式覆盖，用户反馈在
   深色页面上"太亮/太浅看不清楚"。绿色胶囊和黄色提示框分别复用上面
   .tday-ai-refresh-btn（同款"已解锁"绿色高亮）和 .tday-ai-note（同款
   "受限/需升级"琥珀色提示）已经验证过的夜间配色，翻译文字改用跟其它
   次要说明文字（quiz-detail-label 等）同一档 var(--night-muted)，保持
   全站深色模式配色统一，不再各写各的。 */
:root[data-theme="dark"] .quiz-translation-toggle { background: #183d2a; border-color: #397a59; color: #a8e3bd; }
:root[data-theme="dark"] .quiz-translation-toggle:hover { background: #1f4c35; border-color: #45a172; }
:root[data-theme="dark"] .quiz-stem-zh { color: var(--night-muted); }
:root[data-theme="dark"] .ai-panel { background: var(--night-raised); }
/* 用户看完琥珀色版本后，指定要账户面板"会员"卡片（.backend-membership-card）
   那种深绿色调——那张卡是全站"会员"这个概念本身的品牌色，比通用的
   "受限/需升级"琥珀色更贴切，所以"开通会员"这几个字出现的地方（这个
   锁定框的按钮、掌握度趋势下面那行小字的链接）统一换成同一种深绿，
   不再沿用 .tday-ai-note 那套黄色系。 */
:root[data-theme="dark"] .ai-panel.locked { background: linear-gradient(160deg, #1a3226 0%, #0e1a14 65%, #101d17 100%); }
:root[data-theme="dark"] .ai-panel.locked p { color: #cfe3d6; }
:root[data-theme="dark"] .ai-panel.locked button { background: #1f4c35; border: 1px solid #397a59; color: #a8e3bd; }
:root[data-theme="dark"] .ai-panel.locked button:hover { background: #24593e; }
:root[data-theme="dark"] .mastery-locked-hint { color: var(--night-muted); }
:root[data-theme="dark"] .mastery-locked-link { color: #79d9a2; }
:root[data-theme="dark"] .tday-start-btn { background: #eaf0f6; color: #14202a; }
:root[data-theme="dark"] .tday-start-btn:hover { background: #ffffff; }

/* Practice cards and feedback retain a clear, soft contrast. */
:root[data-theme="dark"] .quiz-q-card,
:root[data-theme="dark"] .quiz-fb-card,
:root[data-theme="dark"] .quiz-done-section { background: var(--night-panel); border-color: #2e3d4d; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
:root[data-theme="dark"] .quiz-opt,
:root[data-theme="dark"] .quiz-action-btn,
:root[data-theme="dark"] .quiz-done-btn { background: var(--night-raised); border-color: var(--night-line); color: var(--night-text); }
:root[data-theme="dark"] .quiz-submit-btn:disabled { background: #344251; color: #b5c1cf; }
:root[data-theme="dark"] .quiz-detail-section { border-color: #334356; }
:root[data-theme="dark"] .quiz-action-btn:hover,
:root[data-theme="dark"] .quiz-done-btn:hover { background: var(--night-hover); border-color: #62758a; }
:root[data-theme="dark"] .rdg-feedback-commandbar {
  background: rgba(15,20,25,.94);
  border-color: #3a4754;
  box-shadow: 0 10px 24px rgba(0,0,0,.28);
}
:root[data-theme="dark"] .rdg-detail-toggle {
  color: #b7f4d1;
  background: #0d2a1d;
  border-color: #3f9d69;
}
:root[data-theme="dark"] .rdg-detail-toggle:hover { color: #e5fff0; background: #123824; border-color: #59d995; }
:root[data-theme="dark"] .rdg-detail-section { background: #121a21; border-color: #3a4a5b; box-shadow: 0 10px 26px rgba(0,0,0,.25); }
:root[data-theme="dark"] .rdg-detail-heading { color: #f3f7f4; }
:root[data-theme="dark"] .reading-analysis-intro { background: #102337; border-color: #315d84; }
:root[data-theme="dark"] .reading-analysis-kicker { color: #85c8ff; }
:root[data-theme="dark"] .reading-analysis-field-label,
:root[data-theme="dark"] .reading-analysis-option-label { color: #9eb1c1; }
:root[data-theme="dark"] .reading-analysis-question-jp { color: #f2f7fb; }
:root[data-theme="dark"] .reading-analysis-question-zh { color: #c1d0dc; }
:root[data-theme="dark"] .reading-analysis-option { background: #16212b; border-color: #34485b; }
:root[data-theme="dark"] .reading-analysis-option.correct { background: #0d2b1d; border-color: #2f9f62; }
:root[data-theme="dark"] .reading-analysis-option-head { color: #f2f7fb; }
:root[data-theme="dark"] .reading-analysis-option-head > span:last-child { color: #a9bac8; }
:root[data-theme="dark"] .reading-analysis-option.correct .reading-analysis-option-head > span:last-child { color: #80e8ad; }
:root[data-theme="dark"] .reading-analysis-option-jp { color: #f2f7fb; }
:root[data-theme="dark"] .reading-analysis-option-zh { color: #d0dce5; }
:root[data-theme="dark"] .reading-analysis-option-reason { color: #aebfce; }
:root[data-theme="dark"] .reading-analysis-option.correct .reading-analysis-option-reason { color: #a3efbf; }
:root[data-theme="dark"] .reading-analysis-option-evidence { color: #a3efbf; }
:root[data-theme="dark"] .reading-feedback-commandbar { background: rgba(15,20,25,.94); border-color: #3a4754; box-shadow: 0 10px 24px rgba(0,0,0,.28); }
:root[data-theme="dark"] .reading-detail-toggle { color: #b7f4d1; background: #0d2a1d; border-color: #3f9d69; }
:root[data-theme="dark"] .reading-detail-toggle:hover { color: #e5fff0; background: #123824; border-color: #59d995; }
:root[data-theme="dark"] .reading-detail-section { background: #121a21; border-color: #3a4a5b; box-shadow: 0 10px 26px rgba(0,0,0,.25); }
:root[data-theme="dark"] .reading-detail-heading { color: #f3f7f4; }

/* 学习分析／能力报告页（analysis-screen.js）之前完全没有深色变体，浅色卡片
   直接摆在深色页面背景上——这里按已有的 --night-panel 面板配色补齐。 */
:root[data-theme="dark"] .analysis-page { color: #e8eef5; }
:root[data-theme="dark"] .analysis-hero,
:root[data-theme="dark"] .analysis-section,
:root[data-theme="dark"] .analysis-next-step {
  border-color: #2e3d4d;
  background: var(--night-panel);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.28);
}
:root[data-theme="dark"] .analysis-hero {
  background:
    radial-gradient(circle at 90% 0%, rgba(86, 184, 137, 0.14), transparent 30%),
    var(--night-panel);
}
:root[data-theme="dark"] .analysis-eyebrow { color: #4ade80; }
:root[data-theme="dark"] .analysis-hero h2,
:root[data-theme="dark"] .analysis-section h3,
:root[data-theme="dark"] .analysis-next-step h3 { color: #f2f7fb; }
:root[data-theme="dark"] .analysis-caption { color: #97a2ab; }
:root[data-theme="dark"] .analysis-level-chip { background: #202b37; border-color: #3a4857; color: #c7d0d8; }
:root[data-theme="dark"] .analysis-level-chip:hover { border-color: #70849a; color: #f2f7fb; }
:root[data-theme="dark"] .analysis-primary-action,
:root[data-theme="dark"] .analysis-next-button { border-color: #4ade80; background: #4ade80; color: #0d2b1d; }
:root[data-theme="dark"] .analysis-primary-action:hover,
:root[data-theme="dark"] .analysis-next-button:hover { background: #79e8a3; border-color: #79e8a3; }
:root[data-theme="dark"] .analysis-overall,
:root[data-theme="dark"] .analysis-trend-card,
:root[data-theme="dark"] .analysis-data-summary { border-color: #2e3d4d; background: rgba(255, 255, 255, 0.03); }
:root[data-theme="dark"] .analysis-overall > span,
:root[data-theme="dark"] .analysis-data-summary > span,
:root[data-theme="dark"] .analysis-trend-heading span { color: #97a2ab; }
:root[data-theme="dark"] .analysis-overall strong { color: #4ade80; }
:root[data-theme="dark"] .analysis-overall small,
:root[data-theme="dark"] .analysis-data-summary small,
:root[data-theme="dark"] .analysis-trend-heading small { color: #7c8a99; }
:root[data-theme="dark"] .analysis-data-summary strong { color: #f2f7fb; }
:root[data-theme="dark"] .analysis-trend-line i { background: linear-gradient(180deg, #4ade80, #1d3b2c); }
:root[data-theme="dark"] .analysis-trend-line em { color: #7c8a99; }
:root[data-theme="dark"] .analysis-subject-card { border-color: #2e3d4d; background: #1a232e; color: #e8eef5; }
:root[data-theme="dark"] .analysis-subject-card:hover { box-shadow: 0 9px 20px rgba(0, 0, 0, 0.35); }
:root[data-theme="dark"] .analysis-subject-card.is-priority {
  border-color: color-mix(in srgb, var(--analysis-color) 58%, #2e3d4d);
  background: color-mix(in srgb, var(--analysis-color) 16%, #1a232e);
}
:root[data-theme="dark"] .analysis-priority { background: rgba(74, 222, 128, 0.16); color: #4ade80; }
:root[data-theme="dark"] .analysis-subject-hint { color: #97a2ab; }
:root[data-theme="dark"] .analysis-meter { background: #2b3745; }
:root[data-theme="dark"] .analysis-practice-link { color: #c7d0d8; }
:root[data-theme="dark"] .analysis-next-step { background: linear-gradient(110deg, #142a1f, var(--night-panel)); }
:root[data-theme="dark"] .analysis-next-icon { background: #163826; color: #4ade80; }
:root[data-theme="dark"] .analysis-next-step p:last-child { color: #a8b3ba; }

/* 一句看懂／句子拆解页（daily-sentence.js 的 .sbd-*／.slst-*）同样之前完全
   没有深色变体：.sbd-card/.sbd-list-card 是旧命名遗留的死规则（当前HTML
   实际用的类名一直是这里补的这些），#sentenceBreakdownScreen.active 也
   没被列进上面两处强制深色背景的大清单里，导致整页保持浅色。 */
:root[data-theme="dark"] .sbd-title,
:root[data-theme="dark"] .sbd-full-jp,
:root[data-theme="dark"] .sbd-jp,
:root[data-theme="dark"] .sbd-grammar-pattern,
:root[data-theme="dark"] .slst-jp { color: var(--night-text); }
:root[data-theme="dark"] .sbd-refresh-btn { color: var(--night-muted); }
:root[data-theme="dark"] .sbd-refresh-btn:hover { background: var(--night-hover); color: var(--night-text); }
:root[data-theme="dark"] .sbd-full-zh,
:root[data-theme="dark"] .sbd-zh,
:root[data-theme="dark"] .sbd-grammar-meaning,
:root[data-theme="dark"] .slst-zh { color: var(--night-muted); }
:root[data-theme="dark"] .sbd-section-label,
:root[data-theme="dark"] .sbd-reading,
:root[data-theme="dark"] .slst-desc,
:root[data-theme="dark"] .slst-arrow { color: var(--night-subtle); }
:root[data-theme="dark"] .sbd-pos { color: #a5b4fc; background: #262a4a; }
:root[data-theme="dark"] .sbd-grammar-level { color: #4ade80; background: rgba(74, 222, 128, 0.16); }
:root[data-theme="dark"] .slst-card:hover { background: var(--night-hover); border-color: #5a6d82; }
:root[data-theme="dark"] .slst-card--today { border-color: #a78bfa; background: rgba(124, 58, 237, 0.18); }
:root[data-theme="dark"] .slst-today-badge { color: #c4b5fd; background: rgba(124, 58, 237, 0.24); }

/* Reading: both columns need the same dark surface and legible paragraph text. */
:root[data-theme="dark"] .rdg-article-card,
:root[data-theme="dark"] .rdg-q-panel,
:root[data-theme="dark"] .rdg-done-card { background: var(--night-panel); border-color: #2e3d4d; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
:root[data-theme="dark"] .rdg-para:hover,
:root[data-theme="dark"] .rdg-para--highlighted { background: #21374b; box-shadow: inset 0 0 0 1px #4a83b5; }
:root[data-theme="dark"] .rdg-full-analysis,
:root[data-theme="dark"] .rdg-vocab-row,
:root[data-theme="dark"] .rdg-grammar-row { border-color: #344458; }

/* Listening uses the same readable text instead of light-theme charcoal. */
:root[data-theme="dark"] .lst-q-card,
:root[data-theme="dark"] .lst-transcript-card { background: var(--night-panel); border-color: #2e3d4d; }
:root[data-theme="dark"] .lst-ctrl-btn,
:root[data-theme="dark"] .lst-speed-btn,
:root[data-theme="dark"] .lst-prec-btn { background: var(--night-raised); border-color: var(--night-line); color: var(--night-text); }
/* 播放按钮之前深色下要么完全没配色（主播放键），要么圆圈颜色跟页面
   背景太接近（逐句播放键），看起来像是消失了——按用户要求统一改成
   绿色，直接靠色相跳出来，不再依赖跟背景的明暗对比。 */
:root[data-theme="dark"] .lst-play-btn { background: #22c55e; color: #06240f; }
:root[data-theme="dark"] .lst-play-btn:hover { background: #4ade80; }
:root[data-theme="dark"] .lst-sentence-play-btn { background: var(--night-raised); border-color: #2f6b45; color: #4ade80; }
:root[data-theme="dark"] .lst-sentence-play-btn:hover { border-color: #4ade80; background: #17392b; }
:root[data-theme="dark"] .lst-sentence-play-btn.playing { border-color: #4ade80; background: #17392b; color: #4ade80; }
:root[data-theme="dark"] .lst-sentence.active { background: #17392b; }

/* The mock-exam card is a future feature, but it must still be readable. */
:root[data-theme="dark"] .mock-card-soon {
  background: linear-gradient(135deg, #1d2a37, #18222d);
  border-color: #40536a;
  box-shadow: 0 1px 3px rgba(0,0,0,.20);
}
:root[data-theme="dark"] .mock-title { color: var(--night-text); }
:root[data-theme="dark"] .mock-status { color: #c1ccd8; }
:root[data-theme="dark"] .mock-soon-badge {
  color: #ffd2a5;
  background: #4a321f;
  border: 1px solid #8c5c36;
}

/* The reading-session material is its own component, so theme it explicitly. */
:root[data-theme="dark"] .reading-agent-material {
  background: #202b37;
  border-color: #41556b;
  color: var(--night-text);
}
:root[data-theme="dark"] .reading-agent-material-body { color: var(--night-text); }
:root[data-theme="dark"] .reading-agent-material .w.word-hover,
:root[data-theme="dark"] .text-grammar-material .w.word-hover {
  background: #294864;
  color: #f6fbff;
  box-shadow: inset 0 0 0 2px #75b8ee, 0 2px 6px rgba(15, 53, 87, .38);
}
:root[data-theme="dark"] .reading-sentence.is-translation-linked {
  background: #274963;
  box-shadow: inset 0 0 0 1.5px #78b9ec;
}
:root[data-theme="dark"] .reading-agent-trans-body {
  background: #1b2936;
  border-color: #46627d;
  color: #e8f1fa;
  box-shadow: 0 8px 18px rgba(0,0,0,.22);
}
:root[data-theme="dark"] .reading-translation-segment.is-translation-linked {
  background: #294d6b;
  color: #f2f8ff;
  box-shadow: inset 0 0 0 1.5px #7bbcf0;
}

/* ── Night mode refresh: ink, paper, and green ─────────────────────
   The first dark theme was intentionally blue-grey for low glare, but it
   made the whole product look dusty.  This palette uses black surfaces and
   paper-white type for a clean monochrome base; green is the only large
   status colour, with blue/purple reserved for interaction and AI. */
:root[data-theme="dark"] {
  --bg: #080a0d;
  --text: #f7f8f6;
  --muted: #b8c0c7;
  --border: #273039;
  --dp-bg: #080a0d;
  --dp-surface: #0f1419;
  --dp-border: #273039;
  --night-text: #f7f8f6;
  --night-muted: #b8c0c7;
  --night-subtle: #89949e;
  --night-panel: #0f1419;
  --night-raised: #151b21;
  --night-hover: #1d252d;
  --night-line: #303a44;
  --popup-glass-bg: linear-gradient(145deg, rgba(17,22,27,.96), rgba(7,10,13,.93));
  --popup-glass-border: rgba(247,248,246,.16);
  --popup-glass-shadow: 0 24px 64px rgba(0,0,0,.62), inset 0 1px 0 rgba(255,255,255,.07);
}

:root[data-theme="dark"] body,
:root[data-theme="dark"] .home-full,
:root[data-theme="dark"] .home-body,
:root[data-theme="dark"] .light-home,
:root[data-theme="dark"] .light-home .vh-body,
:root[data-theme="dark"] #todayStartScreen.active,
:root[data-theme="dark"] #readingPassageScreen.active,
:root[data-theme="dark"] #listeningPassageScreen.active,
:root[data-theme="dark"] #sentenceBreakdownScreen.active,
:root[data-theme="dark"] #sentenceListScreen.active,
:root[data-theme="dark"] #vocabularyScreen.active,
:root[data-theme="dark"] #grammarScreen.active,
:root[data-theme="dark"] #readingHomeScreen.active,
:root[data-theme="dark"] #listeningHomeScreen.active,
:root[data-theme="dark"] #vocabSessionScreen.active,
:root[data-theme="dark"] #readingScreen.active,
:root[data-theme="dark"] #listeningScreen.active { background: #080a0d; color: var(--night-text); }

:root[data-theme="dark"] .dash-sidebar,
:root[data-theme="dark"] .home-topbar,
:root[data-theme="dark"] .quiz-topbar,
:root[data-theme="dark"] .vh-topbar,
:root[data-theme="dark"] .rdg-topbar,
:root[data-theme="dark"] .rdg-tab-bar,
:root[data-theme="dark"] .lst-topbar,
:root[data-theme="dark"] .sbd-topbar { background: #0b0f13; border-color: #222b33; }

:root[data-theme="dark"] .dash-card,
:root[data-theme="dark"] .vh-prog-card,
:root[data-theme="dark"] .vh-mode-card,
:root[data-theme="dark"] .quiz-q-card,
:root[data-theme="dark"] .quiz-fb-card,
:root[data-theme="dark"] .quiz-done-section,
:root[data-theme="dark"] .rdg-article-card,
:root[data-theme="dark"] .rdg-q-panel,
:root[data-theme="dark"] .rdg-done-card,
:root[data-theme="dark"] .rdg-question-card,
:root[data-theme="dark"] .rdg-translation-card,
:root[data-theme="dark"] .lst-player-card,
:root[data-theme="dark"] .lst-question-card,
:root[data-theme="dark"] .lst-transcript-card,
:root[data-theme="dark"] .sbd-card,
:root[data-theme="dark"] .sbd-list-card,
:root[data-theme="dark"] .sbd-sentence-block,
:root[data-theme="dark"] .sbd-word,
:root[data-theme="dark"] .sbd-grammar-item,
:root[data-theme="dark"] .slst-card,
:root[data-theme="dark"] .backend-account-dialog,
:root[data-theme="dark"] .backend-delete-dialog,
:root[data-theme="dark"] .appearance-dialog { background: #0f1419; border-color: #29333d; color: var(--night-text); box-shadow: 0 12px 36px rgba(0,0,0,.34); }

:root[data-theme="dark"] .dash-logo,
:root[data-theme="dark"] .home-topbar,
:root[data-theme="dark"] .quiz-topbar,
:root[data-theme="dark"] .vh-topbar,
:root[data-theme="dark"] .rdg-topbar,
:root[data-theme="dark"] .rdg-tab-bar { border-color: #222b33; }

:root[data-theme="dark"] .dash-nav-item:hover:not(:disabled) { background: #151d24; color: #fff; }
:root[data-theme="dark"] .dash-nav-item.active { background: #0d2a1d; color: #f7fff9; box-shadow: inset 3px 0 0 #42d98a; }
:root[data-theme="dark"] .dash-nav-item.active .nav-icon { stroke: #58e69a; }

/* When moving between primary navigation entries, let the hover target carry
   the green focus frame. The actual current page returns to its neutral state
   until the pointer leaves the navigation. */
.dash-nav:has(.dash-nav-item[data-nav]:hover) .dash-nav-item.active {
  background: transparent;
  color: #6F7379;
  box-shadow: none;
  font-weight: 500;
}
.dash-nav:has(.dash-nav-item[data-nav]:hover) .dash-nav-item.active .nav-icon { stroke: currentColor; }
.dash-nav-item[data-nav]:hover:not(:disabled) {
  background: #EAF8F0;
  color: #18A95B;
  box-shadow: inset 3px 0 0 #18A95B;
  font-weight: 600;
}
.dash-nav-item[data-nav]:hover:not(:disabled) .nav-icon { stroke: #18A95B; }

:root[data-theme="dark"] .dash-nav:has(.dash-nav-item[data-nav]:hover) .dash-nav-item.active {
  background: transparent;
  color: #a6b2c0;
  box-shadow: none;
  font-weight: 500;
}
:root[data-theme="dark"] .dash-nav-item[data-nav]:hover:not(:disabled) {
  background: #0d2a1d;
  color: #f7fff9;
  box-shadow: inset 3px 0 0 #42d98a;
  font-weight: 600;
}
:root[data-theme="dark"] .dash-nav-item[data-nav]:hover:not(:disabled) .nav-icon { stroke: #58e69a; }

:root[data-theme="dark"] .appearance-option,
:root[data-theme="dark"] .appearance-close { background: #12181d; border-color: #303a44; color: #f3f6f3; }
:root[data-theme="dark"] .appearance-option:hover,
:root[data-theme="dark"] .appearance-close:hover { background: #1a2229; border-color: #596772; color: #fff; }
:root[data-theme="dark"] .appearance-option.is-selected { background: #0d2a1d; border-color: #4add91; box-shadow: 0 0 0 3px rgba(66,217,138,.12); }
:root[data-theme="dark"] .appearance-option-icon { background: #0b281a; color: #65e9a4; }

:root[data-theme="dark"] .today-card,
:root[data-theme="dark"] .mock-card-soon,
:root[data-theme="dark"] .sentence-card { background: #0d1217; border-color: #29333d; box-shadow: none; }
:root[data-theme="dark"] .mock-card-soon { background: linear-gradient(135deg, #10161b, #0b0f13); outline: none; }
:root[data-theme="dark"] .mock-card-soon::before { display: none; }
:root[data-theme="dark"] .mock-title,
:root[data-theme="dark"] .mock-status { color: var(--night-text); }
:root[data-theme="dark"] .today-card-meta,
:root[data-theme="dark"] .mock-status { color: var(--night-muted); }
:root[data-theme="dark"] .today-chip { background: #192128; border-color: #35414c; color: #f1f5f2; }

:root[data-theme="dark"] .tday-item,
:root[data-theme="dark"] .tday-duration-trigger,
:root[data-theme="dark"] .tday-unlimited-choice,
:root[data-theme="dark"] .tday-mode-card,
:root[data-theme="dark"] .tday-mode-notice,
:root[data-theme="dark"] .tday-duration-popover,
:root[data-theme="dark"] .quiz-opt,
:root[data-theme="dark"] .quiz-action-btn,
:root[data-theme="dark"] .quiz-done-btn,
:root[data-theme="dark"] .lst-ctrl-btn,
:root[data-theme="dark"] .lst-speed-btn,
:root[data-theme="dark"] .lst-prec-btn { background: #151b21; border-color: #303a44; color: var(--night-text); }
:root[data-theme="dark"] .lst-play-btn { background: #22c55e; color: #06240f; }
:root[data-theme="dark"] .lst-play-btn:hover { background: #4ade80; }
:root[data-theme="dark"] .lst-sentence-play-btn { background: #151b21; border-color: #2f6b45; color: #4ade80; }
:root[data-theme="dark"] .lst-sentence-play-btn:hover { border-color: #4ade80; background: #17392b; }
:root[data-theme="dark"] .lst-sentence-play-btn.playing { border-color: #4ade80; background: #17392b; color: #4ade80; }
:root[data-theme="dark"] .tday-item:hover,
:root[data-theme="dark"] .tday-duration-trigger:hover,
:root[data-theme="dark"] .tday-unlimited-choice:hover,
:root[data-theme="dark"] .tday-mode-card:hover:not(.selected),
:root[data-theme="dark"] .quiz-opt:hover:not([aria-disabled="true"]),
:root[data-theme="dark"] .quiz-action-btn:hover,
:root[data-theme="dark"] .quiz-done-btn:hover { background: #1d252d; border-color: #586571; }
:root[data-theme="dark"] .tday-mode-card.selected,
:root[data-theme="dark"] .quiz-opt.correct,
:root[data-theme="dark"] .lst-sentence.active { background: #0d3020; border-color: #47dd90; }
:root[data-theme="dark"] .tday-agent-advice { background: #0c291b; border-color: #29734d; }
:root[data-theme="dark"] .tday-agent-summary { background: var(--night-raised); border-color: var(--night-line); }
:root[data-theme="dark"] .tday-agent-message { color: var(--night-muted); }
:root[data-theme="dark"] .tday-agent-name { color: #79d9a2; }
:root[data-theme="dark"] .tday-agent-breakdown { border-top-color: var(--night-line); }
:root[data-theme="dark"] .tday-agent-breakdown-row strong { color: var(--night-text); }
:root[data-theme="dark"] .tday-agent-breakdown-row span { color: var(--night-muted); }
:root[data-theme="dark"] .tday-agent-advice,
:root[data-theme="dark"] .tday-agent-advice small { color: #a9e8c5; }
:root[data-theme="dark"] .tday-ai-refresh-btn { background: #0c291b; border-color: #29734d; color: #a9e8c5; }
:root[data-theme="dark"] .tday-ai-refresh-btn:hover:not(:disabled) { background: #123822; border-color: #37945f; }
:root[data-theme="dark"] .tday-ai-note { background: #332811; color: #e3c876; }
:root[data-theme="dark"] .tday-ai-note button { background: #201709; border-color: #a1802f; color: #e3c876; }
:root[data-theme="dark"] .tday-start-btn { background: #f4f6f3; color: #0b100d; }
:root[data-theme="dark"] .tday-start-btn:hover { background: #fff; }

/* Blue stays an interaction colour: it must read against ink black. */
:root[data-theme="dark"] .quiz-opt.selected { background: #1d2146; border-color: #8c92ff; }
/* 语法/词汇题干和选项悬停查词的蓝框——浅色模式下用的 rgba(79,70,229,0.1)
   透明蓝底在深色模式的选项按钮深色底（.quiz-opt 在深色模式下是深紫/深蓝，
   见上面 .quiz-opt.selected 那行）上几乎看不见，改成跟 .reading-agent-material
   .w.word-hover 同款的实色深蓝底+白字+浅蓝描边，保证深色模式下也看得清。
   .jp-lookup-text 同时覆盖题干（quiz-stem）和选项（quiz-opt-txt）。 */
:root[data-theme="dark"] .jp-lookup-text .w.word-hover {
  background: #294864;
  color: #f6fbff;
  box-shadow: inset 0 0 0 2px #75b8ee, 0 2px 6px rgba(15, 53, 87, .38);
}
:root[data-theme="dark"] .rdg-para:hover,
:root[data-theme="dark"] .rdg-para--highlighted { background: #112a3b; box-shadow: inset 0 0 0 1px #5ea5e5; }
:root[data-theme="dark"] .reading-agent-material { background: #10161b; border-color: #34414c; }
:root[data-theme="dark"] .listening-material-heading,
:root[data-theme="dark"] .listening-material-heading strong,
:root[data-theme="dark"] .lst-scene-label { color: var(--night-text); }
:root[data-theme="dark"] .lst-scene-label { font-size: 14px; font-weight: 800; letter-spacing: .01em; }
:root[data-theme="dark"] .reading-agent-material .w.word-hover,
:root[data-theme="dark"] .text-grammar-material .w.word-hover { background: #133d5c; color: #fff; box-shadow: inset 0 0 0 2px #79bfff, 0 2px 8px rgba(0,0,0,.34); }
:root[data-theme="dark"] .reading-sentence.is-translation-linked { background: #123955; box-shadow: inset 0 0 0 1.5px #77bbf3; }
:root[data-theme="dark"] .reading-sentence.is-translation-locked { background: #164b70; box-shadow: inset 0 0 0 2px #9bd8ff, 0 0 0 2px rgba(91, 184, 244, .18); }
:root[data-theme="dark"] .reading-agent-trans-body { background: #10161b; border-color: #34414c; color: #edf6ff; }
:root[data-theme="dark"] .reading-translation-segment.is-translation-linked { background: #123c5a; color: #fff; box-shadow: inset 0 0 0 1.5px #7ac0f5; }

/* 阅读解析栏的夜间配色与文章卡保持同一套高对比深色，而不是灰蒙蒙一块。 */
:root[data-theme="dark"] .reading-top-detail-toggle { background: #0d2d20; border-color: #2f8a5c; color: #8cf0bd; }
:root[data-theme="dark"] .reading-top-detail-toggle:hover { background: #123b2a; border-color: #52c986; }
:root[data-theme="dark"] .session-top-review-btn { background: #17232c; border-color: #3b5060; color: #d9e5ed; }
:root[data-theme="dark"] .session-top-review-btn:hover { background: #21313d; border-color: #688197; color: #ffffff; }
:root[data-theme="dark"] .session-top-review-btn.review-added { background: #0d2d20; border-color: #2f8a5c; color: #8cf0bd; }
:root[data-theme="dark"] .listening-top-transcript-toggle { background: #0d2d20; border-color: #2f8a5c; color: #8cf0bd; }
:root[data-theme="dark"] .listening-top-transcript-toggle:hover { background: #123b2a; border-color: #52c986; }
:root[data-theme="dark"] .reading-side-analysis { background: #10161b; border-color: #34414c; box-shadow: 0 10px 24px rgba(0,0,0,.28); }
:root[data-theme="dark"] .reading-side-analysis-heading { color: #f2f7f4; }

/* Personal centre has its own form/card colours.  Keep every level of text
   bright enough in night mode instead of inheriting the light-mode ink. */
:root[data-theme="dark"] .backend-account-card,
:root[data-theme="dark"] .backend-account-head,
:root[data-theme="dark"] .backend-account-view,
:root[data-theme="dark"] .backend-delete-card { color: #edf3f8; }
:root[data-theme="dark"] .backend-account-head { border-color: #29343e; }
:root[data-theme="dark"] .backend-account-head h2,
:root[data-theme="dark"] .backend-account-card label,
:root[data-theme="dark"] .backend-auth-tabs button.is-active,
:root[data-theme="dark"] .backend-user-summary strong,
:root[data-theme="dark"] .backend-identity-heading { color: #f4f8fb; }
:root[data-theme="dark"] .backend-account-card label.backend-terms-row { color: #9aabba; font-weight: 400; }
:root[data-theme="dark"] .backend-account-head p,
:root[data-theme="dark"] .backend-region-copy,
:root[data-theme="dark"] .backend-provider-note,
:root[data-theme="dark"] .backend-user-label,
:root[data-theme="dark"] .backend-identity-item,
:root[data-theme="dark"] .backend-account-status { color: #b7c4d0; }
:root[data-theme="dark"] .backend-region-picker,
:root[data-theme="dark"] .backend-auth-tabs,
:root[data-theme="dark"] .backend-user-summary,
:root[data-theme="dark"] .backend-identity-section { border-color: #31404d; background: #151d24; }
:root[data-theme="dark"] .backend-user-summary { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04); }
:root[data-theme="dark"] .backend-region-picker button,
:root[data-theme="dark"] .backend-auth-tabs button { color: #b8c4cf; }
:root[data-theme="dark"] .backend-region-picker button.is-active,
:root[data-theme="dark"] .backend-auth-tabs button.is-active { color: #f5fbf7; background: #26323e; }
:root[data-theme="dark"] .backend-account-card input,
:root[data-theme="dark"] .backend-delete-card input,
:root[data-theme="dark"] .backend-account-secondary { border-color: #3b4b58; color: #edf3f8; background: #12191f; }
:root[data-theme="dark"] .backend-account-card input::placeholder { color: #7f91a0; }
:root[data-theme="dark"] .backend-delete-card input::placeholder { color: #7f91a0; }
:root[data-theme="dark"] .backend-delete-card > p { color: #b7c4d0; }
:root[data-theme="dark"] .backend-account-close { border-color: #3b4b58; color: #d7e1e9; background: #151d24; }
:root[data-theme="dark"] .backend-account-close:hover { color: #fff; background: #202a33; }
:root[data-theme="dark"] .backend-provider-divider { color: #9aabba; }
:root[data-theme="dark"] .backend-provider-divider::before,
:root[data-theme="dark"] .backend-provider-divider::after { background: #2d3a45; }
:root[data-theme="dark"] .backend-provider-list button,
:root[data-theme="dark"] .backend-identity-item { border-color: #30404d; color: #d8e2ea; background: #131b22; }
:root[data-theme="dark"] .backend-provider-list button:hover { border-color: #4d7660; background: #18231e; }
:root[data-theme="dark"] .backend-identity-item small,
:root[data-theme="dark"] .provider-pending { color: #95a5b3; }
:root[data-theme="dark"] .backend-account-collapsible,
:root[data-theme="dark"] .backend-membership-redeem { border-color: #31404d; background: #151d24; }
:root[data-theme="dark"] .backend-account-collapsible summary,
:root[data-theme="dark"] .backend-membership-redeem summary { color: #f4f8fb; }
:root[data-theme="dark"] .backend-account-collapsible p,
:root[data-theme="dark"] .backend-membership-redeem p { color: #b7c4d0; }

@media (max-width: 760px) {
  .reading-session-shell { max-width: 680px; }
  .reading-session-shell .quiz-body { padding-inline: 14px; }
  .listening-library-shell .quiz-body { padding-inline: 14px; }
  .listening-question-stage { padding: 18px 16px; }
  .listening-agent-material { padding: 18px 16px; }
  .listening-study-stage.transcript-open { grid-template-columns: 1fr; }
  .listening-study-stage.transcript-open .listening-question-column { order: 1; }
  .listening-study-stage.transcript-open .reading-article-column { order: 2; }
  .reading-study-stage.analysis-open { grid-template-columns: 1fr; }
  .reading-side-analysis { order: 2; }
  .reading-article-column { order: 1; }
}

/* Selected answers must stay blue while the pointer rests on them.  This is
   deliberately more specific than the generic option hover rule. */
:root[data-theme="dark"] .quiz-opt.selected:hover:not([aria-disabled="true"]) {
  background: #1d2146;
  border-color: #9aa0ff;
  color: #f7f8ff;
  box-shadow: 0 0 0 3px rgba(140,146,255,.16);
}

:root[data-theme="dark"] .text-grammar-material {
  background: #111923;
  border-color: #3a4d61;
  color: #eef5ff;
}
:root[data-theme="dark"] .text-grammar-material-body { color: #e7eef8; }
:root[data-theme="dark"] .text-grammar-blank { background: #222957; color: #c9ceff; }
:root[data-theme="dark"] .text-grammar-blank.active { background: #222957; color: #c9ceff; box-shadow: inset 0 0 0 1px rgba(99, 102, 241, .28); }
:root[data-theme="dark"] .text-grammar-blank.filled { background: #173d5b; color: #d7ecff; box-shadow: inset 0 0 0 1px #5ba8e7; }
:root[data-theme="dark"] .blank-answer-highlight { background: #173d5b; color: #d7ecff; box-shadow: inset 0 0 0 1px #5ba8e7; }
:root[data-theme="dark"] .text-grammar-group-heading strong { color: #f4f7f4; }
:root[data-theme="dark"] .text-grammar-group-heading span,
:root[data-theme="dark"] .text-grammar-choice-card-title > span { color: #a9b6c4; }
:root[data-theme="dark"] .text-grammar-choice-card { background: #111820; border-color: #303d4a; }
:root[data-theme="dark"] .text-grammar-choice-card-title { color: #e8eff6; }
:root[data-theme="dark"] .text-grammar-choice { background: #151d24; border-color: #354556; color: #eef3f8; }
:root[data-theme="dark"] .text-grammar-choice-key { background: #28394a; color: #c8d5e1; }
:root[data-theme="dark"] .text-grammar-choice-zh { color: #b2c0ce; }
:root[data-theme="dark"] .text-grammar-choice:hover { background: #1c2834; border-color: #6b9acb; }
:root[data-theme="dark"] .text-grammar-choice.selected,
:root[data-theme="dark"] .text-grammar-choice.selected:hover { background: #1d2146; border-color: #9aa0ff; color: #f7f8ff; box-shadow: 0 0 0 2px rgba(140,146,255,.16); }
:root[data-theme="dark"] .text-grammar-choice.selected .text-grammar-choice-key { background: #7379ef; color: #fff; }
:root[data-theme="dark"] .text-grammar-choice.correct { background: #153c2b; border-color: #32bd72; color: #d7f5e4; }
:root[data-theme="dark"] .text-grammar-choice.correct .text-grammar-choice-key { background: #32bd72; color: #0d2a1d; }
:root[data-theme="dark"] .text-grammar-choice.incorrect { background: #48262d; border-color: #df6d79; color: #fbdde1; }
:root[data-theme="dark"] .text-grammar-choice.incorrect .text-grammar-choice-key { background: #df6d79; color: #2c171d; }
:root[data-theme="dark"] .text-grammar-result-row { border-color: #354556; background: #151d24; color: #edf3f8; }
:root[data-theme="dark"] .text-grammar-result-row small { color: #b2c0ce; }
:root[data-theme="dark"] .text-grammar-result-explanation { border-color: rgba(148, 163, 184, .24); color: #d5e0ea; }
:root[data-theme="dark"] .text-grammar-result-wrong-pair { color: #d5e0ea; }
:root[data-theme="dark"] .text-grammar-result-wrong-pair .zh { color: #b2c0ce; }
:root[data-theme="dark"] .text-grammar-result-row.correct small { color: #4ade80; }
:root[data-theme="dark"] .text-grammar-result-row.incorrect small { color: #f87171; }
:root[data-theme="dark"] .text-grammar-detail-block { border-color: rgba(148, 163, 184, .24); }
:root[data-theme="dark"] .text-grammar-detail-heading { color: #f4f7f4; }

/* ── Desktop AI assistant: docked right rail that resizes the page ── */
@media (min-width: 1180px) {
  body > .screen {
    transition: margin-right 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  body.chat-open > .screen.active {
    margin-right: var(--chat-dock-width);
  }

  .chat-panel {
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--chat-dock-width);
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border-radius: 24px 0 0 24px;
    transform: translateX(100%);
    opacity: 1;
    transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .chat-panel.open {
    transform: translateX(0);
    opacity: 1;
  }

  body.chat-open .lib-covers {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }

  body.chat-open .lib-cover-card { aspect-ratio: 1 / 1.12; }
  body.chat-open .lib-cover-footer { padding: 11px 10px 8px; }
  body.chat-open .lib-cover-title { font-size: 13px; }
  body.chat-open .lib-cover-desc { font-size: 9.5px; }

  body.chat-open .ability-card { padding: 16px 17px 17px; }
  body.chat-open .ability-card .dash-card-hd { margin-bottom: 10px; }
  body.chat-open .ability-circle-wrap { width: min(100%, 84px); }
  body.chat-open .ability-grade-text { font-size: 17px; }
}

@media (min-width: 1180px) and (max-width: 1499px) {
  body.chat-open .dash-sidebar { width: 60px; }
  body.chat-open .dash-logo-text,
  body.chat-open .dash-nav-item > span:not(.dash-badge) { display: none; }
  body.chat-open .dash-nav-item { justify-content: center; padding: 11px; }
  body.chat-open .dashboard-grid { grid-template-columns: 1fr; }
  body.chat-open .lib-covers { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  body > .screen,
  .chat-panel { transition: none; }
}

/* ── Settings navigation: a small menu first, then a full right-side page ── */
.dash-settings-stack {
  position: relative;
  margin-top: auto;
}
.dash-settings-stack .nav-settings { margin-top: 0; }
.dash-settings-menu {
  display: none;
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  padding: 6px;
  border: 1px solid var(--dp-border, #e1e8e4);
  border-radius: 12px;
  background: var(--dp-surface, #fff);
  box-shadow: 0 14px 32px rgba(13, 31, 22, .14);
}
.dash-settings-menu.is-open { display: block; }
.dash-settings-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  background: transparent;
  color: var(--dp-text, #18251f);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}
.dash-settings-menu-item:hover,
.dash-settings-menu-item:focus-visible {
  background: var(--dp-soft, #eaf8f0);
  color: #16894d;
  outline: none;
}

.appearance-settings-main {
  min-height: 100%;
  background: var(--dp-bg, #fff);
}
.appearance-settings-page {
  max-width: 800px;
  margin: 0 auto;
  padding: clamp(40px, 7vw, 88px) clamp(24px, 5vw, 72px);
}
.appearance-page-head {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--dp-border, #e7ece8);
}
.appearance-page-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: #edf8f1;
  color: #16894d;
  font-size: 28px;
  flex: 0 0 auto;
}
.appearance-page-head h2 {
  margin: 5px 0 6px;
  color: var(--dp-text, #18251f);
  font-size: clamp(28px, 4vw, 38px);
  letter-spacing: -.03em;
}
.appearance-page-head p {
  margin: 0;
  color: var(--dp-muted, #6d7972);
  font-size: 14px;
  line-height: 1.65;
}
.settings-back-btn {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  padding: 0 2px 4px 0;
  border: 1px solid var(--dp-border, #dbe5df);
  border-radius: 16px;
  background: var(--dp-surface, #fff);
  color: var(--dp-text, #18251f);
  font: 400 36px/1 inherit;
  cursor: pointer;
}
.settings-back-btn:hover { border-color: #7bd4a3; background: #f2fbf6; color: #16894d; }
.settings-list {
  display: grid;
  gap: 14px;
  margin-top: 30px;
}
.settings-list-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 76px;
  padding: 14px 18px;
  border: 1px solid var(--dp-border, #dbe5df);
  border-radius: 16px;
  background: var(--dp-surface, #fff);
  color: var(--dp-text, #18251f);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s, background .16s, box-shadow .16s, transform .16s;
}
.settings-list-row:hover {
  border-color: #7bd4a3;
  background: #f7fcf9;
  box-shadow: 0 10px 24px rgba(15, 92, 53, .07);
  transform: translateY(-1px);
}
.settings-row-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: #edf8f1;
  color: #16894d;
  font-size: 20px;
  font-weight: 800;
}
.settings-row-copy { min-width: 0; }
.settings-row-copy strong { display: block; font-size: 16px; font-weight: 800; }
.settings-row-value { color: var(--dp-muted, #66736c); font-size: 13px; font-weight: 700; white-space: nowrap; }
.settings-row-chevron { color: #8c9690; font-size: 29px; font-weight: 300; line-height: 1; }
.settings-list-row.is-danger { margin-top: 18px; border-color: #f0c9c5; background: #fffafa; }
.settings-list-row.is-danger .settings-row-icon { background: #fff0ee; color: #bd3027; }
.settings-list-row.is-danger .settings-row-copy strong,
.settings-list-row.is-danger .settings-row-chevron { color: #b42318; }
.settings-list-row.is-danger:hover { border-color: #dc938c; background: #fff5f4; box-shadow: 0 10px 24px rgba(180, 35, 24, .07); }
.settings-delete-info-link { display: inline-block; margin-top: 12px; color: #187d45; font-size: 12px; font-weight: 700; text-decoration: none; }
.settings-delete-info-link:hover { text-decoration: underline; }
.settings-detail-page .appearance-primary-section { margin-top: 30px; }
.settings-theme-options { margin-top: 30px; }
.appearance-page-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}
.appearance-page-option {
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-height: 170px;
  padding: 20px;
  border: 1px solid var(--dp-border, #dbe5df);
  border-radius: 18px;
  background: var(--dp-surface, #fff);
  color: var(--dp-text, #18251f);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s, background .16s, box-shadow .16s, transform .16s;
}
.appearance-page-option:hover {
  border-color: #7bd4a3;
  background: #f7fcf9;
  box-shadow: 0 12px 24px rgba(15, 92, 53, .08);
  transform: translateY(-2px);
}
.appearance-page-option.is-selected {
  border-color: #22a960;
  background: #ecfaf1;
  box-shadow: 0 0 0 3px rgba(31, 169, 90, .11);
}
.appearance-page-option .appearance-option-icon {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  font-size: 21px;
}
.appearance-page-option strong,
.appearance-page-option small { display: block; }
.appearance-page-option strong { font-size: 16px; font-weight: 800; }
.appearance-page-option small { margin-top: 5px; color: var(--dp-muted, #728078); font-size: 12.5px; line-height: 1.55; }

.appearance-account-section {
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--dp-border, #e7ece8);
}
.appearance-account-section h3 { margin: 4px 0 16px; color: var(--dp-text, #18251f); font-size: 18px; letter-spacing: -.01em; }
.appearance-account-danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid #f0c9c5;
  border-radius: 14px;
  background: #fffafa;
}
.appearance-account-danger-row strong { color: #b42318; font-size: 14px; }
.appearance-account-danger-row p { margin: 5px 0 0; color: #94655f; font-size: 12.5px; line-height: 1.55; }
.appearance-account-danger-btn {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid #dc938c;
  border-radius: 10px;
  color: #fff;
  background: #c9362d;
  font: 700 13px/1 inherit;
  cursor: pointer;
}
.appearance-account-danger-btn:hover { background: #ad271f; }
.appearance-account-section > a { display: inline-block; margin-top: 10px; color: #187d45; font-size: 12px; font-weight: 700; text-decoration: none; }
.appearance-account-section > a:hover { text-decoration: underline; }

/* 语言设置区块（2026-08-28 新增）：跟外观模式一样借用 .appearance-page-option 的
   选中态样式，但语言按钮没有图标/说明文字，用 min-height:auto 的窄行卡片替代
   外观卡片的 170px 高卡片，避免只显示一个语言名的按钮出现大片空白。 */
.appearance-language-section {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--dp-border, #e7ece8);
}
.appearance-primary-section {
  margin-top: 28px;
  padding-top: 0;
  border-top: 0;
}
.appearance-language-section h3 { margin: 4px 0 6px; color: var(--dp-text, #18251f); font-size: 18px; letter-spacing: -.01em; }
.appearance-language-section > p { margin: 0 0 18px; color: var(--dp-muted, #6d7972); font-size: 13px; line-height: 1.55; }
.appearance-language-section .appearance-page-options { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 0; }
.appearance-language-section .appearance-page-option {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  min-height: auto;
  padding: 12px 10px;
  gap: 0;
}
.appearance-language-section .appearance-page-option strong { font-size: 14px; font-weight: 750; text-align: center; }
@media (max-width: 760px) {
  .appearance-language-section .appearance-page-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.appearance-theme-section {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--dp-border, #e7ece8);
}
.appearance-theme-section h3 { margin: 4px 0 6px; color: var(--dp-text, #18251f); font-size: 18px; letter-spacing: -.01em; }
.appearance-theme-section > p { margin: 0; color: var(--dp-muted, #6d7972); font-size: 13px; line-height: 1.55; }

/* Dictionary and wordbook are part of the dashboard now, so they must follow
   the explicit theme choice rather than the browser's default colour scheme. */
:root[data-theme="dark"] .persistent-dashboard-main,
:root[data-theme="dark"] .appearance-settings-main { background: #080b0f; }
:root[data-theme="dark"] .dash-settings-menu {
  border-color: #2d3a46;
  background: #10171e;
  box-shadow: 0 16px 38px rgba(0, 0, 0, .48);
}
:root[data-theme="dark"] .dash-settings-menu-item { color: #edf4ee; }
:root[data-theme="dark"] .dash-settings-menu-item:hover,
:root[data-theme="dark"] .dash-settings-menu-item:focus-visible { background: #0d2a1d; color: #7ce5a8; }
:root[data-theme="dark"] .appearance-page-head { border-color: #293540; }
:root[data-theme="dark"] .appearance-page-icon,
:root[data-theme="dark"] .appearance-page-option .appearance-option-icon { background: #0c2a1c; color: #70e3a1; }
:root[data-theme="dark"] .appearance-page-head h2 { color: #f1f5f2; }
:root[data-theme="dark"] .appearance-page-head p,
:root[data-theme="dark"] .appearance-page-option small { color: #aebbc7; }
:root[data-theme="dark"] .settings-back-btn,
:root[data-theme="dark"] .settings-list-row { background: #10171e; border-color: #2d3a46; color: #eff6f1; }
:root[data-theme="dark"] .settings-back-btn:hover,
:root[data-theme="dark"] .settings-list-row:hover { background: #15202a; border-color: #527084; }
:root[data-theme="dark"] .settings-row-icon { background: #0c2a1c; color: #70e3a1; }
:root[data-theme="dark"] .settings-row-value { color: #aebbc7; }
:root[data-theme="dark"] .settings-row-chevron { color: #8f9ba7; }
:root[data-theme="dark"] .settings-list-row.is-danger { border-color: #6b3630; background: #241512; }
:root[data-theme="dark"] .settings-list-row.is-danger .settings-row-icon { background: #3a1b18; color: #ff8a80; }
:root[data-theme="dark"] .settings-list-row.is-danger .settings-row-copy strong,
:root[data-theme="dark"] .settings-list-row.is-danger .settings-row-chevron { color: #ff8a80; }
:root[data-theme="dark"] .settings-list-row.is-danger:hover { border-color: #9a4b43; background: #2c1815; }
:root[data-theme="dark"] .appearance-page-option { background: #10171e; border-color: #2d3a46; color: #eff6f1; }
:root[data-theme="dark"] .appearance-account-section { border-color: #293540; }
:root[data-theme="dark"] .appearance-account-section h3 { color: #f1f5f2; }
:root[data-theme="dark"] .appearance-language-section { border-color: #293540; }
:root[data-theme="dark"] .appearance-language-section h3 { color: #f1f5f2; }
:root[data-theme="dark"] .appearance-language-section > p { color: #aebbc7; }
:root[data-theme="dark"] .appearance-theme-section { border-color: #293540; }
:root[data-theme="dark"] .appearance-theme-section h3 { color: #f1f5f2; }
:root[data-theme="dark"] .appearance-theme-section > p { color: #aebbc7; }
:root[data-theme="dark"] .appearance-account-danger-row { border-color: #6b3630; background: #241512; }
:root[data-theme="dark"] .appearance-account-danger-row strong { color: #ff8a80; }
:root[data-theme="dark"] .appearance-account-danger-row p { color: #cf9a94; }
:root[data-theme="dark"] .appearance-page-option:hover { background: #15202a; border-color: #527084; box-shadow: 0 12px 26px rgba(0,0,0,.28); }
:root[data-theme="dark"] .appearance-page-option.is-selected { background: #0d2a1d; border-color: #47dd90; box-shadow: 0 0 0 3px rgba(71,221,144,.11); }

:root[data-theme="dark"] .wordbook-wrap,
:root[data-theme="dark"] .dict-search-wrap,
:root[data-theme="dark"] .dict-entry-wrap { color: #edf3f8; }
:root[data-theme="dark"] .wordbook-title,
:root[data-theme="dark"] .dict-search-head h2 { color: #f1f5f2; }
:root[data-theme="dark"] .wordbook-sub,
:root[data-theme="dark"] .dict-search-sub,
:root[data-theme="dark"] .wordbook-empty,
:root[data-theme="dark"] .dict-empty { color: #aebbc7; }
:root[data-theme="dark"] .word-list-tabs { background: #111820; border-color: #2e3b47; }
:root[data-theme="dark"] .word-list-tab { color: #b8c4cf; }
:root[data-theme="dark"] .word-list-tab:hover { color: #77e6a5; }
:root[data-theme="dark"] .word-list-tab.active { background: #202b35; color: #f0f7f2; box-shadow: none; }
:root[data-theme="dark"] .word-card,
:root[data-theme="dark"] .dict-result-item,
:root[data-theme="dark"] .dict-entry-section { background: #10171e; border-color: #2e3b47; box-shadow: none; }
:root[data-theme="dark"] .word-card-jp,
:root[data-theme="dark"] .dict-result-jp { color: #72dda0; }
:root[data-theme="dark"] .word-card-zh,
:root[data-theme="dark"] .dict-result-zh,
:root[data-theme="dark"] .dict-entry-meaning,
:root[data-theme="dark"] .dict-entry-ex-jp { color: #e5edf3; }
:root[data-theme="dark"] .word-card-reading,
:root[data-theme="dark"] .word-card-date,
:root[data-theme="dark"] .dict-result-reading,
:root[data-theme="dark"] .dict-entry-note,
:root[data-theme="dark"] .dict-entry-ex-zh,
:root[data-theme="dark"] .dict-entry-meaning-en,
:root[data-theme="dark"] .dict-entry-qstat { color: #aebbc7; }
:root[data-theme="dark"] .dict-search-input { background: #10171e; border-color: #354452; color: #f2f6f9; }
:root[data-theme="dark"] .dict-search-input::placeholder { color: #8090a0; }
:root[data-theme="dark"] .dict-result-item:hover { background: #15221b; border-color: #4ccf84; box-shadow: none; }
:root[data-theme="dark"] .dict-result-pos { background: #202b35; color: #b9c6d2; }
:root[data-theme="dark"] .dict-match-keyword { color: #fff; }
:root[data-theme="dark"] .dict-entry-header { background: linear-gradient(135deg, #0d2a1d, #10251d); border-color: #317151; }
:root[data-theme="dark"] .dict-entry-jp { color: #8aeab2; }
:root[data-theme="dark"] .dict-entry-reading { color: #b6f0cd; }
:root[data-theme="dark"] .dict-entry-pos { color: #9bd9b5; }
:root[data-theme="dark"] .dict-entry-section-title { color: #9eacb9; }
:root[data-theme="dark"] .dict-entry-example { border-bottom-color: #293640; }
:root[data-theme="dark"] .dict-entry-qitem { background: #151e26; }

@media (max-width: 700px) {
  .appearance-page-options { grid-template-columns: 1fr; }
  .appearance-page-option { min-height: 0; flex-direction: row; align-items: center; }
  .settings-list-row { grid-template-columns: 42px minmax(0, 1fr) 16px; gap: 12px; min-height: 76px; padding: 14px; }
  .settings-row-icon { width: 42px; height: 42px; border-radius: 13px; }
  .settings-row-value { display: none; }
}

/* ── Main navigation identity: account at the brand, AI at top-right ── */
.dash-logo-account {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #ccebd9;
  border-radius: 12px;
  background: #eaf8f0;
  color: #149451;
  cursor: pointer;
  transition: transform .14s, background .14s, border-color .14s;
}
.dash-logo-account:hover,
.dash-logo-account:focus-visible {
  border-color: #76ce9d;
  background: #dcf6e7;
  outline: none;
  transform: translateY(-1px);
}
.dash-logo-account-mark { display: grid; place-items: center; width: 100%; height: 100%; }
.dash-logo-account-mark img { width: 100%; height: 100%; object-fit: cover; }

/* The product identity belongs in the header, while the sidebar remains the
   navigation and account entry area. */
.topbar-product {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
/* 之前是深色渐变底+白色书本SVG图标；换成品牌图标图片后图标自带白底和
   圆角（跟登录框那个大图标同一张图，见 backend-guest-logo 那条注释），
   不再需要这个深色背景方块给它当底色/裁圆角。 */
.topbar-product-icon {
  display: block;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
}
.topbar-product-text { display: grid; gap: 2px; line-height: 1.05; }
.topbar-product-text strong { font-size: 16px; letter-spacing: -.2px; }
.topbar-product-text small { font-size: 10.5px; font-weight: 500; color: #8792a1; letter-spacing: 0; }

/* The assistant remains universally available.  It takes the former profile
   position on dashboard pages, while quiz pages keep it low-right so it never
   covers a question or the submit action. */
body.at-home .fab {
  /* Align the small AI cube visually with the taller streak capsule: its
     visible overhang is balanced above and below rather than sitting low. */
  top: 14px;
  right: 30px;
  bottom: auto;
  width: 36px;
  height: 36px;
  padding: 2px;
  border-radius: 12px;
  font-size: 18px;
  box-shadow: 0 3px 14px rgba(79, 70, 229, .34);
}
body.at-home .fab img { border-radius: 10px; }
body.at-home .fab:hover { transform: translateY(-1px) scale(1.05); }
body.at-home .home-topbar-right { padding-right: 46px; }

:root[data-theme="dark"] .dash-logo-account { background: #0d2a1d; border-color: #286744; color: #70e3a1; }
:root[data-theme="dark"] .dash-logo-account:hover,
:root[data-theme="dark"] .dash-logo-account:focus-visible { background: #123722; border-color: #4fdc8d; }
:root[data-theme="dark"] .topbar-product-icon { background: #263342; }
:root[data-theme="dark"] .topbar-product-text small { color: #9eabb9; }
/* 夜间模式下使用独立的连续学习配色，避免浅色模式的棕色文字落在
   半透明灰色背景上，尤其要保证普通日期、状态和统计说明清晰可读。 */
:root[data-theme="dark"] .streak-panel {
  color: #f7f3ef;
  border-color: #485461;
  background: linear-gradient(150deg, rgba(21, 27, 33, .98), rgba(10, 14, 18, .97));
  box-shadow: 0 24px 64px rgba(0, 0, 0, .68), inset 0 1px 0 rgba(255, 255, 255, .08);
}
:root[data-theme="dark"] .streak-panel-arrow {
  border-color: #485461 transparent transparent #485461;
  background: #151b21;
}
:root[data-theme="dark"] .streak-panel-flame { background: #3c261b; }
:root[data-theme="dark"] .streak-panel-title { color: #ffbd86; }
:root[data-theme="dark"] .streak-panel-count { color: #fff8f2; }
:root[data-theme="dark"] .streak-panel-status {
  border: 1px solid rgba(251, 146, 60, .30);
  background: rgba(194, 65, 12, .17);
  color: #ffd2ad;
}
:root[data-theme="dark"] .streak-calendar {
  border-color: #4a5561;
  background: #11171d;
}
:root[data-theme="dark"] .streak-calendar-head strong { color: #fff5ec; }
:root[data-theme="dark"] .streak-calendar-head button { color: #ffb477; }
:root[data-theme="dark"] .streak-calendar-head button:hover:not(:disabled) {
  background: rgba(249, 115, 22, .18);
  color: #ffd0a8;
}
:root[data-theme="dark"] .streak-calendar-weekday { color: #b9c3cd; }
:root[data-theme="dark"] .streak-calendar-day { color: #e8edf2; }
:root[data-theme="dark"] .streak-calendar-day.outside { color: #7f8b96; }
:root[data-theme="dark"] .streak-calendar-day.future { color: #89949f; }
:root[data-theme="dark"] .streak-calendar-day.today {
  color: #ffd3ad;
  box-shadow: inset 0 0 0 1.5px #fb923c;
}
:root[data-theme="dark"] .streak-calendar-day.studied {
  background: #653019;
  color: #fff4ea;
  box-shadow: inset 0 0 0 1px #bd5a28;
}
:root[data-theme="dark"] .streak-calendar-day.studied.today {
  background: #8a3b18;
  box-shadow: inset 0 0 0 2px #ff9b54;
}
:root[data-theme="dark"] .streak-stat {
  border-color: #414c58;
  background: #151c23;
}
:root[data-theme="dark"] .streak-stat strong { color: #fff5ec; }
:root[data-theme="dark"] .streak-stat span,
:root[data-theme="dark"] .streak-rule { color: #b9c3cd; }

@media (max-width: 900px) {
  .dash-logo-account { margin: 0 auto; }
  body.at-home .fab { right: 18px; }
  body.at-home .home-topbar-right { padding-right: 42px; }
}

/* 阅读文章右下角的主操作位：提交与下一题必须一眼能看清，也必须完全同款。 */
.reading-article-next-btn {
  min-width: 142px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid #159447;
  border-radius: 12px;
  background: #16a34a;
  color: #ffffff;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: .2px;
  box-shadow: 0 5px 14px rgba(22, 163, 74, .22);
}
.reading-article-next-btn:hover:not(:disabled) {
  border-color: #15803d;
  background: #15803d;
  color: #ffffff;
  box-shadow: 0 7px 18px rgba(22, 163, 74, .30);
  transform: translateY(-1px);
}
.reading-article-next-btn:focus-visible {
  outline: 3px solid rgba(74, 222, 128, .42);
  outline-offset: 3px;
}
.reading-article-submit-btn:disabled {
  opacity: 1;
  border-color: #c5ced8;
  background: #e7ecf1;
  color: #7b8794;
  box-shadow: none;
}
:root[data-theme="dark"] .reading-article-next-btn {
  border-color: #2bc66d;
  background: #159447;
  color: #ffffff;
  box-shadow: 0 5px 16px rgba(0, 0, 0, .32), 0 0 0 1px rgba(74, 222, 128, .12);
}
:root[data-theme="dark"] .reading-article-next-btn:hover:not(:disabled) {
  border-color: #5ae792;
  background: #1cad58;
  color: #ffffff;
}
:root[data-theme="dark"] .reading-article-submit-btn:disabled {
  border-color: #536170;
  background: #344251;
  color: #c7d1dc;
  box-shadow: none;
}

/* 阅读题作答后的结论已由选项颜色和右下角的“下一题”表达；旧页面若仍
   留有摘要节点，也必须隐藏，避免重复出现一个没有新增信息的结果框。 */
.rdg-feedback-summary {
  display: none !important;
}

/* ── Question feedback ──────────────────────────────────────────────── */
.quiz-q-card { padding-bottom: 58px; }
.question-feedback-dialog {
  width: min(460px, calc(100vw - 32px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #dce4df;
  border-radius: 20px;
  color: #18251f;
  background: #fff;
  box-shadow: 0 22px 70px rgba(15, 23, 42, .22);
}
.question-feedback-dialog::backdrop { background: rgba(15, 23, 42, .38); backdrop-filter: blur(3px); }
.question-feedback-card { padding: 24px; }
.question-feedback-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.question-feedback-eyebrow { color: #b66916; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.question-feedback-head h2 { margin: 5px 0 7px; font-size: 22px; letter-spacing: -.02em; }
.question-feedback-head p { max-width: 340px; margin: 0; color: #68756d; font-size: 13px; line-height: 1.55; }
.question-feedback-close {
  width: 34px; height: 34px; flex: 0 0 auto; border: 1px solid #dbe4de; border-radius: 10px;
  color: #56625b; background: #fff; font-size: 23px; line-height: 1; cursor: pointer;
}
.question-feedback-close:hover { background: #f6f8f7; }
.question-feedback-field { display: grid; gap: 7px; margin-top: 19px; color: #34433a; font-size: 13px; font-weight: 750; }
.question-feedback-field select,
.question-feedback-field textarea {
  width: 100%; box-sizing: border-box; border: 1px solid #d8e0db; border-radius: 11px;
  padding: 10px 11px; color: #1c2b22; background: #fff; font: inherit; font-weight: 500;
}
.question-feedback-field textarea { min-height: 116px; resize: vertical; line-height: 1.55; }
.question-feedback-field select:focus,
.question-feedback-field textarea:focus { outline: 3px solid rgba(22, 148, 83, .16); border-color: #36ad73; }
.question-feedback-status { min-height: 20px; margin: 13px 0 0; color: #16824b; font-size: 12px; line-height: 1.5; }
.question-feedback-status:empty { display: none; }
.question-feedback-status[data-error="1"] { color: #bc3b2d; }
.question-feedback-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.question-feedback-actions button { min-height: 38px; padding: 0 16px; border-radius: 10px; font: inherit; font-size: 13px; font-weight: 750; cursor: pointer; }
.question-feedback-cancel { border: 1px solid #d8e0db; color: #526057; background: #fff; }
.question-feedback-submit { border: 1px solid #188954; color: #fff; background: #188954; }
.question-feedback-submit:hover { background: #117545; }
.question-feedback-actions button:disabled { cursor: wait; opacity: .65; }

:root[data-theme="dark"] .question-report-btn { color: #ffd18d; border-color: #8f6028; background: #322717; }
:root[data-theme="dark"] .question-report-btn:hover { background: #44321b; border-color: #d7973e; }
:root[data-theme="dark"] .quiz-ai-explain-btn { color: #e3ddff; border-color: #6959c8; background: #272148; }
:root[data-theme="dark"] .quiz-ai-explain-btn:hover { border-color: #9f92ef; background: #342c5c; }
:root[data-theme="dark"] .question-feedback-dialog { color: var(--night-text); border-color: #334452; background: #10171e; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
:root[data-theme="dark"] .question-feedback-head p { color: #aebdca; }
:root[data-theme="dark"] .question-feedback-close,
:root[data-theme="dark"] .question-feedback-cancel,
:root[data-theme="dark"] .question-feedback-field select,
:root[data-theme="dark"] .question-feedback-field textarea { color: #eaf0f6; border-color: #3b4a58; background: #151e27; }
:root[data-theme="dark"] .question-feedback-field { color: #d9e4ec; }
:root[data-theme="dark"] .question-feedback-close:hover,
:root[data-theme="dark"] .question-feedback-cancel:hover { background: #1d2934; }

@media (max-width: 560px) {
  .question-feedback-dialog { width: calc(100vw - 22px); border-radius: 16px; }
  .question-feedback-card { padding: 20px; }
  .question-feedback-actions button { flex: 1; }
}

/* ── 独立手机版首页 ──────────────────────────────────────────────── */
.mobile-home-nav { display: none; }
.mobile-account-shortcut { display: none; }
.mobile-chat-scrim { display: none; }
html[data-mobile-view="true"] {
  background: #edf1ef;
}
html[data-mobile-view="true"] body {
  width: 100vw;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  background: #fff;
  box-shadow: none;
}
html[data-mobile-view="true"] #homeScreen.active { height: 100dvh; }
html[data-mobile-view="true"] .dash-sidebar { display: none; }
html[data-mobile-view="true"] .home-full { padding-bottom: 76px; }
html[data-mobile-view="true"] .home-main { width: 100%; }
html[data-mobile-view="true"] .home-topbar {
  position: relative;
  height: 72px;
  padding: 0 15px;
  border-color: #edf0ee;
}
html[data-mobile-view="true"] .home-topbar-title {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
html[data-mobile-view="true"] .topbar-product-icon,
html[data-mobile-view="true"] .topbar-product-text { display: none; }
html[data-mobile-view="true"] .home-topbar-title::before { content: none; }
html[data-mobile-view="true"] .mobile-account-shortcut {
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 15px;
  color: #149451;
  background: #eaf8f0;
  box-shadow: none;
  cursor: pointer;
}
html[data-mobile-view="true"] .mobile-account-shortcut svg { width: 22px; height: 22px; }
html[data-mobile-view="true"] .home-topbar-right { margin-left: auto; gap: 6px; padding-right: 48px; }
html[data-mobile-view="true"] .level-dropdown { min-height: 33px; padding: 6px 23px 6px 10px; font-size: 12px; }
html[data-mobile-view="true"] .streak-badge { min-height: 33px; padding: 5px 9px; font-size: 12px; }
html[data-mobile-view="true"] .home-body { padding: 14px 14px 24px; background: #fff; }
html[data-mobile-view="true"] .dash-inner { max-width: none; }
html[data-mobile-view="true"] .dashboard-grid { display: flex; flex-direction: column; gap: 12px; }
html[data-mobile-view="true"] .dash-col-left,
html[data-mobile-view="true"] .dash-col-right { display: contents; }
html[data-mobile-view="true"] .mastery-card { order: 1; padding: 16px; border-radius: 15px; }
html[data-mobile-view="true"] .ability-card { order: 2; padding: 15px; border-radius: 15px; }
html[data-mobile-view="true"] .today-card { order: 3; padding: 15px; border-radius: 15px; }
html[data-mobile-view="true"] .lib-section { order: 4; }
html[data-mobile-view="true"] .lib-section { width: 100%; }
html[data-mobile-view="true"] .sentence-card { order: 5; }
html[data-mobile-view="true"] .mock-card { display: none; }
html[data-mobile-view="true"] .mastery-hd { min-height: 126px; gap: 10px; justify-content: space-between; }
html[data-mobile-view="true"] .mastery-card-label { font-size: 10px; margin-bottom: 4px; }
html[data-mobile-view="true"] .mastery-pct { font-size: 48px; letter-spacing: -1.5px; }
html[data-mobile-view="true"] .mastery-pct-locked-bar { height: 48px; margin-bottom: 5px; }
html[data-mobile-view="true"] .mastery-pct-locked-bar::before {
  width: 76px;
  height: 5px;
  border-radius: 2.5px;
  background: repeating-linear-gradient(90deg, #60A5FA 0 11px, transparent 11px 18px);
}
html[data-mobile-view="true"] .mastery-chart-wrap { flex: 0 0 auto; width: 145px; max-width: 48%; }
/* 桌面版把 .mastery-chart 改成固定 130px 高度后，手机画布这么窄的宽度
   如果还套用桌面那个高度会显得又窄又高、比例失真——按手机版原来的
   宽高比换算一个矮一些的固定高度，保持原有的扁平比例。 */
html[data-mobile-view="true"] .mastery-chart { height: 55px; }
html[data-mobile-view="true"] .ability-card .dash-card-hd { margin-bottom: 10px; }
html[data-mobile-view="true"] .ability-row { gap: 7px; }
html[data-mobile-view="true"] .ability-grade-text { font-size: 17px; }
html[data-mobile-view="true"] .ability-name-text { font-size: 10px; }
html[data-mobile-view="true"] .ability-sample-text { display: none; }
html[data-mobile-view="true"] .today-top { margin-bottom: 10px; }
html[data-mobile-view="true"] .today-title { font-size: 15px; }
html[data-mobile-view="true"] .today-meta { font-size: 11px; }
html[data-mobile-view="true"] .today-tags { gap: 6px; }
html[data-mobile-view="true"] .today-tag { font-size: 10px; padding: 5px 8px; }
html[data-mobile-view="true"] .lib-section-hd { margin: 4px 0 9px; }
html[data-mobile-view="true"] .lib-section-title { font-size: 19px; }
html[data-mobile-view="true"] .lib-covers { gap: 10px; }
html[data-mobile-view="true"] .sentence-card { padding: 15px; margin-bottom: 8px; }
html[data-mobile-view="true"] .mobile-home-nav {
  isolation: isolate;
  overflow: visible;
  position: fixed;
  z-index: 500;
  left: 50%;
  bottom: max(8px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(381px, calc(100vw - 12px));
  min-height: 62px;
  padding: 5px 7px;
  border: 1px solid rgba(210, 220, 214, .9);
  border-radius: 21px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 8px 24px rgba(17, 31, 23, .15);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}
html[data-mobile-view="true"] .mobile-home-nav button {
  display: grid;
  gap: 2px;
  place-items: center;
  min-width: 0;
  border: 0;
  border-radius: 15px;
  padding: 5px 3px;
  color: #64726a;
  background: transparent;
  font: 650 10px/1.2 inherit;
  cursor: pointer;
}
html[data-mobile-view="true"] .mobile-home-nav button.is-active { color: #157d45; background: #e8f7ee; }
html[data-mobile-view="true"] .mobile-home-nav svg { width: 21px; height: 21px; }
html[data-mobile-view="true"] .mobile-home-nav .mobile-assistant-nav {
  position: relative;
  align-self: end;
  overflow: visible;
  padding-top: 0;
  color: #4f46a5;
}
html[data-mobile-view="true"] .mobile-assistant-nav-avatar {
  display: block;
  width: 48px;
  height: 48px;
  margin-top: -23px;
  overflow: hidden;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 7px 18px rgba(91, 65, 190, .3), 0 0 0 1px rgba(108, 84, 215, .16);
}
html[data-mobile-view="true"] .mobile-assistant-nav-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
html[data-mobile-view="true"] .mobile-home-nav .mobile-assistant-nav.is-active {
  color: #5f4cc8;
  background: transparent;
}
html[data-mobile-view="true"] .mobile-home-nav .mobile-assistant-nav.is-active .mobile-assistant-nav-avatar {
  box-shadow: 0 7px 20px rgba(91, 65, 190, .38), 0 0 0 3px rgba(116, 92, 222, .22);
}
/* Suno 必须属于手机画布，而不是相对整块电脑窗口的右侧固定。 */
html[data-mobile-view="true"] body.at-home .fab {
  position: absolute;
  z-index: 520;
  top: 14px;
  right: 12px;
  bottom: auto;
  width: 40px;
  height: 40px;
  padding: 2px;
  border-radius: 13px;
}
html[data-mobile-view="true"] body.at-home .fab img { border-radius: 10px; }
html[data-theme="dark"][data-mobile-view="true"] .lib-section-title { color: #f6faf7; }
/* 在普通电脑窗口里直接打开时，使用用户当前 iPhone 截图对应的
   402 × 874 CSS 视口。进入 Safari 响应式模式或真机（窄于 700px）后，
   页面改为完全跟随设备自身视口，不再套用这层演示画布。 */
@media (min-width: 700px) {
  html[data-mobile-view="true"] body {
    width: 402px;
    height: min(874px, 100dvh);
    margin: 0 auto;
    box-shadow: 0 0 0 1px rgba(21, 33, 26, .08), 0 18px 42px rgba(21, 33, 26, .16);
  }
  html[data-mobile-view="true"] #homeScreen.active {
    width: 402px;
    height: min(874px, 100dvh);
  }
}

/* ── 手机版 V2：不再缩小电脑版，而是一套独立的轻盈首页 ───────────── */
.mobile-welcome-banner { display: none; }

html[data-mobile-view="true"] body.at-home {
  color: #202724;
  background: #ffffff;
}

html[data-mobile-view="true"] body.at-home .home-full,
html[data-mobile-view="true"] body.at-home .home-main,
html[data-mobile-view="true"] body.at-home .home-body {
  background: #ffffff;
}

html[data-mobile-view="true"] body.at-home .home-full {
  padding-bottom: 0;
}

html[data-mobile-view="true"] body.at-home .home-topbar {
  height: 84px;
  min-height: 84px;
  padding: 16px 16px 9px;
  gap: 9px;
  border: 0;
  background: #ffffff;
}

html[data-mobile-view="true"] body.at-home .home-topbar-right {
  gap: 6px;
  margin-left: auto;
  padding-right: 0;
}

html[data-mobile-view="true"] body.at-home .level-dropdown,
html[data-mobile-view="true"] body.at-home .streak-badge {
  height: 38px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8e4;
  border-radius: 999px;
  background-color: #fbfcfb;
  box-shadow: 0 2px 5px rgba(25, 43, 33, .04);
  color: #24302a;
  font-size: 11px;
  font-weight: 750;
}

html[data-mobile-view="true"] body.at-home .level-dropdown {
  width: 46px;
  padding: 0 17px 0 9px;
  background-position: right 8px center;
}

html[data-mobile-view="true"] body.at-home .streak-badge {
  min-width: 46px;
  gap: 2px;
  padding: 0 8px;
  color: #5d4031;
  border-color: #f0dfd2;
  background: #fffaf6;
}

html[data-mobile-view="true"] body.at-home .streak-badge-flame { font-size: 13px; }

html[data-mobile-view="true"] .mobile-welcome-banner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 86px;
  margin: 0 14px 12px;
  padding: 13px 14px 13px 17px;
  overflow: hidden;
  border: 1px solid #e5eee8;
  border-radius: 19px;
  background:
    radial-gradient(circle at 93% 8%, rgba(132, 221, 177, .48) 0 4px, transparent 5px),
    radial-gradient(circle at 78% 85%, rgba(255, 219, 170, .54) 0 3px, transparent 4px),
    linear-gradient(125deg, #eefaf3 0%, #f8fcf8 54%, #fff7ee 100%);
  box-shadow: 0 9px 22px rgba(48, 93, 65, .08);
}

html[data-mobile-view="true"] .mobile-welcome-banner::after {
  content: "";
  position: absolute;
  right: -23px;
  bottom: -40px;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: rgba(96, 200, 144, .12);
}

html[data-mobile-view="true"] .mobile-welcome-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 3px;
  min-width: 0;
}

html[data-mobile-view="true"] .mobile-welcome-copy span {
  color: #29985c;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
}

html[data-mobile-view="true"] .mobile-welcome-copy strong {
  color: #1e2d25;
  font-size: 16px;
  letter-spacing: -.04em;
}

html[data-mobile-view="true"] .mobile-welcome-copy small {
  color: #728078;
  font-size: 10px;
  line-height: 1.45;
}

html[data-mobile-view="true"] .mobile-welcome-banner img {
  position: relative;
  z-index: 1;
  width: 61px;
  height: 61px;
  margin-left: 10px;
  border: 3px solid rgba(255, 255, 255, .86);
  border-radius: 20px;
  object-fit: cover;
  box-shadow: 0 7px 18px rgba(48, 93, 65, .16);
}

html[data-mobile-view="true"] body.at-home .home-body {
  padding: 0 14px 103px;
}

html[data-mobile-view="true"] body.at-home .dashboard-grid {
  gap: 15px;
  align-items: stretch;
}

html[data-mobile-view="true"] body.at-home .dash-card,
html[data-mobile-view="true"] body.at-home .mastery-card,
html[data-mobile-view="true"] body.at-home .ability-card,
html[data-mobile-view="true"] body.at-home .sentence-card {
  border: 1px solid #edf0ed;
  border-radius: 19px;
  background: #f8f9f8;
  box-shadow: 0 6px 16px rgba(32, 55, 42, .045);
}

html[data-mobile-view="true"] body.at-home .mastery-card {
  box-sizing: border-box;
  width: 100%;
  align-self: stretch;
  padding: 16px 17px;
  background: linear-gradient(135deg, #f2f7f3, #fbfcfb 72%);
}

html[data-mobile-view="true"] body.at-home .mastery-hd {
  min-height: 104px;
  align-items: center;
  justify-content: space-between;
}

html[data-mobile-view="true"] body.at-home .mastery-card-label,
html[data-mobile-view="true"] body.at-home .dash-card-label {
  color: #7a8780;
  font-size: 10px;
  letter-spacing: .06em;
}

html[data-mobile-view="true"] body.at-home .mastery-pct {
  color: #1d2922;
  font-size: 49px;
  font-weight: 800;
}

html[data-mobile-view="true"] body.at-home .mastery-pct-locked-bar { height: 49px; }

html[data-mobile-view="true"] body.at-home .mastery-chart-wrap { flex: 0 0 auto; width: 132px; }

html[data-mobile-view="true"] body.at-home .ability-card {
  padding: 15px 15px 14px;
  background: #f5f6f6;
}

html[data-mobile-view="true"] body.at-home .ability-card .dash-card-hd { margin-bottom: 11px; }
html[data-mobile-view="true"] body.at-home .section-more-btn { color: #25995a; font-size: 10px; }
html[data-mobile-view="true"] body.at-home .ability-row { gap: 5px; }
html[data-mobile-view="true"] body.at-home .ability-grade-text { color: #1d2822; font-size: 16px; }
html[data-mobile-view="true"] body.at-home .ability-name-text { color: #68766e; font-size: 9px; }

html[data-mobile-view="true"] body.at-home .today-card {
  position: relative;
  min-height: 118px;
  padding: 17px 17px 16px;
  overflow: hidden;
  border-color: #e5eee8;
  border-radius: 19px;
  background:
    radial-gradient(circle at 93% 8%, rgba(132, 221, 177, .48) 0 4px, transparent 5px),
    radial-gradient(circle at 78% 85%, rgba(255, 219, 170, .54) 0 3px, transparent 4px),
    linear-gradient(125deg, #eefaf3 0%, #f8fcf8 54%, #fff7ee 100%);
  box-shadow: 0 9px 22px rgba(48, 93, 65, .08);
}

html[data-mobile-view="true"] body.at-home .today-card::after {
  content: "";
  position: absolute;
  right: -23px;
  bottom: -40px;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: rgba(96, 200, 144, .12);
  pointer-events: none;
}

html[data-mobile-view="true"] body.at-home .today-top { position: relative; z-index: 1; margin: 0; padding-right: 72px; }
html[data-mobile-view="true"] body.at-home .today-icon-wrap { width: 31px; height: 31px; }
html[data-mobile-view="true"] body.at-home .today-title { color: #1e2d25; font-size: 16px; }
html[data-mobile-view="true"] body.at-home .today-meta { max-width: 205px; color: #728078; font-size: 10px; line-height: 1.55; }
html[data-mobile-view="true"] body.at-home .today-tags { display: none; }
html[data-mobile-view="true"] body.at-home .today-mascot {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: 14px;
  display: block;
  width: 61px;
  height: 61px;
  border: 3px solid rgba(255, 255, 255, .86);
  border-radius: 20px;
  object-fit: cover;
  box-shadow: 0 7px 18px rgba(48, 93, 65, .16);
  transform: translateY(-50%);
}

html[data-mobile-view="true"] body.at-home .lib-section { margin-top: 1px; }
html[data-mobile-view="true"] body.at-home .lib-section-hd { margin: 1px 1px 10px; }
html[data-mobile-view="true"] body.at-home .lib-section-title { color: #1e2a23; font-size: 19px; letter-spacing: -.04em; }

html[data-mobile-view="true"] body.at-home .lib-covers {
  display: flex;
  gap: 11px;
  width: calc(100% + 14px);
  padding: 1px 14px 6px 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

html[data-mobile-view="true"] body.at-home .lib-covers::-webkit-scrollbar { display: none; }

html[data-mobile-view="true"] body.at-home .lib-cover-card {
  flex: 0 0 126px;
  aspect-ratio: 3 / 4;
  border: 1px solid rgba(224, 230, 225, .92);
  border-radius: 16px;
  box-shadow: 0 5px 13px rgba(28, 43, 33, .1);
  scroll-snap-align: start;
}

html[data-mobile-view="true"] body.at-home .lib-cover-footer { padding: 13px 11px; }
html[data-mobile-view="true"] body.at-home .lib-cover-title { font-size: 14px; }
html[data-mobile-view="true"] body.at-home .lib-cover-desc { font-size: 9px; }

/* 手机版首页：学习库与欢迎卡互换位置。 */
html[data-mobile-view="true"] body.at-home .home-main > .lib-section {
  order: 0;
  box-sizing: border-box;
  width: calc(100% - 28px);
  margin: 0 14px 12px;
}

html[data-mobile-view="true"] body.at-home .home-main > .lib-section .lib-section-hd {
  display: none;
}

html[data-mobile-view="true"] body.at-home .sentence-card {
  padding: 16px;
  margin-top: 3px;
  background: linear-gradient(125deg, #fff7ec, #fffcf8);
  border-color: #f3e7d8;
}

html[data-mobile-view="true"] body.at-home .sentence-jp { color: #29342d; font-size: 15px; line-height: 1.65; }
html[data-mobile-view="true"] body.at-home .sentence-zh { color: #7e786e; font-size: 11px; margin-bottom: 11px; }

html[data-mobile-view="true"] .mobile-home-nav {
  width: min(351px, calc(100vw - 24px));
  min-height: 62px;
  bottom: max(10px, env(safe-area-inset-bottom));
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, .38);
  border-radius: 25px;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, .022), rgba(255, 255, 255, .004) 46%, rgba(238, 246, 255, .012));
  box-shadow:
    0 15px 34px rgba(18, 29, 22, .18),
    0 1px 1px rgba(255, 255, 255, .32),
    inset 0 1.5px 0 rgba(255, 255, 255, .68),
    inset 0 -1px 0 rgba(255, 255, 255, .10);
  -webkit-backdrop-filter: blur(5px) saturate(135%) contrast(102%);
  backdrop-filter: blur(5px) saturate(135%) contrast(102%);
}

html[data-mobile-view="true"] .mobile-home-nav::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 1px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, .10), transparent 37%),
    linear-gradient(180deg, rgba(255, 255, 255, .015), transparent 55%);
  pointer-events: none;
}

html[data-mobile-view="true"] .mobile-home-nav button {
  color: #66746c;
  font-size: 9px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(255, 255, 255, .72);
}

html[data-mobile-view="true"] .mobile-home-nav button.is-active {
  color: #167a45;
  background: linear-gradient(135deg, rgba(231, 247, 237, .055), rgba(255, 255, 255, .012));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .55),
    0 3px 12px rgba(30, 67, 45, .07);
}

/* Safari / WebKit 支持系统材质时，直接交给苹果渲染 Clear Glass。
   其他浏览器不认识这个私有属性，会自然保留上面的跨浏览器回退效果。 */
@supports (-apple-visual-effect: -apple-system-glass-material-clear) {
  html[data-mobile-view="true"] .mobile-home-nav {
    border-color: rgba(255, 255, 255, .34);
    background: transparent;
    -apple-visual-effect: -apple-system-glass-material-clear;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow:
      0 14px 32px rgba(18, 29, 22, .14),
      inset 0 1px 0 rgba(255, 255, 255, .38);
  }

  html[data-mobile-view="true"] .mobile-home-nav::before {
    background: transparent;
  }

  html[data-mobile-view="true"] .mobile-home-nav button.is-active {
    background: rgba(225, 247, 234, .06);
  }
}

html[data-mobile-view="true"] body.at-home .fab {
  top: 22px;
  right: 13px;
  width: 38px;
  height: 38px;
  padding: 2px;
  border: 2px solid #eee8ff;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 5px 14px rgba(99, 70, 197, .2);
}

html[data-mobile-view="true"] body.at-home .fab img { border-radius: 50%; }

/* 手机助手是 App 式底部面板；电脑版仍使用原来的右侧抽屉。 */
html[data-mobile-view="true"] .fab { display: none !important; }
html[data-mobile-view="true"] body.chat-open .mobile-chat-scrim {
  position: fixed;
  z-index: 540;
  top: 0;
  bottom: 0;
  left: 50%;
  display: block;
  width: min(402px, 100vw);
  border: 0;
  padding: 0;
  background: rgba(8, 13, 18, .42);
  backdrop-filter: blur(3px);
  transform: translateX(-50%);
}
html[data-mobile-view="true"] .chat-panel {
  z-index: 550;
  top: auto;
  right: auto;
  bottom: 0;
  left: 50%;
  width: min(402px, 100vw);
  height: min(85dvh, calc(var(--chat-viewport-height) - 12px));
  max-height: 742px;
  border-width: 1px 1px 0;
  border-radius: 27px 27px 0 0;
  background: #ffffff;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  transform: translate(-50%, 100%);
  transform-origin: bottom center;
  opacity: 1;
  box-shadow: 0 -18px 54px rgba(8, 13, 18, .25);
  transition: transform .28s cubic-bezier(.22, .84, .3, 1);
}
html[data-mobile-view="true"] .chat-panel::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 7px;
  left: 50%;
  width: 38px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .48);
  transform: translateX(-50%);
}
html[data-mobile-view="true"] .chat-panel.open {
  transform: translate(-50%, 0);
}
html[data-mobile-view="true"] .chat-head {
  padding: 19px 16px 13px;
}
html[data-mobile-view="true"] .chat-input-row {
  position: sticky;
  z-index: 3;
  bottom: 0;
  padding: 11px 12px max(11px, env(safe-area-inset-bottom));
}
html[data-mobile-view="true"] .chat-msgs {
  background: #ffffff;
}

/* 手机版夜间模式：V2 首页有自己的浅色表面，因此需要在其后明确覆盖。 */
:root[data-theme="dark"][data-mobile-view="true"] {
  background: #090e13;
}

:root[data-theme="dark"][data-mobile-view="true"] body.at-home,
:root[data-theme="dark"][data-mobile-view="true"] body.at-home .home-full,
:root[data-theme="dark"][data-mobile-view="true"] body.at-home .home-main,
:root[data-theme="dark"][data-mobile-view="true"] body.at-home .home-body,
:root[data-theme="dark"][data-mobile-view="true"] body.at-home .home-topbar {
  color: #f1f5f3;
  background: #0c1218;
}

:root[data-theme="dark"][data-mobile-view="true"] body.at-home .lib-section-title {
  color: #f2f6f4;
}

:root[data-theme="dark"][data-mobile-view="true"] .mobile-account-shortcut,
:root[data-theme="dark"][data-mobile-view="true"] body.at-home .level-dropdown {
  border-color: #34423a;
}

:root[data-theme="dark"][data-mobile-view="true"] .mobile-account-shortcut {
  color: #149451;
  background: #eaf8f0;
}
:root[data-theme="dark"][data-mobile-view="true"] body.at-home .level-dropdown {
  color: #e8efeb;
  background-color: #18221c;
}

:root[data-theme="dark"][data-mobile-view="true"] .mobile-welcome-banner {
  border-color: #2d4337;
  background:
    radial-gradient(circle at 93% 8%, rgba(74, 169, 116, .34) 0 4px, transparent 5px),
    linear-gradient(125deg, #15271d 0%, #16231d 58%, #2a2118 100%);
  box-shadow: 0 9px 22px rgba(0, 0, 0, .22);
}

:root[data-theme="dark"][data-mobile-view="true"] body.at-home .today-card {
  border-color: #2d4337;
  background:
    radial-gradient(circle at 93% 8%, rgba(74, 169, 116, .34) 0 4px, transparent 5px),
    linear-gradient(125deg, #15271d 0%, #16231d 58%, #2a2118 100%);
  box-shadow: 0 9px 22px rgba(0, 0, 0, .22);
}
:root[data-theme="dark"][data-mobile-view="true"] body.at-home .today-title { color: #eef5f0; }
:root[data-theme="dark"][data-mobile-view="true"] body.at-home .today-meta { color: #a9b8af; }

:root[data-theme="dark"][data-mobile-view="true"] .mobile-welcome-copy strong { color: #eef5f0; }
:root[data-theme="dark"][data-mobile-view="true"] .mobile-welcome-copy small { color: #a9b8af; }

:root[data-theme="dark"][data-mobile-view="true"] body.at-home .mastery-card,
:root[data-theme="dark"][data-mobile-view="true"] body.at-home .ability-card {
  color: #eef4f0;
  border-color: #2c3932;
  background: #151d19;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .18);
}

:root[data-theme="dark"][data-mobile-view="true"] body.at-home .mastery-card {
  background: linear-gradient(135deg, #16231c, #151c18 72%);
}

:root[data-theme="dark"][data-mobile-view="true"] body.at-home .mastery-pct,
:root[data-theme="dark"][data-mobile-view="true"] body.at-home .ability-grade-text {
  color: #f2f7f4;
}

:root[data-theme="dark"][data-mobile-view="true"] body.at-home .mastery-card-label,
:root[data-theme="dark"][data-mobile-view="true"] body.at-home .dash-card-label,
:root[data-theme="dark"][data-mobile-view="true"] body.at-home .ability-name-text {
  color: #9eaea5;
}

:root[data-theme="dark"][data-mobile-view="true"] body.at-home .sentence-card {
  border-color: #4a3b2a;
  background: linear-gradient(125deg, #241d15, #1c1915);
}

:root[data-theme="dark"][data-mobile-view="true"] body.at-home .sentence-jp { color: #f2eee8; }
:root[data-theme="dark"][data-mobile-view="true"] body.at-home .sentence-zh { color: #b9afa2; }

:root[data-theme="dark"][data-mobile-view="true"] .mobile-home-nav {
  border-color: rgba(225, 239, 230, .23);
  background: linear-gradient(115deg, rgba(38, 52, 44, .03), rgba(9, 15, 11, .008) 50%, rgba(28, 35, 45, .018));
  box-shadow:
    0 16px 34px rgba(0, 0, 0, .4),
    inset 0 1px 0 rgba(255, 255, 255, .18),
    inset 0 -1px 0 rgba(255, 255, 255, .05);
}

:root[data-theme="dark"][data-mobile-view="true"] .mobile-home-nav button { color: #a7b5ad; }
:root[data-theme="dark"][data-mobile-view="true"] .mobile-home-nav button.is-active {
  color: #8de0ae;
  background: linear-gradient(135deg, rgba(39, 102, 65, .06), rgba(18, 47, 31, .012));
}
:root[data-theme="dark"][data-mobile-view="true"] .mobile-assistant-nav-avatar {
  border-color: #172019;
  background: #172019;
}
/* .chat-input 原来只有浅色样式（color: #111827 硬编码近黑色文字，
   .chat-input-row 硬编码 background: white），夜间模式下两处都没有对应
   覆盖——.chat-panel 本身走玻璃拟态背景变深，但输入框文字色没跟着变浅，
   变成黑字黑底看不清。补齐后跟 .dict-search-input/.question-feedback-field
   textarea 用同一套颜色。 */
:root[data-theme="dark"] .chat-input-row { background: #10171e; }
:root[data-theme="dark"] .chat-input { background: #151e27; border-color: #3b4a58; color: #eaf0f6; }
:root[data-theme="dark"] .chat-input::placeholder { color: #7f91a0; }

:root[data-theme="dark"][data-mobile-view="true"] .chat-panel {
  border-color: #344251;
  background: #111820;
}
:root[data-theme="dark"][data-mobile-view="true"] .chat-msgs,
:root[data-theme="dark"][data-mobile-view="true"] .chat-input-row {
  background: #111820;
}

/* ── 真正的手机个人中心 ─────────────────────────────────────────
   电脑版保留左侧抽屉；手机版在 402px 手机画布中独立成完整页面，
   不再从整块电脑窗口左侧伸出，也不会比手机画布更宽。 */
html[data-mobile-view="true"] .backend-account-dialog {
  inset: 0 auto 0 50%;
  width: min(402px, 100vw);
  height: 100dvh;
  border: 0;
  border-radius: 0;
  transform: translateX(-50%);
  box-shadow: none;
}

html[data-mobile-view="true"] .backend-account-dialog[open] { animation: none; }

html[data-mobile-view="true"] .backend-account-card {
  min-height: 100%;
  padding: 18px 16px calc(28px + env(safe-area-inset-bottom));
  background: rgba(250, 252, 251, .96);
}

html[data-mobile-view="true"] .backend-account-head {
  padding: 0;
}
html[data-mobile-view="true"] .backend-account-head-info {
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
}

html[data-mobile-view="true"] .backend-account-avatar {
  width: 42px;
  height: 42px;
  border-radius: 13px;
}

html[data-mobile-view="true"] .backend-account-eyebrow { font-size: 10px; }
html[data-mobile-view="true"] .backend-account-head h2 { margin-bottom: 4px; font-size: 21px; }
html[data-mobile-view="true"] .backend-account-head p { max-width: 250px; font-size: 11px; line-height: 1.55; }
html[data-mobile-view="true"] .backend-account-close { width: 34px; height: 34px; border-radius: 11px; }

html[data-mobile-view="true"] .backend-account-view {
  gap: 13px;
  padding-top: 17px;
}

html[data-mobile-view="true"] .backend-region-picker,
html[data-mobile-view="true"] .backend-auth-tabs { border-radius: 12px; }
html[data-mobile-view="true"] .backend-auth-tabs button { min-height: 39px; font-size: 13px; }
html[data-mobile-view="true"] .backend-account-card label { gap: 6px; font-size: 12px; }
html[data-mobile-view="true"] .backend-account-card input { min-height: 44px; border-radius: 11px; }
html[data-mobile-view="true"] .backend-account-primary,
html[data-mobile-view="true"] .backend-account-secondary { min-height: 45px; }
html[data-mobile-view="true"] .backend-provider-list { gap: 7px; }
html[data-mobile-view="true"] .backend-provider-list button { min-height: 42px; }
html[data-mobile-view="true"] .backend-provider-divider { margin-top: 0; }
html[data-mobile-view="true"] .backend-provider-note,
html[data-mobile-view="true"] .backend-legal-note { margin-top: -4px; }

/* ── 手机阅读练习 ───────────────────────────────────────────────
   文章是可滚动的材料区，题目和选项紧随其后；提交属于题目，答完后的
   下一题才贴在文章下方。给底部玻璃导航留出固定安全空间。 */
html[data-mobile-view="true"] #vocabSessionScreen.active {
  width: 100%;
  height: 100dvh;
}

html[data-mobile-view="true"] .reading-session-shell {
  width: 100%;
  max-width: none;
}

html[data-mobile-view="true"] .reading-session-shell .quiz-topbar {
  min-height: 58px;
  box-sizing: border-box;
  padding: 10px 14px;
}

html[data-mobile-view="true"] .reading-session-shell .quiz-body {
  gap: 12px;
  padding: 12px 12px calc(112px + env(safe-area-inset-bottom));
  scroll-padding-bottom: 112px;
}

html[data-mobile-view="true"] .reading-session-shell .quiz-q-card {
  padding: 14px 14px 58px;
  border: 0;
  border-radius: 16px;
  box-shadow: none;
}

html[data-mobile-view="true"] .reading-session-shell .quiz-tags {
  gap: 6px;
  margin-bottom: 12px;
}

html[data-mobile-view="true"] .reading-session-shell .reading-agent-material {
  max-height: min(43dvh, 380px);
  margin-bottom: 14px;
  padding: 17px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 15px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

html[data-mobile-view="true"] .reading-session-shell .reading-agent-material.mobile-paragraph-translation {
  display: grid;
  gap: 10px;
  max-height: none;
  overflow: visible;
  padding: 0;
  border: 0;
  background: transparent;
}

html[data-mobile-view="true"] .reading-mobile-scroll {
  max-height: none;
  margin: 0 -14px;
  padding: 18px 14px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: #f5f8fc;
}

html[data-mobile-view="true"] .reading-mobile-paragraph-pair + .reading-mobile-paragraph-pair { margin-top: 18px; }
html[data-mobile-view="true"] .reading-mobile-original { margin: 0; }
html[data-mobile-view="true"] .reading-mobile-translation {
  display: none;
  margin: 8px 0 0;
  padding-left: 0;
  border-left: 0;
  color: #75819e;
  font-size: 13px;
  line-height: 1.75;
}
html[data-mobile-view="true"] .mobile-translations-open .reading-mobile-translation { display: block; }
html[data-mobile-view="true"] .reading-mobile-trans-toggle {
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 9px 11px;
  border: 1px solid #cbd6ed;
  border-radius: 999px;
  color: #556b9f;
  background: #f7f9ff;
  font: 750 11px/1 inherit;
}
html[data-mobile-view="true"] .reading-mobile-translation-state { display: none; }
html[data-mobile-view="true"] .reading-mobile-actionbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}
html[data-mobile-view="true"] .reading-mobile-primary-action {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid #151515;
  border-radius: 999px;
  color: #fff;
  background: #151515;
  font: 800 12px/1 inherit;
  cursor: pointer;
}
html[data-mobile-view="true"] .reading-mobile-primary-action:disabled {
  border-color: #d9dddb;
  color: #9ca3af;
  background: #e7e9e8;
  cursor: not-allowed;
}

/* 手机屏幕中四道文章语法题逐题纵向排列；每道题内部的答案仍以
   两列横排展示，不能因卡片过窄而变成逐字竖排。 */
html[data-mobile-view="true"] .text-grammar-group-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
html[data-mobile-view="true"] .text-grammar-choice-card { padding: 12px; }
html[data-mobile-view="true"] .text-grammar-choice-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
html[data-mobile-view="true"] .text-grammar-choice {
  min-height: 48px;
  height: auto;
  min-width: 0;
  justify-content: flex-start;
  padding: 10px 12px;
  text-align: left;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
  writing-mode: horizontal-tb;
}
/* 手机端保留四个题位标题【1】～【4】，只隐藏每个题位内部
   四个答案前的重复序号（共 16 个），给长答案留出完整横排空间。 */
html[data-mobile-view="true"] .text-grammar-choice-key {
  display: none;
}

/* 手机端四处填空不再把“当前空”标成黄色。未填、当前与已填都归入
   同一套蓝色语义，避免黄色被误解成答案状态或警告。 */
html[data-mobile-view="true"] .text-grammar-blank.active {
  color: #4338ca;
  background: #e0e7ff;
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, .18);
}

/* 手机端所有题库题统一把“一键解析”和问题反馈收进当前题目大框底部。
   反馈入口不再漂浮于屏幕右下角，也不会随滚动脱离它所对应的题目。 */
html[data-mobile-view="true"] :is(.quiz-q-card, .lst-q-card, .question-item) {
  position: relative;
  padding-bottom: 58px;
}
html[data-mobile-view="true"] :is(.quiz-q-card, .lst-q-card) .quiz-ai-explain-btn {
  left: 14px;
  bottom: 13px;
}
html[data-mobile-view="true"] .question-item .ask-btn {
  position: absolute;
  left: 18px;
  bottom: 14px;
}
html[data-mobile-view="true"] .session-mobile-choice-actionbar {
  position: absolute;
  right: 55px;
  bottom: 13px;
  z-index: 2;
  display: block;
  width: min(142px, calc(100% - 180px));
  margin: 0;
}
html[data-mobile-view="true"] .session-mobile-choice-actionbar .reading-mobile-primary-action {
  width: 100%;
  min-height: 31px;
  padding: 6px 10px;
}

/* 完成页也位于固定底部导航之下。为最后的“继续练习”按钮和
   其后内容预留真实可滚动空间，而不是用空白遮挡来伪装间距。 */
html[data-mobile-view="true"] #vocabSessionShell .quiz-done-body {
  box-sizing: border-box;
  padding-bottom: calc(126px + env(safe-area-inset-bottom));
  scroll-padding-bottom: calc(126px + env(safe-area-inset-bottom));
}

/* 手机端展开听力原文后：原文在上，题目在下。原文跟随整页滚动，不能再
   套一层固定高度的小滚动框；双层滚动会在 Safari 中截断后半段原文。 */
html[data-mobile-view="true"] .listening-study-stage {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
html[data-mobile-view="true"] .listening-study-stage .listening-question-column {
  order: 3;
}
html[data-mobile-view="true"] .listening-study-stage .reading-article-column {
  order: 1;
}
/* 阅读文章可以在卡片内限高，但听力卡同时包含播放器和完整原文。若继续
   继承阅读的 43dvh 限高，Safari 会形成“页面 + 材料卡”双层滚动，后半段
   原文看似存在却很难继续拖到。听力材料必须交给外层 quiz-body 单独滚动。 */
html[data-mobile-view="true"] .reading-session-shell .listening-agent-material {
  max-height: none;
  overflow: visible;
  overscroll-behavior: auto;
}
html[data-mobile-view="true"] .listening-study-stage .listening-side-analysis {
  order: 2;
  width: auto;
  padding: 16px;
  border-radius: 14px;
}
html[data-mobile-view="true"] .listening-study-stage.transcript-open .lst-transcript-card {
  max-height: none;
  overflow: visible;
  display: block;
  padding-top: 0;
}
html[data-mobile-view="true"] .listening-study-stage.transcript-open .lst-transcript-header {
  position: static;
  margin: 0;
  padding: 12px 2px 10px;
  background: #f5f8fc;
}
html[data-mobile-view="true"] .listening-study-stage.transcript-open .lst-sentences {
  overflow: visible;
  padding-right: 3px;
}
html[data-mobile-view="true"] .listening-study-stage.transcript-open .lst-precision-bar {
  flex: 0 0 auto;
  margin-top: 6px;
  padding: 10px 2px 0;
  background: #f5f8fc;
}
:root[data-theme="dark"] html[data-mobile-view="true"] .listening-study-stage.transcript-open :is(.lst-transcript-header, .lst-precision-bar),
html[data-mobile-view="true"][data-theme="dark"] .listening-study-stage.transcript-open :is(.lst-transcript-header, .lst-precision-bar) {
  background: var(--night-panel);
}

/* 阅读与听力共用的手机解析吸附栏。解析很长时，“收起”始终停在当前
   滚动区域顶部，用户不必回到页面最上方寻找原始开关。 */
.mobile-analysis-sticky-head { display: none; }
html[data-mobile-view="true"] .mobile-analysis-sticky-head {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -16px -16px 14px;
  padding: 11px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, .26);
  background: rgba(248, 250, 252, .94);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
}
html[data-mobile-view="true"] .reading-side-analysis .mobile-analysis-sticky-head {
  margin: -16px -16px 14px;
}
html[data-mobile-view="true"] .mobile-analysis-sticky-head strong {
  color: #1e293b;
  font-size: 14px;
  font-weight: 800;
}
html[data-mobile-view="true"] .mobile-analysis-sticky-head button {
  padding: 5px 9px;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  background: #f0fdf4;
  color: #166534;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}
html[data-mobile-view="true"][data-theme="dark"] .mobile-analysis-sticky-head {
  border-bottom-color: rgba(100, 116, 139, .45);
  background: rgba(16, 22, 27, .94);
}
html[data-mobile-view="true"][data-theme="dark"] .mobile-analysis-sticky-head strong { color: #f2f7f4; }
html[data-mobile-view="true"][data-theme="dark"] .mobile-analysis-sticky-head button {
  border-color: #2f8a5c;
  background: #0d2d20;
  color: #8cf0bd;
}

html[data-mobile-view="true"] .reading-session-shell .reading-agent-material-body {
  font-size: 15px;
  line-height: 1.9;
}

html[data-mobile-view="true"] .reading-session-shell .reading-agent-material-body p + p { margin-top: 12px; }
html[data-mobile-view="true"] .reading-session-shell .quiz-stem { margin: 6px 2px 14px; font-size: 15px; line-height: 1.7; }
html[data-mobile-view="true"] .reading-session-shell .quiz-opts { gap: 9px; }
html[data-mobile-view="true"] .reading-session-shell .quiz-opt { min-height: 52px; padding: 11px 12px; font-size: 14px; }
html[data-mobile-view="true"] .reading-session-shell .quiz-submit-btn { min-height: 50px; padding: 13px; border-radius: 13px; }

html[data-mobile-view="true"] .reading-session-shell .reading-article-next-row {
  position: sticky;
  z-index: 2;
  bottom: 0;
  margin-top: 8px;
  padding-top: 6px;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,.96) 32%);
}

html[data-mobile-view="true"] .reading-session-shell .reading-article-next-btn {
  min-height: 45px;
  border-radius: 12px;
}

html[data-mobile-view="true"] .reading-session-shell .reading-study-stage.analysis-open {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
html[data-mobile-view="true"] .reading-session-shell .reading-article-column { order: 1; }
html[data-mobile-view="true"] .reading-session-shell .reading-side-analysis {
  order: 2;
  width: auto;
  padding: 16px;
  border-radius: 14px;
}

html[data-mobile-view="true"] .reading-session-shell .quiz-ai-explain-btn {
  left: 14px;
  bottom: 13px;
}

html[data-mobile-view="true"] .question-report-btn {
  position: absolute;
  right: 14px;
  bottom: 13px;
  z-index: 2;
}

:root[data-theme="dark"][data-mobile-view="true"] .backend-account-card { background: rgba(14, 21, 27, .97); }
:root[data-theme="dark"][data-mobile-view="true"] .reading-session-shell .reading-article-next-row {
  background: linear-gradient(180deg, transparent, rgba(12,18,24,.96) 32%);
}
:root[data-theme="dark"][data-mobile-view="true"] .reading-mobile-scroll { border: 0; background: #10161b; }
:root[data-theme="dark"][data-mobile-view="true"] .reading-mobile-translation { border-left: 0; color: #aebbd7; }
:root[data-theme="dark"][data-mobile-view="true"] .reading-mobile-trans-toggle { border-color: #425675; color: #bdc9e5; background: #17202b; }
:root[data-theme="dark"][data-mobile-view="true"] .reading-mobile-primary-action { border-color: #edf3ef; color: #111815; background: #edf3ef; }
:root[data-theme="dark"][data-mobile-view="true"] .reading-mobile-primary-action:disabled { border-color: #303a35; color: #748078; background: #222b26; }

/* 学习分析页「复习建议」（2026-10-21，analysis-screen.js renderPointReport；按复习安排分组，不显示会/不会判断）。
   沿用本页卡片配色；深色模式按上方 analysis 深色变体同一套 --night-panel 配色补齐。 */
.analysis-points .analysis-caption { margin: 6px 0 0; max-width: 640px; }
.analysis-points-body { display: grid; gap: 14px; }
.analysis-points-empty { margin: 0; color: #667085; font-size: 14px; line-height: 1.6; }
.analysis-point-group { border: 1px solid #E8ECEB; border-radius: 18px; padding: 16px 18px; background: #FAFBFA; }
.analysis-point-group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 10px; }
.analysis-point-group-head small { color: #667085; font-size: 12px; }
.analysis-point-status { font-weight: 800; font-size: 14px; color: #182018; }
.analysis-point-group.is-review-now { border-color: #F2D6A8; background: #FFFAF2; }
.analysis-point-group.is-review-now .analysis-point-status { color: #B45309; }
.analysis-point-group.is-upcoming .analysis-point-status { color: #2563EB; }
.analysis-point-group.is-steady .analysis-point-status { color: #18A95B; }
.analysis-point-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.analysis-point { padding: 10px 12px; border-radius: 12px; background: #FFF; border: 1px solid #EEF1F0; }
.analysis-point-name { font-weight: 700; color: #1D2939; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.analysis-point-name small { font-weight: 600; font-size: 11px; color: #667085; }
.analysis-point-usage { margin: 4px 0 0; font-size: 13px; color: #475467; line-height: 1.5; }
.analysis-point-meta { margin: 4px 0 0; font-size: 12px; color: #667085; }
.analysis-point-meta b { color: #18A95B; }
.analysis-points-more { margin: 8px 0 0; font-size: 12px; color: #667085; }
:root[data-theme="dark"] .analysis-points-empty,
:root[data-theme="dark"] .analysis-point-group-head small,
:root[data-theme="dark"] .analysis-point-name small,
:root[data-theme="dark"] .analysis-point-meta,
:root[data-theme="dark"] .analysis-points-more { color: #97a2ab; }
:root[data-theme="dark"] .analysis-point-group { border-color: #2e3d4d; background: rgba(255, 255, 255, 0.03); }
:root[data-theme="dark"] .analysis-point-group.is-review-now { border-color: #6b5326; background: rgba(245, 158, 11, 0.08); }
:root[data-theme="dark"] .analysis-point-status { color: #f2f7fb; }
:root[data-theme="dark"] .analysis-point-group.is-review-now .analysis-point-status { color: #fcd34d; }
:root[data-theme="dark"] .analysis-point-group.is-upcoming .analysis-point-status { color: #93c5fd; }
:root[data-theme="dark"] .analysis-point-group.is-steady .analysis-point-status,
:root[data-theme="dark"] .analysis-point-meta b { color: #4ade80; }
:root[data-theme="dark"] .analysis-point { border-color: #2e3d4d; background: #202b37; }
:root[data-theme="dark"] .analysis-point-name { color: #f2f7fb; }
:root[data-theme="dark"] .analysis-point-usage { color: #c7d0d8; }
