/* ============================================================
   天开英语 · 南开中学天开学校智能学习平台 - 样式表
   移动优先（Mobile First）：默认为手机布局，媒体查询扩展到平板/桌面
   设计语言：杂志编辑（Editorial）—— 规则线 / 大字距 / 强层级 / 色彩纪律
   校色取自校标 #6D245F 与校名书法底 #86376D（★ 校色不随主题改动）

   【设计原则】旧版的问题是"所有东西一样重"：每张卡片同尺寸同阴影、
   每行文字同粗细、每个区域同留白。本版靠三件事建立秩序：
     ① 一套语义令牌，组件里不再出现硬编码色值/阴影；
     ② 一个强调色（青莲紫）负责所有关键动作，绿/橙/红只做状态语义；
     ③ 卡片分三档（.card / .card.plain / .card.soft），高度层级不再随手写。
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  /* ---------- 校色（固定，不参与主题切换）---------- */
  --primary: #6D245F;
  --primary-2: #86376D;
  --primary-grad: linear-gradient(135deg, #86376D 0%, #6D245F 100%);
  --primary-light: #F7EDF4;

  /* ---------- 主色阶（用于发丝线 / 悬浮 / 渐变停靠点）---------- */
  --primary-50: #FBF6FA;
  --primary-100: #F7EDF4;
  --primary-200: #EBD6E5;
  --primary-400: #A85C93;
  --primary-600: #6D245F;
  --primary-700: #5A1C4E;
  --primary-800: #421E3C;

  /* ---------- 状态语义色（只表达状态，不做装饰）---------- */
  --success: #0E7A5B;
  --success-light: #E2F6EE;
  --danger: #B3373A;
  --danger-light: #FCECEC;
  --warning: #96610D;
  --warning-light: #FBF0DC;
  /* 功能色：仅供日历复习标记等既有语义使用，勿用于新组件 */
  --accent-mark: #B45309;

  /* ---------- 文字 ---------- */
  /* 纯黑压纯白会显脏，统一用暖调墨色 */
  --text: #2A1E33;
  --text-2: #5D5568;
  --text-3: #91879B;
  --text-4: #B3AABA;

  /* ---------- 表面 ---------- */
  --bg: #F7F4F8;
  --bg-2: #F1ECF3;
  --card: #FFFFFF;
  --border: #EAE3EB;
  --border-2: #DED5E1;
  --rule: #EFE9F1;          /* 分隔线：比 border 更轻，用于卡内列表 */

  /* ---------- 圆角 ---------- */
  --radius-sm: 8px;
  --radius: 16px;
  --radius-lg: 20px;
  --radius-xl: 26px;

  /* ---------- 间距梯度（纵向节奏只用这七档）---------- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 40px;
  --sp-7: 64px;

  /* ---------- 字阶（1.25 比例，禁止在组件里手写字号）---------- */
  --fs-xs: 11.5px;
  --fs-sm: 12.5px;
  --fs-base: 14px;
  --fs-md: 15px;
  --fs-lg: 17px;
  --fs-xl: 21px;
  --fs-2xl: 26px;
  --fs-3xl: 34px;
  --fs-4xl: 44px;

  /* ---------- 阴影：三级高度体系，带环境色而非纯黑 ---------- */
  --shadow-sm: 0 1px 2px rgba(66, 30, 60, 0.06);
  --shadow-md: 0 2px 6px rgba(66, 30, 60, 0.05), 0 8px 24px rgba(66, 30, 60, 0.07);
  --shadow-lg: 0 8px 16px rgba(66, 30, 60, 0.08), 0 20px 48px rgba(66, 30, 60, 0.12);

  /* ---------- 动效 ---------- */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 160ms;
  --dur-base: 320ms;
  --dur-slow: 640ms;

  /* ---------- 字体 ---------- */
  /* 显示字：正文用系统中文栈以保证小字号的屏幕可读性；
     但"展示字"位置（标题/大数字/问候语）用宋体族拉开与正文的对比——
     中文场景下宋体/黑体的对比就是英文里衬线/无衬线的对比。 */
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
               "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --font-display: "Songti SC", "SimSun", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

html { font-size: 16px; }

body {
  font-family: var(--font-sans);
  background:
    linear-gradient(180deg, var(--primary-50) 0%, transparent 320px),
    radial-gradient(1100px 480px at 88% -8%, rgba(134, 55, 109, 0.075), transparent 62%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(134, 55, 109, 0.2); }

/* ---------- 焦点可见（键盘可达性基线，全站唯一实现处）----------
   鼠标点击不触发（:focus-visible），键盘 Tab 才显示 2px 描边 + 2px 偏移 */
:focus-visible {
  outline: 2px solid var(--primary-2);
  outline-offset: 2px;
  border-radius: 6px;
}
/* 顶栏等深紫底上的焦点圈需换浅色，否则看不见 */
.topbar :focus-visible { outline-color: #fff; }

/* ---------- 动效降级：系统开启"减少动态效果"时全站静止 ----------
   放在文件靠后位置会失效（被组件自身的 animation 覆盖），
   所以用 !important 兜底 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- 顶部栏 ----------
   旧版是饱和紫底白字，把内容压得很闷，且用户姓名 + 「管理员」徽章会挤成竖排。
   新版改为浅底 + 发丝线，底部压一道青莲紫渐隐细线（本设计的记忆点）；
   身份区强制 nowrap，姓名永不换行。 */
.topbar {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  color: var(--text);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(66, 30, 60, 0.02);
}
/* 记忆点：顶栏底缘的青莲紫渐隐细线，取自校名书法的运笔起收 */
.topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--primary-2) 12%,
    var(--primary) 48%,
    var(--primary-2) 78%,
    transparent 100%);
  opacity: 0.85;
  pointer-events: none;
}
.topbar .brand {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--primary);
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar .user-chip {
  font-size: var(--fs-sm);
  font-family: var(--font-sans);
  background: var(--primary-50);
  color: var(--text-2);
  padding: 5px 6px 5px 14px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  border: 1px solid var(--primary-200);
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 62%;
  overflow: hidden;
}
/* 姓名本身也禁止换行——「管理员」徽章曾把两个字的名字压成两行 */
.topbar .user-chip > * { white-space: nowrap; }
.topbar .user-chip .tag {
  background: var(--primary) !important;
  color: #fff !important;
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.topbar .logout-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 999px;
  transition: background var(--dur-fast) ease-out, color var(--dur-fast) ease-out;
  flex-shrink: 0;
}
.topbar .logout-btn:hover { background: var(--primary-light); }

/* ---------- 云端同步状态点 ----------
   旧版是 cloud.js 注入的 position:fixed 徽章，浮在内容之上，
   实测遮挡「← 返回首页」「学习统计」等标题和按钮（P0 缺陷）。
   改为顶栏内联的微型状态点：不再脱离文档流，也就不会遮挡任何东西。 */
.cloud-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-4);
  /* 呼吸感：只动 opacity，性能安全 */
  animation: cloudPulse 2.6s ease-in-out infinite;
}
.cloud-dot.on { background: #1D9E75; box-shadow: 0 0 0 3px rgba(29, 158, 117, 0.16); }
.cloud-dot.off { background: var(--text-4); box-shadow: 0 0 0 3px rgba(145, 135, 155, 0.14); }
@keyframes cloudPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ---------- 主内容区 ---------- */
.page { display: none; padding: var(--sp-4) var(--sp-4) 96px; max-width: 1024px; margin: 0 auto; }
.page.active { display: block; }

/* 入场编排：页面切换时容器只做轻微上浮，具体节奏交给卡片的 .reveal */
.page.active { animation: pageIn var(--dur-base) var(--ease-out) both; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* 卡片入场：错峰上浮。用 nth-child 而非 JS，零依赖且不会有竞态。
   前 6 张卡片按 60ms 递增，第 7 张起统一延迟——保证长页面不会"越往下越慢"。 */
.reveal { animation: revealUp var(--dur-base) var(--ease-out) both; }
.reveal:nth-child(1) { animation-delay: 0ms; }
.reveal:nth-child(2) { animation-delay: 60ms; }
.reveal:nth-child(3) { animation-delay: 120ms; }
.reveal:nth-child(4) { animation-delay: 180ms; }
.reveal:nth-child(5) { animation-delay: 240ms; }
.reveal:nth-child(6) { animation-delay: 300ms; }
.reveal:nth-child(n+7) { animation-delay: 340ms; }
@keyframes revealUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* 页面标题：用宋体族做展示字，与正文黑体拉开对比；
   下方一条发丝规则线，是杂志编辑方向的基础骨架 */
.page-title {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.01em;
  color: var(--primary);
  margin-bottom: var(--sp-1);
}
.page-sub {
  font-size: var(--fs-sm);
  color: var(--text-3);
  letter-spacing: 0.02em;
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--rule);
}

/* 课文跟读：可点击句子 */
.lesson-sent { cursor: pointer; border-bottom: 1px dashed var(--border-2); transition: background var(--dur-fast) ease-out; }
.lesson-sent:hover { background: var(--primary-light); border-radius: 4px; }

/* ---------- 词汇子导航：顶部横向卡片（学单词 / 测试 / 生词本） ---------- */
.vocab-cards {
  display: none;
  gap: var(--sp-2);
  max-width: 1024px;
  margin: 0 auto;
  padding: var(--sp-3) var(--sp-4) 0;
}
.vocab-cards .vc {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 11px 6px 9px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-2);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: border-color var(--dur-fast) ease-out,
              background var(--dur-fast) ease-out,
              transform var(--dur-fast) ease-out;
}
.vocab-cards .vc:hover { border-color: var(--primary-200); color: var(--primary); transform: translateY(-1px); }
.vocab-cards .vc:active { transform: scale(0.98); }
.vocab-cards .vc-icon { font-size: 19px; line-height: 1.25; }
/* 选中态：不再大面积铺底色，改用顶部 2px 标记 + 轻背景，层级更干净 */
.vocab-cards .vc.active {
  position: relative;
  border-color: var(--primary-200);
  background: var(--primary-50);
  color: var(--primary);
}
.vocab-cards .vc.active::before {
  content: "";
  position: absolute;
  top: -1px; left: 22%; right: 22%;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--primary);
}

/* ---------- 底部标签栏（手机端主导航） ---------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -1px 0 rgba(66, 30, 60, 0.03);
}
.tab {
  flex: 1;
  min-height: 48px;
  padding: 7px 4px 6px;
  text-align: center;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--text-3);
  cursor: pointer;
  border: none;
  background: none;
  position: relative;
  transition: color var(--dur-fast) ease-out;
}
.tab .tab-icon {
  font-size: 20px;
  display: block;
  line-height: 1.2;
  transition: transform var(--dur-base) var(--ease-out);
}
/* 选中指示条：从中心展开，比"变个颜色"更能让人看清位置 */
.tab::after {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  width: 0; height: 2.5px;
  border-radius: 0 0 3px 3px;
  background: var(--primary);
  transform: translateX(-50%);
  transition: width var(--dur-base) var(--ease-out);
}
.tab.active { color: var(--primary); font-weight: 700; }
.tab.active::after { width: 34%; }
.tab.active .tab-icon { transform: translateY(-1px) scale(1.1); }
.tab:active .tab-icon { transform: scale(0.92); }

/* ---------- 卡片与通用组件 ----------
   三档卡片，替代原先散落各处的内联 style：
     .card        默认：白底 + 发丝边框 + 轻阴影（信息容器）
     .card.plain  无阴影：用于紧邻排列的信息块，避免"阴影叠阴影"
     .card.soft   主色浅底：用于引导语、提示、总评等非交互说明块
     .card.accent 主色左描边：用于"当前该做的事"这类唯一焦点卡片
   所有卡片入场统一走 .reveal 错峰。 */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5) var(--sp-4);
  margin-bottom: var(--sp-3);
  box-shadow: var(--shadow-md);
}
.card:last-child { margin-bottom: 0; }
.card h3 {
  font-size: var(--fs-md);
  margin-bottom: var(--sp-3);
  font-weight: 700;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.card.plain { box-shadow: none; }
.card.soft {
  background: var(--primary-50);
  border-color: var(--primary-100);
  box-shadow: none;
}
.card.accent {
  border-color: var(--primary-200);
  border-left: 3px solid var(--primary);
  box-shadow: var(--shadow-md);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 12px;
  padding: 12px 22px;
  min-height: 44px;
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  background: var(--primary-grad);
  color: #fff;
  font-family: inherit;
  transition: transform var(--dur-fast) ease-out,
              box-shadow var(--dur-fast) ease-out,
              opacity var(--dur-fast) ease-out;
  box-shadow: 0 4px 14px rgba(109, 36, 95, 0.24);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(109, 36, 95, 0.3); }
.btn:active { transform: translateY(0) scale(0.985); opacity: 0.92; }
.btn.block { display: flex; width: 100%; }
.btn.ghost { background: var(--primary-light); color: var(--primary); box-shadow: none; }
.btn.ghost:hover { box-shadow: 0 4px 12px rgba(109, 36, 95, 0.14); }
.btn.danger { background: linear-gradient(135deg, #C74B4E 0%, #B3373A 100%); box-shadow: 0 4px 14px rgba(179, 55, 58, 0.22); }
.btn.small { padding: 7px 14px; min-height: 34px; font-size: var(--fs-sm); border-radius: 9px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

/* 返回按钮（学习/测试中途退出） */
.btn-back {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-2);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 6px 13px;
  min-height: 32px;
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--dur-fast) ease-out;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-back:hover { border-color: var(--primary-200); color: var(--primary); background: var(--primary-50); }
.btn-back:active { transform: scale(0.96); }

input[type="text"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  padding: 11px 14px;
  min-height: 44px;
  font-size: 16px;   /* ≥16px 可避免 iOS 聚焦时自动放大页面 */
  border: 1px solid var(--border-2);
  border-radius: 12px;
  background: #FCFBFD;
  font-family: inherit;
  color: var(--text);
  transition: border-color var(--dur-fast) ease-out,
              box-shadow var(--dur-fast) ease-out,
              background var(--dur-fast) ease-out;
}
input:hover, select:hover, textarea:hover { border-color: var(--primary-200); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-2);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(134, 55, 109, 0.12);
}
textarea { min-height: 0; }
label.field {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.02em;
  margin: var(--sp-4) 0 5px;
}

/* ---------- 登录页 ---------- */
.login-wrap { max-width: 460px; margin: 7vh auto 0; padding: 0 18px; animation: pageIn var(--dur-slow) var(--ease-out) both; }
.login-logo {
  font-family: var(--font-display);
  text-align: center;
  font-size: var(--fs-2xl);
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: 0.06em;
  color: var(--primary);
}
/* 渐变色文字：仅在浏览器支持 background-clip:text 时启用，
   否则保持纯色（旧版手机浏览器不支持会变成透明=看不见） */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .login-logo {
    background: linear-gradient(120deg, #6D245F 20%, #86376D 60%, #0E7A5B 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}
/* 副标题两侧加发丝规则线，收住标题区，形成"报头"感 */
.login-tagline {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  justify-content: center;
  font-size: var(--fs-sm);
  color: var(--text-3);
  margin-bottom: var(--sp-5);
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.login-tagline::before, .login-tagline::after {
  content: "";
  flex: 1;
  max-width: 56px;
  height: 1px;
  background: var(--border-2);
}
.login-wrap .card { box-shadow: var(--shadow-lg); border-color: var(--border); }
.role-switch {
  display: flex;
  margin-bottom: var(--sp-4);
  background: var(--bg-2);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.role-switch button {
  flex: 1;
  padding: 10px;
  min-height: 44px;
  border: none;
  background: transparent;
  font-size: var(--fs-md);
  cursor: pointer;
  color: var(--text-2);
  font-family: inherit;
  border-radius: 9px;
  transition: background var(--dur-fast) ease-out,
              color var(--dur-fast) ease-out,
              box-shadow var(--dur-fast) ease-out;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.role-switch button.active { background: #fff; color: var(--primary); box-shadow: var(--shadow-sm); }

/* ---------- 功能宫格 ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
.func-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5) var(--sp-3);
  text-align: center;
  cursor: pointer;
  transition: transform var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out),
              border-color var(--dur-fast) ease-out;
  box-shadow: var(--shadow-sm);
}
.func-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary-200); }
.func-tile:active { transform: scale(0.98); }
.func-tile .icon { font-size: 28px; display: block; margin-bottom: var(--sp-2); }
.func-tile .name { font-size: var(--fs-md); font-weight: 700; letter-spacing: 0.02em; }
.func-tile .desc { font-size: var(--fs-sm); color: var(--text-3); margin-top: 2px; }

/* ---------- 学习卡片（正反面切换） ----------
   注：不使用 CSS 3D 翻转——部分手机浏览器（微信 X5 / UC / 旧 webview）
   对 preserve-3d + backface-visibility 有渲染 bug，会导致卡片整面空白。
   改用透明度淡入切换，所有浏览器都能稳定渲染。 */
.flashcard {
  height: 300px;
  margin: var(--sp-4) 0;
}
.flashcard-inner {
  position: relative;
  width: 100%; height: 100%;
  cursor: pointer;
}
.flash-face {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5) var(--sp-4);
  text-align: center;
  box-shadow: var(--shadow-md);
  overflow-y: auto;
  transition: opacity 220ms ease, transform 220ms ease;
}
/* 背面加一层极淡的主色氛围，与正面产生"翻过去了"的感知差异 */
.flash-face.back {
  background:
    radial-gradient(420px 200px at 50% -30%, rgba(134, 55, 109, 0.09), transparent 70%),
    linear-gradient(160deg, #FFFFFF 0%, var(--primary-50) 100%);
  opacity: 0;
  transform: scale(0.97);
  pointer-events: none;
}
.flashcard.flipped .flash-face {
  opacity: 0;
  transform: scale(0.97);
  pointer-events: none;
}
.flashcard.flipped .flash-face.back {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
/* 单词本体用展示字（衬线），与释义的黑体形成字体对比——
   这是全站最该被记住的一屏 */
.flash-word {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--primary);
  word-break: break-word;
}
.flash-phonetic {
  font-family: var(--font-mono);
  font-size: var(--fs-md);
  color: var(--text-3);
  margin-top: var(--sp-2);
  letter-spacing: 0.02em;
}
.flash-meaning { font-size: var(--fs-xl); font-weight: 600; line-height: 1.6; }
.flash-hint {
  position: absolute;
  bottom: var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--text-3);
  letter-spacing: 0.06em;
}
.flash-pos {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 6px;
  padding: 2px 9px;
  margin-bottom: var(--sp-2);
  letter-spacing: 0.04em;
}
/* 学习卡片背面的语境例句 */
.flash-example {
  margin-top: var(--sp-4);
  padding: 11px 14px;
  background: var(--primary-light);
  border-left: 3px solid var(--primary-200);
  border-radius: 4px 10px 10px 4px;
  font-size: var(--fs-base);
  line-height: 1.7;
  color: var(--text-2);
  text-align: left;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  max-width: 100%;
}
.flash-example .speak-mini { font-size: var(--fs-md); opacity: 0.7; flex-shrink: 0; margin-top: 2px; }
.flash-example span { flex: 1; }
/* 例句中填入的目标词高亮 */
.flash-example .ex-blank { color: var(--primary); font-weight: 700; }

/* ---------- 进度条 ---------- */
.progress-track { background: var(--bg-2); height: 8px; border-radius: 999px; overflow: hidden; }
.progress-fill {
  height: 100%;
  background: var(--primary-grad);
  border-radius: 999px;
  transition: width var(--dur-base) var(--ease-out);
}
.progress-fill.green { background: linear-gradient(90deg, #1E9E78, #0E7A5B); }

/* ---------- 统计块 ----------
   数字统一用等宽字形（tabular-nums），位数变化时不再左右抖动。
   手机端用 2×2：四块统计若排成 3+1，第二行孤零零一块会显得没做完；
   三块时（首页）仍走 3 列，因为正好整除。 */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); margin-bottom: var(--sp-4); }
/* 四块统计的容器（统计页 / 教师工作台）：手机端 2×2 */
.stat-row.four { grid-template-columns: repeat(2, 1fr); }
.stat-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  padding: var(--sp-4) 6px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
/* 顶部 2px 主色标记：让三块统计有统一的"仪表"身份 */
.stat-box::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--primary-grad);
  opacity: 0.75;
}
.stat-num {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  color: var(--primary);
}
.stat-num.green { color: var(--success); }
.stat-num.red { color: var(--danger); }
.stat-label {
  font-size: var(--fs-xs);
  color: var(--text-3);
  margin-top: 3px;
  letter-spacing: 0.06em;
}

/* ---------- 测试页 ---------- */
/* 题目用展示字，是这一页唯一的主角 */
.quiz-question {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: 600;
  text-align: center;
  margin: var(--sp-5) 0 var(--sp-5);
  line-height: 1.35;
  letter-spacing: 0.01em;
  color: var(--primary);
}
.quiz-phonetic {
  font-family: var(--font-mono);
  font-size: var(--fs-base);
  color: var(--text-3);
  text-align: center;
  margin-top: -16px;
  margin-bottom: var(--sp-4);
}
.options { display: grid; gap: var(--sp-2); }
.option {
  padding: 14px 16px;
  min-height: 44px;
  border: 1px solid var(--border-2);
  border-radius: 12px;
  background: #fff;
  font-size: var(--fs-md);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  transition: border-color var(--dur-fast) ease-out,
              background var(--dur-fast) ease-out,
              transform var(--dur-fast) ease-out;
  box-shadow: var(--shadow-sm);
}
.option:hover { border-color: var(--primary-200); background: var(--primary-50); transform: translateY(-1px); }
.option:active { border-color: var(--primary); transform: scale(0.99); }
/* 正确/错误：色 + 图标双重编码，不单靠颜色传达结果（色觉障碍友好） */
.option.correct {
  border-color: var(--success);
  background: var(--success-light);
  color: var(--success);
  font-weight: 700;
}
.option.correct::before { content: "✓ "; }
.option.wrong {
  border-color: var(--danger);
  background: var(--danger-light);
  color: var(--danger);
}
.option.wrong::before { content: "✕ "; }
.option.disabled { pointer-events: none; }
.option.disabled:not(.correct):not(.wrong) { opacity: 0.55; }
.spell-input { font-size: var(--fs-xl); text-align: center; letter-spacing: 0.16em; font-family: var(--font-mono); }
.quiz-feedback {
  text-align: center;
  padding: 13px;
  border-radius: 12px;
  margin: var(--sp-4) 0;
  font-size: var(--fs-md);
  display: none;
  font-weight: 600;
}
.quiz-feedback.show { display: block; animation: revealUp var(--dur-base) var(--ease-out) both; }
.quiz-feedback.ok { background: var(--success-light); color: var(--success); }
.quiz-feedback.no { background: var(--danger-light); color: var(--danger); }

/* 单句填空 */
.cloze-sentence { font-size: 19px; font-weight: 600; line-height: 1.9; margin-top: 10px; text-align: left; }
.cloze-blank {
  display: inline-block;
  min-width: 90px;
  border-bottom: 2.5px solid var(--primary-2);
  margin: 0 4px;
  border-radius: 2px;
}

/* ---------- 列表 ---------- */
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  padding: 13px 0;
  border-bottom: 1px solid var(--rule);
  font-size: var(--fs-base);
}
.list-item:last-child { border-bottom: none; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 700; font-size: var(--fs-md); }
.list-item .li-sub { font-size: var(--fs-sm); color: var(--text-3); margin-top: 2px; }
.list-item .li-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

/* 词库列表底部：「显示全部 / 收起」。分隔线沿用上一条 .list-item 的 border-bottom，
   这里不再加 border-top，避免出现 2px 双线 */
.word-more { padding: 14px 0 2px; }

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary);
  margin-right: 6px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.tag.warn { background: var(--warning-light); color: var(--warning); }
.tag.danger { background: var(--danger-light); color: var(--danger); }
.tag.ok { background: var(--success-light); color: var(--success); }

/* ---------- 表格（教师端，桌面才展开） ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
table.data th, table.data td {
  padding: 11px 13px;
  text-align: left;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
table.data th {
  background: var(--primary-50);
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
}
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td, table.data tr:hover td { background: var(--primary-50); }

/* ---------- 模态框 ---------- */
.modal-mask {
  display: none;
  position: fixed; inset: 0;
  background: rgba(42, 30, 51, 0.48);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff;
  width: 100%;
  max-width: 560px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--sp-5) 22px calc(var(--sp-5) + env(safe-area-inset-bottom));
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: sheetUp var(--dur-base) var(--ease-out) both;
}
@keyframes sheetUp {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-3); gap: var(--sp-3); }
.modal-head h3 { font-size: var(--fs-lg); font-weight: 700; }
.modal-close {
  border: none;
  background: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-3);
  padding: 4px 8px;
  border-radius: 8px;
  transition: background var(--dur-fast) ease-out, color var(--dur-fast) ease-out;
}
.modal-close:hover { background: var(--bg-2); color: var(--text); }

/* ---------- 发音按钮 ---------- */
.speak-btn {
  border: 1px solid var(--primary-200);
  background: var(--primary-light);
  color: var(--primary);
  font-size: var(--fs-lg);
  border-radius: 50%;
  width: 44px; height: 44px;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform var(--dur-fast) ease-out, box-shadow var(--dur-fast) ease-out, background var(--dur-fast) ease-out;
}
.speak-btn:hover { box-shadow: 0 4px 14px rgba(109, 36, 95, 0.2); background: var(--primary-100); }
.speak-btn:active { transform: scale(0.9); }
.speak-mini {
  border: none;
  background: none;
  cursor: pointer;
  font-size: var(--fs-base);
  opacity: 0.55;
  padding: 2px;
  min-width: 28px;
  min-height: 28px;
  transition: opacity var(--dur-fast) ease-out;
}
.speak-mini:hover { opacity: 1; }
.speak-mini:active { opacity: 1; }

/* ---------- 自选任务勾选按钮 ---------- */
.target-btn {
  border: 1px solid var(--border-2);
  background: #fff;
  border-radius: 50%;
  width: 36px; height: 36px;
  font-size: var(--fs-md);
  cursor: pointer;
  flex-shrink: 0;
  margin-right: 4px;
  filter: grayscale(1);
  opacity: 0.45;
  transition: all var(--dur-fast) ease-out;
}
.target-btn.on {
  filter: none;
  opacity: 1;
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 3px 10px rgba(109, 36, 95, 0.2);
}

/* ---------- Toast 提示 ---------- */
.toast {
  position: fixed;
  left: 50%; bottom: 100px;
  transform: translateX(-50%) translateY(8px);
  background: rgba(42, 30, 51, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: var(--fs-base);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast) ease-out, transform var(--dur-base) var(--ease-out);
  max-width: 86vw;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 空状态 ---------- */
.empty {
  text-align: center;
  color: var(--text-3);
  padding: var(--sp-6) var(--sp-4);
  font-size: var(--fs-base);
}

/* ---------- 分段控件（近 7 天 / 近 8 周 这类二选一）----------
   旧版靠 JS 直接写 element.style.cssText，选中态样式散在 student.js 里；
   现在样式回归 CSS，JS 只切换 .on 类。 */
.seg-btn {
  background: transparent;
  color: var(--text-2);
  border: 0;
  padding: 6px 12px;
  min-height: 32px;
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-fast) ease-out, color var(--dur-fast) ease-out;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn:hover { background: var(--primary-50); color: var(--primary); }
.seg-btn.on { background: var(--primary); color: #fff; }
.seg-btn.on:hover { background: var(--primary-600); color: #fff; }

/* ---------- 分组标题 ----------
   主色短竖条 + 字距，替代整块背景色，密度更低、层级更清楚 */
.section-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-2);
  margin: var(--sp-5) 0 var(--sp-3);
  letter-spacing: 0.14em;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.section-title::before {
  content: "";
  display: inline-block;
  width: 3px; height: 13px;
  border-radius: 2px;
  background: var(--primary-grad);
}

/* ---------- 滚动条美化（桌面端） ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--primary-200); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-400); }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   平板 / 桌面适配（≥768px）
   ============================================================ */
@media (min-width: 768px) {
  .page { padding: var(--sp-5) 32px var(--sp-6); }
  .topbar { padding: 12px 32px; }
  .grid-2 { grid-template-columns: repeat(4, 1fr); }
  .flashcard { height: 360px; max-width: 560px; margin-left: auto; margin-right: auto; }
  .flash-word { font-size: var(--fs-4xl); }
  .stat-row { grid-template-columns: repeat(4, 1fr); }
  .stat-row.four { grid-template-columns: repeat(4, 1fr); }
  /* 桌面端隐藏底部标签栏，改用页面内顶部导航 */
  .tabbar {
    position: static;
    border-top: none;
    border-bottom: 1px solid var(--border);
    max-width: 1024px;
    margin: 0 auto;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0 32px;
    box-shadow: none;
  }
  .tab {
    font-size: var(--fs-base);
    padding: 13px 18px;
    flex: none;
    border-bottom: 2.5px solid transparent;
  }
  .tab .tab-icon { display: inline; font-size: var(--fs-md); margin-right: 6px; }
  .tab.active { border-bottom-color: var(--primary); }
  .tab.active::after { display: none; }   /* 桌面端用下边框做指示，不再叠一层短条 */
  .tab.active .tab-icon { transform: none; }
  .login-wrap { margin-top: 10vh; }
  .modal-mask { align-items: center; }
  .modal { border-radius: var(--radius-xl); }
}

/* ============================================================
   二期：口语训练 + 写作批改（语音录入 · 对话气泡 · 评分组件）
   ============================================================ */

/* 麦克风按钮：主色实心 + 只在录音时脉冲，避免静止时的无意义装饰 */
.mic-btn {
  width: 76px; height: 76px; border-radius: 50%;
  border: none; cursor: pointer; font-size: 30px;
  background: var(--primary-grad); color: #fff;
  box-shadow: 0 8px 22px rgba(109, 36, 95, 0.3);
  transition: transform var(--dur-fast) ease-out, box-shadow var(--dur-fast) ease-out;
}
.mic-btn:active { transform: scale(0.95); }
.mic-btn.listening {
  background: linear-gradient(135deg, #D8453E 0%, #B3373A 100%);
  box-shadow: 0 0 0 10px rgba(216, 69, 62, 0.12), 0 8px 22px rgba(179, 55, 58, 0.38);
  animation: mic-pulse 1.2s infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 8px rgba(216, 69, 62, 0.12), 0 8px 22px rgba(179, 55, 58, 0.38); }
  50% { box-shadow: 0 0 0 16px rgba(216, 69, 62, 0.05), 0 8px 22px rgba(179, 55, 58, 0.38); }
}

/* 对话气泡 */
.chat-box {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--sp-4) var(--sp-3); max-height: 420px; overflow-y: auto; margin-bottom: var(--sp-3);
  display: flex; flex-direction: column; gap: var(--sp-3);
}
.chat-row { display: flex; }
.chat-row.ai { justify-content: flex-start; }
.chat-row.me { justify-content: flex-end; }
.chat-bubble {
  max-width: 85%; padding: 10px 14px; border-radius: 14px;
  font-size: var(--fs-base); line-height: 1.7; box-shadow: var(--shadow-sm);
}
.chat-bubble.ai { background: var(--primary-light); border-bottom-left-radius: 4px; color: var(--text); }
.chat-bubble.me { background: var(--success-light); border-bottom-right-radius: 4px; color: var(--text); }

/* 评分进度条复用 .progress-track/.progress-fill，无需新增 */

/* ============================================================
   三期：南开中学天开学校品牌化（青莲紫校色 · 校标 · 校名书法）
   ⚠ 本区块承载学校素材，改动前请确认不破坏学校视觉识别
   ============================================================ */

/* 顶栏标题：2026-09-14 起顶栏不再放校标，仅保留文字标题（样式见文件上方 .topbar .brand） */

/* ---------- 学段入口（学生登录第一步选择 小学/初中/高中） ---------- */
.stage-entry-row { display: flex; gap: var(--sp-2); margin: 6px 0 4px; }
.stage-entry {
  flex: 1;
  padding: 14px 0;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--primary-200);
  background: #fff;
  color: var(--primary);
  font-family: inherit;
  font-size: var(--fs-base);
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background var(--dur-fast) ease-out,
              color var(--dur-fast) ease-out,
              border-color var(--dur-fast) ease-out,
              transform var(--dur-fast) ease-out;
}
.stage-entry:active { transform: scale(0.97); }
.stage-entry.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 3px 10px rgba(109, 36, 95, 0.22);
}
.stu-stage-chip {
  display: flex; align-items: center; gap: var(--sp-2);
  background: var(--primary-50); color: var(--primary); border-radius: 10px;
  padding: 9px 12px; font-size: var(--fs-sm); margin-bottom: var(--sp-4);
  border: 1px solid var(--primary-100);
}
.stu-stage-chip a { margin-left: auto; color: var(--primary); text-decoration: underline; cursor: pointer; white-space: nowrap; }

/* ---------- 登录页品牌头图（★ 学校核心素材，保留） ----------
   教学楼全景 + 青莲紫渐变蒙层 + 校标 + 校名书法 + 校训。
   本次仅把底部圆角从 26px 收到 20px 与全站圆角体系统一，其余不动。 */
.login-hero {
  position: relative; margin: 0 -18px var(--sp-5);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg); overflow: hidden;
  box-shadow: 0 12px 32px rgba(66, 30, 60, 0.24);
}
.login-hero-bg {
  display: block; width: 100%; height: 230px; object-fit: cover;
}
.login-hero-mask {
  position: absolute; inset: 0;
  background: linear-gradient(180deg,
    rgba(66, 30, 60, 0.3) 0%,
    rgba(86, 30, 74, 0.5) 45%,
    rgba(94, 31, 84, 0.88) 100%);
}
.login-hero-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 12px 18px 18px; text-align: center;
}
.login-emblem {
  width: 56px; height: auto; margin-bottom: 8px;
  filter: brightness(0) invert(1) drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
}
.login-school-name {
  width: 76%; max-width: 320px; height: auto; margin-bottom: 8px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}
.login-motto {
  color: rgba(255, 255, 255, 0.92); font-size: var(--fs-sm);
  letter-spacing: 0.34em; text-indent: 0.34em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* ---------- 学生首页校园横幅（★ 学校核心素材，保留）---------- */
.home-hero {
  position: relative; border-radius: var(--radius); overflow: hidden;
  margin-bottom: var(--sp-3); box-shadow: var(--shadow-md);
}
.home-hero-bg {
  display: block; width: 100%; height: auto;
  aspect-ratio: 1920 / 900; object-fit: cover;
}
.home-hero-mask {
  position: absolute; inset: 0;
  background: linear-gradient(100deg,
    rgba(74, 24, 66, 0.82) 0%,
    rgba(109, 36, 95, 0.42) 55%,
    rgba(109, 36, 95, 0.06) 100%);
}
.home-hero-text {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  justify-content: center; padding: var(--sp-4) var(--sp-4); color: #fff;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
}
/* 问候语用展示字——首页第一眼的记忆点 */
.home-hero-text .hero-greet {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.02em;
}

/* ---------- 登录页学校落款（★ 保留） ---------- */
.login-footer {
  text-align: center; font-size: var(--fs-sm); color: var(--text-3);
  margin: var(--sp-5) 0 var(--sp-6); letter-spacing: 0.08em;
}
