/*
 * 词根词缀记忆工坊 - 极简主义设计
 * 原则：Less is More
 * 设计师：偏执的完美主义者
 */

/* ===== 重置与基础 ===== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root,
:root[data-theme="day"] {
  /* 柔和日间：避免纯白背景与纯黑文字造成眩光 */
  --color-text: #26342c;
  --color-text-secondary: #5d6d63;
  --color-text-tertiary: #829087;
  --color-accent: #4f8a68;
  --color-accent-dark: #397653;
  --color-accent-soft: #e5f1e9;
  --color-on-accent: #ffffff;
  --color-border: #d9e2dc;
  --color-bg: #f4f7f3;
  --color-surface: #fffefa;
  --color-bg-secondary: #edf3ee;
  --color-bg-hover: #e7efe9;
  --color-nav: rgba(255, 254, 250, 0.94);
  --color-prefix: #b76565;
  --color-root: #4d76a1;
  --color-suffix: #9a743c;
  --color-danger: #b24b4b;
  --color-danger-soft: #f8e6e3;

  /* 间距系统（8px网格） */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;

  /* 字体系统 */
  --font-family: ui-rounded, 'SF Pro Rounded', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', system-ui, sans-serif;
  --font-word: 'Avenir Next', 'Trebuchet MS', 'Segoe UI', sans-serif;

  /* 阴影系统（极浅） */
  --shadow-sm: 0 1px 2px rgba(35, 54, 42, 0.04);
  --shadow-md: 0 5px 18px rgba(35, 54, 42, 0.07);
  --shadow-lg: 0 12px 36px rgba(35, 54, 42, 0.1);

  /* 圆角（统一） */
  --radius: 12px;
  --radius-lg: 18px;

  /* 过渡 */
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

:root[data-theme="sepia"] {
  --color-text: #433a2f;
  --color-text-secondary: #716453;
  --color-text-tertiary: #938571;
  --color-accent: #987047;
  --color-accent-dark: #7f5934;
  --color-accent-soft: #eadcc6;
  --color-on-accent: #fffaf0;
  --color-border: #ded1bd;
  --color-bg: #f1eadc;
  --color-surface: #fff9ee;
  --color-bg-secondary: #ebe1d0;
  --color-bg-hover: #e5dac6;
  --color-nav: rgba(255, 249, 238, 0.94);
  --color-prefix: #a85f58;
  --color-root: #55758e;
  --color-suffix: #9a7138;
  --color-danger: #a34747;
  --color-danger-soft: #f2deda;
}

:root[data-theme="night"] {
  --color-text: #e5ebe7;
  --color-text-secondary: #aebbb3;
  --color-text-tertiary: #7f8d85;
  --color-accent: #76b18d;
  --color-accent-dark: #91c7a5;
  --color-accent-soft: #263f31;
  --color-on-accent: #122019;
  --color-border: #344139;
  --color-bg: #171c19;
  --color-surface: #202722;
  --color-bg-secondary: #273029;
  --color-bg-hover: #303a33;
  --color-nav: rgba(30, 37, 32, 0.94);
  --color-prefix: #d58b86;
  --color-root: #82add2;
  --color-suffix: #d4ad70;
  --color-danger: #e28a85;
  --color-danger-soft: #472c2b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.16);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 14px 38px rgba(0, 0, 0, 0.28);
}

html {
  font-size: 18px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--color-text);
  background: var(--color-bg);
  transition: color 180ms ease, background-color 180ms ease;
  overflow-x: hidden;
}

a,
button,
input {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ===== 排版系统 ===== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 3rem;
  font-weight: 700;
}

h2 {
  font-size: 2rem;
  font-weight: 600;
}

h3 {
  font-size: 1.5rem;
  font-weight: 600;
}

p {
  margin-bottom: var(--space-md);
}

/* ===== 布局容器 ===== */

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-wide {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* ===== 按钮系统 ===== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 14px 32px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
  color: var(--color-text);
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  min-height: 48px;
  white-space: nowrap;
}

.btn:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  color: var(--color-on-accent);
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.btn-primary:hover {
  background: var(--color-accent-dark);
  border-color: var(--color-accent-dark);
  color: var(--color-on-accent);
}

.btn-large {
  padding: 18px 48px;
  font-size: 1.125rem;
  font-weight: 600;
  min-height: 56px;
}

.btn-text {
  background: transparent;
  border: none;
  padding: 8px 16px;
  color: var(--color-text-secondary);
}

.btn-text:hover {
  background: transparent;
  color: var(--color-text);
  border: none;
  transform: none;
  box-shadow: none;
}

/* ===== 卡片系统 ===== */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--color-accent);
}

.card-simple {
  border: none;
  padding: var(--space-lg);
}

/* ===== 导航栏 ===== */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--color-nav);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

.nav-link {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.nav-link:hover {
  color: var(--color-text);
}

.nav-link.active {
  color: var(--color-accent-dark);
  font-weight: 700;
}

/* ===== Hero Section ===== */

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-4xl) var(--space-lg);
}

.hero-title {
  font-size: 4rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-lg);
  max-width: 800px;
}

.hero-subtitle {
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-3xl);
  max-width: 600px;
}

/* ===== 词根拆解演示 ===== */

.demo {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  margin: var(--space-3xl) 0;
  max-width: 600px;
}

.demo-word {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.demo-breakdown {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.demo-part {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
}

.demo-part.prefix {
  background: color-mix(in srgb, var(--color-prefix) 12%, transparent);
  color: var(--color-prefix);
  border: 1px solid color-mix(in srgb, var(--color-prefix) 30%, transparent);
}

.demo-part.root {
  background: color-mix(in srgb, var(--color-root) 12%, transparent);
  color: var(--color-root);
  border: 2px solid color-mix(in srgb, var(--color-root) 32%, transparent);
}

.demo-part.suffix {
  background: color-mix(in srgb, var(--color-suffix) 12%, transparent);
  color: var(--color-suffix);
  border: 1px solid color-mix(in srgb, var(--color-suffix) 30%, transparent);
}

.demo-meaning {
  font-size: 1.125rem;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.demo-arrow {
  color: var(--color-text-secondary);
  font-weight: 400;
}

/* ===== 进度指示器 ===== */

.progress {
  margin: var(--space-2xl) 0;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--color-accent);
  transition: width 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-top: var(--space-sm);
  text-align: right;
}

/* ===== 选项按钮（测试题） ===== */

.option {
  width: 100%;
  text-align: left;
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition);
}

.option:hover:not(:disabled) {
  border-color: var(--color-text);
  background: var(--color-bg-hover);
}

.option:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.option.correct {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-on-accent);
}

.option.wrong {
  background: var(--color-danger-soft);
  border-color: var(--color-danger);
  color: var(--color-danger);
}

/* ===== 反馈消息 ===== */

.feedback {
  padding: var(--space-lg);
  border-radius: var(--radius);
  margin: var(--space-lg) 0;
  font-weight: 500;
}

.feedback.success {
  background: var(--color-accent-soft);
  color: var(--color-text);
  border: 1px solid var(--color-accent);
}

.feedback.error {
  background: var(--color-danger-soft);
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
}

/* ===== 统计卡片 ===== */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-lg);
  margin: var(--space-3xl) 0;
}

.stat-card {
  text-align: center;
  padding: var(--space-2xl);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.stat-value {
  font-size: 3rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

.stat-label {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  font-weight: 500;
}

/* ===== Footer ===== */

.footer {
  border-top: 1px solid var(--color-border);
  padding: var(--space-3xl) var(--space-lg);
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  margin-top: var(--space-lg);
}

.footer-link {
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.footer-link:hover {
  color: var(--color-text);
}

/* ===== 工具类 ===== */

/* ===== 单词发音 ===== */

.pronounce-word {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-weight: inherit;
  line-height: inherit;
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
  overflow-wrap: anywhere;
}

.pronounce-word:hover {
  color: var(--color-accent-dark);
  background: var(--color-accent-soft);
}

.pronounce-speaker {
  font-family: var(--font-family);
  font-size: 0.72em;
  filter: grayscale(1);
  opacity: 0.58;
  transition: filter var(--transition), opacity var(--transition);
}

.pronounce-word:hover .pronounce-speaker {
  filter: none;
  opacity: 1;
}

.pronunciation-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 14px;
}

.pronunciation-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 36px;
  padding: 6px 11px;
  color: var(--color-text-secondary);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: var(--font-family);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.pronunciation-btn:hover {
  color: var(--color-text);
  background: var(--color-surface);
  border-color: var(--color-accent-dark);
  transform: translateY(-1px);
}

.pronunciation-btn:active {
  transform: translateY(0);
}

.pronunciation-controls-compact {
  display: inline-flex;
  gap: 4px;
  margin: 0 0 0 8px;
  vertical-align: middle;
}

.pronunciation-controls-compact .pronunciation-btn {
  min-width: 32px;
  min-height: 32px;
  padding: 4px 6px;
}

.pronunciation-controls-compact .pronunciation-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== 词素拆解卡 ===== */

.morpheme-breakdown {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin: 4px 0 16px;
  overflow-x: auto;
  padding: 2px 2px 6px;
}

.morpheme-card {
  flex: 1 1 0;
  min-width: 150px;
  padding: 12px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-top-width: 3px;
  border-radius: 9px;
}

.morpheme-prefix { border-top-color: var(--color-prefix); }
.morpheme-root { border-top-color: var(--color-root); }
.morpheme-suffix { border-top-color: var(--color-suffix); }

.morpheme-card-missing {
  border-top-color: var(--color-text-tertiary);
  border-style: dashed;
}

.morpheme-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.morpheme-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  color: var(--color-text);
  background: transparent;
  border: 0;
  font-family: var(--font-word);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.morpheme-text:hover {
  color: var(--color-accent-dark);
}

.morpheme-text span {
  font-family: var(--font-family);
  font-size: 0.75rem;
  opacity: 0.55;
}

.morpheme-type {
  flex: 0 0 auto;
  color: var(--color-text-tertiary);
  font-size: 0.6875rem;
  font-weight: 600;
}

.morpheme-definition {
  color: var(--color-text);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.45;
}

.morpheme-ipa {
  display: block;
  margin-top: 5px;
  color: var(--color-text-secondary);
  font-family: var(--font-family);
  font-size: 0.75rem;
}

.morpheme-plus {
  align-self: center;
  flex: 0 0 auto;
  color: var(--color-text-tertiary);
  font-size: 1.25rem;
  font-weight: 600;
}

/* ===== 语境例句 ===== */

.context-example {
  margin-top: 18px;
  padding: 17px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 14px;
}

.context-example-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--color-text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
}

.context-level {
  padding: 2px 8px;
  color: var(--color-accent-dark);
  background: var(--color-accent-soft);
  border-radius: 999px;
  font-size: 0.68rem;
}

.context-sentence-button {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
  padding: 0;
  color: var(--color-text);
  background: transparent;
  border: 0;
  font-family: var(--font-word);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.65;
  text-align: left;
  cursor: pointer;
}

.context-sentence-button:hover {
  color: var(--color-accent-dark);
}

.context-sentence-button mark {
  padding: 1px 3px;
  color: inherit;
  background: var(--color-accent-soft);
  border-radius: 4px;
}

.context-audio {
  flex: 0 0 auto;
  margin-top: 2px;
  font-family: var(--font-family);
  font-size: 0.85rem;
  opacity: 0.7;
}

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

.context-actions button {
  min-height: 36px;
  padding: 5px 11px;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 9px;
  font-family: var(--font-family);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.context-actions button:hover,
.context-actions button[aria-pressed="true"],
.context-actions button[aria-expanded="true"] {
  color: var(--color-accent-dark);
  border-color: var(--color-accent);
}

.context-translation {
  margin: 11px 0 0;
  padding-top: 10px;
  color: var(--color-text-secondary);
  border-top: 1px dashed var(--color-border);
  font-size: 0.9rem;
  line-height: 1.65;
}

.context-translation[hidden],
.context-sentence-full[hidden],
.context-sentence-cloze[hidden] {
  display: none;
}

.context-collocations {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 13px;
}

.context-collocations > span:not(.context-collocations-label) {
  padding: 4px 9px;
  color: var(--color-root);
  background: color-mix(in srgb, var(--color-root) 10%, transparent);
  border-radius: 8px;
  font-family: var(--font-word);
  font-size: 0.72rem;
}

.context-collocations-label {
  margin-right: 2px;
  color: var(--color-text-tertiary);
  font-size: 0.7rem;
  font-weight: 700;
}

/* ===== 小说阅读器式设置 ===== */

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

.reading-settings {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1200;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  font-family: var(--font-family);
}

.reading-settings-toggle {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-left: auto;
  color: var(--color-on-accent);
  background: var(--color-accent);
  border: 0;
  border-radius: 50%;
  box-shadow: var(--shadow-lg);
  font-family: var(--font-word);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition);
}

.reading-settings-toggle:hover {
  background: var(--color-accent-dark);
  transform: translateY(-2px);
}

.reading-settings-panel {
  width: min(320px, calc(100vw - 32px));
  margin-bottom: 12px;
  padding: 18px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
}

.reading-settings-panel[hidden] {
  display: none;
}

.reading-settings-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 1rem;
}

.reading-settings-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--color-text-secondary);
  background: var(--color-bg-secondary);
  border: 0;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
}

.reading-settings-label {
  margin: 12px 0 7px;
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
}

.theme-options,
.font-size-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.theme-options button,
.font-size-options button {
  min-height: 44px;
  padding: 7px 8px;
  color: var(--color-text-secondary);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.theme-options button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.theme-options button.active {
  color: var(--color-accent-dark);
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
}

.theme-swatch {
  width: 15px;
  height: 15px;
  border: 1px solid rgba(90, 80, 65, 0.25);
  border-radius: 50%;
}

.theme-swatch-day { background: #f4f7f3; }
.theme-swatch-sepia { background: #e9dcc6; }
.theme-swatch-night { background: #202722; }

.font-size-options {
  grid-template-columns: 1fr 1.2fr 1fr;
  align-items: center;
}

.font-size-options output {
  color: var(--color-text);
  text-align: center;
  font-family: var(--font-word);
  font-size: 0.85rem;
  font-weight: 800;
}

.font-size-options button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

@media (max-width: 640px) {
  .morpheme-breakdown {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    overflow-x: visible;
    padding-bottom: 2px;
  }

  .morpheme-card {
    flex-basis: auto;
    width: 100%;
    min-width: 0;
    padding: 13px 14px;
  }

  .morpheme-plus {
    align-self: center;
    height: 22px;
    line-height: 18px;
  }
}

.text-center {
  text-align: center;
}

.text-secondary {
  color: var(--color-text-secondary);
}

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }

/* ===== 响应式 ===== */

@media (max-width: 768px) {
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .container,
  .container-wide {
    width: 100%;
    padding-right: 14px;
    padding-left: 14px;
  }

  .card {
    padding: 18px;
    border-radius: 16px;
  }

  .hero-title {
    font-size: 2.05rem;
    line-height: 1.25;
  }

  .hero-subtitle {
    margin-bottom: 28px;
    font-size: 1rem;
  }

  .hero {
    min-height: auto;
    padding: 88px 16px 56px;
  }

  .hero > .container {
    padding: 0;
  }

  .demo {
    width: 100%;
    margin: 28px 0;
    padding: 22px 16px;
  }

  .demo-breakdown {
    gap: 7px;
  }

  .demo-word {
    margin-bottom: 14px;
    font-size: 1.7rem;
  }

  .hero-actions {
    flex-direction: column;
    gap: 10px !important;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .btn-large {
    min-height: 50px;
    padding: 13px 20px;
    font-size: 1rem;
  }

  .home-stats {
    padding: 48px 14px !important;
  }

  .stat-grid {
    gap: 12px;
    margin: 20px 0;
  }

  .stat-card {
    padding: 20px;
  }

  .nav-links {
    flex: 1;
    justify-content: flex-end;
    gap: 4px;
  }

  .nav-container {
    min-height: 56px;
    padding: 5px 10px;
  }

  .nav-logo {
    flex: 0 0 34px;
    font-size: 0;
  }

  .nav-logo svg {
    width: 22px;
    height: 22px;
  }

  .nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 44px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 14px;
  }

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

  .stat-value {
    font-size: 2rem;
  }

  .pronunciation-controls {
    gap: 6px;
  }

  .pronunciation-btn {
    min-height: 42px;
    padding: 7px 10px;
  }

  .learn-page .study-progress-bar {
    top: 56px !important;
    padding: 8px 12px !important;
  }

  .learn-page .study-progress-inner {
    flex-wrap: nowrap !important;
    gap: 24px !important;
    padding: 0;
  }

  .learn-page .learn-main {
    padding-top: 24px !important;
  }

  .learn-page .learn-container {
    padding-top: 12px !important;
    padding-bottom: 40px !important;
  }

  .learn-page .learn-card {
    padding: 18px;
    border: 0;
    box-shadow: none;
  }

  .learn-page .learn-header {
    margin-bottom: 30px !important;
    padding-bottom: 22px !important;
  }

  .learn-page #rootName {
    font-size: 2.5rem !important;
  }

  .learn-page .learn-section {
    margin-bottom: 36px !important;
  }

  .learn-page .learn-section h2 {
    margin-bottom: 16px !important;
    font-size: 1.25rem !important;
  }

  .learn-page #rootDescription {
    padding: 18px !important;
    font-size: 1rem !important;
  }

  .learn-page .word-card {
    padding: 17px !important;
  }

  .context-example {
    margin-top: 16px;
    padding: 15px;
  }

  .context-sentence-button {
    font-size: 0.95rem;
  }

  .context-actions button {
    min-height: 42px;
  }

  .learn-page .quiz-box {
    padding: 18px !important;
  }

  .learn-page .learn-actions {
    flex-direction: column;
  }

  .learn-page .learn-actions .btn {
    width: 100%;
  }

  .progress-page .progress-main {
    padding-top: 70px !important;
  }

  .progress-page .progress-container {
    padding-top: 24px !important;
    padding-bottom: 32px !important;
  }

  .progress-page .progress-title {
    margin-bottom: 28px !important;
    font-size: 2rem !important;
  }

  .progress-page .progress-stats-grid,
  .progress-page .progress-details-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
    margin-bottom: 28px !important;
  }

  .progress-page .progress-stats-grid .card {
    padding: 18px;
  }

  .flashcard-example .pronunciation-controls-compact {
    display: flex;
    width: fit-content;
    margin: 7px 0 0;
  }

  .reading-settings {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .reading-settings-toggle {
    width: 48px;
    height: 48px;
  }

  .reading-settings-panel {
    width: min(320px, calc(100vw - 24px));
    padding: 16px;
  }
}

@media (max-width: 360px) {
  .nav-link {
    min-width: 43px;
    padding: 0 3px;
    font-size: 13px;
  }

  .pronunciation-controls:not(.pronunciation-controls-compact) .pronunciation-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .pronunciation-controls:not(.pronunciation-controls-compact) .pronunciation-btn {
    min-width: 48px;
  }
}

/* ===== 无障碍 ===== */

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

/* ===== 焦点样式 ===== */

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ===== 选择样式 ===== */

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