/* ===== Dokedo Design Tokens v1 ===== */
:root {
  /* Color */
  --color-bg: #F4F5F2;
  --color-paper: #FFFEFB;
  --color-surface: #F8F8F5;
  --color-surface-strong: #EEF1EF;
  --color-text: #202422;
  --color-text-soft: #626A65;
  --color-text-muted: #8C938E;
  --color-border: #DDE1DD;
  --color-border-strong: #C8CEC9;
  --color-primary: #2F6F62;
  --color-primary-strong: #24566B;
  --color-primary-soft: #E8F2EF;
  --color-danger: #C84843;
  --color-danger-soft: #F9ECEB;

  /* Learning semantics */
  --learn-vocab: var(--color-primary);
  --learn-vocab-bg: var(--color-primary-soft);
  --learn-dict: #626B73;
  --learn-dict-bg: #EEF1F3;
  --learn-particle: #7A6A4D;
  --learn-particle-bg: #F4EFE5;
  --learn-trap: var(--color-danger);
  --learn-trap-bg: var(--color-danger-soft);

  /* Typography */
  --font-ui: 'Inter', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  --font-ja: 'Noto Sans JP', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', sans-serif;
  --font-reading: 'Noto Serif JP', 'Hiragino Mincho ProN', 'Yu Mincho', 'MS Mincho', serif;
  --text-xs: 11px;
  --text-sm: 13px;
  --text-md: 15px;
  --text-lg: 17px;
  --text-reading: 20px;
  --text-ruby: 10px;
  --leading-ui: 1.6;
  --leading-reading: 2.25;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* Shape and elevation */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-round: 999px;
  --shadow-popover: 0 8px 24px rgba(32, 36, 34, .07);
  --shadow-modal: 0 20px 60px rgba(32, 36, 34, .16);

  /* Legacy variable bridge. New styles should use the tokens above. */
  --sumi: var(--color-text);
  --accent: var(--color-primary);
  --accent-soft: var(--color-primary-soft);
  --danger: var(--color-danger);
  --danger-soft: var(--color-danger-soft);
  --shusha: var(--color-primary);
  --kinari: var(--color-bg);
  --shironeri: var(--color-paper);
  --ainezumi: var(--color-text-soft);
  --border: var(--color-border);
  --paper: var(--color-paper);
  --surface: var(--color-surface);
  --line: var(--color-border);
  --muted: var(--color-text-soft);
  --ink: var(--color-text);
  --ink-soft: var(--color-text-soft);

  --n5: var(--learn-vocab);
  --n4: var(--learn-vocab);
  --n3: var(--learn-vocab);
  --n5-bg: var(--learn-vocab-bg);
  --n4-bg: var(--learn-vocab-bg);
  --n3-bg: var(--learn-vocab-bg);
  --particle: var(--learn-particle);
  --particle-bg: var(--learn-particle-bg);
  --km: var(--learn-vocab);
  --km-bg: var(--learn-vocab-bg);
  --trap: var(--learn-trap);
  --trap-bg: var(--learn-trap-bg);

  --reading-base-font: var(--text-reading);
  --reading-ruby-font: var(--text-ruby);
  --reading-ruby-gap: 0.16em;
  --reading-line-height: var(--leading-reading);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: var(--text-md);
  line-height: var(--leading-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Hero 首屏 ===== */
.hero-intro {
  max-width: 680px;
  margin: 0 auto;
  padding: 120px 24px 80px;
  text-align: center;
}

.hero-brand {
  margin-bottom: 64px;
}

.brand-mark-large {
  width: 72px;
  height: 72px;
  margin: 0 auto 32px;
  display: grid;
  place-items: center;
  background: var(--sumi);
  color: var(--kinari);
  border: 2px solid var(--sumi);
  font-family: 'Noto Serif JP', 'Hiragino Mincho ProN', 'Yu Mincho', 'MS Mincho', 'Noto Serif SC', 'SimSun', serif;
  font-size: var(--type-size-hero);
  font-weight: 500;
}

.hero-title {
  font-family: 'Noto Serif JP', 'Hiragino Mincho ProN', 'Yu Mincho', 'MS Mincho', 'Noto Serif SC', 'SimSun', serif;
  font-size: var(--type-size-page-title);
  font-weight: 500;
  color: var(--sumi);
  margin: 0 0 8px;
  letter-spacing: 0.08em;
}

.hero-subtitle {
  font-size: var(--type-size-control);
  color: var(--ainezumi);
  margin: 0;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.hero-input {
  margin-bottom: 24px;
}

.hero-input textarea {
  width: 100%;
  min-height: 200px;
  border: 2px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  font-size: var(--type-size-body);
  background: var(--shironeri);
  color: var(--sumi);
  font-family: 'Noto Sans JP', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
  resize: vertical;
  transition: border-color 0.2s;
}

.hero-input textarea:focus {
  outline: none;
  border-color: var(--sumi);
}

.hero-input textarea::placeholder {
  color: var(--ainezumi);
  opacity: 0.6;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 100;
}

/* btn-primary-large / btn-ghost-large → btn-primary/btn-secondary btn--large に統合 */
/* Hero エリアの z-index 保持 */
.hero-actions .btn-primary,
.hero-actions .btn-secondary {
  position: relative;
  z-index: 100;
  pointer-events: auto;
}

.hero-features {
  display: flex;
  gap: 24px;
  justify-content: center;
  font-size: var(--type-size-meta);
  color: var(--ainezumi);
  margin-top: 16px;
}

.hero-features span {
  position: relative;
  padding-left: 12px;
}

.hero-features span::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 3px;
  background: var(--ainezumi);
  border-radius: 50%;
}

/* ===== 首次访问/应用界面切换 ===== */
body.first-visit .app-interface { display: none !important; }
body.first-visit .app-sidebar { display: none !important; }
body:not(.first-visit) .hero-intro { display: none !important; }

.hero-intro {
  display: block !important;
}

/* ===== 应用界面布局 ===== */
.app-interface {
  display: flex;
  min-height: 100vh;
}

/* 兼容旧结构 */
.app-interface .wrap {
  display: block;
  width: 100%;
  max-width: none;
  padding: 0;
  margin: 0;
  margin-left: 240px;
}

.app-interface .panels {
  display: block;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-7) var(--space-6);
}

.app-interface .reading-main {
  max-width: 800px;
  margin: 0 auto;
}

body[data-view="reading"] .grammar-section,
body[data-view="reading"] .typing-section,
body[data-view="reading"] .retell-section,
body[data-view="reading"] .discover-section,
body[data-view="reading"] .test-section,
body[data-view="reading"] .history-section,
body[data-view="reading"] .settings-section,
body[data-view="grammar"] .reading-main,
body[data-view="grammar"] .typing-section,
body[data-view="grammar"] .retell-section,
body[data-view="grammar"] .discover-section,
body[data-view="grammar"] .test-section,
body[data-view="grammar"] .history-section,
body[data-view="grammar"] .settings-section,
body[data-view="typing"] .reading-main,
body[data-view="typing"] .grammar-section,
body[data-view="typing"] .retell-section,
body[data-view="typing"] .discover-section,
body[data-view="typing"] .test-section,
body[data-view="typing"] .history-section,
body[data-view="typing"] .settings-section,
body[data-view="retell"] .reading-main,
body[data-view="retell"] .grammar-section,
body[data-view="retell"] .typing-section,
body[data-view="retell"] .discover-section,
body[data-view="retell"] .test-section,
body[data-view="retell"] .history-section,
body[data-view="retell"] .settings-section,
body[data-view="discover"] .reading-main,
body[data-view="discover"] .grammar-section,
body[data-view="discover"] .typing-section,
body[data-view="discover"] .retell-section,
body[data-view="discover"] .test-section,
body[data-view="discover"] .history-section,
body[data-view="discover"] .settings-section,
body[data-view="test"] .reading-main,
body[data-view="test"] .grammar-section,
body[data-view="test"] .typing-section,
body[data-view="test"] .retell-section,
body[data-view="test"] .discover-section,
body[data-view="test"] .history-section,
body[data-view="test"] .settings-section,
body[data-view="history"] .reading-main,
body[data-view="history"] .grammar-section,
body[data-view="history"] .typing-section,
body[data-view="history"] .retell-section,
body[data-view="history"] .discover-section,
body[data-view="history"] .test-section,
body[data-view="history"] .settings-section,
body[data-view="settings"] .reading-main,
body[data-view="settings"] .grammar-section,
body[data-view="settings"] .typing-section,
body[data-view="settings"] .retell-section,
body[data-view="settings"] .discover-section,
body[data-view="settings"] .test-section,
body[data-view="settings"] .history-section {
  display: none !important;
}

body[data-view="grammar"] .grammar-section,
body[data-view="typing"] .typing-section,
body[data-view="retell"] .retell-section,
body[data-view="discover"] .discover-section,
body[data-view="test"] .test-section,
body[data-view="history"] .history-section,
body[data-view="settings"] .settings-section {
  display: block;
  max-width: 900px;
  margin: var(--space-7) auto;
}

/* 左侧边栏 */
.app-sidebar {
  width: 240px;
  background: var(--sumi);
  color: var(--kinari);
  padding: 32px 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 50;
}

/* 首次访问时隐藏侧边栏 */
body.first-visit .app-sidebar {
  display: none;
}

.sidebar-brand {
  padding: 0 24px 32px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 32px;
}

.brand-mini {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  opacity: 0.9;
  transition: opacity 0.2s;
}

.brand-mini:hover {
  opacity: 1;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--kinari);
  font-family: 'Noto Serif JP', serif;
  font-size: var(--type-size-subtitle);
}

.brand-text {
  font-size: var(--type-size-control);
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: 0 24px;
}

.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  margin-bottom: 8px;
  background: transparent;
  border: none;
  color: var(--kinari);
  font-size: var(--type-size-control);
  cursor: pointer;
  border-radius: 4px;
  opacity: 0.7;
  transition: all 0.2s;
  position: relative;
}

.nav-item[data-view="reading"]::after,
.nav-item[data-view="vocab"]::after,
.nav-item[data-view="retell"]::after {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #a5aaa5;
  font-size: var(--type-size-micro);
  font-weight: 650;
}

.nav-item[data-view="reading"]::after { content: '1'; }
.nav-item[data-view="vocab"]::after { content: '2'; right: 46px; }
.nav-item[data-view="retell"]::after { content: '3'; }

.nav-item:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--shusha);
}

.nav-vocab {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-badge {
  float: none !important;
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--shusha);
  color: white;
  text-align: center;
  font-size: var(--type-size-micro);
  font-weight: 600;
  margin-left: auto;
}

.nav-item span {
  float: right;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  text-align: center;
  font-size: var(--type-size-micro);
}

.vocab-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: var(--kinari);
  font-size: var(--type-size-meta);
  cursor: pointer;
  transition: all 0.2s;
}

.vocab-badge:hover {
  background: rgba(255, 255, 255, 0.1);
}

.vocab-badge span {
  background: var(--shusha);
  color: white;
  border-radius: 2px;
  padding: 2px 8px;
  font-size: var(--type-size-micro);
  font-weight: 600;
}

/* 主内容区 */
.app-main {
  margin-left: 240px;
  flex: 1;
  padding: 48px;
  max-width: 1040px;
}

/* 兼容现有的reading-main卡片 */
.reading-main {
  max-width: 800px;
  margin: 0 auto;
}

.reading-main .card-pad {
  padding: 0;
}

.main-content {
  max-width: 800px;
  margin: 0 auto;
}

/* 标题签名元素 */
.section-title {
  font-family: 'Noto Serif JP', 'Hiragino Mincho ProN', 'Yu Mincho', 'MS Mincho', 'Noto Serif SC', 'SimSun', serif;
  font-size: var(--type-size-feature-title);
  font-weight: 500;
  color: var(--sumi);
  margin: 0 0 32px;
  padding-left: 0;
  position: static;
  letter-spacing: 0.03em;
}

.section-title::before {
  display: none;
}

/* 状态条 */
.status-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--shironeri);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 24px;
  font-size: var(--type-size-meta);
}

.status-bar span {
  color: var(--sumi);
  font-weight: 600;
}

/* btn-text → btn-secondary btn--text に統合 */

/* 图例 */
.legend-inline {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--shironeri);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 24px;
  font-size: var(--type-size-caption);
}

.legend-label {
  font-weight: 600;
  color: var(--sumi);
  margin-right: 8px;
}

.legend-inline span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ainezumi);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-n5 { background: var(--n5); }
.dot-n4 { background: var(--n4); }
.dot-n3 { background: var(--n3); }
.dot-particle { background: var(--ainezumi); }
.dot-trap { background: var(--danger); }

/* 输入区域 */
.source-composer {
  margin-bottom: var(--space-6);
}

.source-dropzone {
  background: var(--color-paper);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.source-dropzone textarea {
  width: 100%;
  min-height: 160px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-family: var(--font-ja);
  font-size: var(--text-md);
  color: var(--color-text);
  resize: vertical;
}

.source-dropzone textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

.source-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.source-help {
  font-size: var(--text-sm);
  color: var(--color-text-soft);
  margin-top: var(--space-2);
}

.pro-pill,
.plan-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid rgba(142, 94, 34, .28);
  border-radius: 999px;
  background: #fff7e8;
  color: #7a4a12;
  font-size: var(--type-size-micro);
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.hero-text-action .pro-pill,
.pro-action-button .pro-pill {
  margin-left: 6px;
}

.plan-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: var(--type-size-meta);
  line-height: 1.5;
}

.plan-pill.local {
  border-color: rgba(63, 126, 103, .26);
  background: #edf8f2;
  color: #28654e;
}

.plan-pill.pro {
  border-color: rgba(142, 94, 34, .28);
  background: #fff7e8;
  color: #7a4a12;
}

.quota-list {
  display: grid;
  gap: 8px;
}

.quota-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf9f6;
  color: var(--muted);
  font-size: var(--type-size-meta);
}

.quota-row b {
  color: var(--sumi);
  font-size: var(--type-size-caption);
  white-space: nowrap;
}

.import-status {
  font-size: var(--text-sm);
  color: var(--color-text-soft);
  margin-top: var(--space-2);
}

.import-status:empty {
  display: none;
}

.import-status.error {
  color: var(--danger);
}

.import-status.ok {
  color: var(--n5);
}

/* 阅读输出区 */
.reading-output {
  font-size: var(--reading-base-font);
  line-height: var(--reading-line-height);
  padding: var(--space-6);
  background: var(--color-paper);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  min-height: 400px;
  font-family: var(--font-reading);
}

.reading-output rt {
  font-size: var(--reading-ruby-font);
  color: var(--ink-soft);
}

.reading-output ruby.w {
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.reading-output ruby.w:hover {
  background: rgba(47, 111, 98, 0.1);
  box-shadow: 0 0 0 2px rgba(47, 111, 98, 0.08);
}

.reading-output ruby.w:active,
.reading-output ruby.w.is-just-selected {
  transform: translateY(1px);
  background: rgba(47, 111, 98, 0.16);
  box-shadow: 0 0 0 3px rgba(47, 111, 98, 0.14);
}

.reading-output ruby.w.active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: 0 0 0 2px rgba(47, 111, 98, 0.18);
}

/* 按钮系统 */
button {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  border: none;
  cursor: pointer;
  padding: 10px var(--space-4);
  border-radius: var(--radius-md);
  min-height: 40px;
  transition: opacity 0.2s;
  position: relative;
  z-index: 10;
}

button:active {
  opacity: 0.7;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== ボタンシステム（3階層） =====
 * btn-primary  : 主要アクション（朱砂色）
 * btn-secondary: 補助アクション（枠線付き）
 *   修飾子: btn--large / btn--small / btn--text
 * btn-icon     : アイコン専用ボタン
 * ===================================== */

/* --- 共通ベース --- */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity 0.2s, border-color 0.2s, background 0.2s;
  min-height: 36px;
}

/* --- Primary: 主要アクション --- */
.btn-primary {
  background: var(--shusha);
  color: white;
  border-color: var(--shusha);
}

.btn-primary:hover {
  opacity: 0.85;
}

.btn-primary:active {
  opacity: 0.7;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Secondary: 補助アクション --- */
.btn-secondary {
  background: transparent;
  color: var(--sumi);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: var(--sumi);
  background: rgba(44, 52, 64, 0.04);
}

.btn-secondary:active {
  background: rgba(44, 52, 64, 0.08);
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: var(--border);
}

/* danger variant */
.btn-secondary.danger-action {
  color: var(--danger);
  border-color: var(--border);
}

.btn-secondary.danger-action:hover {
  border-color: var(--danger);
  background: var(--color-danger-soft);
}

/* --- btn--large 修飾子 --- */
.btn--large {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-md);
  min-height: 48px;
}

/* --- btn--small 修飾子 --- */
.btn--small {
  padding: 5px 10px;
  font-size: var(--text-xs);
  min-height: 28px;
}

/* --- btn--text 修飾子（テキストリンク風） --- */
.btn-secondary.btn--text {
  background: none;
  border-color: transparent;
  color: var(--color-primary);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
}

.btn-secondary.btn--text:hover {
  background: rgba(47, 111, 98, 0.08);
  border-color: transparent;
}

/* 按钮loading状态 */
.btn-loading {
  position: relative;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid currentColor;
  border-radius: 50%;
  border-top-color: transparent;
  animation: btn-spin 0.6s linear infinite;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

.btnrow {
  display: flex;
  gap: 12px;
  margin: 16px 0;
  flex-wrap: wrap;
}

/* 卡片 */
.card {
  background: var(--color-paper);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-5);
}

.card-pad {
  padding: var(--space-5);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
}

/* 词义面板（右侧滑出） */
.detail-drawer {
  position: fixed;
  right: -400px;
  top: 0;
  width: 400px;
  height: 100vh;
  background: var(--shironeri);
  border-left: 1px solid var(--border);
  padding: 32px 24px;
  transition: right 0.3s ease;
  z-index: 100;
  overflow-y: auto;
}

.detail-drawer.active {
  right: 0;
}

.drawer-close {
  position: absolute;
  right: 16px;
  top: 16px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  font-size: var(--type-size-section-title);
  cursor: pointer;
  color: var(--ainezumi);
}

.drawer-close:hover {
  color: var(--sumi);
}

/* 菜单面板 */
.menu-panel {
  position: fixed;
  top: 0;
  right: -320px;
  width: 320px;
  height: 100vh;
  background: var(--shironeri);
  border-left: 1px solid var(--border);
  padding: 32px 24px;
  transition: right 0.3s ease;
  z-index: 100;
  overflow-y: auto;
}

.menu-panel.active {
  right: 0;
}

.menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.menu-header strong {
  font-size: var(--type-size-emphasis);
  color: var(--sumi);
}

.menu-nav button {
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  margin-bottom: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--sumi);
  font-size: var(--type-size-control);
  cursor: pointer;
  transition: all 0.2s;
}

.menu-nav button:hover {
  border-color: var(--sumi);
  background: #f7f7f5;
}

.menu-nav button span {
  display: block;
  font-weight: 700;
}

.menu-nav button small {
  display: block;
  margin-top: 2px;
  color: var(--ainezumi);
  font-weight: 400;
}

.menu-nav hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* 生词本面板 */
.vocab-panel-slide {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  height: 100vh;
  background: var(--shironeri);
  border-left: 1px solid var(--border);
  padding: 0;
  transition: right 0.3s ease;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.vocab-panel-slide.active {
  right: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-header strong {
  font-size: var(--type-size-emphasis);
  color: var(--sumi);
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* --- btn-icon: アイコン専用ボタン (icon-btn を統合) --- */
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--ainezumi);
  font-size: var(--type-size-section-title);
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}

.btn-icon:hover {
  color: var(--sumi);
  background: rgba(44, 52, 64, 0.06);
}

/* 生词本滑动面板内容区 */
.vocab-section {
  margin-bottom: 32px;
}

.review-section {
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

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

.section-title {
  font-size: var(--type-size-body);
  font-weight: 600;
  color: var(--sumi);
}

.section-title b {
  color: var(--shusha);
  font-size: var(--type-size-emphasis);
}

.review-stats {
  font-size: var(--type-size-control);
  color: var(--ainezumi);
  margin-bottom: 12px;
}

.review-stats b {
  color: var(--sumi);
  font-weight: 600;
}

.review-actions {
  display: flex;
  gap: 8px;
}

/* btn-ghost-small → btn-secondary btn--small に統合 */

.vocab-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ainezumi);
  font-size: var(--type-size-control);
  line-height: 1.6;
}

.vocab-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.vocab-list li,
.vocab-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.vocab-remove {
  display: inline-grid;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0.72;
  transition: background .16s ease, border-color .16s ease, color .16s ease, opacity .16s ease;
}

.vocab-remove svg {
  width: 18px;
  height: 18px;
}

.vocab-remove svg path,
.reading-queue-remove svg path,
.history-remove svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.vocab-remove:hover,
.vocab-remove:focus-visible {
  border-color: rgba(200, 72, 67, 0.18);
  background: rgba(200, 72, 67, 0.08);
  color: var(--trap);
  opacity: 1;
  outline: none;
}

/* ===== 语法词典样式 ===== */
.grammar-lookup-shell {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 6px 0 10px;
}

.grammar-lookup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 34px;
  padding-bottom: 20px;
  border-bottom: 2px solid rgba(47, 111, 98, 0.12);
}

.grammar-lookup-head h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--sumi);
  font-family: var(--font-display);
  font-size: var(--type-size-feature-title);
  font-weight: 700;
  line-height: 1.25;
}

.grammar-lookup-head h1 span {
  padding: 3px 8px;
  border-radius: var(--radius-small);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: var(--type-size-caption);
  font-weight: 700;
}

.grammar-lookup-head p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: var(--type-size-control);
  line-height: 1.7;
}

.grammar-book-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.grammar-book-summary span {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: var(--type-size-meta);
  white-space: nowrap;
}

.grammar-book-summary b {
  color: var(--accent);
}

.grammar-book-panel,
.grammar-capture-panel {
  display: grid;
  gap: 16px;
  margin-bottom: 28px;
  padding: 18px;
  border: 1px solid var(--line);
  background: #fff;
}

.grammar-book-panel-head,
.grammar-capture-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.grammar-book-panel h2,
.grammar-capture-panel h2 {
  margin: 0;
  color: var(--sumi);
  font-size: var(--type-size-body-large);
}

.grammar-book-panel-head span,
.grammar-capture-head span {
  color: var(--muted);
  font-size: var(--type-size-meta);
}

.grammar-book-list {
  display: grid;
  gap: 12px;
}

.grammar-book-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  background: #FAFCFA;
}

.grammar-book-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.grammar-book-card h3 {
  margin: 0;
  color: var(--sumi);
  font-size: var(--type-size-subtitle);
  line-height: 1.35;
}

.grammar-book-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.grammar-book-meta span {
  padding: 4px 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--type-size-caption);
  font-weight: 700;
}

.grammar-book-sub,
.grammar-book-note {
  margin: 0;
  color: var(--muted);
  font-size: var(--type-size-control);
  line-height: 1.8;
}

.grammar-book-note {
  color: var(--sumi);
}

.grammar-book-examples {
  display: grid;
  gap: 8px;
}

.grammar-book-example {
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: rgba(47, 111, 98, 0.05);
}

.grammar-book-example .jp {
  color: var(--sumi);
  font-size: var(--type-size-control);
  line-height: 1.7;
}

.grammar-book-example .cn {
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--type-size-meta);
}

.grammar-capture-grid {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 12px;
}

.grammar-capture-grid input,
.grammar-capture-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #FCFCFC;
  color: var(--sumi);
  font: inherit;
}

.grammar-capture-grid input {
  min-height: 46px;
  padding: 0 14px;
}

.grammar-capture-grid textarea {
  grid-column: 1 / -1;
  min-height: 96px;
  padding: 12px 14px;
  resize: vertical;
}

.grammar-capture-grid button {
  justify-self: start;
  min-width: 150px;
}

.grammar-search-wrap {
  position: relative;
  width: min(720px, 100%);
  margin-bottom: 38px;
}

.grammar-search-wrap svg {
  position: absolute;
  top: 50%;
  left: 20px;
  width: 21px;
  height: 21px;
  fill: none;
  stroke: #A8AEAA;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: translateY(-50%);
  pointer-events: none;
}

.grammar-search {
  width: 100%;
  height: 64px;
  padding: 0 24px 0 56px;
  border: 2px solid var(--line);
  border-radius: 32px !important;
  background: #FCFCFC;
  color: var(--sumi);
  font-size: var(--type-size-emphasis);
  box-shadow: 0 4px 12px rgba(0,0,0,0.02);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.grammar-search:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 8px 20px rgba(47, 111, 98, 0.1);
}

.grammar-search:focus + svg,
.grammar-search-wrap:focus-within svg {
  stroke: var(--accent);
}

.grammar-grid {
  display: grid;
  gap: 16px;
}

.grammar-suggestion-panel {
  display: grid;
  gap: 28px;
}

.grammar-suggestion-section {
  display: grid;
  gap: 14px;
}

.grammar-suggestion-section h2 {
  margin: 0;
  color: var(--muted);
  font-size: var(--type-size-body);
  font-weight: 700;
}

.grammar-suggestion-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.grammar-suggestion {
  min-height: 36px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px !important;
  background: #fff;
  color: var(--sumi);
  cursor: pointer;
  font: inherit;
  font-size: var(--type-size-control);
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease, transform 0.12s ease;
}

.grammar-suggestion:hover,
.grammar-suggestion:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  outline: none;
  transform: translateY(-1px);
}

.grammar-empty {
  padding: 34px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius) !important;
  background: #FAFCFA;
  color: var(--muted);
  font-size: var(--type-size-control);
  text-align: center;
}

.gpoint {
  padding: 18px 20px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.12s ease;
}

.gpoint:hover,
.gpoint:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(33, 37, 41, 0.06);
  outline: none;
  transform: translateY(-1px);
}

.gpoint-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gpoint-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.gpoint-title {
  color: var(--sumi);
  font-size: var(--type-size-subtitle);
  font-weight: 700;
}

.gpoint-level {
  flex: 0 0 auto;
  padding: 3px 8px;
  font-size: var(--type-size-caption);
  font-weight: 700;
}

.grammar-save-button {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: var(--type-size-caption);
  font-weight: 700;
}

.grammar-save-button:hover,
.grammar-save-button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.grammar-save-button.is-saved {
  background: var(--accent-soft);
  color: var(--muted);
  cursor: default;
}

.gpoint-sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: var(--type-size-control);
}

.gpoint-body {
  display: none;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--sumi);
  font-size: var(--type-size-control);
  line-height: 1.75;
}

.gpoint.open .gpoint-body {
  display: grid;
  gap: 12px;
}

.gpoint-ex {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: rgba(47, 111, 98, 0.04);
}

.gpoint-ex .jp {
  margin-bottom: 4px;
  color: var(--sumi);
  font-size: var(--type-size-body);
}

.gpoint-ex .cn {
  color: var(--muted);
  font-size: var(--type-size-meta);
}

.gpoint-pitfall {
  color: var(--muted);
  font-size: var(--type-size-meta);
}

.gpoint-pitfall b {
  margin-right: 6px;
  color: var(--sumi);
}

.grammar-item {
  padding: 16px;
  background: var(--kinari);
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: all 0.2s;
}

.grammar-item:hover {
  border-color: var(--shusha);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.grammar-title {
  font-size: var(--type-size-emphasis);
  font-weight: 600;
  color: var(--sumi);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.grammar-title .tag {
  font-size: var(--type-size-micro);
  padding: 2px 8px;
}

.grammar-content {
  font-size: var(--type-size-control);
  line-height: 1.8;
  color: var(--sumi);
}

.grammar-content p {
  margin: 8px 0;
}

.grammar-example {
  margin: 12px 0;
  padding: 12px;
  background: rgba(47, 111, 98, 0.04);
  border: 1px solid var(--line);
  border-radius: 2px;
}

.grammar-example-ja {
  font-size: var(--type-size-body);
  color: var(--sumi);
  margin-bottom: 4px;
}

.grammar-example-zh {
  font-size: var(--type-size-meta);
  color: var(--ainezumi);
}

/* ===== 找材料页面样式 ===== */
.discover-sources {
  display: grid;
  gap: 12px;
}

.source-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  background: var(--kinari);
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}

.source-card:hover {
  border-color: var(--shusha);
  background: rgba(47, 111, 98, 0.04);
}

.source-card b {
  font-size: var(--type-size-body);
  color: var(--sumi);
  font-weight: 600;
}

.source-card span {
  font-size: var(--type-size-meta);
  color: var(--ainezumi);
}

/* ===== 水平测试页面样式 ===== */
.test-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.status-label {
  font-size: var(--type-size-control);
  color: var(--ainezumi);
}

.status-value {
  font-size: var(--type-size-control);
  font-weight: 600;
  color: var(--shusha);
}

.test-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.level-question-single {
  display: grid;
  gap: 16px;
  max-width: 720px;
  margin: 14px 0 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.level-question-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: 800;
}

.level-question-progress b {
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}

.level-question-single h2 {
  margin: 0;
  color: var(--sumi);
  font-size: var(--type-size-lead);
  line-height: 1.5;
  letter-spacing: 0;
}

.level-options {
  display: grid;
  gap: 10px;
}

.level-options label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--sumi);
  cursor: pointer;
}

.level-options label:hover,
.level-options label.selected {
  border-color: rgba(47, 111, 98, 0.32);
  background: rgba(47, 111, 98, 0.06);
}

.level-options input {
  margin-top: 4px;
  accent-color: var(--accent);
}

.level-question-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}

.level-result-card {
  display: grid;
  gap: 14px;
  max-width: 720px;
  margin-top: 12px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.level-result-card h2 {
  margin: 0;
  color: var(--sumi);
  font-size: var(--type-size-step-22);
  line-height: 1.35;
  letter-spacing: 0;
}

.level-result-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.level-result-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.level-result-stats div {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcfb;
}

.level-result-stats b,
.level-result-stats span {
  display: block;
}

.level-result-stats b {
  color: var(--sumi);
  font-size: var(--type-size-feature-title);
  line-height: 1;
}

.level-result-stats span {
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: 700;
}

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

/* ===== 历史记录页面样式 ===== */
.history-list {
  display: grid;
  gap: 12px;
}

.history-item {
  padding: 16px;
  background: var(--kinari);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.history-item:hover {
  border-color: var(--shusha);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.history-title {
  font-size: var(--type-size-body);
  font-weight: 600;
  color: var(--sumi);
  margin-bottom: 8px;
}

.history-meta {
  font-size: var(--type-size-meta);
  color: var(--ainezumi);
}

.history-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ainezumi);
}

.history-toolbar,
.history-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-toolbar {
  flex-wrap: wrap;
}

.history-toolbar .btn-ghost {
  padding: 6px 12px;
  font-size: var(--type-size-caption);
}

.weekly-progress {
  padding: 22px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.history-subhead h2 {
  margin: 0;
  font-size: var(--type-size-emphasis);
  letter-spacing: 0;
}

.history-subhead p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: var(--type-size-meta);
}

.weekly-progress-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.weekly-progress-summary > div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcfb;
}

.weekly-progress-summary b,
.weekly-progress-summary span {
  display: block;
}

.weekly-progress-summary b {
  font-size: var(--type-size-section-title-large);
  line-height: 1.2;
}

.weekly-progress-summary span {
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--type-size-caption);
}

.weekly-practice-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  height: 142px;
  margin-top: 20px;
  padding-top: 18px;
  border-bottom: 1px solid var(--line);
}

.weekly-practice-day {
  display: grid;
  grid-template-rows: 16px minmax(0, 1fr) 24px;
  justify-items: center;
  min-width: 0;
}

.weekly-practice-value,
.weekly-practice-label {
  color: var(--muted);
  font-size: var(--type-size-micro);
}

.weekly-practice-bar {
  align-self: end;
  width: min(28px, 70%);
  min-height: 4px;
  border-radius: 3px 3px 0 0;
  background: var(--line);
}

.weekly-practice-bar.is-active {
  background: var(--shusha);
}

.weekly-practice-label {
  padding-top: 7px;
}

.article-history-head {
  margin: 0 0 14px;
  padding-top: 22px;
}

.history-unified-panel {
  display: grid;
  gap: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.history-unified-panel .history-dashboard {
  padding-bottom: 22px;
}

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

.history-dashboard-grid > div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfcfb;
}

.history-dashboard-grid b,
.history-dashboard-grid span {
  display: block;
}

.history-dashboard-grid b {
  color: var(--sumi);
  font-size: var(--type-size-feature-title);
  line-height: 1.2;
}

.history-dashboard-grid span {
  margin-top: 5px;
  color: var(--muted);
  font-size: var(--type-size-caption);
}

.history-quiz-section {
  display: grid;
  gap: 14px;
  padding: 22px 0;
  border-top: 0;
  border-bottom: 1px solid var(--line);
}

.history-quiz-list {
  display: grid;
  gap: 9px;
}

.history-quiz-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.history-quiz-item > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 14px;
  cursor: pointer;
  list-style: none;
}

.history-quiz-item > summary::-webkit-details-marker {
  display: none;
}

.history-quiz-item > summary span,
.history-quiz-item > summary small {
  display: block;
}

.history-quiz-item > summary small {
  margin-top: 3px;
  color: var(--muted);
  font-size: var(--type-size-micro);
}

.history-quiz-item > summary strong {
  color: var(--accent);
  white-space: nowrap;
}

.history-quiz-answers {
  display: grid;
  gap: 8px;
  padding: 0 14px 14px;
}

.history-quiz-answers > div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-left: 3px solid var(--line);
  background: #fafbf9;
  font-size: var(--type-size-meta);
}

.history-quiz-answers > div.is-correct {
  border-left-color: var(--accent);
}

.history-quiz-answers > div.is-wrong {
  border-left-color: var(--trap);
}

.history-quiz-answers span {
  color: var(--muted);
}

.history-quiz-empty {
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.history-source-link {
  display: inline-block;
  margin-top: 6px;
  color: var(--accent);
  font-size: var(--type-size-caption);
  text-decoration: none;
}

.history-source-link:hover {
  text-decoration: underline;
}

/* ===== 打字练习页面样式 ===== */
.typing-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr 300px;
}

.typing-prompt {
  padding: 20px;
  background: var(--kinari);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 16px;
}

.typing-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.typing-chip {
  padding: 4px 10px;
  background: rgba(47, 111, 98, 0.1);
  color: var(--shusha);
  border-radius: 12px;
  font-size: var(--type-size-caption);
  font-weight: 600;
}

.typing-cn {
  font-size: var(--type-size-body);
  color: var(--sumi);
  line-height: 1.6;
  margin-bottom: 8px;
}

.typing-answer {
  font-size: var(--type-size-control);
  color: var(--ainezumi);
}

.typing-input {
  width: 100%;
  min-height: 120px;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: 4px;
  font-size: var(--type-size-body);
  font-family: 'Noto Sans JP', sans-serif;
  resize: vertical;
  margin-bottom: 16px;
}

.typing-input:focus {
  outline: none;
  border-color: var(--shusha);
}

.typing-result {
  margin-top: 16px;
  padding: 16px;
  background: var(--kinari);
  border-radius: 4px;
  font-size: var(--type-size-control);
  line-height: 1.6;
}

.typing-list {
  display: grid;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.typing-list button {
  text-align: left;
  padding: 12px;
  background: var(--kinari);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-size: var(--type-size-control);
  transition: all 0.2s;
}

.typing-list button:hover {
  border-color: var(--shusha);
  background: rgba(47, 111, 98, 0.04);
}

.typing-list button.active {
  border-color: var(--shusha);
  background: rgba(47, 111, 98, 0.08);
}

.typing-score {
  font-size: var(--type-size-body);
  font-weight: 600;
  color: var(--shusha);
}

@media (max-width: 768px) {
  .practice-hero,
  .practice-module-head {
    display: block;
  }

  .practice-unlock-strip {
    justify-content: flex-start;
    max-width: none;
    margin-top: 14px;
  }

  .module-lock {
    margin-top: 10px;
  }

  .practice-subgrid {
    grid-template-columns: 1fr;
  }

  .practice-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .typing-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Toast通知 ===== */
.toast {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 24px;
  background: var(--sumi);
  color: white;
  border-radius: 4px;
  font-size: var(--type-size-control);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  transition: bottom 0.3s ease;
  max-width: 90%;
  text-align: center;
}

.toast.show {
  bottom: 32px;
}

.toast-error {
  background: var(--danger);
}

.toast-warning {
  background: var(--danger);
}

.toast-success {
  background: var(--accent);
}

.toast-info {
  background: var(--sumi);
}

/* ===== 弹窗和模态框 ===== */
.export-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(44, 52, 64, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.export-modal.active {
  display: flex;
}

.reading-display-modal {
  background: rgba(33, 39, 52, 0.58);
  backdrop-filter: blur(5px);
  padding: 18px;
}

.reading-display-dialog {
  width: min(760px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid rgba(96, 88, 120, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 70px rgba(22, 25, 35, 0.28);
  overflow: hidden;
}

.reading-display-head {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 28px;
  border-bottom: 1px solid #E2E3EA;
}

.reading-display-head strong {
  color: #111217;
  font-size: var(--type-size-section-title-large);
  font-weight: 800;
  line-height: 1.2;
}

.reading-display-close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #646779;
  font: inherit;
  font-size: var(--type-size-page-title);
  line-height: 1;
  cursor: pointer;
}

.reading-display-close:hover {
  background: #F1EFF8;
  color: #5D3EA8;
}

.reading-display-body {
  display: grid;
  gap: 14px;
  padding: 16px 28px 12px;
  overflow: hidden;
}

.reading-display-section {
  display: grid;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid #E2E3EA;
}

.reading-display-presets {
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: center;
}

.reading-display-section-label,
.reading-display-section h3,
.reading-display-preview-label {
  margin: 0;
  color: #111217;
  font-size: var(--type-size-body-large);
  font-weight: 800;
  line-height: 1.3;
}

.reading-display-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.reading-display-preset-grid button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid #DCDDE7;
  border-radius: 8px;
  background: #FFFFFF;
  color: #16171D;
  font: inherit;
  font-size: var(--type-size-body);
  font-weight: 800;
  cursor: pointer;
}

.reading-display-preset-grid button:hover,
.reading-display-preset-grid button.is-selected {
  border-color: transparent;
  background: #6F50B7;
  color: #FFFFFF;
  box-shadow: 0 7px 16px rgba(105, 78, 174, 0.18);
}

.reading-display-controls {
  display: grid;
  gap: 9px;
}

.reading-display-row {
  display: grid;
  grid-template-columns: 118px minmax(180px, 1fr) 74px;
  align-items: center;
  gap: 14px;
  margin: 0;
}

.reading-display-row > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #1B1C22;
  font-size: var(--type-size-body);
  font-weight: 800;
  white-space: nowrap;
}

.reading-display-row input[type="range"] {
  width: 100%;
  height: 24px;
  accent-color: #6F50B7;
}

.reading-display-row input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 999px;
  background: #DADBE3;
}

.reading-display-row input[type="range"]::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  margin-top: -9px;
  border: 4px solid #FFFFFF;
  border-radius: 50%;
  background: #6F50B7;
  box-shadow: 0 2px 6px rgba(41, 35, 60, 0.22);
  -webkit-appearance: none;
}

.reading-display-row input[type="range"]::-moz-range-track {
  height: 3px;
  border-radius: 999px;
  background: #DADBE3;
}

.reading-display-row input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 4px solid #FFFFFF;
  border-radius: 50%;
  background: #6F50B7;
  box-shadow: 0 2px 6px rgba(41, 35, 60, 0.22);
}

.reading-display-row output {
  min-width: 66px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid #DCDDE7;
  border-radius: 8px;
  background: #FFFFFF;
  color: #111217;
  font-size: var(--type-size-body);
  font-variant-numeric: tabular-nums;
}

.reading-display-preview-wrap {
  display: grid;
  gap: 6px;
}

.reading-display-preview {
  min-height: 82px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 12px 32px;
  border: 1px solid #DCDDE7;
  border-radius: 8px;
  background: #FFFDFB;
  color: #101116;
  font-family: var(--font-reading);
  font-size: var(--preview-base-font, var(--type-size-step-22));
  line-height: var(--preview-line-height, 2);
  overflow: hidden;
}

.reading-display-preview rt {
  color: #24252B;
  font-size: var(--preview-ruby-font, var(--type-size-caption));
  line-height: 1;
  transform: translateY(calc(var(--preview-ruby-gap, 0.16em) * -1));
}

.reading-display-preview-divider {
  align-self: stretch;
  width: 1px;
  min-height: 52px;
  background: #DCDDE7;
}

.reading-display-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 28px;
  border-top: 1px solid #E7E8EE;
  background: rgba(255, 255, 255, 0.96);
}

.reading-display-actions .btn-secondary,
.reading-display-actions .btn-primary {
  min-width: 96px;
  height: 42px;
  border-radius: 8px;
  font-size: var(--type-size-body);
  font-weight: 800;
}

.reading-display-actions .btn-primary {
  background: #6F50B7;
  color: #FFFFFF;
}

.export-dialog {
  background: var(--shironeri);
  border: 1px solid var(--border);
  border-radius: 4px;
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.export-parameters-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: none;
  overflow: visible;
}

.export-parameters-dialog .export-head {
  padding: 18px 20px;
}

.export-parameters-dialog .export-body {
  padding: 18px 20px 10px;
}

.export-parameters-dialog .export-actions {
  padding: 14px 20px;
}

.export-parameters-dialog .export-settings {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 0;
}

.export-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  border-bottom: 1px solid var(--border);
}

.export-head strong {
  font-size: var(--type-size-subtitle);
  color: var(--sumi);
}

.export-body {
  padding: 24px;
}

.export-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.retell-permission-dialog {
  width: min(560px, calc(100vw - 32px));
  overflow: hidden;
}

.retell-permission-copy {
  display: grid;
  gap: 8px;
}

.retell-permission-copy p {
  margin: 0;
  color: var(--ink);
  font-size: var(--type-size-body);
  line-height: 1.8;
}

.retell-permission-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
}

.retell-permission-steps span {
  min-height: 66px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #F7FAF7;
  color: var(--ink-soft);
  font-size: var(--type-size-meta);
  font-weight: 650;
}

.retell-permission-steps b {
  color: var(--accent);
  font-family: var(--font-display);
  font-size: var(--type-size-subtitle);
}

/* 与网站视觉一致的危险操作确认层 */
.delete-confirm-modal {
  padding: 20px;
  background: rgba(36, 43, 42, 0.45);
  backdrop-filter: blur(3px);
}

.delete-confirm-dialog {
  width: min(520px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(32, 40, 45, 0.24);
}

.delete-confirm-head {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 34px;
  align-items: start;
  gap: 14px;
  padding: 26px 28px 20px;
}

.delete-confirm-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--danger-soft);
  color: var(--danger);
}

.delete-confirm-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.delete-confirm-head .module-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: var(--type-size-meta);
  font-weight: 800;
}

.delete-confirm-head strong {
  display: block;
  color: var(--sumi);
  font-size: var(--type-size-feature-title);
  font-weight: 700;
  line-height: 1.22;
}

.delete-confirm-close {
  width: 34px;
  height: 34px;
  align-self: start;
  color: var(--muted);
  font-size: var(--type-size-step-22);
}

.delete-confirm-body {
  padding: 0 28px 28px 94px;
}

.delete-confirm-body p {
  margin: 0;
  color: var(--muted);
  font-size: var(--type-size-body);
  line-height: 1.75;
}

.delete-confirm-target {
  margin-top: 18px;
  padding: 15px 18px;
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  background: #f7f8f5;
  color: var(--sumi);
  font-size: var(--type-size-body-large);
  font-weight: 650;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.delete-confirm-target.is-hidden {
  display: none;
}

.delete-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 28px;
  border-top: 1px solid var(--line);
  background: #fafbf9;
}

.delete-confirm-submit {
  min-height: 46px;
  padding: 10px 20px;
  border: 1px solid var(--danger);
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font: inherit;
  font-size: var(--type-size-control);
  font-weight: 700;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.delete-confirm-submit:hover {
  border-color: #ae3d39;
  background: #ae3d39;
}

.delete-confirm-submit:focus-visible {
  outline: 3px solid rgba(200, 72, 67, 0.18);
  outline-offset: 2px;
}

.delete-confirm-modal.is-neutral .delete-confirm-icon {
  background: var(--accent-soft);
  color: var(--accent);
}

.delete-confirm-modal.is-neutral .delete-confirm-submit {
  border-color: var(--accent);
  background: var(--accent);
}

.delete-confirm-modal.is-neutral .delete-confirm-submit:hover {
  border-color: #286f66;
  background: #286f66;
}

.delete-confirm-modal.is-neutral .delete-confirm-submit:focus-visible {
  outline-color: rgba(47, 128, 117, 0.18);
}

@media (max-width: 520px) {
  .delete-confirm-head {
    grid-template-columns: 40px minmax(0, 1fr) 32px;
    padding: 18px 16px 14px;
  }

  .delete-confirm-icon {
    width: 40px;
    height: 40px;
  }

  .delete-confirm-head strong {
    font-size: var(--type-size-section-title);
  }

  .delete-confirm-body {
    padding: 0 16px 18px;
  }

  .delete-confirm-actions {
    padding: 12px 16px;
  }
}

.mobile-main-menu-button { display: none; }

.vocab-edit-fields {
  display: grid;
  gap: 14px;
  padding: 22px 24px;
}

.vocab-edit-fields label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 700;
}

.vocab-edit-fields input,
.vocab-edit-fields textarea {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

@media (max-width: 720px) {
  .sidebar-brand .sidebar-toggle-button { display: none !important; }
  .app-sidebar .sidebar-footer { display: none !important; }
  .mobile-main-menu-button {
    width: 42px;
    height: 42px;
    display: grid;
    align-content: center;
    gap: 5px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
  }
  .mobile-main-menu-button span {
    width: 100%;
    height: 2px;
    display: block;
    border-radius: 999px;
    background: currentColor;
  }
  .vocab-edit-dialog { width: min(100%, 480px); }
  .vocab-edit-fields { padding: 18px 16px; }
}

/* icon-btn は btn-icon に統合されました */

/* 朗读控制：平时隐藏，仅在朗读中再次点击图标时出现 */
.tts-control-menu {
  position: fixed;
  z-index: 70;
  display: none;
  align-items: center;
  gap: 8px;
  min-width: 190px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(33, 37, 41, 0.16);
}

.tts-control-menu.active {
  display: flex;
}

.tts-control-menu > span {
  margin-right: auto;
  color: var(--ink-soft);
  font-size: var(--type-size-caption);
  font-weight: 650;
  white-space: nowrap;
}

/* 选中文本工具 */
.selection-tools {
  position: fixed;
  bottom: 80px;
  right: 24px;
  background: var(--shironeri);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  display: none;
  flex-direction: column;
  gap: 12px;
  max-width: 320px;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.selection-tools.active {
  display: flex;
}

.selection-text {
  font-size: var(--type-size-control);
  color: var(--sumi);
  font-weight: 500;
}

.selection-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.selection-result {
  font-size: var(--type-size-meta);
  color: var(--ainezumi);
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* 导入预览 */
.import-preview-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: var(--type-size-meta);
  color: var(--ainezumi);
  margin-bottom: 16px;
}

.import-preview-summary span {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
}

.import-preview-warning {
  flex-basis: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(168, 111, 47, 0.22);
  border-radius: 6px;
  background: rgba(168, 111, 47, 0.08);
  color: #8a5a24;
  font-size: var(--type-size-caption);
  font-weight: 650;
}

.clean-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.export-selects {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.export-select-field label {
  display: block;
  font-size: var(--type-size-meta);
  font-weight: 600;
  color: var(--sumi);
  margin-bottom: 8px;
}

.export-select-shell select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--shironeri);
  color: var(--sumi);
  font-size: var(--type-size-control);
}

.export-settings {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.export-settings label {
  display: flex;
  flex-direction: column;
  font-size: var(--type-size-caption);
  color: var(--ainezumi);
}

.export-settings input {
  margin-top: 4px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: var(--type-size-control);
}

.lookup-status {
  font-size: var(--type-size-meta);
  color: var(--ainezumi);
  line-height: 1.6;
}

.article-practice-empty {
  border: 1px solid var(--border);
  background: var(--shironeri);
  border-radius: 12px;
  padding: 40px 20px;
  margin-top: 16px;
  text-align: center;
}

.article-practice-empty p {
  margin: 0 0 14px;
  color: var(--ainezumi);
  font-size: var(--type-size-control);
  line-height: 1.6;
}

body.has-reading .article-practice-empty {
  display: none;
}

body:not(.has-reading) .article-practice-body {
  display: none;
}

.export-status {
  font-size: var(--type-size-meta);
  color: var(--ainezumi);
}
@media (max-width: 1024px) {
  .app-interface {
    display: block;
  }

  .app-interface .wrap {
    margin-left: 0;
  }

  .app-sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    padding: 12px 16px;
    transform: none;
    z-index: 101;
  }

  .sidebar-brand {
    padding: 0 0 12px;
    margin-bottom: 12px;
    border-bottom-color: rgba(255, 255, 255, 0.14);
  }

  .sidebar-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 0 4px;
    flex: none;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    margin-bottom: 0;
    padding: 10px 12px;
    white-space: nowrap;
  }

  .nav-item.active::before {
    display: none;
  }

  .app-main {
    margin-left: 0;
    padding: 24px;
  }

  .vocab-panel-slide,
  .menu-panel,
  .detail-drawer {
    width: 100%;
    right: -100%;
  }
}

@media (max-width: 640px) {
  .hero-intro {
    padding: 80px 16px 60px;
  }

  .hero-title {
    font-size: var(--type-size-feature-title);
  }

  .hero-actions {
    flex-direction: column;
  }

  .btn-primary-large,
  .btn-ghost-large {
    width: 100%;
  }

  .app-main {
    padding: 16px;
  }

  .app-interface .wrap {
    padding: 0;
  }

  body[data-view="grammar"] .grammar-section,
  body[data-view="typing"] .typing-section,
  body[data-view="retell"] .retell-section,
  body[data-view="discover"] .discover-section,
  body[data-view="test"] .test-section,
  body[data-view="history"] .history-section {
    margin: 18px 12px;
  }

  .main-content {
    padding: 0;
  }
}

/* 隐藏旧布局的特定元素，保留基础功能 */
.workspace-nav,
.top-row,
.app-header,
.onboarding-banner,
.app-header-simple {
  display: none !important;
}

/* ===== 练习页面样式 ===== */
.practice-switch {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
}

.workspace-tab {
  flex: 1;
  padding: 12px 24px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--ainezumi);
  font-size: var(--type-size-body);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -2px;
}

.workspace-tab:hover {
  color: var(--sumi);
  background: rgba(47, 111, 98, 0.06);
}

.workspace-tab.active {
  color: var(--shusha);
  border-bottom-color: var(--shusha);
  font-weight: 600;
}

.article-practice-empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--ainezumi);
}

.article-practice-empty p {
  margin-bottom: 24px;
  font-size: var(--type-size-body);
  line-height: 1.6;
}

.article-practice-body {
  display: none;
}

body.has-reading .article-practice-empty {
  display: none;
}

body.has-reading .article-practice-body {
  display: block;
}

.practice-hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 8px 0 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.practice-hero h2 {
  margin: 10px 0 6px;
  font-size: var(--type-size-feature-title);
  line-height: 1.25;
  letter-spacing: 0;
}

.practice-hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.practice-unlock-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: 360px;
}

.practice-start-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 0 18px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--line);
}

.practice-start-row button.is-selected {
  border-color: rgba(47, 111, 98, 0.22);
  background: var(--accent-soft);
  color: var(--accent);
}

.practice-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 0 4px;
}

.practice-summary-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfcfb;
}

.practice-summary-grid b {
  display: block;
  color: var(--sumi);
  font-size: var(--type-size-subtitle);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.practice-summary-grid span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: 650;
}

.practice-review-panel {
  margin: 14px 0 4px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbf8;
}

.practice-review-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.practice-review-head h3 {
  margin: 2px 0 0;
  font-size: var(--type-size-body-large);
  letter-spacing: 0;
}

.practice-review-head h2 {
  margin: 2px 0 0;
  font-size: var(--type-size-subtitle);
  letter-spacing: 0;
}

.practice-review-list {
  display: grid;
  gap: 10px;
}

.practice-review-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.practice-review-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.practice-review-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--type-size-micro);
  font-weight: 700;
}

.practice-review-item h4 {
  margin: 0;
  font-size: var(--type-size-emphasis);
  letter-spacing: 0;
}

.practice-review-item p,
.practice-review-item small {
  display: block;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: var(--type-size-caption);
  line-height: 1.55;
}

.practice-review-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.practice-review-actions button {
  white-space: nowrap;
}

.practice-review-empty {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: var(--type-size-meta);
  line-height: 1.7;
}

.unlock-pill,
.module-lock {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7f7f5;
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: 650;
  white-space: nowrap;
}

.unlock-pill.unlocked,
.module-lock.unlocked {
  border-color: rgba(47, 111, 98, 0.22);
  background: var(--accent-soft);
  color: var(--accent);
}

.practice-module {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.practice-module:not(.is-active) {
  display: none;
}

.practice-module:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.practice-module-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.practice-module-head h3 {
  margin: 2px 0 0;
  font-size: var(--type-size-subtitle);
  line-height: 1.35;
  letter-spacing: 0;
}

.module-kicker {
  display: block;
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: 700;
}

.practice-subgrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 16px;
}

.practice-mode-tabs {
  display: inline-flex;
  gap: 4px;
  margin-top: 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f7f5;
}

.practice-mode-tab {
  min-width: 88px;
  min-height: 34px;
  padding: 6px 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: 700;
  cursor: pointer;
}

.practice-mode-tab.active {
  background: #fff;
  color: var(--sumi);
  box-shadow: 0 1px 6px rgba(44, 52, 64, 0.08);
}

.article-practice-panel {
  display: none;
}

.article-practice-panel.active {
  display: block;
}

.practice-subpanel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfcfb;
}

.cloze-output {
  min-height: 140px;
  max-height: 360px;
  overflow: auto;
  margin-top: 12px;
  padding: 18px;
  font-size: var(--type-size-body);
  line-height: 2;
}

.reading-quiz-source {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 2px 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--sumi);
  font-size: var(--type-size-meta);
}

.reading-quiz-source:empty {
  display: none;
}

.reading-quiz-source span {
  font-weight: 650;
}

.reading-quiz-source small {
  color: var(--muted);
  font-size: var(--type-size-caption);
}

.reading-quiz-source button {
  min-height: 28px;
  margin-left: auto;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: var(--type-size-caption);
  font-weight: 650;
}

.reading-quiz-count {
  min-height: 24px;
  margin: 0 0 12px;
  color: var(--accent);
  font-size: var(--type-size-meta);
  font-weight: 750;
}

.reading-quiz-count:empty {
  display: none;
}

.reading-quiz-start {
  min-height: 260px;
  display: grid;
  place-items: center;
  gap: 16px;
  margin-top: 12px;
  padding: 34px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  text-align: center;
}

.reading-quiz-start p {
  margin: 0;
  color: var(--muted);
  font-size: var(--type-size-body);
}

.reading-quiz-start .btn-primary {
  min-width: 190px;
  min-height: 48px;
  background: var(--accent);
  border-color: var(--accent);
}

.reading-quiz-answer-actions.is-hidden,
.reading-quiz-start.is-hidden,
.cloze-output.is-hidden {
  display: none !important;
}

.reading-quiz-answer-actions {
  justify-content: center;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.vocab-practice-empty {
  margin-top: 14px;
  padding: 28px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfcfb;
  color: var(--muted);
}

.vocab-practice-empty p {
  margin: 0 0 16px;
}

.vocab-practice-body {
  margin-top: 14px;
}

.vocab-quiz-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfcfb;
  margin-bottom: 12px;
}

.vocab-quiz-word {
  font-family: 'Noto Serif JP', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  font-size: var(--type-size-step-34);
  line-height: 1.25;
  margin: 12px 0 8px;
}

.vocab-quiz-reading {
  color: var(--accent);
  font-weight: 650;
  min-height: 24px;
}

.vocab-quiz-meaning {
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.7;
}

.vocab-practice-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: var(--type-size-micro);
  font-weight: 650;
  vertical-align: middle;
}

.vocab-practice-tag.needs-work {
  background: rgba(200, 72, 67, 0.1);
  color: var(--trap);
}

.vocab-practice-tag.practiced {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ===== 上线前界面整理：更轻的主页和统一工作台 ===== */
:root {
  /* Kept for older selectors; values now come from Dokedo Design Tokens v1. */
}

body {
  background: var(--color-bg);
}

.wrap {
  min-height: 100vh;
}

.hero-intro {
  min-height: 100vh;
  max-width: 960px;
  padding: 20vh 24px 80px;
}

.hero-brand {
  margin-bottom: 28px;
}

.brand-mark-large {
  display: none;
}

.hero-title {
  font-family: var(--font-ui);
  font-size: var(--type-size-page-title);
  font-weight: 650;
  letter-spacing: 0;
  margin-bottom: 10px;
}

.hero-subtitle {
  font-size: var(--text-md);
  color: var(--color-text-soft);
}

.hero-input {
  max-width: 760px;
  margin: 0 auto 18px;
  padding: var(--space-4);
  background: var(--color-paper);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-popover);
}

.hero-input textarea {
  min-height: 116px;
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--type-size-emphasis);
  line-height: 1.7;
}

.hero-input textarea:focus {
  border-color: var(--color-primary);
}

.hero-actions {
  justify-content: flex-end;
  margin-top: 8px;
}

.btn--large {
  min-height: 42px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
}

.btn-primary.btn--large {
  background: var(--color-primary);
  color: #fff;
}

.btn-secondary.btn--large {
  background: var(--color-paper);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.hero-features {
  gap: 18px;
  margin-top: 14px;
  color: var(--color-text-soft);
}

.app-interface {
  min-height: 100vh;
  background: var(--color-bg);
}

.app-interface .wrap {
  margin-left: 0;
}

.app-sidebar {
  width: 188px;
  padding: 22px 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--sumi);
  border-right: 1px solid var(--line);
  box-shadow: none;
}

.sidebar-brand {
  padding: 0 8px 22px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.brand-mini {
  gap: 10px;
}

.global-search {
  position: relative;
  padding: 0 8px 14px;
}

.global-search-icon {
  position: absolute;
  left: 20px;
  top: 9px;
  z-index: 1;
  width: 19px;
  height: 19px;
  color: var(--ink-soft);
  pointer-events: none;
}

.global-search-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.global-search-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.global-search input {
  width: 100%;
  min-height: 36px;
  padding: 8px 11px 8px 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--sumi);
  font: inherit;
  font-size: var(--type-size-meta);
}

.global-search input:focus {
  outline: none;
  border-color: rgba(47, 111, 98, 0.35);
  box-shadow: 0 0 0 3px rgba(47, 111, 98, 0.08);
}

.global-search-results {
  display: none;
  position: absolute;
  left: 8px;
  right: 8px;
  top: 42px;
  z-index: 180;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(44, 52, 64, 0.12);
}

.global-search-results.active {
  display: grid;
}

.global-search-results button {
  display: block;
  width: 100%;
  min-height: 0;
  padding: 10px 11px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--sumi);
  text-align: left;
}

.global-search-results button:hover,
.global-search-results button:focus-visible {
  background: #f7f8f6;
  outline: none;
}

.global-search-results b,
.global-search-results small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-search-results b {
  font-size: var(--type-size-meta);
}

.global-search-results small,
.global-search-empty {
  color: var(--muted);
  font-size: var(--type-size-micro);
}

.global-search-empty {
  padding: 12px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sumi);
  color: #fff;
  font-size: var(--type-size-control);
}

.brand-text {
  font-size: var(--type-size-control);
  color: var(--sumi);
}

.sidebar-nav {
  padding: 0;
}

.nav-item {
  min-height: 38px;
  margin-bottom: 4px;
  padding: 9px 12px;
  color: var(--muted);
  border-radius: 10px;
  opacity: 1;
}

.nav-item:hover {
  color: var(--sumi);
  background: #f3f4f2;
}

.nav-item.active {
  color: var(--sumi);
  background: var(--accent-soft);
}

.nav-item.active::before {
  display: none;
}

.nav-badge,
.nav-item span {
  background: #eef0ee;
  color: var(--muted);
}

.app-content {
  margin-left: 188px;
  padding: 42px 48px 64px;
}

.reading-workbench {
  display: grid;
  grid-template-columns: minmax(0, 760px) minmax(280px, 340px);
  gap: 24px;
  align-items: start;
  max-width: 1140px;
  margin: 0 auto;
}

.daily-plan {
  grid-column: 1 / -1;
  padding: 0 0 22px;
  border-bottom: 1px solid var(--line);
}

.daily-plan-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.daily-plan-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.daily-goal-summary {
  max-width: 360px;
  overflow: hidden;
  color: var(--muted);
  font-size: var(--type-size-caption);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daily-goal-toggle {
  padding: 7px 10px;
  font-size: var(--type-size-caption);
}

.daily-plan-eyebrow {
  color: var(--shusha);
  font-size: var(--type-size-caption);
  font-weight: 700;
}

.daily-plan h2 {
  margin: 4px 0 0;
  font-size: var(--type-size-section-title);
  letter-spacing: 0;
}

.daily-plan-progress {
  min-width: 58px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: 700;
  text-align: center;
}

.daily-plan-progress.is-complete {
  border-color: #aac9ba;
  background: #eef7f2;
  color: #38664f;
}

.daily-goal-settings {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbf8;
}

.daily-goal-settings.is-hidden {
  display: none;
}

.daily-goal-settings label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: 700;
}

.daily-goal-settings input,
.daily-goal-settings select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--sumi);
  font: inherit;
  font-size: var(--type-size-meta);
  padding: 7px 9px;
}

.learning-path-guide {
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfcfb;
}

.learning-path-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.learning-path-head h3 {
  margin: 2px 0 0;
  font-size: var(--type-size-body-large);
  letter-spacing: 0;
}

.learning-path-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.learning-path-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 2px 8px;
  align-items: center;
  min-height: 66px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--sumi);
  text-align: left;
}

.learning-path-step span {
  grid-row: 1 / 3;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: 800;
}

.learning-path-step b,
.learning-path-step small {
  display: block;
  min-width: 0;
}

.learning-path-step b {
  overflow: hidden;
  font-size: var(--type-size-meta);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.learning-path-step small {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--type-size-micro);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.learning-path-step.is-current {
  border-color: rgba(47, 111, 98, 0.35);
  background: var(--accent-soft);
}

.learning-path-step.is-done span {
  border-color: #aac9ba;
  background: #eef7f2;
  color: #38664f;
}

.daily-task-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.daily-task {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 68px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--sumi);
  text-align: left;
  cursor: pointer;
}

.daily-task:hover {
  border-color: #aeb8b3;
  background: #fafbf9;
}

.daily-task-status {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: 700;
}

.daily-task-copy,
.daily-task-copy b,
.daily-task-copy small {
  display: block;
  min-width: 0;
}

.daily-task-copy b {
  font-size: var(--type-size-control);
}

.daily-task-copy small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: var(--type-size-micro);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daily-task-action {
  color: var(--shusha);
  font-size: var(--type-size-micro);
  font-weight: 700;
  white-space: nowrap;
}

.daily-task.is-done .daily-task-status {
  border-color: #aac9ba;
  background: #eef7f2;
  color: #38664f;
}

.daily-task.is-done .daily-task-action {
  color: #557565;
}

body:not([data-view="reading"]) .reading-workbench {
  display: none !important;
}

body[data-view="reading"] .vocab-section-page,
body[data-view="reading"] .grammar-section,
body[data-view="reading"] .typing-section,
body[data-view="reading"] .retell-section,
body[data-view="reading"] .discover-section,
body[data-view="reading"] .test-section,
body[data-view="reading"] .history-section,
body[data-view="reading"] .settings-section,
body[data-view="vocab"] .reading-workbench,
body[data-view="vocab"] .grammar-section,
body[data-view="vocab"] .typing-section,
body[data-view="vocab"] .retell-section,
body[data-view="vocab"] .discover-section,
body[data-view="vocab"] .test-section,
body[data-view="vocab"] .history-section,
body[data-view="vocab"] .settings-section,
body[data-view="grammar"] .vocab-section-page,
body[data-view="typing"] .vocab-section-page,
body[data-view="retell"] .vocab-section-page,
body[data-view="discover"] .vocab-section-page,
body[data-view="test"] .vocab-section-page,
body[data-view="history"] .vocab-section-page,
body[data-view="settings"] .vocab-section-page {
  display: none !important;
}

.reading-main {
  max-width: none;
  margin: 0;
}

.reading-main.card,
.vocab-section-page,
.grammar-section,
.typing-section,
.retell-section,
.discover-section,
.test-section,
.history-section,
.settings-section {
  border-color: var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 60px rgba(44, 52, 64, 0.04);
}

.reading-main .card-pad {
  padding: 22px;
}

.reading-side {
  gap: 14px !important;
}

.reading-side .card {
  margin-bottom: 0;
  border-color: var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: none;
}

.reading-side .card-pad {
  padding: 18px;
}

.card-head {
  margin-bottom: 12px;
  align-items: center;
  gap: 12px;
}

.card-title {
  font-size: var(--type-size-control);
}

.page-focus {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfcfb;
}

.page-focus.compact {
  margin-top: -4px;
}

.page-focus h2 {
  margin: 2px 0 5px;
  font-size: var(--type-size-section-title);
  line-height: 1.3;
  letter-spacing: 0;
}

.page-focus p {
  margin: 0;
  color: var(--muted);
  font-size: var(--type-size-meta);
  line-height: 1.65;
}

.page-focus .btn-primary,
.page-focus .btn-ghost {
  min-width: 118px;
}

.tag {
  background: #eef0ee;
  color: var(--muted);
  border-radius: 999px;
  padding: 2px 7px;
  margin-right: 7px;
}

.source-composer {
  margin-bottom: 16px;
}

.source-dropzone {
  padding: 0;
  background: transparent;
  border: 0;
}

.source-dropzone textarea {
  min-height: 132px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfcfb;
}

.source-actions {
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

button,
.btn-primary,
.btn-secondary,
.btn-icon {
  border-radius: 10px;
}

.btn-primary {
  background: var(--sumi);
}

.btn-secondary {
  background: #fff;
  border-color: var(--line);
}

.status-bar,
.legend-inline,
.import-disclosure,
.stats,
.reading-analysis-card,
.reading-hint {
  border-color: var(--line);
  border-radius: 12px;
  background: #fcfcfb;
}

.reading-analysis-card {
  margin: 12px 0;
  padding: 16px;
  border: 1px solid var(--line);
}

.reading-analysis-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.reading-analysis-head h3 {
  margin: 2px 0 0;
  font-size: var(--type-size-subtitle);
  letter-spacing: 0;
}

.reading-analysis-level {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--type-size-caption);
  font-weight: 750;
  white-space: nowrap;
}

.reading-analysis-level.easy {
  background: var(--n5-bg);
  color: var(--n5);
}

.reading-analysis-level.fit {
  background: var(--accent-soft);
  color: var(--accent);
}

.reading-analysis-level.hard {
  background: var(--trap-bg);
  color: var(--trap);
}

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

.reading-analysis-grid div {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.reading-analysis-grid b,
.reading-analysis-grid span {
  display: block;
}

.reading-analysis-grid b {
  color: var(--sumi);
  font-size: var(--type-size-subtitle);
  line-height: 1.2;
}

.reading-analysis-grid span {
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: 700;
}

.reading-analysis-card p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: var(--type-size-meta);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.reading-analysis-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.import-disclosure {
  margin: 12px 0;
  padding: 0 12px;
}

.import-disclosure summary {
  cursor: pointer;
  color: var(--muted);
}

.legend-inline {
  margin-bottom: 12px;
}

.reading-output {
  min-height: 360px;
  padding: 28px;
  border-color: var(--line);
  border-radius: 14px;
  background: #fff;
  font-size: var(--type-size-body-large);
  line-height: 2.15;
  box-shadow: inset 0 1px 0 rgba(44, 52, 64, 0.02);
}

.next-step-bar {
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfcfb;
}

.next-step-bar span {
  margin-right: auto;
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: 650;
}

.reading-insights {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfcfb;
}

.reading-insights > summary {
  min-height: 44px;
  padding: 12px 14px;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--type-size-meta);
  font-weight: 700;
  list-style: none;
}

.reading-insights > summary::-webkit-details-marker {
  display: none;
}

.reading-insights > summary::after {
  content: '+';
  float: right;
  color: var(--muted);
}

.reading-insights[open] > summary {
  border-bottom: 1px solid var(--line);
}

.reading-insights[open] > summary::after {
  content: '-';
}

.reading-insights .import-disclosure,
.reading-insights .legend-inline,
.reading-insights .stats,
.reading-insights .reading-analysis-card {
  margin: 12px;
}

body[data-view="grammar"] .grammar-section,
body[data-view="vocab"] .vocab-section-page,
body[data-view="typing"] .typing-section,
body[data-view="retell"] .retell-section,
body[data-view="discover"] .discover-section,
body[data-view="test"] .test-section,
body[data-view="history"] .history-section,
body[data-view="settings"] .settings-section {
  max-width: 920px;
  margin: 0 auto;
}

body[data-view="discover"] .discover-section {
  max-width: 1040px;
}

.vocab-page-actions,
.test-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.danger-action {
  color: var(--trap);
}

.progressive-panel,
.vocab-review-disclosure {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfcfb;
}

.progressive-panel {
  margin: -6px 0 16px;
}

.progressive-panel summary,
.vocab-review-disclosure summary {
  min-height: 44px;
  padding: 12px 14px;
  color: var(--sumi);
  cursor: pointer;
  font-size: var(--type-size-meta);
  font-weight: 750;
  list-style: none;
}

.progressive-panel summary::-webkit-details-marker,
.vocab-review-disclosure summary::-webkit-details-marker {
  display: none;
}

.progressive-panel summary::after,
.vocab-review-disclosure summary::after {
  content: '';
  float: right;
  width: 9px;
  height: 9px;
  margin-top: 4px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}

.progressive-panel[open] summary::after,
.vocab-review-disclosure[open] summary::after {
  content: '';
  transform: rotate(-135deg);
  margin-top: 8px;
}

.progressive-panel .vocab-page-actions {
  padding: 0 14px 14px;
}

.primary-task-panel {
  margin-top: 12px;
}

.vocab-page-summary.quiet-summary {
  grid-template-columns: repeat(2, minmax(0, 140px));
  gap: 8px;
  margin: -4px 0 12px;
}

.vocab-page-summary.quiet-summary > div {
  padding: 10px 12px;
  background: transparent;
}

.vocab-page-summary.quiet-summary b {
  font-size: var(--type-size-section-title);
}

.mini-disclosure {
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.mini-disclosure summary {
  min-height: 38px;
  padding: 10px 0 0;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--type-size-caption);
  font-weight: 750;
  list-style: none;
}

.mini-disclosure summary::-webkit-details-marker {
  display: none;
}

.mini-disclosure summary::after {
  content: '+';
  float: right;
}

.mini-disclosure[open] summary::after {
  content: '-';
}

.mini-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 2px;
}

.mini-action-row .btn-ghost {
  min-height: 32px;
  padding: 5px 10px;
  font-size: var(--type-size-caption);
}

.practice-secondary-panel {
  margin: 10px 0 0;
}

.practice-secondary-panel .practice-summary-grid {
  padding: 0 14px 14px;
}

.practice-secondary-panel .practice-review-panel {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0 0 12px 12px;
  background: #fff;
}

.source-directory-panel,
.history-progress-panel {
  margin-top: 18px;
}

.source-directory-panel .source-directory-head,
.source-directory-panel .discover-sources,
.history-progress-panel .weekly-progress {
  padding: 0 14px 14px;
}

.vocab-filter-bar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin: 0 0 24px;
}

.vocab-library-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--accent-soft);
}

.vocab-library-head h2 {
  margin: 0;
  color: var(--accent);
  font-size: var(--type-size-feature-title);
  line-height: 1.25;
  letter-spacing: 0;
}

.vocab-library-total,
.vocab-review-disclosure summary span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--type-size-caption);
  font-weight: 800;
  white-space: nowrap;
}

.vocab-review-disclosure summary span {
  margin-left: 8px;
  min-height: 22px;
  padding: 2px 8px;
  vertical-align: middle;
}

.vocab-search-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--sumi);
  font: inherit;
  font-size: var(--type-size-meta);
}

.vocab-search-input:focus {
  outline: none;
  border-color: var(--sumi);
}

.vocab-select-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
}

.vocab-select-shell {
  position: relative;
  min-width: 0;
}

.vocab-select-shell::after {
  position: absolute;
  right: 15px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  color: var(--muted);
  pointer-events: none;
  content: "";
  transform: translateY(-68%) rotate(45deg);
}

.vocab-select-filters select {
  width: 100%;
  min-height: 44px;
  padding: 10px 38px 10px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--sumi);
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: var(--type-size-body);
  font-weight: 650;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease, color .16s ease;
}

.vocab-select-shell:hover select,
.vocab-select-filters select:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}

.vocab-select-filters select:focus {
  box-shadow: 0 0 0 3px rgba(47, 111, 98, 0.10);
}

.vocab-select-shell-export select {
  border-color: #dce3de;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
}

.vocab-select-shell-export::after {
  color: var(--accent);
}

.vocab-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.vocab-category-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.vocab-filter-tab {
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: 700;
}

.vocab-category-tabs .vocab-filter-tab {
  min-height: 72px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 4px;
  border-radius: 8px;
  text-align: left;
}

.vocab-category-tabs .vocab-filter-tab b {
  color: var(--sumi);
  font-size: var(--type-size-step-22);
  line-height: 1;
}

.vocab-category-tabs .vocab-filter-tab span {
  color: inherit;
}

.vocab-filter-tab.active {
  border-color: rgba(47, 111, 98, 0.22);
  background: var(--accent-soft);
  color: var(--accent);
}

.vocab-page-list .vocab-list {
  max-height: 560px;
  overflow-y: auto;
  padding-right: 4px;
}

.vocab-list-header,
.vocab-page-list .vocab-table-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.15fr) minmax(220px, 1.8fr) minmax(128px, 1fr) minmax(130px, 1fr) 76px;
  column-gap: 14px;
}

.vocab-list-header {
  padding: 0 16px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: 800;
}

.vocab-list-header span:last-child {
  text-align: right;
}

.vocab-page-list .vocab-table-row {
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  border-radius: 8px;
  transition: background .16s ease;
}

.vocab-page-list .vocab-table-row:hover {
  background: #fafbf8;
}

.vocab-page-list .vocab-table-row:last-child {
  border-bottom: 0;
}

.vocab-cell {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.vocab-word-main {
  color: var(--accent);
  font-size: var(--type-size-lead);
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.vocab-level-chip {
  width: fit-content;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--type-size-micro);
  font-weight: 800;
}

.vocab-reading,
.vocab-source-title {
  color: var(--sumi);
  font-size: var(--type-size-meta);
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vocab-page-list .vocab-meaning,
.vocab-source-kind,
.vocab-cell-mastery small {
  color: var(--muted);
  font-size: var(--type-size-caption);
  line-height: 1.5;
}

.vocab-page-list .vocab-meaning {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.vocab-mastery {
  width: fit-content;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: var(--type-size-caption);
  font-weight: 800;
}

.vocab-mastery.mastered {
  background: rgba(47, 111, 98, 0.12);
  color: var(--accent);
}

.vocab-mastery.unsure,
.vocab-mastery.new {
  background: rgba(225, 186, 87, 0.18);
  color: #8b6a17;
}

.vocab-mastery.weak {
  background: rgba(200, 72, 67, 0.1);
  color: var(--trap);
}

.vocab-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  opacity: 0;
  transition: opacity .16s ease;
}

.vocab-table-row:hover .vocab-row-actions,
.vocab-row-actions:focus-within {
  opacity: 1;
}

.vocab-action-button {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(44, 52, 64, 0.06);
}

.vocab-action-button svg {
  width: 18px;
  height: 18px;
}

.vocab-action-button svg path:first-child {
  fill: currentColor;
  stroke: none;
}

.vocab-action-button svg path:last-child {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.vocab-review-primary {
  display: grid;
  gap: 14px;
}

.vocab-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.vocab-review-actions button b {
  font: inherit;
}

.history-practice-summary,
.history-practice-review {
  margin-top: 18px;
}

.history-practice-summary {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.history-practice-summary .practice-summary-grid {
  padding: 0;
}

.history-practice-review.practice-review-panel {
  background: #fff;
}

.vocab-page-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 180px));
  gap: 12px;
  margin-bottom: 20px;
}

.vocab-page-summary > div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfcfb;
}

.vocab-page-summary b {
  display: block;
  font-size: var(--type-size-feature-title-large);
  line-height: 1;
  margin-bottom: 6px;
}

.vocab-page-summary span,
.review-copy {
  color: var(--muted);
}

.vocab-page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 18px;
}

.vocab-review-disclosure {
  align-self: start;
}

.vocab-page-list,
.vocab-page-review {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.vocab-review-disclosure .vocab-page-review {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0 0 12px 12px;
}

.flash-page-placeholder {
  margin-top: 14px;
  padding: 18px;
  border-radius: 12px;
  background: #f7f8f6;
  color: var(--muted);
  font-size: var(--type-size-meta);
  line-height: 1.7;
}

.vocab-page-review .flash-stage {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fcfcfb;
  cursor: pointer;
}

.vocab-page-review .flash-word {
  font-size: var(--type-size-step-34);
  font-weight: 700;
  line-height: 1.35;
}

.vocab-page-review .flash-reading {
  margin-top: 10px;
  color: var(--muted);
  font-size: var(--type-size-subtitle);
}

.vocab-page-review .flash-meaning {
  margin-top: 12px;
  font-size: var(--type-size-emphasis);
}

.vocab-page-review .flash-tap-hint,
.vocab-page-review .flash-empty {
  color: var(--muted);
}

.vocab-page-review .rate-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.vocab-page-review .rate-btn {
  min-height: 42px;
}

.discover-section .card-pad {
  padding: 28px;
}

.resource-library-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 24px;
  align-items: end;
  padding: 24px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  background: linear-gradient(135deg, #fff 0%, #f7faf8 100%);
}

.resource-library-hero h2 {
  margin: 5px 0 0;
  color: var(--sumi);
  font-size: var(--type-size-feature-title);
  line-height: 1.3;
  letter-spacing: 0;
}

.resource-library-hero p {
  max-width: 620px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: var(--type-size-control);
  line-height: 1.75;
}

.resource-library-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.resource-library-stats div {
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
}

.resource-library-stats b {
  color: var(--sumi);
  font-size: var(--type-size-feature-title);
  line-height: 1;
}

.resource-library-stats span {
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: 700;
}

.reading-library-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 18px;
}

.library-panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.reading-queue-section {
  padding: 20px;
  margin-bottom: 0;
  border-bottom: 0;
}

.reading-queue-head,
.source-directory-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.reading-queue-head h2,
.source-directory-head h2 {
  margin: 0;
  font-size: var(--type-size-subtitle);
  letter-spacing: 0;
}

.reading-queue-head p,
.source-directory-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: var(--type-size-meta);
}

.reading-queue-count {
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef0ee;
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: 700;
  white-space: nowrap;
}

.reading-queue-form {
  display: grid;
  grid-template-columns: minmax(160px, 240px) minmax(260px, 1fr) auto;
  gap: 8px;
  margin-top: 16px;
}

.reading-queue-form input {
  min-width: 0;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--sumi);
  font: inherit;
  font-size: var(--type-size-meta);
}

.reading-queue-form input:focus {
  border-color: var(--shusha);
  outline: 2px solid rgba(196, 72, 65, 0.1);
}

.reading-queue-status {
  min-height: 20px;
  margin-top: 7px;
  color: var(--muted);
  font-size: var(--type-size-caption);
}

.reading-queue-status.ok {
  color: #38664f;
}

.reading-queue-status.error {
  color: var(--trap);
}

.reading-queue-list {
  max-height: 420px;
  margin-top: 6px;
  overflow-y: auto;
}

.reading-queue-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.reading-queue-item.is-read {
  opacity: 0.68;
}

.reading-queue-state {
  min-width: 42px;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #38664f;
  font-size: var(--type-size-micro);
  font-weight: 700;
  text-align: center;
}

.reading-queue-item.is-read .reading-queue-state {
  background: #eef0ee;
  color: var(--muted);
}

.reading-queue-copy {
  min-width: 0;
}

.reading-queue-copy h3 {
  margin: 0;
  overflow: hidden;
  font-size: var(--type-size-control);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reading-queue-copy p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: var(--type-size-micro);
  overflow-wrap: anywhere;
}

.reading-queue-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.reading-queue-actions .btn-primary,
.reading-queue-actions .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 9px;
  font-size: var(--type-size-micro);
  text-decoration: none;
}

.reading-queue-remove {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.reading-queue-remove svg {
  width: 18px;
  height: 18px;
}

.reading-queue-remove:hover,
.history-remove:hover {
  background: #f7eceb;
  color: var(--trap);
}

.history-remove {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.history-remove svg {
  width: 18px;
  height: 18px;
}

.reading-queue-empty {
  padding: 18px 0 4px;
  color: var(--muted);
  font-size: var(--type-size-meta);
}

.source-directory-head {
  align-items: flex-start;
  flex-direction: column;
  gap: 0;
  margin-bottom: 10px;
}

body[data-view="discover"] .discover-section {
  max-width: min(1480px, calc(100vw - var(--sidebar-width) - 80px)) !important;
  border: 0;
  background: transparent;
  box-shadow: none !important;
}

body[data-view="discover"] .discover-section > .card-pad {
  padding: 0;
}

body[data-view="discover"] .source-directory-panel {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.discover-sources {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.source-level-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 22px;
}

.source-level-tabs button {
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid rgba(47, 111, 98, 0.18);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: var(--type-size-control);
  font-weight: 700;
  cursor: pointer;
}

.source-level-tabs button:hover,
.source-level-tabs button.active {
  border-color: rgba(47, 111, 98, 0.26);
  background: var(--accent-soft);
  color: var(--accent);
}

.source-directory-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  gap: 12px 20px;
  min-height: 178px;
  align-items: start;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 22px rgba(32, 40, 45, 0.12);
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.source-directory-item:hover {
  border-color: rgba(47, 111, 98, 0.34);
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(32, 40, 45, 0.08);
}

.source-directory-item.recommended {
  border-color: rgba(47, 111, 98, 0.45);
  background: #fff;
}

.source-directory-icon,
.source-open-btn {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  background: #f4f7f5;
  color: var(--accent);
  cursor: pointer;
}

.source-directory-icon svg,
.source-open-btn svg,
.source-external-action svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.source-directory-copy {
  min-width: 0;
  grid-column: 2;
  grid-row: 1 / span 2;
  overflow-wrap: normal;
  word-break: normal;
}

.source-directory-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.source-directory-title-row > span {
  display: inline-flex;
  flex: 0 0 auto;
  width: max-content;
  padding: 5px 10px;
  border-radius: 12px;
  background: rgba(47, 111, 98, 0.08);
  color: var(--accent);
  font-size: var(--type-size-meta);
  font-weight: 650;
}

.source-directory-item h3 {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: var(--type-size-section-title-large);
  line-height: 1.35;
  letter-spacing: 0;
  word-break: normal;
  overflow-wrap: normal;
}

.source-directory-item p {
  margin: 14px 0 0;
  color: var(--accent);
  opacity: 0.78;
  font-size: var(--type-size-body);
  line-height: 1.7;
}

.source-directory-item .btnrow {
  grid-column: 2;
  grid-row: 3;
  align-self: end;
  justify-self: start;
  display: flex;
  gap: 8px;
  margin: 18px 0 0;
  justify-content: flex-start;
}

.source-directory-item .btnrow button {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: var(--type-size-meta);
  font-weight: 800;
}

.source-directory-item .btnrow .btn-primary {
  background: rgba(47, 111, 98, 0.08);
  color: var(--accent);
  box-shadow: none;
}

.source-directory-item .btnrow .btn-ghost {
  background: #f4f7f5;
  color: var(--accent);
}

.source-external-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.source-external-action svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.2;
}

.source-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.source-traits span {
  display: inline-flex;
  min-width: 58px;
  justify-content: center;
  padding: 3px 7px;
  border-radius: 7px;
  background: rgba(47, 111, 98, 0.08);
  color: var(--accent);
  font-size: var(--type-size-step-11-5);
  font-weight: 700;
}

.source-recommendation-panel {
  margin-top: 22px;
  padding-top: 0;
  border-top: 1px solid var(--line);
}

.source-recommendation-head {
  margin-bottom: 10px;
}

.source-recommendation-head h2 {
  margin-bottom: 4px;
}

.source-recommendation-head p {
  max-width: none;
  font-size: var(--type-size-meta);
  line-height: 1.45;
}

.source-recommendation-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.source-recommendation-card {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 38px;
  gap: 10px;
  align-items: start;
  min-height: 132px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.source-recommendation-index {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--type-size-meta);
  font-weight: 800;
}

.source-recommendation-card h3 {
  margin: 0 0 6px;
  color: var(--sumi);
  font-size: var(--type-size-body);
  line-height: 1.35;
}

.source-recommendation-card p {
  margin: 0;
  color: var(--muted);
  font-size: var(--type-size-meta);
  line-height: 1.6;
}

.source-recommendation-card div > span {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  font-size: var(--type-size-caption);
  font-weight: 750;
}

.source-open-btn {
  width: 38px;
  height: 38px;
}

@media (max-width: 760px) {
  .resource-library-hero,
  .reading-library-grid {
    grid-template-columns: 1fr;
  }

  .discover-sources,
  .source-recommendation-list {
    grid-template-columns: 1fr;
  }

  .resource-library-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .vocab-page-layout {
    grid-template-columns: 1fr;
  }

  .vocab-page-summary,
  .practice-summary-grid,
  .reading-analysis-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reading-analysis-head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .practice-review-head,
  .practice-review-item {
    display: grid;
    grid-template-columns: 1fr;
  }

  .practice-review-actions {
    justify-content: flex-start;
  }

  .source-directory-item {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 12px;
    min-height: 0;
  }

  .source-directory-item .btnrow {
    justify-content: flex-start;
  }
}

@media (max-width: 1180px) {
  .reading-workbench {
    grid-template-columns: minmax(0, 1fr);
    max-width: 820px;
  }

  .reading-side {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 1024px) {
  .app-content {
    margin-left: 0;
    padding: 24px 18px 48px;
  }

  .app-sidebar {
    width: 100%;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  .history-dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body {
    font-size: var(--type-size-control);
  }

  .hero-intro {
    padding: 14vh 16px 48px;
  }

  .hero-title {
    font-size: var(--type-size-feature-title);
  }

  .hero-input {
    padding: 12px;
    border-radius: 20px;
  }

  .hero-actions {
    justify-content: stretch;
  }

  .hero-features {
    display: grid;
    gap: 8px;
    text-align: left;
  }

  .app-sidebar {
    position: sticky;
    top: 0;
    z-index: 120;
    padding: 8px 10px 10px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
  }

  .sidebar-brand {
    display: none;
  }

  .global-search {
    padding: 0 0 8px;
  }

  .global-search input {
    min-height: 38px;
  }

  .global-search-results {
    left: 0;
    right: 0;
    top: 42px;
  }

  .sidebar-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 0 0 2px;
    scrollbar-width: none;
  }

  .sidebar-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 8px 11px;
    margin: 0;
    border-radius: 999px;
    font-size: var(--type-size-meta);
    white-space: nowrap;
  }

  .nav-item[data-view="reading"]::after,
  .nav-item[data-view="vocab"]::after,
  .nav-item[data-view="retell"]::after {
    display: none;
  }

  .nav-badge {
    min-width: 18px;
    padding: 1px 5px;
    margin-left: 6px;
  }

  .app-content {
    margin-left: 0;
    padding: 14px 12px 40px;
  }

  .reading-side {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .reading-workbench {
    max-width: none;
    gap: 12px;
  }

  .daily-plan {
    padding-bottom: 16px;
  }

  .daily-plan-head,
  .daily-plan-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .daily-plan-actions {
    width: 100%;
    gap: 8px;
  }

  .daily-goal-summary {
    max-width: 100%;
    text-align: left;
    white-space: normal;
  }

  .daily-goal-settings {
    grid-template-columns: 1fr 1fr;
  }

  .daily-goal-toggle,
  .daily-plan-progress {
    width: 100%;
  }

  .daily-goal-settings button {
    grid-column: 1 / -1;
  }

  .learning-path-head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .learning-path-head .btn-primary {
    width: 100%;
  }

  .learning-path-steps {
    grid-template-columns: 1fr 1fr;
  }

  .daily-plan h2 {
    font-size: var(--type-size-subtitle);
  }

  .daily-task-list {
    grid-template-columns: 1fr;
  }

  .daily-task {
    min-height: 62px;
  }

  .reading-main .card-pad,
  .card-pad {
    padding: 16px;
  }

  .reading-output {
    padding: 20px;
    font-size: var(--type-size-emphasis);
    min-height: 280px;
    overflow-wrap: anywhere;
  }

  .reading-main.card,
  .vocab-section-page,
  .grammar-section,
  .retell-section,
  .discover-section,
  .test-section,
  .history-section {
    border-radius: 12px;
    margin: 0 auto;
  }

  .practice-hero {
    padding-bottom: 16px;
    margin-bottom: 14px;
  }

  .practice-hero h2 {
    font-size: var(--type-size-section-title-large);
  }

  .practice-unlock-strip {
    justify-content: flex-start;
    max-width: none;
  }

  .unlock-pill,
  .module-lock {
    white-space: normal;
  }

  .practice-start-row,
  .btnrow,
  .review-actions,
  .vocab-page-actions,
  .test-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .practice-start-row button,
  .btnrow button,
  .review-actions button,
  .reading-analysis-actions button,
  .vocab-page-actions button,
  .test-actions button {
    width: 100%;
    min-height: 40px;
  }

  .vocab-filter-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .vocab-filter-tab {
    width: 100%;
  }

  .practice-summary-grid {
    gap: 8px;
  }

  .practice-summary-grid div,
  .vocab-page-summary > div {
    padding: 11px;
  }

  .history-section .card-head,
  .history-subhead {
    align-items: stretch;
    flex-direction: column;
  }

  .page-focus {
    grid-template-columns: 1fr;
  }

  .page-focus .btn-primary,
  .page-focus .btn-ghost {
    width: 100%;
  }

  .history-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .history-toolbar .btn-ghost,
  .history-subhead > .btn-ghost {
    width: 100%;
    min-height: 38px;
  }

  .weekly-progress-summary {
    grid-template-columns: 1fr 1fr;
  }

  .weekly-practice-chart {
    gap: 5px;
  }

  .practice-summary-grid b {
    font-size: var(--type-size-emphasis);
  }

  .practice-module {
    padding: 18px 0;
  }

  .practice-subpanel,
  .vocab-quiz-card,
  .vocab-page-list,
  .vocab-page-review,
  .source-directory-item {
    padding: 14px;
    border-radius: 12px;
  }

  .practice-mode-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .practice-mode-tab {
    min-width: 0;
  }

  .cloze-output {
    max-height: 280px;
    padding: 14px;
    font-size: var(--type-size-control);
  }

  .typing-prompt,
  .typing-result {
    padding: 14px;
  }

  .typing-input {
    min-height: 104px;
    padding: 13px;
  }

  .typing-list {
    max-height: 260px;
  }

  .vocab-quiz-word,
  .vocab-page-review .flash-word {
    font-size: var(--type-size-page-title);
  }

  .vocab-page-review .rate-row {
    grid-template-columns: 1fr;
  }

  .reading-queue-head {
    align-items: flex-start;
  }

  .reading-queue-form {
    grid-template-columns: 1fr;
  }

  .reading-queue-form .btn-primary {
    min-height: 42px;
    width: 100%;
  }

  .reading-queue-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .reading-queue-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .reading-queue-actions .btn-primary,
  .reading-queue-actions .btn-ghost {
    min-width: 0;
    white-space: nowrap;
    width: 100%;
  }

  .reading-queue-remove {
    width: 100%;
    border-radius: 8px;
    background: #fafbf9;
  }

  .discover-section .card-pad {
    padding: 16px;
  }

  .source-directory-item .btnrow {
    justify-content: stretch;
  }
}

@media (max-width: 520px) {
  body.first-visit .hero-secondary-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body.first-visit .hero-secondary-actions > * {
    width: 100%;
    min-width: 0;
  }

  body[data-view="reading"] .reader-toolbar {
    display: flex;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }

  body[data-view="reading"] .reader-toolbar::-webkit-scrollbar { display: none; }
  body[data-view="reading"] .reader-tool-group { flex: 0 0 auto; }
}

@media (max-width: 420px) {
  .vocab-page-summary,
  .practice-summary-grid,
  .reading-analysis-grid {
    grid-template-columns: 1fr;
  }

  .hero-title {
    font-size: var(--type-size-step-22);
  }

  .daily-goal-settings,
  .history-toolbar,
  .vocab-filter-tabs,
  .learning-path-steps {
    grid-template-columns: 1fr;
  }

  .reading-output {
    padding: 16px;
    font-size: var(--type-size-body);
  }
}

/* 任务优先：阅读页只展示当前阶段真正可执行的内容 */
.app-interface .reading-main {
  width: 100%;
  max-width: none;
  margin: 0;
}

body:not(.has-reading) .reading-workbench {
  grid-template-columns: minmax(0, 820px);
  max-width: 820px;
}

body:not(.has-reading) .daily-plan,
body:not(.has-reading) .reading-side,
body:not(.has-reading) #statusBar,
body:not(.has-reading) #readerToolbar,
body:not(.has-reading) #legendInline,
body:not(.has-reading) #statsBar,
body:not(.has-reading) #readingAnalysisCard,
body:not(.has-reading) #readingHint,
body:not(.has-reading) #nextStepBar,
body:not(.has-reading) #output,
body:not(.has-reading) .reading-insights {
  display: none !important;
}

body.has-reading .source-composer:not(.is-open) {
  display: none;
}

body.is-editing-source .daily-plan {
  display: none;
}

.daily-plan,
.next-step-bar {
  display: none !important;
}

body.is-editing-source .source-composer {
  display: block;
}

.daily-plan {
  padding: 0 0 16px;
}

.daily-plan-head {
  align-items: center;
  margin-bottom: 8px;
}

.daily-goal-summary {
  max-width: 620px;
  margin-top: 6px;
  text-align: left;
  white-space: normal;
}

.daily-plan-actions .btn-primary {
  min-height: 42px;
  white-space: nowrap;
}

.learning-path-disclosure {
  margin-top: 6px;
}

.learning-path-disclosure > summary {
  width: fit-content;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--type-size-caption);
  font-weight: 650;
}

.learning-path-disclosure[open] > summary {
  margin-bottom: 10px;
}

.learning-path-guide {
  margin: 0;
}

.source-actions .btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.source-actions .btn-ghost:hover {
  border-color: var(--line);
  background: #fff;
  color: var(--sumi);
}

.nav-more.active {
  color: var(--sumi);
  background: var(--accent-soft);
}

.nav-item[data-view="reading"]::after,
.nav-item[data-view="vocab"]::after,
.nav-item[data-view="retell"]::after {
  display: none;
}

.menu-panel {
  z-index: 230;
  background: var(--surface);
}

body.menu-open::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 220;
  background: rgba(32, 36, 34, 0.24);
}

body.menu-open {
  overflow: hidden;
}

.hero-actions {
  align-items: center;
}

.hero-secondary-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.hero-text-action {
  min-height: 42px;
  color: var(--muted);
}

.hero-text-action:hover {
  color: var(--sumi);
  background: #f3f4f2;
}

@media (max-width: 1024px) {
  .menu-panel {
    width: min(88vw, 340px);
  }
}

@media (max-width: 720px) {
  .global-search {
    display: none;
  }

  .sidebar-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: visible;
  }

  .nav-item {
    justify-content: center;
    min-height: 44px;
    padding: 9px 8px;
  }

  .daily-plan-head,
  .daily-plan-actions {
    width: 100%;
  }

  .daily-plan-actions {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: center;
  }

  .daily-plan-progress,
  .daily-plan-actions .btn-primary {
    width: 100%;
    min-height: 44px;
  }

  .learning-path-steps {
    grid-template-columns: 1fr;
  }

  .source-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .source-actions .btn-primary {
    grid-column: 1 / -1;
    min-height: 46px;
  }

  .source-actions .btn-ghost {
    min-height: 44px;
  }

  .menu-panel {
    width: min(88vw, 340px);
  }

  .hero-actions,
  .hero-secondary-actions {
    width: 100%;
  }

  .hero-actions {
    display: grid;
  }

  .hero-actions .btn-primary-large {
    width: 100%;
  }

  .hero-secondary-actions {
    justify-content: center;
    flex-wrap: wrap;
  }
}

/* SaaS 工作台骨架：稳定阅读工作区 */
.app-content {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  gap: 24px;
  padding-top: 24px;
}

.nav-resources.active {
  color: var(--sumi);
  background: var(--accent-soft);
}

.resource-hub-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfcfb;
}

.resource-hub-tabs button {
  min-height: 34px;
  padding: 7px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: var(--type-size-meta);
  font-weight: 750;
  cursor: pointer;
}

.resource-hub-tabs button:hover,
.resource-hub-tabs button.active {
  background: var(--accent-soft);
  color: var(--sumi);
}

body[data-view="reading"] .reading-workbench {
  grid-template-columns: minmax(0, 820px) minmax(240px, 280px);
  max-width: 1180px;
  width: 100%;
}

body.has-reading .reading-side {
  position: sticky;
  top: 32px;
}

body.has-reading .reading-side .detail-panel {
  min-height: 260px;
}

.reading-main.card {
  overflow: hidden;
}

.reader-toolbar {
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  margin-bottom: var(--space-3);
  padding: 6px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.reader-tool-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.reader-tool-group-end {
  margin-left: auto;
}

.reader-tool-divider {
  width: 1px;
  height: 22px;
  margin: 0 2px;
  background: var(--line);
}

.reader-tool,
.reader-tool-details > summary {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0 !important;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: var(--type-size-body-large);
  font-weight: 750;
  line-height: 1;
  cursor: pointer;
  position: relative;
}

.reader-speech-tool svg {
  width: 21px;
  height: 21px;
  overflow: visible;
}

.reader-speech-tool svg path:first-child {
  fill: currentColor;
  stroke: none;
}

.reader-speech-tool svg path:last-child {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.reader-speech-tool.tts-bounce-source.is-speaking {
  background: var(--accent-soft);
  color: var(--accent);
  animation: speakingBounce 0.7s ease-in-out infinite alternate;
}

.download-tool svg,
.refresh-tool svg,
.trash-tool svg {
  width: 21px;
  height: 21px;
}

.download-tool svg path,
.refresh-tool svg path,
.trash-tool svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reader-speech-tool.is-paused {
  background: rgba(225, 186, 87, 0.16);
  color: #8b6a17;
}

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

.reader-tool-details > summary {
  width: auto;
  min-width: 54px;
  padding: 0 12px !important;
  font-size: var(--type-size-meta);
}

.reader-font-details > summary {
  width: 34px;
  min-width: 34px;
  padding: 0 !important;
}

.reader-font-details {
  position: relative;
}

.reader-font-popover {
  width: 320px;
  padding: 24px;
  border: 1px solid #E0E0E0;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  overflow: visible;
  z-index: 120;
}

.font-size-grid {
  display: grid;
  gap: 0;
}

.font-size-row {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.font-size-row:last-child {
  margin-bottom: 0;
}

.font-size-row-label {
  display: block;
  color: #666666;
  font-size: var(--type-size-meta);
  font-weight: 700;
}

.font-size-row-label span {
  color: var(--accent);
}

.font-size-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px;
  border-radius: 8px;
  background: #F5F5F5;
}

.font-size-stepper-btn {
  width: 60px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #E0E0E0;
  border-radius: 6px !important;
  background: #FFFFFF;
  color: #333333;
  font: inherit;
  font-size: var(--type-size-emphasis);
  font-weight: 700;
  cursor: pointer;
  transition: all .2s ease;
}

.font-size-stepper-btn:hover {
  border-color: #7A9A5B;
  color: #7A9A5B;
}

.font-size-stepper-btn:active {
  background: #E9EED9;
}

.font-size-stepper-value {
  width: 50px;
  color: #333333;
  font-size: var(--type-size-emphasis);
  font-weight: 700;
  text-align: center;
}

.font-size-options {
  position: static;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  width: 100%;
  max-height: 116px;
  overflow-y: auto;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: none;
  overscroll-behavior: contain;
}

.font-size-options::-webkit-scrollbar {
  width: 6px;
}

.font-size-options::-webkit-scrollbar-thumb {
  background: rgba(96, 108, 105, 0.32);
  border-radius: 999px;
}

.font-size-options button {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: var(--type-size-meta);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.font-size-options button:last-child {
  border-bottom: 0;
}

.font-size-options button.is-selected::after {
  content: "✓";
  color: var(--accent);
}

.font-size-options button:hover,
.font-size-options button.is-selected {
  background: var(--accent-soft);
  color: var(--accent);
}

.vocab-page-head {
  align-items: center;
}

.vocab-tool-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
}

.vocab-tool-row .reader-tool {
  color: var(--ink-soft);
}

.vocab-tool-row .reader-tool-stat {
  width: auto;
  min-width: 84px;
  grid-auto-flow: column;
  gap: 7px;
  padding: 0 10px !important;
  font-size: var(--type-size-caption);
  font-weight: 650;
  white-space: nowrap;
}

.reader-tool-stat b {
  color: var(--ink);
  font-size: var(--type-size-meta);
  font-variant-numeric: tabular-nums;
}

.reader-tool-stat:hover b {
  color: var(--accent);
}

.vocab-tool-row .danger-tool:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.vocab-review-primary {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
  border: 1px solid var(--line);
  background: var(--paper);
}

.flash-card-host > .flash-empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  padding: var(--space-5);
  border: 1px solid var(--line);
  background: #f7f8f6;
  color: var(--ink-soft);
  text-align: center;
}

.vocab-review-primary .vocab-page-summary.quiet-summary {
  margin: 0;
}

.vocab-review-primary .review-actions {
  margin: 0;
}

.vocab-review-primary #startReviewBtn {
  justify-self: start;
}

.reading-output {
  font-size: var(--reading-base-font) !important;
}

.reading-output rt {
  font-size: 0 !important;
  line-height: 0;
  visibility: hidden;
  opacity: 0;
  transform: translateY(calc(var(--reading-ruby-gap, 0.16em) * -1));
}

body.reading-ruby-visible .reading-output rt {
  font-size: var(--reading-ruby-font) !important;
  line-height: normal;
  visibility: visible;
  opacity: 1;
}

.paragraph-translation {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: rgba(47, 111, 98, 0.065);
  color: var(--ink);
  font-family: var(--font-reading);
  font-size: calc(var(--reading-base-font) * 0.88);
  line-height: 1.9;
}

.reading-translation-pair {
  display: block;
  margin: 0 0 28px;
}

.reading-translation-pair:last-child {
  margin-bottom: 0;
}

.reading-japanese {
  display: block;
}

.selected-detail-text {
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-reading);
  line-height: 1.8;
}

.detail-panel .card-head {
  margin-bottom: var(--space-4);
}

.detail-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.detail-head-actions {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.detail-head-actions:empty {
  display: none;
}

.detail-head-actions .detail-icon-actions {
  padding-top: 0;
}

.detail-panel .tag,
.level-badge {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
}

.detail-box {
  display: grid;
  gap: 11px;
}

.detail-word-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-word-header .detail-icon-actions {
  padding: 0;
}

.detail-word {
  color: var(--ink);
  font-size: var(--type-size-step-31);
  font-weight: 650;
  line-height: 1.1;
}

.detail-reading,
.detail-empty {
  color: var(--ink-soft);
  font-size: var(--type-size-step-13-5);
  line-height: 1.7;
}

.detail-reading-control {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-reading-text {
  color: var(--ink-soft);
  font-family: var(--font-reading);
  font-size: var(--type-size-body);
  line-height: 1.5;
}

.detail-reading-edit,
.detail-reading-action {
  width: 32px;
  height: 32px;
  min-width: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.detail-reading-edit {
  opacity: 0.38;
}

.detail-reading-control:hover .detail-reading-edit,
.detail-reading-edit:focus-visible {
  color: var(--accent);
  opacity: 1;
}

.detail-reading-edit:hover,
.detail-reading-action:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.detail-reading-edit svg,
.detail-reading-action svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.detail-reading-control.is-editing {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px 34px;
  gap: 6px;
}

.detail-reading-control input {
  min-width: 0;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.detail-reading-control input:focus {
  border-color: rgba(47, 111, 98, 0.42);
  outline: 3px solid rgba(47, 111, 98, 0.12);
}

.detail-reading-control.is-editing .detail-reading-action {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border: 1px solid var(--line);
  background: #FFFFFF;
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.detail-inflection {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: var(--type-size-meta);
  line-height: 1.5;
}

.detail-inflection span {
  display: inline-flex;
  align-items: baseline;
  min-height: 26px;
  gap: 7px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(230, 241, 237, 0.62);
}

.detail-inflection b {
  min-width: 0;
  color: var(--accent);
  font-size: var(--type-size-micro);
}

.detail-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #F5F6F5;
  color: var(--ink-soft);
  font-size: var(--type-size-micro);
  font-weight: 650;
  line-height: 1;
}

.detail-badge-level {
  border-color: rgba(47, 111, 98, 0.18);
  background: var(--accent-soft);
  color: var(--accent);
}

.detail-definition {
  display: grid;
  gap: 6px;
  margin-top: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.detail-definition > span {
  color: var(--muted);
  font-size: var(--type-size-micro);
  font-weight: 700;
}

.detail-meaning {
  color: var(--ink);
  font-size: var(--type-size-body);
  line-height: 1.75;
}

.level-badge {
  width: 100%;
  padding: 7px 10px;
  font-size: var(--type-size-meta);
  font-weight: 750;
}

.ruby-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.detail-icon-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: var(--space-1);
}

.detail-icon-button {
  border: 1px solid var(--line);
  background: var(--paper);
}

.detail-icon-button svg {
  width: 21px;
  height: 21px;
}

.add-vocab-tool svg path,
.save-ruby-tool svg path,
.hide-ruby-tool svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ruby-editor-actions .reader-tool {
  border: 1px solid var(--line);
  background: var(--paper);
}

.ruby-editor-actions .reader-tool svg {
  width: 20px;
  height: 20px;
}

.ruby-editor {
  display: grid;
  gap: var(--space-2);
  padding: 12px;
  border: 1px solid rgba(47, 111, 98, 0.14);
  border-radius: 7px;
  background: rgba(47, 111, 98, 0.04);
}

.ruby-editor label {
  display: grid;
  gap: 5px;
  color: var(--ink-soft);
  font-size: var(--type-size-meta);
  font-weight: 650;
}

.ruby-editor input {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-reading);
  font-size: var(--type-size-body);
  line-height: 1.4;
  box-shadow: none;
}

.ruby-editor input:focus {
  outline: 2px solid rgba(47, 111, 98, 0.16);
  outline-offset: 1px;
  border-color: rgba(47, 111, 98, 0.5);
}

.ruby-editor-actions .reader-tool {
  width: 36px;
  height: 36px;
  min-height: 36px;
}

.reader-tool:hover,
.reader-tool.is-active,
.reader-tool-toggle:has(input:checked),
.reader-tool-details[open] > summary {
  background: var(--accent-soft);
  color: var(--accent);
}

.reader-tool[data-tooltip]::after,
.reader-tool-toggle[data-tooltip]::after,
.reader-tool-details > summary[data-tooltip]::after {
  display: none;
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  z-index: 60;
  transform: translateX(-50%);
  padding: 5px 8px;
  border-radius: var(--radius-small);
  background: var(--ink);
  color: var(--paper);
  font-size: var(--type-size-caption);
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.06s ease;
}

.reader-tool[data-tooltip]:hover::after,
.reader-tool-toggle[data-tooltip]:hover::after,
.reader-tool-details > summary[data-tooltip]:hover::after {
  opacity: 0;
}

.icon-button-hint {
  position: fixed;
  z-index: 10000;
  max-width: min(240px, calc(100vw - 16px));
  padding: 6px 9px;
  border-radius: 5px;
  background: #222B33;
  color: #FFFFFF;
  font-family: var(--font-ui, 'Inter', 'PingFang SC', sans-serif);
  font-size: var(--type-size-caption);
  font-weight: 650;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(2px);
  transition: opacity 0.04s ease, transform 0.04s ease, visibility 0s linear 0.04s;
}

.icon-button-hint.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition-delay: 0s;
}

.icon-button-hint::after {
  position: absolute;
  left: var(--hint-arrow-left, 50%);
  width: 0;
  height: 0;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  content: "";
  transform: translateX(-50%);
}

.icon-button-hint[data-placement="top"]::after {
  top: 100%;
  border-top: 5px solid #222B33;
}

.icon-button-hint[data-placement="bottom"]::after {
  bottom: 100%;
  border-bottom: 5px solid #222B33;
}

.reader-tool-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.reader-tool-details {
  position: relative;
}

.reader-tool-details > summary {
  list-style: none;
}

.reader-tool-details > summary::-webkit-details-marker {
  display: none;
}

.reader-tool-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 35;
  width: min(520px, calc(100vw - 48px));
  padding: var(--space-4);
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 16px 38px rgba(33, 37, 41, 0.12);
}

.reader-tool-popover .legend-inline,
.reader-tool-popover .stats,
.reader-tool-popover .reading-analysis-card {
  margin-top: var(--space-3);
}

.reader-tool-popover.reader-font-popover {
  width: 210px;
  max-width: calc(100vw - 48px);
  z-index: 120;
  padding: 14px;
}

.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}

.status-bar span {
  margin-right: auto;
}

.reading-output {
  font-family: 'Noto Serif JP', 'Hiragino Mincho ProN', 'Yu Mincho', 'Noto Sans JP', serif;
}

body[data-view="discover"] .discover-section,
body[data-view="test"] .test-section,
body[data-view="grammar"] .grammar-section,
body[data-view="history"] .history-section {
  max-width: 1040px;
}

body[data-view="test"] .test-section,
body[data-view="grammar"] .grammar-section,
body[data-view="history"] .history-section {
  margin: 0 auto;
}

@media (max-width: 1180px) {
  body[data-view="reading"] .reading-workbench {
    grid-template-columns: minmax(0, 1fr);
    max-width: 860px;
  }

  body.has-reading .reading-side {
    position: static;
  }

  body.has-reading .reading-side .vocab-panel {
    max-height: none;
  }
}

@media (max-width: 1024px) {
  .app-content {
    padding-top: 18px;
  }
}

@media (max-width: 720px) {
  .app-content {
    gap: 14px;
  }

  .resource-hub-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .resource-hub-tabs button {
    width: 100%;
  }
}

/* 长期使用体验：新手引导、学习概况与低频设置 */
.sidebar-learning-card {
  margin: 16px 0 10px;
  padding: 14px;
  border: 1px solid #e3e7e1;
  border-radius: 8px;
  background: #f8faf7;
}

.sidebar-card-kicker {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: var(--type-size-step-09);
  font-weight: 800;
}

.sidebar-card-level {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-card-level strong {
  color: var(--sumi);
  font-family: 'Noto Serif JP', serif;
  font-size: var(--type-size-subtitle);
}

.sidebar-card-level span,
.sidebar-learning-card p {
  color: var(--muted);
  font-size: var(--type-size-ruby);
}

.sidebar-learning-card p {
  margin: 7px 0 0;
  line-height: 1.45;
}

.sidebar-footer {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.sidebar-utility-button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: var(--type-size-caption);
  cursor: pointer;
}

.sidebar-utility-button:hover {
  background: #f3f4f2;
  color: var(--sumi);
}

.sidebar-utility-mark {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--sumi);
  font-size: var(--type-size-micro);
  font-weight: 800;
}

.onboarding-banner {
  position: relative;
  display: grid !important;
  grid-column: 1 / -1;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  align-items: center;
  gap: 24px;
  padding: 18px 20px;
  border: 1px solid #d9dfd7;
  border-radius: 8px;
  background: #fbfcfa;
}

.onboarding-banner.is-hidden,
body:not([data-view="reading"]) .onboarding-banner {
  display: none !important;
}

.onboarding-copy h2 {
  margin: 2px 0 4px;
  font-family: 'Noto Serif JP', serif;
  font-size: var(--type-size-body-large);
  letter-spacing: 0;
}

.onboarding-copy p {
  margin: 0;
  color: var(--muted);
  font-size: var(--type-size-caption);
}

.onboarding-steps {
  display: flex;
  gap: 12px;
}

.onboarding-steps span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: var(--type-size-micro);
  white-space: nowrap;
}

.onboarding-steps b {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: #e7eee6;
  color: #4b6654;
  font-size: var(--type-size-ruby);
}

.onboarding-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-right: 28px;
}

.onboarding-actions button:not(.btn-icon) {
  min-height: 38px;
  white-space: nowrap;
}

.onboarding-close {
  position: absolute;
  top: 8px;
  right: 8px;
}

.menu-header {
  align-items: flex-start;
  margin-bottom: 18px;
}

.menu-header strong,
.menu-header .module-kicker {
  display: block;
}

.menu-storage-status {
  display: grid;
  gap: 3px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid #d9dfd7;
  border-radius: 8px;
  background: #f5f8f4;
}

.menu-storage-status b {
  font-size: var(--type-size-caption);
}

.menu-storage-status span,
.menu-nav button small {
  color: var(--muted);
  font-size: var(--type-size-micro);
}

.menu-language-setting {
  display: grid;
  gap: 7px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.menu-language-setting label {
  color: var(--sumi);
  font-size: var(--type-size-caption);
  font-weight: 800;
}

.menu-language-setting select {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--sumi);
}

.menu-language-setting small {
  color: var(--muted);
  font-size: var(--type-size-micro);
  line-height: 1.5;
}

.menu-nav button {
  display: grid;
  gap: 2px;
  min-height: 58px;
  padding: 10px 12px;
  border-color: var(--line);
  border-radius: 8px;
  background: #fff;
}

.menu-nav button span {
  font-weight: 750;
}

@media (max-width: 1180px) {
  .onboarding-banner {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .onboarding-steps {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .onboarding-actions {
    grid-column: 2;
    grid-row: 1;
  }
}

@media (max-width: 1024px) {
  .sidebar-learning-card {
    display: none;
  }

  .sidebar-footer {
    position: fixed;
    right: 14px;
    bottom: 14px;
    z-index: 210;
    padding: 0;
    border: 0;
  }

  .sidebar-utility-button {
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
    border: 1px solid var(--line);
    background: #fff;
    box-shadow: 0 8px 28px rgba(44, 52, 64, 0.14);
  }

  .sidebar-utility-button > span:last-child {
    display: none;
  }
}

@media (max-width: 720px) {
  .onboarding-banner {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }

  .onboarding-steps,
  .onboarding-actions {
    grid-column: 1;
    grid-row: auto;
  }

  .onboarding-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .onboarding-steps span {
    align-items: flex-start;
    white-space: normal;
  }

  .onboarding-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding-right: 0;
  }
}

/* 简洁操作系统：单一主操作、安静次操作、分段模式 */
.btn-primary,
.btn-secondary,
.btn-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-size: var(--type-size-meta);
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.btn-primary {
  border-color: var(--sumi);
  background: var(--sumi);
  color: #fff;
  box-shadow: 0 1px 2px rgba(44, 52, 64, 0.12);
}

.btn-primary:hover {
  border-color: #1f252d;
  background: #1f252d;
  opacity: 1;
}

.btn-secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--sumi);
}

.btn-secondary:hover {
  border-color: #c9cfca;
  background: #f7f8f6;
}

.btn-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn-quiet:hover {
  background: #f1f3f0;
  color: var(--sumi);
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-quiet:focus-visible,
.btn-icon:focus-visible {
  outline: 3px solid rgba(47, 111, 98, 0.22);
  outline-offset: 2px;
}

.btn--large {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: var(--type-size-control);
}

.btn--small {
  min-height: 32px;
  padding: 6px 9px;
  font-size: var(--type-size-caption);
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: var(--type-size-subtitle);
}

.hero-actions .btn-primary.btn--large {
  min-width: 132px;
  border-color: var(--sumi);
  border-radius: 8px;
}

.hero-text-action {
  min-height: 36px;
  color: var(--muted) !important;
}

.source-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.source-actions .btn-primary {
  min-width: 116px;
  margin-right: auto;
}

.source-actions .btn-quiet {
  min-width: 0;
}

.source-actions .source-library-link {
  margin-left: 8px;
  color: var(--accent) !important;
  font-weight: 700;
}

body:not(.has-reading) .source-dropzone {
  border: 1px solid var(--line);
  border-radius: 8px !important;
  background: #fff;
}

body:not(.has-reading) .source-dropzone textarea {
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px !important;
  background: #fff;
}

body:not(.has-reading) .source-dropzone textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 98, 0.1);
}

.status-bar .btn-quiet {
  min-height: 32px;
}

.resource-hub-tabs {
  gap: 3px;
  padding: 4px;
  border-radius: 8px;
}

.resource-hub-tabs button {
  min-height: 34px;
  border-radius: 6px;
  font-size: var(--type-size-caption);
}

.practice-start-row {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(112px, 1fr));
  gap: 3px;
  padding: 4px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f6f3;
}

.practice-start-row button {
  min-height: 38px;
  padding: 8px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: var(--type-size-meta);
  font-weight: 700;
  cursor: pointer;
}

.practice-start-row button:hover {
  color: var(--sumi);
}

.practice-start-row button.is-selected {
  border-color: transparent;
  background: #fff;
  color: var(--sumi);
  box-shadow: 0 1px 4px rgba(44, 52, 64, 0.1);
}

.practice-tool-row {
  margin-bottom: 16px;
}

.practice-tool-popover {
  width: min(560px, calc(100vw - 48px));
}

.reading-quiz-list {
  display: grid;
  gap: 12px;
}

.reading-quiz-question {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.reading-quiz-prompt {
  margin: 0 0 10px;
  color: var(--sumi);
  font-family: var(--font-reading);
  font-size: var(--type-size-step-15-5);
  font-weight: 650;
  line-height: 1.55;
}

.reading-quiz-options {
  display: grid;
  gap: 8px;
}

.reading-quiz-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 11px 46px 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-family: var(--font-reading);
  font-size: var(--type-size-step-14-5);
  cursor: pointer;
  line-height: 1.6;
  transition: border-color .18s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.reading-quiz-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.reading-quiz-option::after {
  position: absolute;
  top: 50%;
  right: 16px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-ui);
  font-size: var(--type-size-meta);
  font-weight: 800;
  line-height: 1;
  opacity: 0;
  transform: translateY(-50%) scale(.82);
  transition: opacity .16s ease, transform .16s ease;
  content: "✓";
}

.reading-quiz-option:hover,
.reading-quiz-option:focus-within {
  border-color: rgba(47, 111, 98, 0.24);
  background: #fbfdfb;
}

.reading-quiz-option:has(input:checked) {
  border-color: rgba(47, 111, 98, 0.46);
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 98, 0.08);
}

.reading-quiz-option:has(input:checked)::after {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.quiz-empty-message {
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: var(--type-size-control);
}

.post-reading-practice {
  display: none;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfa;
}

body.has-reading .post-reading-practice {
  display: flex;
}

.post-reading-summary {
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 220px;
}

.post-reading-practice span {
  color: var(--accent);
  font-size: var(--type-size-micro);
  font-weight: 800;
}

.post-reading-practice strong {
  color: var(--sumi);
  font-size: var(--type-size-emphasis);
  font-weight: 700;
}

.post-reading-practice small {
  color: var(--muted);
  font-size: var(--type-size-caption);
  line-height: 1.45;
}

.post-reading-practice-actions {
  display: grid;
  grid-template-columns: minmax(160px, 240px);
  gap: 8px;
}

.post-reading-practice-actions button {
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  text-align: left;
  font-weight: 650;
  cursor: pointer;
}

.post-reading-practice-actions button b {
  color: var(--sumi);
  font-size: var(--type-size-meta);
}

.post-reading-practice-actions button small {
  color: var(--muted);
  font-size: var(--type-size-micro);
}

.post-reading-practice-actions button:hover {
  border-color: rgba(47, 111, 98, 0.28);
  background: var(--accent-soft);
  color: var(--accent);
}

.detail-empty-smart {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfa;
}

.detail-empty-smart b {
  color: var(--sumi);
  font-size: var(--type-size-body);
}

.detail-empty-smart span,
.detail-empty-smart small {
  color: var(--muted);
  font-size: var(--type-size-meta);
  line-height: 1.7;
}

.detail-empty-smart small {
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.detail-empty-smart small:empty {
  display: none;
}

@media (max-width: 680px) {
  .post-reading-practice {
    align-items: stretch;
    flex-direction: column;
  }

  .post-reading-practice-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .export-parameters-dialog {
    max-height: calc(100vh - 24px);
    overflow-y: auto;
  }

  .export-parameters-dialog .export-settings {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.reading-quiz-option.is-correct {
  border-color: rgba(47, 111, 98, 0.28);
  background: var(--accent-soft);
  color: var(--accent);
}

.reading-quiz-option.is-correct::after {
  opacity: 1;
  transform: translateY(-50%) scale(1);
  background: var(--accent);
  content: "✓";
}

.reading-quiz-option.is-wrong {
  border-color: rgba(166, 77, 60, 0.28);
  background: var(--trap-bg);
  color: var(--trap);
}

.reading-quiz-option.is-wrong::after {
  opacity: 1;
  transform: translateY(-50%) scale(1);
  background: var(--trap);
  content: "×";
}

.practice-answer-actions {
  display: grid;
  grid-template-columns: 1fr minmax(120px, auto) 1fr;
  align-items: center;
  gap: 6px;
  margin: 14px 0 10px;
}

.practice-answer-actions .btn-quiet:first-child {
  justify-self: start;
}

.practice-answer-actions .btn-quiet:last-child {
  justify-self: end;
}

.practice-rating-actions {
  display: grid;
  grid-template-columns: auto repeat(3, minmax(82px, 1fr));
  align-items: center;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f8f6;
}

.practice-rating-actions > span {
  padding: 0 8px;
  color: var(--muted);
  font-size: var(--type-size-micro);
  font-weight: 700;
}

.practice-rating-actions .btn-secondary {
  min-height: 34px;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
  font-size: var(--type-size-caption);
}

.practice-rating-actions .btn-secondary:hover {
  background: #fff;
  box-shadow: 0 1px 3px rgba(44, 52, 64, 0.08);
}

.practice-subpanel .btnrow,
#typingPracticeModule .btnrow {
  align-items: center;
  gap: 4px;
}

.practice-subpanel .btnrow .btn-primary,
#typingPracticeModule .btnrow .btn-primary {
  margin-right: 4px;
}

@media (max-width: 720px) {
  .source-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .source-actions .btn-primary {
    grid-column: 1 / -1;
    width: 100%;
    margin-right: 0;
  }

  .practice-start-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .practice-start-row button {
    width: auto;
    min-width: 0;
    padding-inline: 6px;
    white-space: normal;
  }

  .practice-rating-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .practice-rating-actions > span {
    grid-column: 1 / -1;
    padding: 3px 4px;
  }

  .level-result-stats {
    grid-template-columns: 1fr;
  }

  .level-result-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .vocab-library-head,
  .vocab-filter-bar {
    grid-template-columns: 1fr;
  }

  .vocab-library-head {
    display: grid;
  }

  .vocab-select-filters {
    grid-template-columns: 1fr;
  }

  .vocab-list-header {
    display: none;
  }

  .vocab-page-list .vocab-table-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
  }

  .vocab-page-list .vocab-table-row .vocab-row-actions {
    grid-column: 2;
    grid-row: 1;
    opacity: 1;
  }

  .vocab-cell-meaning,
  .vocab-cell-mastery,
  .vocab-cell-source {
    grid-column: 1 / -1;
  }

  .vocab-reading,
  .vocab-source-title {
    white-space: normal;
  }
}

/* 全站留白节奏：页面 32、区块 24、模块 16、控件 8 */
:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --sidebar-width: 188px;
  --workspace-max: 1120px;
  --font-display: 'Noto Serif SC', 'Songti SC', 'STSong', 'Noto Serif JP', 'Yu Mincho', serif;
  --font-ui: 'Inter', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans JP', sans-serif;
  --font-reading: 'Noto Sans JP', 'Noto Sans SC', 'Hiragino Sans', 'Yu Gothic', sans-serif;
  --radius: 4px;
  --radius-small: 2px;
}

body,
button,
input,
textarea,
select {
  font-family: var(--font-ui);
}

.hero-title,
.brand-text,
.onboarding-copy h2,
.daily-plan h2,
.practice-hero h1,
.page-focus h2 {
  font-family: var(--font-display);
  font-weight: 600;
}

.brand-mark {
  font-family: 'Noto Serif JP', 'Yu Mincho', var(--font-display);
}

.reading-output,
.cloze-output,
.typing-prompt,
.vocab-word,
.detail-word {
  font-family: var(--font-reading);
}

.card-title,
.section-title,
.retell-section .page-focus h2,
.practice-module-head h3,
.practice-review-head h3,
.history-subhead h2,
.reading-queue-head h2,
.source-directory-head h2,
.progressive-panel summary,
.vocab-review-disclosure summary {
  font-family: var(--font-ui);
}

.daily-plan-progress,
.sidebar-card-level strong,
.vocab-page-summary b,
.practice-summary-grid b,
.weekly-progress-summary b,
.reading-analysis-grid b,
.review-stats b {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
}

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

.brand-mini {
  width: 100%;
  min-height: 44px;
  padding: 0;
  justify-content: flex-start;
  border: 0;
  background: transparent;
  text-align: left;
}

h1.card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--type-size-section-title);
  font-weight: 600;
  line-height: 1.35;
}

.practice-hero h1 {
  margin: 10px 0 6px;
  font-family: var(--font-display);
  font-size: var(--type-size-feature-title);
  font-weight: 600;
  line-height: 1.25;
}

.btn-primary,
.btn-secondary,
.btn-quiet,
.nav-item,
.resource-hub-tabs button,
.vocab-filter-tab,
.practice-mode-tab,
.practice-start-row button {
  min-height: 44px;
}

.btn-icon {
  width: 44px;
  height: 44px;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid rgba(47, 111, 98, 0.24);
  outline-offset: 2px;
}

button,
textarea,
select,
input:not([type="checkbox"]):not([type="radio"]),
.card,
.hero-input,
.global-search-results,
.sidebar-learning-card,
.onboarding-banner,
.menu-storage-status,
.page-focus,
.resource-hub-tabs,
.progressive-panel,
.vocab-review-disclosure,
.practice-review-panel,
.practice-subpanel,
.vocab-quiz-card,
.typing-prompt,
.reading-output,
.reading-analysis-card,
.source-card,
.source-directory-item,
.reading-queue-item,
.daily-task,
.learning-path-step,
.level-question,
.gpoint,
.export-dialog,
.import-preview-dialog {
  border-radius: var(--radius) !important;
}

.sidebar-toggle-button,
.sidebar-restore-button {
  border: 0 !important;
  background: transparent !important;
  color: #8a8f93;
  cursor: pointer;
  box-shadow: none !important;
}

.sidebar-icon-toggle {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  display: inline-grid;
  place-items: center;
  padding: 0 !important;
}

.sidebar-icon-toggle span {
  width: 18px;
  height: 18px;
  display: block;
  position: relative;
  border: 2px solid currentColor;
  border-radius: 6px;
}

.sidebar-icon-toggle span::before {
  content: '';
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 6px;
  width: 2px;
  background: currentColor;
  opacity: 0.65;
}

.brand-mark,
.sidebar-utility-mark,
.weekly-progress-summary > div,
.practice-summary-grid > div,
.practice-review-item,
.practice-review-empty,
.practice-mode-tabs,
.vocab-practice-empty,
.daily-plan-progress,
.daily-goal-settings,
.learning-path-guide,
.status-bar,
.legend-inline,
.import-disclosure,
.stats,
.reading-hint,
.next-step-bar,
.reading-insights,
.reading-analysis-grid > div,
.vocab-page-summary > div,
.vocab-page-list,
.vocab-page-review,
.flash-page-placeholder,
.vocab-page-review .flash-stage,
.practice-start-row,
.practice-rating-actions {
  border-radius: var(--radius) !important;
}

.tag,
.nav-badge,
.unlock-pill,
.module-lock,
.typing-chip,
.gpoint-level,
.reading-queue-count,
.reading-queue-state,
.vocab-filter-tab,
.practice-mode-tab,
.status-value {
  border-radius: var(--radius-small) !important;
}

.practice-review-meta span,
.vocab-practice-tag,
.reading-analysis-level,
.source-directory-item > span {
  border-radius: var(--radius-small) !important;
}

.reading-main.card,
.vocab-section-page,
.grammar-section,
.typing-section,
.retell-section,
.discover-section,
.test-section,
.history-section,
.reading-side .card,
.source-directory-item {
  box-shadow: none !important;
}

.hero-input,
.practice-mode-tab.active,
.practice-start-row button.is-selected {
  box-shadow: none !important;
}

.sidebar-learning-card {
  border-left: 1px solid var(--line);
}

.onboarding-banner {
  border-top: 1px solid var(--line);
}

.section-title::before {
  display: none;
}

.grammar-example {
  border: 1px solid var(--line);
  border-left-width: 1px;
}

.vocab-section-page > .card-pad > .card-head,
.grammar-section > .card-pad > .card-head,
.retell-section > .card-pad > .card-head,
.discover-section > .card-pad > .card-head,
.test-section > .card-pad > .card-head,
.history-section > .card-pad > .card-head,
.daily-plan-head {
  padding-left: var(--space-3);
  border-left: 3px solid var(--accent);
}

.app-content {
  flex: 1 1 auto;
  width: calc(100% - var(--sidebar-width));
  min-width: 0;
  margin-left: var(--sidebar-width);
  gap: 0;
  padding: var(--space-6) 40px 56px;
}

.app-sidebar {
  width: var(--sidebar-width);
  padding: var(--space-5) var(--space-4);
}

.sidebar-brand {
  margin-bottom: var(--space-4);
  padding: 0 var(--space-2) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.sidebar-brand .brand-mini {
  flex: 1 1 auto;
  min-width: 0;
}

.global-search {
  padding: 0 0 var(--space-4);
}

.sidebar-toggle-button {
  flex: 0 0 auto;
  margin-left: auto;
}

.sidebar-toggle-button:hover,
.sidebar-restore-button:hover {
  color: #5f6368;
  background: transparent !important;
}

.sidebar-toggle-button:active,
.sidebar-restore-button:active {
  opacity: 1;
  background: transparent !important;
}

.sidebar-restore-button {
  position: fixed;
  left: 22px;
  top: 22px;
  z-index: 70;
  display: none;
}

.app-sidebar,
.app-content {
  transition: transform 0.24s ease, margin-left 0.24s ease, width 0.24s ease, padding 0.24s ease;
}

body.sidebar-collapsed .app-sidebar {
  transform: translateX(calc(-1 * var(--sidebar-width)));
}

body.sidebar-collapsed .app-content {
  width: 100%;
  margin-left: 0;
  padding-top: var(--space-6);
}

body.sidebar-collapsed .sidebar-restore-button {
  display: inline-flex;
}

body.first-visit .sidebar-restore-button {
  display: none !important;
}

.hero-guide-prompt {
  margin: 2px 14px 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(67, 118, 108, 0.16);
  border-radius: 999px;
  background: #F6F9F6;
  color: #43766C;
  font-size: var(--type-size-step-13-5);
}

.hero-guide-prompt.is-hidden {
  display: none;
}

body.sample-tour-active .daily-plan,
body.sample-tour-active #nextStepBar,
body.sample-tour-active .onboarding-banner {
  display: none !important;
}

body.sample-tour-active .icon-button-hint {
  display: none !important;
}

.tour-highlight {
  filter: none !important;
  opacity: 1 !important;
  outline: 3px solid rgba(47, 111, 98, 0.68) !important;
  outline-offset: 4px;
  box-shadow: 0 8px 20px rgba(33, 37, 41, 0.16) !important;
}

.guided-tour {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}

.guided-tour.is-hidden {
  display: none;
}

.guided-mask {
  position: fixed;
  z-index: 0;
  background: rgba(25, 31, 29, 0.46);
  pointer-events: none;
}

.guided-callout {
  position: fixed;
  z-index: 2;
  width: min(252px, calc(100vw - 28px));
  padding: 15px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 8px !important;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 14px 34px rgba(18, 24, 21, 0.2);
  pointer-events: auto;
}

.guided-callout::before {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  filter: drop-shadow(0 2px 1px rgba(18, 24, 21, 0.12));
}

.guided-callout[data-placement="right"]::before {
  left: -9px;
  top: var(--guided-arrow-offset, 50%);
  transform: translateY(-50%);
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-right: 9px solid var(--paper);
}

.guided-callout[data-placement="left"]::before {
  right: -9px;
  top: var(--guided-arrow-offset, 50%);
  transform: translateY(-50%);
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 9px solid var(--paper);
}

.guided-callout[data-placement="bottom"]::before {
  left: var(--guided-arrow-offset, 50%);
  top: -9px;
  transform: translateX(-50%);
  border-right: 9px solid transparent;
  border-left: 9px solid transparent;
  border-bottom: 9px solid var(--paper);
}

.guided-callout[data-placement="top"]::before {
  left: var(--guided-arrow-offset, 50%);
  bottom: -9px;
  transform: translateX(-50%);
  border-right: 9px solid transparent;
  border-left: 9px solid transparent;
  border-top: 9px solid var(--paper);
}

.guided-callout strong {
  display: block;
  margin-top: 3px;
  font-family: var(--font-display);
  font-size: var(--type-size-emphasis);
  font-weight: 600;
}

.guided-callout p {
  margin: 5px 0 12px;
  color: var(--ink-soft);
  font-size: var(--type-size-step-12-5);
  line-height: 1.55;
}

.guided-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nav-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  justify-content: stretch;
  text-align: left;
  margin-bottom: 0;
}

.nav-item .nav-icon,
.nav-item .nav-label {
  float: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-grid;
  place-items: center;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-label {
  width: auto;
  min-width: 0;
  justify-self: start;
  text-align: left;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1.25;
}

.nav-item.active .nav-icon {
  color: var(--accent);
}

.sidebar-learning-card {
  margin: var(--space-4) 0;
}

.sidebar-footer {
  padding-top: var(--space-3);
}

.reading-workbench {
  width: 100%;
  max-width: var(--workspace-max) !important;
  margin-right: auto;
  margin-left: auto;
  gap: var(--space-5);
}

body[data-view="reading"].has-reading .reading-workbench {
  grid-template-columns: minmax(0, 1fr) 280px;
}

body[data-view="reading"]:not(.has-reading) .reading-workbench {
  grid-template-columns: minmax(0, 1fr) !important;
}

.vocab-section-page,
.grammar-section,
.typing-section,
.retell-section,
.discover-section,
.test-section,
.history-section,
.settings-section {
  width: 100%;
  max-width: var(--workspace-max) !important;
  margin-right: auto !important;
  margin-left: auto !important;
}

.reading-main.card,
.vocab-section-page,
.grammar-section,
.retell-section,
.discover-section,
.test-section,
.history-section,
.settings-section {
  margin-bottom: 0;
}

.reading-main .card-pad,
.reading-side .card-pad,
.vocab-section-page > .card-pad,
.grammar-section > .card-pad,
.retell-section > .card-pad,
.discover-section > .card-pad,
.test-section > .card-pad,
.history-section > .card-pad,
.settings-section > .card-pad {
  padding: var(--space-5);
}

.reading-side {
  gap: var(--space-5) !important;
}

.daily-plan {
  padding: 0;
}

.daily-plan-head {
  margin-bottom: var(--space-2);
}

.learning-path-disclosure {
  margin-top: var(--space-2);
}

.learning-path-disclosure[open] > summary {
  margin-bottom: var(--space-3);
}

.vocab-section-page > .card-pad,
.grammar-section > .card-pad,
.retell-section > .card-pad,
.discover-section > .card-pad,
.test-section > .card-pad,
.history-section > .card-pad,
.settings-section > .card-pad {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.vocab-section-page > .card-pad > *,
.grammar-section > .card-pad > *,
.retell-section > .card-pad > *,
.discover-section > .card-pad > *,
.test-section > .card-pad > *,
.history-section > .card-pad > *,
.settings-section > .card-pad > * {
  margin-block: 0 !important;
}

.card-head {
  min-height: 28px;
  margin-bottom: var(--space-4);
}

.vocab-section-page > .card-pad > .card-head,
.grammar-section > .card-pad > .card-head,
.retell-section > .card-pad > .card-head,
.discover-section > .card-pad > .card-head,
.test-section > .card-pad > .card-head,
.history-section > .card-pad > .card-head,
.settings-section > .card-pad > .card-head {
  margin-bottom: 0;
}

.page-focus {
  gap: var(--space-4);
  margin: 0;
  padding: 20px;
}

.page-focus.compact {
  margin-top: 0;
}

.resource-hub-tabs {
  margin: 0;
}

.progressive-panel,
.vocab-review-disclosure,
.practice-secondary-panel,
.source-directory-panel,
.history-progress-panel,
.primary-task-panel {
  margin: 0;
}

.vocab-page-summary.quiet-summary {
  margin: 0;
}

.practice-start-row {
  align-self: flex-start;
  margin: 0;
}

.practice-module {
  margin: 0;
  padding: var(--space-5) 0 0;
  border-top: 1px solid var(--line);
}

.practice-module-head {
  margin-bottom: var(--space-3);
}

.practice-module .lookup-status + .lookup-status {
  margin-top: var(--space-2);
}

.practice-subgrid,
.typing-grid {
  margin-top: var(--space-4);
}

.reading-queue-section {
  margin: 0;
  padding: 0 0 var(--space-4);
}

.reading-queue-form {
  margin-top: var(--space-4);
}

.reading-queue-list {
  margin-top: var(--space-2);
}

.source-directory-head {
  margin-bottom: var(--space-4);
}

.vocab-filter-bar {
  margin-bottom: var(--space-3);
}

.btnrow {
  gap: var(--space-2);
  margin: var(--space-4) 0;
}

.review-actions,
.vocab-page-actions,
.history-toolbar,
.mini-action-row {
  gap: var(--space-2);
}

.panel-heading-actions {
  display: flex;
  gap: var(--space-2);
}

.panel-review-actions,
.export-format-note {
  margin-top: var(--space-3);
}

body[data-view="discover"] .discover-section {
  max-width: min(1480px, calc(100vw - var(--sidebar-width) - 80px)) !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-view="discover"] .discover-section > .card-pad {
  padding: 0 !important;
}

body[data-view="discover"] .source-directory-panel,
body[data-view="discover"] .source-directory-panel .discover-sources {
  margin: 0 !important;
  padding: 0 !important;
}

body[data-view="discover"] .source-directory-panel {
  border: 0 !important;
  background: transparent !important;
}

body[data-view="discover"] .source-recommendation-panel {
  padding-top: 18px !important;
}

body[data-view="history"] .history-unified-panel {
  margin: 0 !important;
}

body[data-view="discover"] .source-directory-item {
  border-radius: 18px !important;
  box-shadow: 0 12px 22px rgba(32, 40, 45, 0.12) !important;
}

body[data-view="discover"] .source-directory-item:hover {
  box-shadow: 0 16px 30px rgba(32, 40, 45, 0.16) !important;
}

body[data-view="discover"] .source-directory-title-row > span,
body[data-view="discover"] .source-level-tabs button,
body[data-view="discover"] .source-traits span {
  border-radius: 12px !important;
}

@media (max-width: 1180px) {
  body[data-view="reading"].has-reading .reading-workbench {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1024px) {
  .app-content {
    width: 100%;
    margin-left: 0;
    padding: var(--space-5) 20px 40px;
  }

  .app-sidebar {
    width: 100%;
    padding: var(--space-3) var(--space-4);
  }

  body.sidebar-collapsed .app-sidebar {
    transform: translateY(-100%);
  }

  body.sidebar-collapsed .app-content {
    padding-top: var(--space-5);
  }

  .sidebar-nav {
    flex-direction: row;
    gap: var(--space-2);
  }

  .sidebar-footer {
    padding: 0;
  }
}

@media (max-width: 720px) {
  .app-content {
    padding: var(--space-4) var(--space-3) var(--space-6);
  }

  .app-sidebar {
    padding: var(--space-2) 10px 10px;
  }

  .sidebar-nav {
    display: grid;
    gap: 6px;
  }

  .reading-workbench {
    gap: var(--space-4);
  }

  .reader-toolbar,
  .reader-tool-group {
    flex-wrap: wrap;
  }

  .reader-font-popover {
    right: auto;
    left: 0;
  }

  body[data-view="reading"].has-reading .reading-workbench {
    grid-template-columns: minmax(0, 1fr);
  }

  .reading-main .card-pad,
  .reading-side .card-pad,
  .vocab-section-page > .card-pad,
  .grammar-section > .card-pad,
  .retell-section > .card-pad,
  .discover-section > .card-pad,
  .test-section > .card-pad,
  .history-section > .card-pad {
    padding: var(--space-4);
  }

  .reading-side {
    gap: var(--space-4) !important;
  }

  .vocab-section-page > .card-pad,
  .grammar-section > .card-pad,
  .retell-section > .card-pad,
  .discover-section > .card-pad,
  .test-section > .card-pad,
  .history-section > .card-pad {
    gap: var(--space-3);
  }

  .page-focus {
    gap: var(--space-3);
    padding: var(--space-4);
  }

  .practice-start-row {
    align-self: stretch;
  }

  .practice-module {
    padding-top: var(--space-4);
  }
}

/* 生词本页面：按上传代码的视觉规格独立呈现 */
body[data-view="vocab"] {
  --vocab-avocado-main: #7A9A5B;
  --vocab-avocado-light: #E9EED9;
  --vocab-avocado-dark: #5B7542;
  --vocab-bg: #F8F9F5;
  --vocab-text-main: #333333;
  --vocab-text-secondary: #666666;
  --vocab-border: #EEEEEE;
  --vocab-status-green: #4CAF50;
  --vocab-status-yellow: #FFC107;
  --vocab-status-red: #F44336;
}

body[data-view="vocab"] .app-content {
  background: var(--vocab-bg);
}

body[data-view="vocab"] .vocab-section-page {
  width: 100%;
  max-width: 1000px !important;
  border: 0 !important;
  border-radius: 12px !important;
  background: #FFFFFF !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04) !important;
  position: relative;
  overflow: hidden;
}

body[data-view="vocab"] .vocab-section-page > .card-pad {
  padding: 30px 40px !important;
  gap: 0;
}

body[data-view="vocab"] .vocab-page-list {
  padding: 0;
  border: 0;
  border-radius: 0 !important;
  background: transparent;
}

body[data-view="vocab"] .vocab-library-head {
  align-items: center;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--vocab-avocado-light);
}

body[data-view="vocab"] .vocab-library-head::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  margin: 0 14px;
  background: var(--vocab-avocado-light);
}

body[data-view="vocab"] .vocab-flash-widget {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px 8px 10px;
  border: 0;
  border-radius: 8px !important;
  background: var(--vocab-avocado-dark);
  color: #fff;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(91, 117, 66, 0.2);
  transition: background-color .2s ease, transform .1s ease, box-shadow .2s ease;
}

body[data-view="vocab"] .vocab-flash-widget:hover {
  background: #4A6335;
  box-shadow: 0 6px 16px rgba(91, 117, 66, 0.25);
  transform: translateY(-1px);
}

body[data-view="vocab"] .vocab-flash-icon {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  color: #fff;
}

body[data-view="vocab"] .vocab-flash-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body[data-view="vocab"] .vocab-flash-widget b,
body[data-view="vocab"] .vocab-flash-widget small {
  display: block;
  text-align: left;
}

body[data-view="vocab"] .vocab-flash-widget b {
  font-size: var(--type-size-control);
  font-weight: 700;
}

body[data-view="vocab"] .vocab-flash-widget small {
  margin-top: 1px;
  color: rgba(255,255,255,0.78);
  font-size: var(--type-size-caption);
  font-weight: 500;
}

body[data-view="vocab"] .vocab-flash-widget i {
  font-style: normal;
}

body[data-view="vocab"] .vocab-library-total {
  order: 3;
  min-height: 28px;
  padding: 4px 12px;
  border-radius: 20px !important;
  background: var(--vocab-avocado-light);
  color: var(--vocab-text-secondary);
  font-size: var(--type-size-control);
  font-weight: 400;
}

body[data-view="vocab"] .vocab-library-total b {
  color: inherit;
  font-weight: 600;
}

/* 练习页：让当前任务成为页面重心 */
body[data-view="retell"] .retell-section {
  max-width: 1120px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-view="retell"] .retell-section > .card-pad {
  padding: 0 !important;
}

body[data-view="retell"] .practice-start-row {
  width: max-content;
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #F4F6F3;
}

body[data-view="retell"] .practice-start-row button {
  min-height: 48px;
  border: 0;
  border-radius: 6px !important;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

body[data-view="retell"] .practice-start-row button.is-selected {
  background: #FFFFFF;
  color: var(--sumi);
  box-shadow: 0 1px 8px rgba(32, 40, 45, 0.06);
}

body[data-view="retell"] .practice-module {
  padding: 26px 0 0;
  border-top: 1px solid var(--line);
}

body[data-view="retell"] .practice-module-head {
  align-items: center;
  margin-bottom: 18px;
}

body[data-view="retell"] .practice-module-head h3 {
  font-size: var(--type-size-step-22);
}

body[data-view="retell"] .practice-subpanel,
body[data-view="retell"] .retell-source-card,
body[data-view="retell"] .typing-main,
body[data-view="retell"] .typing-side {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #FFFFFF;
}

body[data-view="retell"] .reading-quiz-panel {
  min-height: 430px;
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 26px;
}

body[data-view="retell"] .reading-quiz-source {
  margin: 0;
}

body[data-view="retell"] .reading-quiz-start {
  min-height: 170px;
  display: grid;
  place-items: center;
  margin: 0;
}

body[data-view="retell"] .reading-quiz-start .btn-primary {
  min-width: 190px;
  min-height: 54px;
  font-size: var(--type-size-body);
}

body[data-view="retell"] .reading-quiz-start.is-hidden {
  display: none !important;
}

body[data-view="retell"] .reading-quiz-panel.has-quiz {
  min-height: 0;
}

body[data-view="retell"] .cloze-output {
  max-height: none;
  min-height: 220px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #FCFCFB;
}

body[data-view="retell"] .retell-source-card {
  padding: 18px;
}

body[data-view="retell"] .retell-source-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--accent);
  font-size: var(--type-size-meta);
  font-weight: 800;
}

body[data-view="retell"] .retell-source-text {
  max-height: 240px;
  overflow: auto;
  padding: 18px;
  border-radius: 8px;
  background: #F7FAF7;
  color: var(--sumi);
  font-family: var(--font-reading);
  font-size: var(--type-size-subtitle);
  line-height: 2;
  white-space: pre-wrap;
}

body[data-view="retell"] #retellResult:empty {
  display: none;
}

body[data-view="retell"] .typing-grid {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 16px;
}

body[data-view="retell"] .typing-main {
  padding: 20px;
}

body[data-view="retell"] .typing-prompt {
  margin-bottom: 14px;
  border-radius: 8px;
  background: #F7FAF7;
}

body[data-view="retell"] .typing-cn {
  color: var(--sumi);
  font-size: var(--type-size-subtitle);
  font-weight: 650;
}

body[data-view="retell"] .typing-input {
  min-height: 180px;
  border-width: 1px;
  border-radius: 8px;
  font-size: var(--type-size-subtitle);
  line-height: 1.8;
}

body[data-view="retell"] .typing-side {
  min-width: 0;
  padding: 14px;
}

body[data-view="retell"] .typing-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: 800;
}

body[data-view="retell"] .typing-side-head > div {
  display: flex;
  gap: 4px;
}

body[data-view="retell"] .typing-list {
  max-height: 420px;
}

body[data-view="retell"] .typing-list button {
  border-radius: 8px;
  background: #FCFCFB;
  font-size: var(--type-size-caption);
}

body[data-view="retell"] .typing-list button b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 资料页：等级 + 类型 + 快速闭环 */
body[data-view="discover"] .source-type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -10px 0 16px;
}

body[data-view="discover"] .source-filter-selects {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 14px;
}

body[data-view="discover"] .source-filter-selects label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: 800;
}

body[data-view="discover"] .source-filter-selects select {
  min-width: 150px;
  min-height: 42px;
  padding: 0 38px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--sumi);
  font: inherit;
  font-size: var(--type-size-control);
}

body[data-view="discover"] .source-type-tabs button,
body[data-view="discover"] .source-quick-loop button {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: 750;
  cursor: pointer;
}

body[data-view="discover"] .source-type-tabs button.active,
body[data-view="discover"] .source-type-tabs button:hover {
  border-color: rgba(47, 111, 98, 0.24);
  background: var(--accent-soft);
  color: var(--accent);
}

body[data-view="discover"] .source-quick-loop {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #FCFCFB;
}

body[data-view="discover"] .source-quick-loop button:first-child {
  border-color: var(--accent);
  background: var(--accent);
  color: #FFFFFF;
}

body[data-view="discover"] .discover-sources {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

body[data-view="discover"] .source-directory-item {
  min-height: 150px;
  padding: 20px !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 18px rgba(32, 40, 45, 0.07) !important;
}

body[data-view="discover"] .source-directory-icon,
body[data-view="discover"] .source-open-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
}

body[data-view="discover"] .source-directory-item h3 {
  font-size: var(--type-size-subtitle);
}

body[data-view="discover"] .source-directory-item p {
  margin-top: 8px;
  font-size: var(--type-size-meta);
}

body[data-view="discover"] .source-empty-state {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--muted);
  text-align: center;
}

/* 设置页：从抽屉改为完整工作区 */
body[data-view="settings"] .settings-section {
  max-width: 980px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-view="settings"] .settings-section > .card-pad {
  padding: 0 !important;
}

.sidebar-utility-button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.settings-page-panel {
  display: grid;
  gap: 20px;
}

.settings-page-head h2 {
  margin: 4px 0 0;
  font-size: var(--type-size-page-title);
  letter-spacing: 0;
}

.settings-page-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.settings-page-card {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #FFFFFF;
}

.settings-page-card h3 {
  margin: 0;
  color: var(--sumi);
  font-size: var(--type-size-body-large);
}

.settings-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: var(--type-size-meta);
  font-weight: 750;
}

.settings-field select {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--sumi);
  font: inherit;
}

.settings-action-button {
  min-height: 72px;
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #FCFCFB;
  color: var(--sumi);
  text-align: left;
  cursor: pointer;
}

.settings-action-button:hover {
  border-color: rgba(47, 111, 98, 0.28);
  background: #F7FAF7;
}

.settings-action-button b {
  font-size: var(--type-size-control);
}

.settings-action-button span {
  color: var(--muted);
  font-size: var(--type-size-caption);
  line-height: 1.5;
}

body[data-view="vocab"] .vocab-filter-bar {
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
  margin-bottom: 24px;
}

body[data-view="vocab"] .vocab-search-input,
body[data-view="vocab"] .vocab-select-filters select {
  min-height: 40px;
  border: 1px solid var(--vocab-border);
  border-radius: 12px !important;
  background: #fff;
  color: var(--vocab-text-main);
  font-size: var(--type-size-body);
}

body[data-view="vocab"] .vocab-search-input {
  padding: 10px 16px;
}

body[data-view="vocab"] .vocab-select-filters select {
  min-height: 48px;
  padding: 10px 40px 10px 18px;
  font-weight: 650;
}

body[data-view="vocab"] .vocab-search-input:focus,
body[data-view="vocab"] .vocab-select-shell:hover select,
body[data-view="vocab"] .vocab-select-filters select:focus {
  border-color: var(--vocab-avocado-main);
  outline: none;
}

body[data-view="vocab"] .vocab-select-filters {
  grid-template-columns: repeat(4, minmax(116px, 1fr));
  gap: 12px;
}

body[data-view="vocab"] .vocab-select-shell::after {
  right: 17px;
  color: var(--vocab-text-secondary);
}

body[data-view="vocab"] .vocab-select-shell-export select {
  border-color: #dfe7df;
  background: transparent;
  color: var(--vocab-avocado-dark);
  font-weight: 800;
}

body[data-view="vocab"] .vocab-select-shell-export::after {
  color: var(--vocab-avocado-dark);
}

body[data-view="vocab"] .vocab-list-header,
body[data-view="vocab"] .vocab-page-list .vocab-table-row {
  grid-template-columns: 1.5fr 2.5fr 1fr 1.5fr 1fr;
  column-gap: 12px;
}

body[data-view="vocab"] .vocab-list-header {
  padding: 0 16px 12px;
  border-bottom: 1px solid var(--vocab-border);
  color: #999999;
  font-size: var(--type-size-meta);
  font-weight: 500;
}

body[data-view="vocab"] .vocab-page-list .vocab-table-row {
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--vocab-border);
  border-radius: 8px !important;
  color: var(--vocab-text-main);
  transition: background-color .2s ease;
}

body[data-view="vocab"] .vocab-page-list .vocab-table-row:hover {
  background: #FAFBFA;
}

body[data-view="vocab"] .vocab-word-main {
  color: var(--vocab-avocado-dark);
  font-size: var(--type-size-section-title);
  font-weight: 600;
}

body[data-view="vocab"] .vocab-level-chip {
  min-height: 21px;
  padding: 2px 8px;
  border-radius: 4px !important;
  background: #F0F0F0;
  color: #666666;
  font-size: var(--type-size-caption);
  font-weight: 500;
}

body[data-view="vocab"] .vocab-level-chip.level-n3 {
  background: #E3F2FD;
  color: #1976D2;
}

body[data-view="vocab"] .vocab-level-chip.level-n4 {
  background: #FFF3E0;
  color: #F57C00;
}

body[data-view="vocab"] .vocab-reading {
  color: #888888;
  font-size: var(--type-size-meta);
  font-weight: 400;
}

body[data-view="vocab"] .vocab-page-list .vocab-meaning {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--vocab-text-main);
  font-size: var(--type-size-control);
}

body[data-view="vocab"] .vocab-page-list .vocab-meaning-system {
  color: #999999;
  font-size: var(--type-size-meta);
  font-style: italic;
}

body[data-view="vocab"] .vocab-mastery {
  gap: 8px;
  min-height: auto;
  padding: 0;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--vocab-text-secondary) !important;
  font-size: var(--type-size-meta);
  font-weight: 400;
}

body[data-view="vocab"] .vocab-mastery i {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
}

body[data-view="vocab"] .vocab-mastery.mastered i {
  background: var(--vocab-status-green);
}

body[data-view="vocab"] .vocab-mastery.unsure i,
body[data-view="vocab"] .vocab-mastery.new i {
  background: var(--vocab-status-yellow);
}

body[data-view="vocab"] .vocab-mastery.weak i {
  background: var(--vocab-status-red);
}

body[data-view="vocab"] .vocab-cell-mastery small {
  display: none;
}

body[data-view="vocab"] .vocab-source-title {
  width: fit-content;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 4px !important;
  background: #F5F5F5;
  color: #888888;
  font-size: var(--type-size-meta);
  font-weight: 400;
}

body[data-view="vocab"] .vocab-source-kind {
  display: none;
}

body[data-view="vocab"] .vocab-row-actions {
  gap: 8px;
  opacity: .32;
  transition: opacity .18s ease;
}

body[data-view="vocab"] .vocab-table-row:hover .vocab-row-actions,
body[data-view="vocab"] .vocab-row-actions:focus-within {
  opacity: 1;
}

body[data-view="vocab"] .vocab-action-button {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 6px;
  border: 0;
  border-radius: 6px !important;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  cursor: pointer;
  font-size: var(--type-size-emphasis);
  line-height: 1;
  transition: transform .1s ease, background-color .2s ease;
}

body[data-view="vocab"] .vocab-action-button svg {
  width: 18px;
  height: 18px;
  display: block;
  overflow: visible;
}

body[data-view="vocab"] .vocab-action-button svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body[data-view="vocab"] .vocab-action-button.reader-speech-tool svg path:first-child {
  fill: currentColor;
  stroke: none;
}

body[data-view="vocab"] .vocab-action-button.reader-speech-tool svg path:last-child {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

body[data-view="vocab"] .vocab-action-button:hover {
  background: var(--vocab-avocado-light);
  transform: scale(1.05);
}

body[data-view="vocab"] .vocab-empty {
  color: var(--vocab-text-secondary);
}

body[data-view="vocab"] .vocab-review-primary {
  min-height: 560px;
  padding: 30px 40px 38px;
  border: 1px solid var(--vocab-border);
  border-radius: 12px !important;
  background: var(--vocab-bg);
}

body[data-view="vocab"] .vocab-review-primary.is-hidden {
  display: none;
}

body[data-view="vocab"] .vocab-section-page.is-reviewing .vocab-page-list,
body[data-view="vocab"] .vocab-section-page.is-reviewing .export-inline-status {
  display: none;
}

body[data-view="vocab"] .vocab-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 34px;
}

body[data-view="vocab"] .vocab-review-progress {
  color: var(--vocab-text-secondary);
  font-size: var(--type-size-body);
  font-weight: 700;
}

body[data-view="vocab"] .vocab-review-exit {
  min-height: 36px;
  padding: 8px 16px;
  border: 1px solid var(--vocab-border);
  border-radius: 999px !important;
  background: #fff;
  color: var(--vocab-text-main);
  cursor: pointer;
  font: inherit;
  font-size: var(--type-size-control);
  font-weight: 700;
}

body[data-view="vocab"] .flash-card-host {
  display: flex;
  flex-direction: column;
  align-items: center;
}

body[data-view="vocab"] .vocab-page-review .flash-stage {
  width: min(560px, 100%);
  height: min(320px, 44vh);
  min-height: 260px;
  border: 0;
  border-radius: 16px !important;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  outline: none;
  perspective: 1000px;
}

body[data-view="vocab"] .flash-stage:focus-visible .flash-face {
  border-color: var(--vocab-avocado-main);
  box-shadow: 0 0 0 4px rgba(122, 154, 91, .16), 0 10px 30px rgba(0,0,0,0.08);
}

body[data-view="vocab"] .flash-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .6s cubic-bezier(.4,.2,.2,1);
}

body[data-view="vocab"] .flash-stage.is-flipped .flash-card-inner {
  transform: rotateX(180deg);
}

body[data-view="vocab"] .flash-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 34px 42px;
  border: 2px solid transparent;
  border-radius: 16px !important;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  backface-visibility: hidden;
  transition: border-color .18s ease, box-shadow .18s ease;
}

body[data-view="vocab"] .flash-face:hover {
  border-color: var(--vocab-avocado-light);
}

body[data-view="vocab"] .flash-back {
  transform: rotateX(180deg);
  border-color: var(--vocab-avocado-light);
  background: #FAFCFA;
}

body[data-view="vocab"] .vocab-page-review .flash-word {
  color: #26313a;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: clamp(var(--type-size-hero-wide), 6.2vw, var(--type-size-step-62));
  font-weight: 800;
  line-height: 1.12;
  text-align: center;
}

body[data-view="vocab"] .vocab-page-review .flash-tap-hint {
  position: absolute;
  bottom: 24px;
  color: #bbbbbb;
  font-size: var(--type-size-control);
}

body[data-view="vocab"] .vocab-page-review .flash-reading {
  margin-top: 14px;
  color: #667066;
  font-size: clamp(var(--type-size-subtitle), 2.1vw, var(--type-size-step-22));
  font-weight: 700;
}

body[data-view="vocab"] .vocab-page-review .flash-meaning {
  max-width: 92%;
  margin-top: 12px;
  color: #667066;
  font-size: clamp(var(--type-size-subtitle), 2.1vw, var(--type-size-step-22));
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  overflow-wrap: anywhere;
}

body[data-view="vocab"] .vocab-page-review .rate-row {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 36px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .22s ease, transform .22s ease;
}

body[data-view="vocab"] .vocab-page-review .rate-row.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

body[data-view="vocab"] .vocab-page-review .rate-btn {
  min-width: 116px;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 999px !important;
  font-size: var(--type-size-body);
  font-weight: 700;
  cursor: pointer;
}

body[data-view="vocab"] .vocab-page-review .rate-again {
  background: #FCE8E8;
  color: #B44343;
}

body[data-view="vocab"] .vocab-page-review .rate-hard {
  background: #FFF4D8;
  color: #9B6A00;
}

body[data-view="vocab"] .vocab-page-review .rate-easy {
  background: #E8F5E9;
  color: #2E7D32;
}

body[data-view="vocab"] .vocab-page-review .flash-empty {
  width: min(600px, 100%);
  padding: 72px 24px;
  border: 1px solid var(--vocab-border);
  border-radius: 16px !important;
  background: #fff;
  color: var(--vocab-text-secondary);
  text-align: center;
}

@media (hover: none), (pointer: coarse) {
  body[data-view="vocab"] .vocab-row-actions {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-view="vocab"] .flash-card-inner {
    transition: opacity .2s ease;
    transform-style: flat;
  }

  body[data-view="vocab"] .flash-stage.is-flipped .flash-card-inner {
    transform: none;
  }

  body[data-view="vocab"] .flash-front {
    opacity: 1;
  }

  body[data-view="vocab"] .flash-stage.is-flipped .flash-front {
    opacity: 0;
  }

  body[data-view="vocab"] .flash-back {
    transform: none;
    opacity: 0;
  }

  body[data-view="vocab"] .flash-stage.is-flipped .flash-back {
    opacity: 1;
  }
}

@media (max-width: 900px) {
  body[data-view="vocab"] .vocab-filter-bar,
  body[data-view="vocab"] .vocab-select-filters {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body[data-view="vocab"] .vocab-section-page > .card-pad {
    padding: 22px 18px !important;
  }

  body[data-view="vocab"] .vocab-library-head {
    display: grid;
    gap: 12px;
  }

  body[data-view="vocab"] .vocab-list-header {
    display: none;
  }

  body[data-view="vocab"] .vocab-page-list .vocab-table-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
  }

  body[data-view="vocab"] .vocab-row-actions {
    grid-column: 2;
    grid-row: 1;
    opacity: 1;
  }

  body[data-view="vocab"] .vocab-review-primary {
    min-height: 520px;
    padding: 24px 16px 32px;
  }

  body[data-view="vocab"] .vocab-review-head {
    margin-bottom: 32px;
  }

  body[data-view="vocab"] .vocab-page-review .flash-stage {
    height: 280px;
    min-height: 240px;
  }

  body[data-view="vocab"] .flash-face {
    padding: 28px 22px;
  }

  body[data-view="vocab"] .vocab-page-review .flash-word {
    font-size: clamp(var(--type-size-step-34), 12vw, var(--type-size-step-52));
  }

  body[data-view="vocab"] .vocab-page-review .rate-row {
    flex-direction: column;
    width: min(280px, 100%);
  }

  body[data-view="vocab"] .vocab-page-review .rate-btn {
    width: 100%;
  }
}

/* 学习历史页面：按上传代码的数据中心视觉呈现 */
body[data-view="history"] {
  --history-avocado-main: #6750A4;
  --history-avocado-light: #EADDFF;
  --history-avocado-dark: #4F378B;
  --history-bg: #F8F6FE;
  --history-text-main: #333333;
  --history-text-sec: #666666;
  --history-border: #EEEEEE;
}

body[data-view="history"] .app-content {
  background: var(--history-bg);
}

body[data-view="history"] .history-section {
  width: 100%;
  max-width: 1000px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-view="history"] .history-section > .card-pad {
  padding: 0 !important;
}

body[data-view="history"] .history-data-center {
  width: 100%;
  color: var(--history-text-main);
  font-family: 'PingFang SC', 'Microsoft YaHei', var(--font-ui);
}

body[data-view="history"] .history-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

body[data-view="history"] .history-stat-card {
  padding: 24px;
  border: 0;
  border-radius: 12px !important;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

body[data-view="history"] .history-stat-title {
  margin-bottom: 12px;
  color: var(--history-text-sec);
  font-size: var(--type-size-control);
}

body[data-view="history"] .history-stat-value {
  margin-bottom: 8px;
  color: var(--history-avocado-dark);
  font-size: var(--type-size-display);
  font-weight: 700;
  line-height: 1;
}

body[data-view="history"] .history-stat-sub {
  color: #999999;
  font-size: var(--type-size-caption);
  line-height: 1.45;
}

body[data-view="history"] .history-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

body[data-view="history"] .history-diag-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

body[data-view="history"] .history-chart-card {
  padding: 24px;
  border: 0;
  border-radius: 12px !important;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

body[data-view="history"] .history-chart-card h3 {
  margin: 0 0 20px;
  color: var(--history-text-main);
  font-size: var(--type-size-emphasis);
  font-weight: 700;
  line-height: 1.35;
}

body[data-view="history"] .history-heatmap {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
}

body[data-view="history"] .history-heat-box {
  aspect-ratio: 1;
  border-radius: 4px !important;
  background: #EBEDF0;
}

body[data-view="history"] .history-heat-box.heat-1 {
  background: rgba(103, 80, 164, .18);
}

body[data-view="history"] .history-heat-box.heat-2 {
  background: rgba(103, 80, 164, .34);
}

body[data-view="history"] .history-heat-box.heat-3 {
  background: var(--history-avocado-main);
}

body[data-view="history"] .history-heat-box.heat-4 {
  background: var(--history-avocado-dark);
}

body[data-view="history"] .history-bar-chart {
  height: 120px;
  display: flex;
  align-items: flex-end;
  gap: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--history-border);
}

body[data-view="history"] .history-bar {
  flex: 1;
  min-height: 4px;
  border-radius: 4px 4px 0 0 !important;
  background: var(--history-avocado-light);
  transition: background-color .3s ease;
}

body[data-view="history"] .history-bar:hover,
body[data-view="history"] .history-bar.is-strong {
  background: var(--history-avocado-main);
}

body[data-view="history"] .history-bar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  color: var(--history-text-sec);
  font-size: var(--type-size-caption);
}

body[data-view="history"] .history-error-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

body[data-view="history"] .history-error-list li {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--history-border);
  color: var(--history-text-main);
  font-size: var(--type-size-control);
}

body[data-view="history"] .history-error-list li:last-child {
  border-bottom: 0;
}

body[data-view="history"] .history-error-list li span:last-child {
  flex: 0 0 auto;
  color: var(--history-text-sec);
}

body[data-view="history"] .history-level-badge {
  margin-bottom: 15px;
  padding: 20px;
  border-radius: 8px !important;
  background: var(--history-avocado-light);
  color: var(--history-avocado-dark);
  font-size: var(--type-size-feature-title);
  font-weight: 700;
  text-align: center;
}

body[data-view="history"] #historyLevelAdvice {
  margin: 0;
  color: var(--history-text-sec);
  font-size: var(--type-size-meta);
  line-height: 1.5;
}

body[data-view="reading"] .reader-tool-popover.reader-font-popover {
  right: auto;
  left: 0;
  top: calc(100% + 4px);
  width: 332px;
  max-width: calc(100vw - 48px);
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px !important;
  background: #FFFFFF;
  box-shadow: 0 8px 20px rgba(32, 40, 45, 0.08);
}

body[data-view="reading"] .reader-tool-popover.reader-font-popover::before,
body[data-view="reading"] .reader-tool-popover.reader-font-popover::after {
  position: absolute;
  left: 11px;
  width: 0;
  height: 0;
  border-right: 6px solid transparent;
  border-left: 6px solid transparent;
  content: "";
}

body[data-view="reading"] .reader-tool-popover.reader-font-popover::before {
  top: -7px;
  border-bottom: 7px solid var(--line);
}

body[data-view="reading"] .reader-tool-popover.reader-font-popover::after {
  top: -6px;
  border-bottom: 7px solid #FFFFFF;
}

body[data-view="reading"] .reader-font-popover .font-size-grid {
  gap: 10px;
}

body[data-view="reading"] .reader-font-popover .font-size-row {
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin: 0;
}

body[data-view="reading"] .reader-font-popover .font-size-row-label {
  color: #555555;
  white-space: nowrap;
}

body[data-view="reading"] .reader-font-popover .font-size-stepper {
  gap: 8px;
  padding: 5px 7px;
}

body[data-view="reading"] .reader-font-popover .font-size-stepper-btn {
  width: 58px;
  height: 40px;
  flex: 0 0 58px;
}

body[data-view="reading"] .reading-output {
  line-height: var(--reading-line-height, 1.8) !important;
}

@media (max-width: 520px) {
  .reading-display-modal {
    padding: 10px;
  }

  .reading-display-dialog {
    width: min(100%, calc(100vw - 20px));
    max-height: calc(100vh - 20px);
  }

  .reading-display-head {
    min-height: 58px;
    margin: 0 16px;
  }

  .reading-display-head strong {
    font-size: var(--type-size-subtitle);
  }

  .reading-display-body {
    gap: 12px;
    padding: 14px 16px 10px;
  }

  .reading-display-presets {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .reading-display-preset-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .reading-display-row {
    grid-template-columns: 1fr 68px;
    gap: 6px 10px;
  }

  .reading-display-row > span {
    grid-column: 1 / -1;
  }

  .reading-display-preview {
    min-height: 76px;
    align-items: center;
    gap: 14px;
    padding: 12px;
    font-size: min(var(--preview-base-font, var(--type-size-step-22)), var(--type-size-step-22));
  }

  .reading-display-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px 16px;
  }

  .reading-display-actions .btn-secondary:first-child {
    grid-column: 1 / -1;
  }

  body[data-view="reading"] .reader-tool-popover.reader-font-popover {
    left: 50%;
    width: min(360px, calc(100vw - 32px));
    max-width: none;
    transform: translateX(-50%);
  }

  body[data-view="reading"] .reader-tool-popover.reader-font-popover::before,
  body[data-view="reading"] .reader-tool-popover.reader-font-popover::after {
    left: calc(50% - 6px);
  }

  body[data-view="reading"] .reader-font-popover .font-size-row {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 8px;
  }

  body[data-view="reading"] .reader-font-popover .font-size-stepper {
    gap: 4px;
    padding-inline: 5px;
  }

  body[data-view="reading"] .reader-font-popover .font-size-stepper-btn {
    width: 52px;
    flex-basis: 52px;
  }
}

/* 设置与帮助抽屉 */
.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 220;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0 !important;
  background: rgba(32, 36, 34, 0.34);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

body.menu-open::after {
  display: none;
}

body.menu-open .menu-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.menu-panel {
  top: 0;
  right: 0;
  width: 380px;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--line);
  background: var(--paper, #FFFFFF);
  box-shadow: -10px 0 30px rgba(33, 37, 41, 0.1);
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.menu-panel.active {
  right: 0;
  transform: translateX(0);
}

.menu-panel .menu-header {
  flex: 0 0 auto;
  align-items: flex-start;
  margin: 0;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}

.menu-header-titles {
  display: grid;
  gap: 4px;
}

.menu-header-titles .module-kicker {
  color: var(--muted);
  font-size: var(--type-size-micro);
  letter-spacing: 1px;
}

.menu-header-titles strong {
  color: var(--sumi);
  font-size: var(--type-size-section-title);
  font-weight: 650;
}

.menu-close-button {
  width: 36px;
  height: 36px;
  min-width: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.menu-close-button:hover {
  background: var(--accent-soft);
  color: var(--sumi);
}

.menu-close-button svg,
.menu-language-setting svg,
.menu-action-icon svg,
.menu-link-item > svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu-content {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 24px;
  overflow-y: auto;
}

.menu-setting-group {
  display: grid;
  gap: 14px;
}

.menu-setting-group h3 {
  margin: 0;
  color: var(--muted);
  font-size: var(--type-size-caption);
  font-weight: 700;
}

.menu-panel .menu-storage-status {
  gap: 8px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  background: #F7F9F6;
}

.menu-status-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu-status-title b {
  color: var(--sumi);
  font-size: var(--type-size-control);
}

.menu-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(47, 111, 98, 0.1);
}

.menu-panel .menu-storage-status p {
  margin: 0;
  color: var(--muted);
  font-size: var(--type-size-caption);
  line-height: 1.6;
}

.menu-panel .menu-language-setting {
  gap: 9px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.menu-panel .menu-language-setting label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--sumi);
  font-size: var(--type-size-control);
  font-weight: 650;
}

.menu-panel .menu-language-setting label svg {
  color: var(--accent);
}

.menu-panel .menu-language-setting select {
  min-height: 44px;
  padding: 0 40px 0 12px;
  border-color: var(--line);
  font-size: var(--type-size-control);
}

.menu-panel .menu-language-setting small,
.menu-action-button small,
.menu-link-item small {
  color: var(--muted);
  font-size: var(--type-size-micro);
  font-weight: 450;
  line-height: 1.5;
}

.menu-action-list {
  display: grid;
  gap: 10px;
}

.menu-action-button {
  width: 100%;
  min-height: 72px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  background: #FFFFFF;
  color: var(--sumi);
  text-align: left;
}

.menu-action-button:hover {
  border-color: var(--accent);
  background: #FAFCFA;
}

.menu-action-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
}

.menu-action-button > span:last-child,
.menu-link-item > span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.menu-action-button b,
.menu-link-item b {
  font-size: var(--type-size-control);
  font-weight: 650;
}

.menu-link-list {
  display: grid;
}

.menu-link-item {
  width: 100%;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0 !important;
  background: transparent;
  color: var(--sumi);
  text-align: left;
}

button.menu-link-item:hover {
  color: var(--accent);
}

.menu-link-item > svg {
  flex: 0 0 auto;
  color: #A8AEAA;
}

.menu-version-row {
  border-bottom: 0;
}

/* 首次进入页：主操作与辅助操作分层 */
body.first-visit .hero-title > span {
  color: var(--accent);
}

body.first-visit .hero-intro {
  max-width: 960px;
  padding-top: 86px;
  padding-right: 24px;
  padding-bottom: 96px;
  padding-left: 24px;
}

body.first-visit .hero-input {
  width: 100%;
  max-width: 900px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  position: relative;
  margin: 0 auto 18px;
  padding: var(--space-6);
  overflow: visible;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md) !important;
  background: var(--color-paper);
  box-shadow: var(--shadow-popover);
}

body.first-visit .hero-input textarea {
  flex: 1 1 auto;
  width: 100%;
  min-height: 185px;
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md) !important;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--type-size-section-title);
  line-height: 1.7;
  box-shadow: none;
}

body.first-visit .hero-input textarea::placeholder {
  color: var(--color-text-muted);
  opacity: 1;
}

body.first-visit .hero-input textarea:hover {
  background: var(--color-surface);
}

body.first-visit .hero-input textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(47, 111, 98, .12);
}

body.first-visit .hero-actions {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 0 0 0 2px;
  flex-wrap: wrap;
}

body.first-visit .hero-secondary-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

body.first-visit .hero-text-action {
  min-width: 146px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md) !important;
  background: var(--color-paper);
  color: var(--color-text-soft) !important;
  font-size: var(--text-md);
  font-weight: 700;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}

body.first-visit .hero-text-action:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-primary) !important;
}

body.first-visit .hero-text-action svg,
body.first-visit .hero-features svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.first-visit .hero-actions .btn-primary.btn--large {
  min-width: 174px;
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0 26px;
  border: 0;
  border-radius: var(--radius-md) !important;
  background: var(--color-primary);
  color: #fff;
  font-size: var(--type-size-body-large);
  font-weight: 700;
  box-shadow: var(--shadow-popover);
}

body.first-visit .hero-actions .btn-primary.btn--large:hover {
  background: var(--color-primary-strong);
}

body.first-visit .hero-actions .hero-start-button[aria-disabled="true"] {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-popover);
}

body.first-visit .hero-actions .hero-start-button[aria-disabled="true"]:hover {
  background: var(--color-primary-strong);
}

body.first-visit .hero-actions .hero-start-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.first-visit .hero-input-hint {
  display: none;
}

body.first-visit .hero-guide-prompt {
  display: none;
}

body.first-visit .hero-mascot-dock {
  display: none;
}

body.first-visit .hero-bubble {
  display: none;
}

body.first-visit .hero-mascot {
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border: 2px solid #DCD9CC;
  border-radius: 50%;
  background: #FFFFFF;
  color: transparent;
  box-shadow: none;
  font-family: var(--font-reading);
  font-size: var(--type-size-meta);
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
}

body.first-visit .hero-features {
  display: none !important;
}

body.first-visit .hero-features > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  white-space: nowrap;
}

body.first-visit .hero-features > span::before {
  display: none;
}

body.first-visit .hero-features svg {
  color: var(--accent);
}

body.first-visit .hero-flow {
  max-width: 900px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin: 38px auto 0;
  text-align: center;
}

body.first-visit .hero-flow-item {
  display: grid;
  grid-template-rows: minmax(210px, auto) auto;
  overflow: hidden;
  border: 1px solid rgba(222, 221, 211, 0.95);
  border-radius: 18px;
  background: #FFFFFF;
  box-shadow: 0 8px 28px rgba(22, 54, 44, 0.05);
}

body.first-visit .hero-flow-item:hover {
  box-shadow: 0 8px 28px rgba(22, 54, 44, 0.05);
  transform: none;
}

body.first-visit .hero-flow-item:nth-child(3) {
  grid-column: 1 / -1;
}

body.first-visit .hero-flow-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  border-top: 1px solid rgba(222, 221, 211, 0.85);
  background: #FBFBFA;
}

body.first-visit .hero-flow-copy h2 {
  margin: 0;
  color: #43766C;
  font-family: var(--font-ui);
  font-size: var(--type-size-body);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.4;
  writing-mode: horizontal-tb;
}

body.first-visit .hero-mini-reader,
body.first-visit .hero-mini-card,
body.first-visit .hero-mini-practice {
  width: 100%;
  min-height: 210px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: #FFFFFF;
  color: var(--sumi) !important;
  font-size: var(--type-size-emphasis) !important;
  font-weight: 750;
}

body.first-visit .hero-demo-reader {
  min-height: 210px;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 36px 28px;
}

body.first-visit .hero-demo-reader p {
  margin: 0;
  color: #2C3E2E;
  font-family: var(--font-ui);
  font-size: clamp(var(--type-size-subtitle), 2vw, var(--type-size-feature-title));
  font-weight: 500;
  line-height: 1.9;
  text-align: center;
}

.hero-target-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: baseline;
}

.hero-pointer {
  display: none;
}

@keyframes heroPointerFloat {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -7px); }
}

body.first-visit .hero-demo-token {
  position: relative;
  min-height: 0;
  display: inline-grid;
  place-items: center;
  margin: 0 6px;
  padding: 7px 14px;
  border: 0;
  border-radius: 8px !important;
  background: #2F6F62;
  color: #FFFFFF;
  font-family: var(--font-reading);
  font-size: 1em;
  font-weight: 600;
  cursor: default;
  line-height: 1;
  box-shadow: none;
}

body.first-visit .hero-demo-token:hover,
body.first-visit .hero-demo-reader.is-active .hero-demo-token {
  background: #2F6F62;
  box-shadow: none;
  transform: none;
}

body.first-visit .hero-demo-token span {
  color: #FFFFFF;
  font-size: 1em;
  line-height: 1;
}

body.first-visit .hero-demo-token small {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  max-height: none;
  padding: 0 6px;
  overflow: visible;
  color: #2F6F62;
  font-family: var(--font-display);
  font-size: var(--type-size-meta);
  font-weight: 700;
  line-height: 1.2;
  opacity: 1;
  transform: translateX(-50%);
  transition: none;
}

body.first-visit .hero-demo-reader.is-active .hero-demo-token small {
  opacity: 1;
  transform: translateX(-50%);
}

body.first-visit .hero-demo-detail {
  max-height: 0;
  display: grid;
  justify-self: center;
  gap: 4px;
  overflow: hidden;
  min-width: min(300px, 100%);
  padding: 0 18px;
  border-radius: 10px;
  background: #F4F8F5;
  color: #5F645F;
  font-size: var(--type-size-control);
  opacity: 0;
  transition: max-height .18s ease, opacity .18s ease, padding .18s ease;
}

body.first-visit .hero-demo-reader.is-active .hero-demo-detail {
  max-height: 76px;
  padding: 12px 18px;
  opacity: 1;
}

body.first-visit .hero-demo-detail strong {
  color: #43766C;
  font-size: var(--type-size-body);
}

body.first-visit .hero-mini-reader i {
  display: block;
  margin-top: -4px;
  color: var(--accent);
  font-style: normal;
  font-size: var(--type-size-micro);
}

body.first-visit .hero-mini-card {
  min-height: 210px;
  align-content: center;
  gap: 22px;
  padding: 36px 28px;
  background: #FFFFFF;
  color: #2C3E2E !important;
  font-family: var(--font-ui);
}

body.first-visit .hero-demo-flashcard p {
  margin: 0;
  color: #2C3E2E;
  font-size: clamp(var(--type-size-subtitle), 2vw, var(--type-size-feature-title));
  font-weight: 500;
  line-height: 1.45;
  text-align: center;
}

body.first-visit .hero-card-options {
  width: min(580px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

body.first-visit .hero-card-options span {
  min-height: 60px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px !important;
  color: #43766C;
  font-size: clamp(var(--type-size-subtitle), 2vw, var(--type-size-step-22));
  font-weight: 700;
  box-shadow: none;
}

body.first-visit .hero-card-options span:first-child {
  background: #43766C;
  color: #FFFFFF;
}

body.first-visit .hero-card-options span:last-child {
  background: #E8EDE9;
  color: #43766C;
}

body.first-visit .hero-demo-flashcard > small {
  display: none;
}

body.first-visit .hero-mini-practice {
  min-height: 210px;
  align-content: center;
  gap: 18px;
  padding: 36px 28px;
  background: #FFFFFF;
  color: #5F645F !important;
  font-size: var(--type-size-meta) !important;
}

body.first-visit .hero-demo-practice > span {
  color: #2C3E2E;
  font-family: var(--font-reading);
  font-size: clamp(var(--type-size-subtitle), 2vw, var(--type-size-feature-title));
  text-align: center;
}

body.first-visit .hero-demo-practice div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: min(380px, 100%);
}

body.first-visit .hero-demo-practice .hero-practice-answer,
body.first-visit .hero-demo-practice .hero-practice-result {
  min-width: 0;
  min-height: 48px;
  display: grid;
  place-items: center;
  padding: 0 16px;
  border: 2px solid #C4D4CB;
  border-radius: 12px;
  background: #F4F8F5;
  color: #43766C;
  font-family: var(--font-reading);
  font-size: var(--type-size-subtitle);
  text-align: center;
}

body.first-visit .hero-demo-practice .hero-practice-result {
  border: 0;
  background: var(--color-primary);
  color: #fff;
}

@media (max-width: 720px) {
  body.first-visit .hero-intro {
    padding-right: 14px;
    padding-left: 14px;
  }

  body.first-visit .hero-input {
    width: 100%;
    min-height: 430px;
    padding: var(--space-5);
    border-radius: var(--radius-md) !important;
  }

  body.first-visit .hero-input textarea {
    min-height: 250px;
    padding: var(--space-3);
    font-size: var(--type-size-subtitle);
  }

  body.first-visit .hero-text-action {
    min-width: 0;
    min-height: 50px;
    padding: 0 18px;
    font-size: var(--text-md);
  }

  body.first-visit .hero-text-action svg,
  body.first-visit .hero-features svg {
    width: 20px;
    height: 20px;
  }

  body.first-visit .hero-actions .btn-primary.btn--large {
    min-height: 58px;
    font-size: var(--type-size-subtitle);
  }

  body.first-visit .hero-mascot-dock {
    display: none;
  }

  body.first-visit .hero-features {
    display: none !important;
  }

  body.first-visit .hero-flow {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  body.first-visit .hero-flow-item {
    grid-column: auto;
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(180px, auto) auto;
    gap: 16px;
    border-radius: 16px;
  }

  body.first-visit .hero-flow-copy {
    min-height: 46px;
    border-right: 0;
    border-top: 1px solid rgba(222, 221, 211, 0.85);
    border-bottom: 0;
  }

  body.first-visit .hero-flow-copy h2 {
    writing-mode: horizontal-tb;
    letter-spacing: 1px;
  }

  body.first-visit .hero-demo-reader,
  body.first-visit .hero-mini-card,
  body.first-visit .hero-mini-practice {
    min-height: 0;
    padding: 34px 18px;
  }

  body.first-visit .hero-card-options {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  body.first-visit .hero-card-options span {
    min-height: 64px;
  }
}

@media (max-width: 520px) {
  body.first-visit .hero-input {
    padding: var(--space-4);
    border-radius: var(--radius-md) !important;
    min-height: 0;
  }

  body.first-visit .hero-input textarea {
    min-height: 190px;
    padding: var(--space-3);
    font-size: var(--type-size-body-large);
  }

  body.first-visit .hero-actions {
    display: grid;
    gap: 10px;
    padding: 8px 10px 12px;
  }

  body.first-visit .hero-actions .btn-primary.btn--large {
    width: 100%;
    min-width: 0;
    grid-row: 1;
  }

  body.first-visit .hero-secondary-actions {
    justify-content: center;
    grid-row: 2;
  }

  body.first-visit .hero-text-action {
    width: 100%;
  }

  body.first-visit .hero-input-hint {
    margin-top: -4px;
    padding: 0 10px 10px;
  }

  .hero-guide-prompt {
    margin-right: 10px;
    margin-left: 10px;
    border-radius: 14px;
    flex-wrap: wrap;
  }

  body.first-visit .hero-features {
    display: none !important;
  }

  body.first-visit .hero-features > span {
    white-space: normal;
  }

  body.first-visit .hero-demo-practice div {
    grid-template-columns: 1fr;
  }

  .menu-panel {
    width: 100vw;
    border-left: 0;
  }

  .menu-panel .menu-header,
  .menu-content {
    padding-right: 20px;
    padding-left: 20px;
  }
}

@media (max-width: 960px) {
  body[data-view="history"] .history-stats-grid,
  body[data-view="history"] .history-charts-grid,
  body[data-view="history"] .history-diag-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  body[data-view="history"] .history-stats-grid,
  body[data-view="history"] .history-charts-grid,
  body[data-view="history"] .history-diag-grid {
    grid-template-columns: 1fr;
  }

  body[data-view="history"] .history-error-list li {
    display: grid;
    gap: 4px;
  }
}

/* 手机端：顶部品牌栏 + 底部导航，避免桌面侧栏在窄屏挤压内容 */
@media (max-width: 720px) {
  body:not(.first-visit) {
    background: var(--kinari);
  }

  body:not(.first-visit) .app-interface {
    display: block;
    min-height: 100vh;
    padding-top: 64px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  body:not(.first-visit) .app-sidebar {
    position: fixed !important;
    inset: 0;
    z-index: 220;
    width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 100vh;
    display: block;
    padding: 0 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    pointer-events: none;
    transform: none !important;
  }

  body:not(.first-visit) .sidebar-brand {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 225;
    width: 100%;
    height: 64px;
    min-width: 0;
    display: flex !important;
    align-items: center;
    gap: 10px;
    margin: 0 !important;
    padding: 0 64px 0 14px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--line) !important;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 24px rgba(32, 40, 45, 0.06);
    backdrop-filter: blur(16px);
    pointer-events: auto;
  }

  body:not(.first-visit) .brand-mini {
    min-width: 0;
    gap: 9px;
  }

  body:not(.first-visit) .brand-mark {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
  }

  body:not(.first-visit) .brand-text {
    max-width: 120px;
    overflow: hidden;
    color: var(--sumi);
    font-size: var(--type-size-body-large);
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body:not(.first-visit) .sidebar-toggle-button,
  body:not(.first-visit) .sidebar-restore-button,
  body:not(.first-visit) .global-search {
    display: none !important;
  }

  body:not(.first-visit) .sidebar-footer {
    position: fixed;
    top: 13px;
    right: 14px;
    z-index: 235;
    width: 38px;
    height: 38px;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: auto;
  }

  body:not(.first-visit) .sidebar-utility-button {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    display: grid;
    place-items: center;
    padding: 0 !important;
    border: 1px solid var(--line);
    border-radius: 12px !important;
    background: #fff;
    box-shadow: none;
    font-size: 0;
  }

  body:not(.first-visit) .sidebar-utility-button > span:not(.sidebar-utility-mark) {
    display: none;
  }

  body:not(.first-visit) .sidebar-utility-mark {
    width: auto;
    height: auto;
    background: transparent;
    color: var(--accent);
    font-size: var(--type-size-body);
    font-weight: 750;
  }

  body:not(.first-visit) .sidebar-nav {
    position: fixed;
    top: auto !important;
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
    z-index: 230;
    width: auto;
    height: 62px;
    display: none !important;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 2px;
    margin: 0 !important;
    padding: 6px;
    overflow: visible;
    border: 1px solid rgba(219, 224, 220, 0.9);
    border-radius: 18px !important;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 14px 34px rgba(32, 40, 45, 0.14);
    backdrop-filter: blur(18px);
    pointer-events: auto;
  }

  body:not(.first-visit) .nav-item {
    width: 100%;
    min-width: 0;
    height: 50px;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    margin: 0 !important;
    padding: 4px 2px !important;
    border-radius: 13px !important;
    font-size: var(--type-size-ruby);
    line-height: 1.1;
    white-space: normal;
  }

  body:not(.first-visit) .nav-item.active {
    background: var(--accent-soft);
    color: var(--accent);
  }

  body:not(.first-visit) .nav-item::after,
  body:not(.first-visit) .nav-item::before {
    display: none !important;
  }

  body:not(.first-visit) .nav-icon {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    margin: 0;
  }

  body:not(.first-visit) .nav-icon svg {
    width: 19px;
    height: 19px;
  }

  body:not(.first-visit) .nav-label {
    max-width: 100%;
    display: block;
    overflow: hidden;
    font-size: var(--type-size-ruby);
    font-weight: 650;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body:not(.first-visit) .app-content,
  body.sidebar-collapsed:not(.first-visit) .app-content {
    width: 100% !important;
    min-width: 0;
    margin-left: 0 !important;
    padding: 16px 14px calc(28px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body:not(.first-visit) .reading-workbench,
  body[data-view="reading"].has-reading .reading-workbench {
    max-width: none !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px;
  }

  body:not(.first-visit) .reading-main,
  body:not(.first-visit) .reading-side .card,
  body:not(.first-visit) .vocab-section-page,
  body:not(.first-visit) .grammar-section,
  body:not(.first-visit) .retell-section,
  body:not(.first-visit) .discover-section,
  body:not(.first-visit) .test-section,
  body:not(.first-visit) .history-section,
  body:not(.first-visit) .settings-section {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
  }
}

@media (max-width: 900px) {
  body[data-view="retell"] .typing-grid,
  body[data-view="discover"] .discover-sources,
  .settings-page-grid {
    grid-template-columns: 1fr;
  }

  body[data-view="retell"] .typing-side {
    order: -1;
  }

  body[data-view="retell"] .typing-list {
    max-height: 190px;
  }
}

@media (max-width: 640px) {
  body[data-view="retell"] .practice-start-row {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body[data-view="retell"] .practice-start-row button {
    min-width: 0;
    padding-inline: 6px;
  }

  body[data-view="retell"] .reading-quiz-panel,
  body[data-view="retell"] .typing-main,
  body[data-view="retell"] .typing-side,
  body[data-view="retell"] .retell-source-card,
  .settings-page-card {
    padding: 14px;
  }

  body[data-view="retell"] .retell-source-text {
    max-height: 210px;
    padding: 14px;
    font-size: var(--type-size-emphasis);
  }

  body[data-view="retell"] .typing-input {
    min-height: 150px;
    font-size: var(--type-size-emphasis);
  }

  body[data-view="discover"] .source-level-tabs,
  body[data-view="discover"] .source-type-tabs,
  body[data-view="discover"] .source-quick-loop {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  body[data-view="discover"] .source-level-tabs button,
  body[data-view="discover"] .source-type-tabs button,
  body[data-view="discover"] .source-quick-loop button {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

/* 闪卡复习：聚焦学习动作，桌面/手机都保持稳定居中 */
body[data-view="vocab"] .vocab-review-primary {
  min-height: clamp(520px, calc(100vh - 160px), 720px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-items: stretch;
  padding: clamp(22px, 3vw, 40px);
  border-color: rgba(219, 224, 220, 0.9);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.74), rgba(255,255,255,0.34)),
    var(--vocab-bg);
}

body[data-view="vocab"] .vocab-review-head {
  min-height: 42px;
  align-items: center;
  margin-bottom: clamp(20px, 3vh, 34px);
}

body[data-view="vocab"] .vocab-review-progress {
  min-width: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border: 1px solid var(--vocab-border);
  border-radius: 999px !important;
  background: rgba(255,255,255,0.88);
  color: var(--vocab-avocado-dark);
  line-height: 1.2;
}

body[data-view="vocab"] .vocab-review-exit {
  min-width: 86px;
  color: var(--vocab-text-secondary);
  transition: border-color .18s ease, color .18s ease, background-color .18s ease;
}

body[data-view="vocab"] .vocab-review-exit:hover,
body[data-view="vocab"] .vocab-review-exit:focus-visible {
  border-color: rgba(122, 154, 91, 0.42);
  background: #fff;
  color: var(--vocab-avocado-dark);
  outline: none;
}

body[data-view="vocab"] .flash-card-host {
  min-height: 0;
  justify-content: center;
  gap: clamp(20px, 4vh, 34px);
}

body[data-view="vocab"] .vocab-page-review .flash-stage {
  width: min(620px, 100%);
  height: clamp(280px, 43vh, 380px);
  min-height: 280px;
  max-height: 380px;
}

body[data-view="vocab"] .flash-face {
  padding: clamp(30px, 5vw, 52px);
  border: 1px solid rgba(219, 224, 220, 0.96);
  box-shadow: 0 18px 42px rgba(32, 40, 45, 0.10);
}

body[data-view="vocab"] .flash-back {
  background:
    radial-gradient(circle at 50% 18%, rgba(233, 238, 217, 0.72), transparent 42%),
    #FAFCFA;
}

body[data-view="vocab"] .vocab-page-review .flash-word {
  font-size: clamp(var(--type-size-step-42), 5.6vw, var(--type-size-step-68));
  letter-spacing: 0;
}

body[data-view="vocab"] .vocab-page-review .flash-reading {
  min-height: 1.4em;
  margin-top: 18px;
  color: #6B716D;
  font-size: clamp(var(--type-size-subtitle), 2vw, var(--type-size-step-23));
}

body[data-view="vocab"] .vocab-page-review .flash-meaning {
  max-width: min(460px, 92%);
  margin-top: 14px;
  color: var(--vocab-avocado-dark);
  font-size: clamp(var(--type-size-subtitle), 2.2vw, var(--type-size-step-25));
}

body[data-view="vocab"] .vocab-page-review .flash-tap-hint {
  bottom: 26px;
  color: #9EA49F;
  font-size: var(--type-size-meta);
}

body[data-view="vocab"] .vocab-page-review .rate-row {
  width: min(520px, 100%);
  margin-top: 0;
  padding: 4px;
  border: 1px solid rgba(219, 224, 220, 0.76);
  border-radius: 999px !important;
  background: rgba(255,255,255,0.82);
}

body[data-view="vocab"] .vocab-page-review .rate-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 46px;
  border-radius: 999px !important;
  transition: transform .16s ease, filter .16s ease;
}

body[data-view="vocab"] .vocab-page-review .rate-btn:hover,
body[data-view="vocab"] .vocab-page-review .rate-btn:focus-visible {
  filter: saturate(1.05);
  outline: none;
  transform: translateY(-1px);
}

@media (max-width: 720px) {
  body[data-view="vocab"] .vocab-review-primary {
    min-height: calc(100vh - 188px);
    min-height: calc(100dvh - 188px);
    padding: 16px 14px calc(88px + env(safe-area-inset-bottom, 0px));
  }

  body[data-view="vocab"] .vocab-review-head {
    margin-bottom: 14px;
  }

  body[data-view="vocab"] .vocab-review-progress {
    min-width: 56px;
    padding: 6px 10px;
    font-size: var(--type-size-meta);
  }

  body[data-view="vocab"] .vocab-review-exit {
    min-width: 72px;
    min-height: 34px;
    padding: 7px 12px;
    font-size: var(--type-size-meta);
  }

  body[data-view="vocab"] .flash-card-host {
    gap: 18px;
    justify-content: start;
  }

  body[data-view="vocab"] .vocab-page-review .flash-stage {
    width: 100%;
    height: min(330px, 42vh);
    min-height: 260px;
  }

  body[data-view="vocab"] .flash-face {
    padding: 30px 22px;
    box-shadow: 0 14px 30px rgba(32, 40, 45, 0.10);
  }

  body[data-view="vocab"] .vocab-page-review .flash-word {
    font-size: clamp(var(--type-size-step-40), 13vw, var(--type-size-step-58));
  }

  body[data-view="vocab"] .vocab-page-review .flash-tap-hint {
    bottom: 20px;
    font-size: var(--type-size-caption);
  }

  body[data-view="vocab"] .vocab-page-review .rate-row {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 0;
    border: 0;
    border-radius: 0 !important;
    background: transparent;
  }

  body[data-view="vocab"] .vocab-page-review .rate-btn {
    width: 100%;
    min-height: 44px;
    box-shadow: none;
  }
}

/* 手机端二轮体检：弹窗、字号面板、闪卡和底部导航的窄屏保护 */
@media (max-width: 720px) {
  .export-modal {
    align-items: flex-end;
    padding: 10px 10px calc(88px + env(safe-area-inset-bottom, 0px));
  }

  .export-dialog {
    width: min(100%, 520px);
    max-height: min(82vh, calc(100dvh - 116px - env(safe-area-inset-bottom, 0px)));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 12px !important;
  }

  .export-head {
    flex: 0 0 auto;
    padding: 14px 16px;
  }

  .export-head strong {
    min-width: 0;
    overflow: hidden;
    font-size: var(--type-size-emphasis);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .export-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 14px 16px;
    overflow-y: auto;
  }

  .export-actions {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px 16px;
  }

  .retell-permission-dialog {
    width: 100%;
  }

  .retell-permission-steps {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .retell-permission-steps span {
    min-height: 48px;
    grid-template-columns: 28px 1fr;
    align-items: center;
  }

  #importPreviewText {
    min-height: min(42vh, 260px) !important;
    max-height: 46vh;
    resize: vertical;
  }

  .clean-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .clean-actions .btn-secondary {
    min-width: 0;
    white-space: normal;
  }

  .import-preview-summary {
    gap: 6px;
  }

  .import-preview-summary span {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  body[data-view="reading"] .reader-tool-popover.reader-font-popover {
    width: min(340px, calc(100vw - 24px));
    padding: 12px;
  }

  body[data-view="reading"] .reader-font-popover .font-size-row {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  body[data-view="reading"] .reader-font-popover .font-size-stepper-value {
    min-width: 34px;
  }
}

@media (max-width: 430px) {
  body:not(.first-visit) .sidebar-nav {
    left: 8px;
    right: 8px;
    height: 58px;
    padding: 5px;
  }

  body:not(.first-visit) .nav-item {
    height: 48px;
    min-height: 48px;
    gap: 2px;
  }

  body:not(.first-visit) .nav-icon,
  body:not(.first-visit) .nav-icon svg {
    width: 18px;
    height: 18px;
  }

  body:not(.first-visit) .nav-label {
    font-size: var(--type-size-step-09);
  }

  body[data-view="vocab"] .vocab-review-primary {
    padding: 12px 10px calc(82px + env(safe-area-inset-bottom, 0px));
  }

  body[data-view="vocab"] .vocab-review-head {
    margin-bottom: 10px;
  }

  body[data-view="vocab"] .flash-card-host {
    gap: 12px;
  }

  body[data-view="vocab"] .vocab-page-review .flash-stage {
    height: min(286px, 38vh);
    min-height: 220px;
  }

  body[data-view="vocab"] .flash-face {
    padding: 24px 18px;
  }

  body[data-view="vocab"] .vocab-page-review .flash-word {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: clamp(var(--type-size-display), 12vw, var(--type-size-step-48));
  }

  body[data-view="vocab"] .vocab-page-review .flash-reading {
    font-size: var(--type-size-emphasis);
  }

  body[data-view="vocab"] .vocab-page-review .flash-meaning {
    max-width: 100%;
    font-size: var(--type-size-body-large);
  }

  body[data-view="vocab"] .vocab-page-review .rate-row {
    gap: 6px;
  }

  body[data-view="vocab"] .vocab-page-review .rate-btn {
    min-height: 40px;
  }
}

/* 2026-07-12 Safari 与手机端布局收口 */
#importPreviewModal .export-dialog {
  width: min(860px, calc(100vw - 48px));
  max-width: 860px;
  overflow: hidden;
}

#importPreviewModal .export-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

#importPreviewText {
  display: block;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  resize: vertical;
}

@media (max-width: 720px) {
  body.first-visit .hero-intro {
    width: 100%;
    padding-right: 16px;
    padding-left: 16px;
    box-sizing: border-box;
  }

  body.first-visit .hero-input {
    padding: 16px;
  }

  body.first-visit .hero-actions {
    grid-template-columns: 1fr;
    padding-right: 0;
    padding-left: 0;
  }

  body.first-visit .hero-secondary-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    justify-content: stretch;
  }

  body.first-visit .hero-secondary-actions > *,
  body.first-visit .hero-text-action {
    width: 100%;
    min-width: 0;
  }

  body:not(.first-visit) .app-content,
  body.sidebar-collapsed:not(.first-visit) .app-content {
    padding-right: 16px !important;
    padding-left: 16px !important;
  }

  body[data-view="reading"] .reader-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 8px;
    overflow: visible;
    flex-wrap: wrap;
  }

  body[data-view="reading"] .reader-tool-group,
  body[data-view="reading"] .reader-tool-group-end {
    display: flex;
    flex: 0 1 auto;
    min-width: 0;
    margin-left: 0;
    flex-wrap: wrap;
  }

  body[data-view="reading"] .reader-tool-group-end {
    padding-top: 0;
  }

  body[data-view="reading"] .reading-main .card-pad {
    padding: 12px;
  }

  body[data-view="reading"] .reading-output {
    padding: 20px 18px;
  }

  #importPreviewModal {
    padding-right: 12px;
    padding-left: 12px;
  }

  #importPreviewModal .export-dialog {
    width: 100%;
    max-width: 560px;
  }
}

@media (max-width: 430px) {
  body[data-view="reading"] .reader-toolbar {
    gap: 6px;
  }

  body[data-view="reading"] .reader-tool-group {
    gap: 5px;
  }

  body[data-view="reading"] .reader-tool,
  body[data-view="reading"] .reader-tool-details > summary {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }

  body[data-view="reading"] .reader-tool-wide {
    width: auto;
    min-width: 72px;
    padding-right: 12px !important;
    padding-left: 12px !important;
  }

  body[data-view="reading"] .reader-tool-divider {
    display: none;
  }

  body[data-view="reading"] .reading-output {
    padding: 18px 16px;
  }
}

/* Real-device follow-up: align the generated markup with the mobile rules. */
.reading-display-preset-grid button.is-selected {
  border-color: transparent !important;
  background: #6F50B7 !important;
  color: #fff !important;
}

@media (max-width: 900px) {
  body[data-view="retell"] .typing-side { order: initial; }
}

@media (max-width: 720px) {
  .export-actions .export-status {
    grid-column: 1 / -1;
    min-height: 0;
  }

  .export-actions .btn-secondary { grid-column: 1; }
  .export-actions .btn-primary { grid-column: 2; }

  .settings-tts-controls {
    min-width: 0;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .settings-tts-controls select,
  .settings-tts-controls button {
    min-width: 0 !important;
    max-width: 100%;
  }

  body[data-view="vocab"] .flash-stage-solid {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 240px;
    height: min(310px, 40vh);
    overflow: hidden;
  }

  body[data-view="vocab"] .flash-card-surface {
    width: 100%;
    min-width: 0;
    padding: 28px 20px;
    overflow-wrap: anywhere;
  }

  body[data-view="vocab"] .flash-main-word {
    max-width: 100%;
    font-size: clamp(var(--type-size-step-40), 13vw, var(--type-size-step-64));
    overflow-wrap: anywhere;
  }

  body[data-view="vocab"] .flash-rating-row {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  body[data-view="vocab"] .flash-rating-row .rate-btn {
    min-width: 0;
    padding-inline: 5px;
    white-space: normal;
  }
}

/* Mobile menu reuses the desktop sidebar's quiet, single-column language. */
.menu-sidebar-nav {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 16px;
  overflow-y: auto;
}

.menu-nav.menu-sidebar-nav .nav-item {
  width: 100%;
  min-height: 44px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sumi);
  text-align: left;
}

.menu-sidebar-nav .nav-icon,
.menu-sidebar-nav .nav-icon svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.menu-sidebar-nav .nav-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu-sidebar-nav .nav-label {
  font-size: var(--type-size-control);
  font-weight: 650;
}

.menu-nav.menu-sidebar-nav .nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.menu-sidebar-nav hr {
  width: 100%;
  margin: 8px 0;
}

.icon-button-hint {
  z-index: 2147483000;
  max-width: calc(100vw - 20px);
  white-space: normal;
}

@media (max-width: 720px) {
  body[data-view="vocab"] .vocab-section-page,
  body[data-view="vocab"] .vocab-section-page > .card-pad,
  body[data-view="vocab"] .vocab-review-primary,
  body[data-view="vocab"] .flash-card-host,
  body[data-view="vocab"] #flashArea {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }

  body[data-view="vocab"] #flashArea.has-card {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: transparent;
  }

  body[data-view="vocab"] #flashArea .flash-stage-solid {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: min(300px, 42dvh);
    min-height: 220px;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    box-sizing: border-box;
    overflow: hidden;
  }

  body[data-view="vocab"] #flashArea .flash-card-surface {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    overflow: hidden;
    text-align: center;
  }

  body[data-view="vocab"] #flashArea .flash-main-word,
  body[data-view="vocab"] #flashArea .flash-main-reading,
  body[data-view="vocab"] #flashArea .flash-main-meaning {
    width: 100%;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  body[data-view="vocab"] .vocab-review-primary {
    min-height: auto;
    padding-bottom: 24px;
  }
}
