/* ===== 本地字体：Nunito（已本地化，不再依赖 Google Fonts，国内加载稳定） ===== */
/* 可变字体单文件覆盖 100~900 全部字重 */
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  /* 相对 css/ 目录，需回退一级到根目录的 fonts/ */
  src: url('../fonts/nunito-variable.woff2') format('woff2');
}

:root {
  --primary: #4F46E5;
  --primary-light: #818CF8;
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --text: #1E293B;
  --text-light: #64748B;
  --success: #10B981;
  --border: #E2E8F0;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(0,0,0,0.06);
}

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

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.screen {
  display: none;
  min-height: 100vh;
  padding-bottom: 80px;
}

.screen.active {
  display: block;
}

/* ===== 启动页 ===== */
#splash {
  background: linear-gradient(160deg, #4F46E5 0%, #7C3AED 100%);
  color: white;
  padding: 40px 24px;
}

/* 同 #license：display:flex 只能挂在 .active 上，否则启动页会永久显示在其它页面下方 */
#splash.active {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.splash-content .logo {
  font-size: 64px;
  margin-bottom: 16px;
}

.splash-content h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
}

.subtitle {
  opacity: 0.9;
  margin-bottom: 40px;
  font-size: 16px;
}

.tip {
  margin-top: 24px;
  font-size: 13px;
  opacity: 0.7;
}

/* ===== 按钮 ===== */
.btn-primary {
  background: white;
  color: var(--primary);
  border: none;
  padding: 14px 36px;
  border-radius: 50px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  transition: transform 0.15s;
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-secondary {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
  padding: 12px 28px;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.btn-small {
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  margin-top: 12px;
  cursor: pointer;
}

/* ===== 主界面 ===== */
#main {
  padding: 20px 16px 100px;
}

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

.user-info {
  display: flex;
  flex-direction: column;
}

#greeting {
  font-size: 20px;
  font-weight: 700;
}

.level {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 2px;
}

.today-time {
  background: #EEF2FF;
  color: var(--primary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.recommend-card {
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  color: white;
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.recommend-tag {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  margin-bottom: 10px;
}

.recommend-card h2 {
  font-size: 20px;
  margin-bottom: 6px;
}

.recommend-card p {
  opacity: 0.9;
  font-size: 14px;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 28px;
}

.mode-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 12px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s;
}

.mode-card:active {
  transform: scale(0.97);
}

.mode-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.mode-name {
  font-weight: 700;
  font-size: 15px;
}

.recent-section h3 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--text-light);
}

.recent-list {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.empty-tip {
  text-align: center;
  color: var(--text-light);
  font-size: 14px;
  padding: 12px 0;
}

/* ===== 对话页 ===== */
#chat {
  display: none;
  flex-direction: column;
  height: 100vh;
  padding: 0;
  background: #F1F5F9;
}

#chat.active {
  display: flex;
}

.chat-header {
  background: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.back-btn, .end-btn {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
}

.chat-title {
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 聊天页头部：Alex 真人头像，强化"正在和 Alex 聊"的感觉 */
.chat-alex {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  box-shadow: 0 0 0 2px #EEEDFE;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 18px;
  line-height: 1.55;
  animation: fadeIn 0.25s ease;
}

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

.message.ai {
  background: white;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.message.user {
  background: var(--primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-input-area {
  background: white;
  padding: 12px 16px 20px;
  border-top: 1px solid var(--border);
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.voice-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #EEF2FF;
  font-size: 20px;
  cursor: pointer;
}

#userInput {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 13px 18px;
  font-size: 17px;
  outline: none;
  font-family: inherit;
}

#userInput:focus {
  border-color: var(--primary-light);
}

.send-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 24px;
  padding: 13px 22px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}

.input-tip {
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
  margin-top: 8px;
}

/* ===== 反馈页 ===== */
#feedback {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #EEF2FF, #F8FAFC);
}

#feedback.active {
  display: flex;
}

.feedback-card {
  background: white;
  border-radius: 24px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  max-width: 360px;
  width: 100%;
}

.feedback-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.feedback-card h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.feedback-summary {
  color: var(--text-light);
  margin-bottom: 24px;
}

.feedback-section {
  text-align: left;
  background: #F8FAFC;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.feedback-section h4 {
  font-size: 14px;
  color: var(--primary);
  margin-bottom: 4px;
}

.feedback-section p {
  font-size: 14px;
  line-height: 1.5;
}

.feedback-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

/* ===== 底部导航 ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  display: flex;
  justify-content: space-around;
  padding: 10px 0 16px;
  border-top: 1px solid var(--border);
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  color: var(--text-light);
  cursor: pointer;
}

.nav-item.active {
  color: var(--primary);
  font-weight: 700;
}

.nav-item span:first-child {
  font-size: 22px;
}

/* 隐藏底部导航在对话和反馈页 */
#chat.active ~ .bottom-nav,
#feedback.active ~ .bottom-nav,
#splash.active ~ .bottom-nav {
  display: none;
}
/* 语音按钮状态 */
.voice-btn.listening {
  background: #FEE2E2 !important;
  animation: pulse 1.2s infinite;
}

/* AI 说完后，等待学生开口时的提示高亮（绿色，区别于录音中红色） */
.voice-btn.waiting {
  background: #DCFCE7 !important;
  animation: pulse-green 1.4s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
  70% { box-shadow: 0 0 0 12px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.message.thinking {
  opacity: 0.7;
  font-style: italic;
}

/* ===== 成长 / 我的 页 ===== */
#growth, #profile {
  padding: 20px 16px 100px;
}

.page-header {
  margin-bottom: 18px;
}

.page-header h2 {
  font-size: 24px;
  font-weight: 800;
}

.page-sub {
  font-size: 13px;
  color: var(--text-light);
}

/* 统计卡 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 6px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
}

.stat-label {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

/* 等级卡 */
.level-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.level-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
}

.level-next {
  color: var(--text-light);
  font-weight: 600;
  font-size: 12px;
}

.level-bar {
  height: 10px;
  background: #EEF2FF;
  border-radius: 999px;
  overflow: hidden;
}

.level-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #818CF8, #4F46E5);
  border-radius: 999px;
  transition: width 0.5s;
}

/* 通用卡片块 */
.block {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.block h3 {
  font-size: 15px;
  margin-bottom: 12px;
  color: var(--text-light);
}

/* 7 天柱状图 */
.week-chart {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 6px;
  height: 150px;
  padding: 6px 2px 0;
}

.wk-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}

.wk-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
}

.wk-bar {
  width: 62%;
  max-width: 26px;
  background: linear-gradient(180deg, #818CF8, #4F46E5);
  border-radius: 6px 6px 0 0;
  transition: height 0.4s;
  min-height: 2px;
}

.wk-val {
  font-size: 11px;
  color: var(--text-light);
  margin-bottom: 4px;
  height: 14px;
}

.wk-day {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 6px;
}

/* 徽章 */
.badge-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.badge {
  text-align: center;
  padding: 10px 4px;
  border-radius: 12px;
  background: #F1F5F9;
  opacity: 0.55;
}

.badge.got {
  background: #EEF2FF;
  opacity: 1;
}

.badge-icon {
  font-size: 26px;
}

.badge-name {
  font-size: 11px;
  font-weight: 700;
  margin-top: 4px;
}

.badge-desc {
  font-size: 10px;
  color: var(--text-light);
  margin-top: 2px;
}

/* 我的 - 资料卡 */
.profile-card {
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  cursor: pointer;
}

.profile-avatar {
  font-size: 38px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.profile-meta {
  flex: 1;
}

.profile-name {
  font-size: 20px;
  font-weight: 800;
}

.profile-grade {
  font-size: 13px;
  opacity: 0.9;
  margin-top: 2px;
}

.profile-edit {
  font-size: 18px;
  opacity: 0.85;
}

/* 设置行 + 开关 */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-row.col {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.setting-title {
  font-size: 15px;
  font-weight: 600;
}

.setting-sub {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

.toggle {
  width: 50px;
  height: 28px;
  border-radius: 999px;
  background: #CBD5E1;
  position: relative;
  flex: none;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle.on {
  background: var(--success);
}

.toggle-knob {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle.on .toggle-knob {
  left: 25px;
}

#setRate {
  width: 100%;
  accent-color: var(--primary);
}

.btn-block {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.btn-block.danger {
  background: #FEE2E2;
  color: #DC2626;
}

/* 登录 / 注册屏 */
#auth {
  background: linear-gradient(160deg, #4F46E5 0%, #7C3AED 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
}

.auth-card {
  width: 100%;
  max-width: 360px;
}

.auth-card .logo {
  font-size: 56px;
  margin-bottom: 12px;
}

.auth-card h1 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 6px;
}

.auth-card .subtitle {
  opacity: 0.9;
  margin-bottom: 32px;
  font-size: 14px;
}

.auth-input {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 16px;
  font-family: inherit;
  text-align: center;
  margin-bottom: 10px;
  outline: none;
  box-sizing: border-box;
}

.auth-tip {
  font-size: 13px;
  opacity: 0.85;
  min-height: 18px;
  margin-bottom: 16px;
  white-space: pre-line;
}

.auth-btn {
  width: 100%;
  margin-bottom: 10px;
}

.auth-btn-ghost {
  background: transparent;
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 50px;
  padding: 10px 28px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.cloud-note {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 12px;
  line-height: 1.5;
  text-align: left;
}

/* ===== 授权拦截屏 ===== */
#license {
  background: linear-gradient(160deg, #4F46E5 0%, #7C3AED 100%);
  color: white;
  padding: 40px 24px;
}

/* 注意：display:flex 必须写在 .active 上。
   若写成 #license{display:flex}，ID 优先级高于 .screen{display:none}，
   授权屏会永远显示在其它页面下方（曾经的显示 Bug）。 */
#license.active {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.license-box {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 16px 18px;
  margin: 0 0 24px;
  font-size: 14px;
  line-height: 1.7;
  text-align: left;
}

/* 授权屏自诊断：显示当前登录账号，方便发现"用错邮箱登录" */
.license-account {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 13px;
  word-break: break-all;
}

/* ===== 激活码兑换（授权屏紫底卡片） ===== */
.redeem-box {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 0 0 16px;
  text-align: left;
}
.redeem-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #fff;
}
.redeem-box .auth-input { width: 100%; color: var(--text); }
#redeemBlock .redeem-title { color: var(--text); }

/* 管理面板：生成激活码区 */
.gen-codes-box {
  margin: 14px 0 4px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

/* ===== 我的页：授权状态 ===== */
.profile-license {
  background: #F1F5F9;
  border-radius: 12px;
  padding: 12px 16px;
  margin: 14px 0;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

/* ===== 授权管理面板（管理员） ===== */
#adminPanel h3 {
  margin-bottom: 4px;
}

.grant-row {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.grant-row .auth-input {
  margin-bottom: 0;
  text-align: left;
  padding: 12px 14px;
}

.grant-row select.auth-input {
  flex: 0 0 156px;   /* 加宽，容纳「年卡 · 12 个月（¥199）」这类带价格的选项 */
}

#adminPanel .auth-tip {
  opacity: 1;
  color: var(--text);
  min-height: 16px;
  margin: 8px 0 4px;
}

/* ===== 授权管理：已授权学员名单 ===== */
.license-list-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.license-list-title { font-size: 14px; font-weight: 700; color: var(--text); flex: none; }
.license-stat { flex: 1; font-size: 12px; color: var(--text-light); }
.btn-mini {
  background: #EEF2FF;
  color: var(--primary);
  border: none;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 14px;
  cursor: pointer;
  flex: none;
}
.btn-mini:active { opacity: .7; }

.license-list { display: flex; flex-direction: column; gap: 8px; }
.license-empty { font-size: 13px; color: var(--text-light); text-align: center; padding: 14px 0; }

.license-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  text-align: left;
}
.license-item-main { display: flex; align-items: center; gap: 8px; }
.license-email {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  word-break: break-all;
}
.license-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 10px;
  flex: none;
}
.badge-active   { background: #E1F5EE; color: #0F6E56; }
.badge-expiring { background: #FAEEDA; color: #854F0B; }
.badge-expired  { background: #FCEBEB; color: #A32D2D; }

.license-meta { font-size: 12px; color: var(--text-light); margin-top: 5px; line-height: 1.5; }
.license-actions { display: flex; gap: 8px; margin-top: 9px; }
.license-actions button {
  flex: 1;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
}
.license-actions button.danger { color: #A32D2D; border-color: #F7C1C1; }
.license-actions button:active { opacity: .7; }

/* ===== 顶部导航（整合页：未登录/已登录双态） ===== */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}
.top-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.logo-sm { font-size: 24px; }
.top-brand { font-weight: 800; font-size: 16px; color: var(--text); white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-guest { display: flex; align-items: center; gap: 8px; }

/* 顶部导航按钮：手机端不换行、不被压缩（防止"登录/注册"在窄屏折成两行） */
.top-guest .btn-sm {
  white-space: nowrap;
  flex: none;
}

/* 窄屏（≤420px，覆盖 iPhone SE/14/14 Plus 等所有主流手机尺寸）：
   收紧间距+隐藏品牌文字只留头像，保证两个按钮单行 */
@media (max-width: 420px) {
  .top-nav { padding: 10px 10px; }
  .top-logo { gap: 6px; }
  .top-brand { font-size: 14px; display: none; }
  .top-actions { gap: 6px; }
  .top-guest { gap: 6px; }
  .top-guest .btn-sm { padding: 7px 12px; font-size: 12px; }
}

/* 超窄屏（≤350px）进一步收紧按钮，保证极小屏也单行 */
@media (max-width: 350px) {
  .top-guest .btn-sm { padding: 6px 10px; font-size: 12px; }
}

/* 落地页两个主按钮同样防止文字内部换行 */
.hero-actions .btn-hero,
.hero-actions .btn-secondary {
  white-space: nowrap;
}
.top-member {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  background: #EEF2FF;
  padding: 6px 12px;
  border-radius: 50px;
}
.top-avatar { font-size: 20px; }
.top-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 小号按钮 + 幽灵按钮（顶栏用） */
.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: 50px; }
.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-ghost:active { background: #EEF2FF; }

/* 渐变主按钮（浅色背景页面的主 CTA） */
.btn-hero {
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  color: #fff;
  border: none;
  padding: 14px 34px;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35);
  transition: transform 0.15s;
}
.btn-hero:active { transform: scale(0.97); }

/* 浅色页面的 .btn-primary 统一改为渐变紫底白字（splash / license 紫底页保持原白底紫字） */
.screen:not(#splash):not(#license) .btn-primary,
.modal .btn-primary {
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  color: #fff;
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.30);
}

/* ===== 游客落地页 ===== */
.guest-home { text-align: center; }
.hero { padding: 34px 8px 26px; }
.hero-badge {
  display: inline-block;
  background: #EEF2FF;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 14px;
}
.hero h1 {
  font-size: 27px;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 10px;
  color: var(--text);
}

/* 首页 hero：标题文字在左、Alex 头像在右（须写在 .hero h1 之后才能覆盖其 margin） */
.hero-headline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 10px;
}
.hero-headline h1 {
  margin-bottom: 0;
  text-align: left;
}
.hero-alex {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  border: 3px solid #fff;
  box-shadow: 0 8px 22px rgba(79, 70, 229, 0.28);
}
.hero-sub { color: var(--text-light); font-size: 15px; margin-bottom: 24px; }
.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.btn-hero-ghost { background: #fff; }
.hero-tip { margin-top: 16px; font-size: 12px; color: var(--text-light); }
.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 26px 0 4px;
  text-align: left;
}
.feature-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 14px;
  box-shadow: var(--shadow);
}
.feature-icon { font-size: 26px; margin-bottom: 8px; }
.feature-title { font-weight: 700; font-size: 15px; margin-bottom: 3px; }
.feature-desc { font-size: 12px; color: var(--text-light); line-height: 1.55; }
.guest-section h3 {
  font-size: 16px;
  color: var(--text-light);
  margin: 28px 0 12px;
}

/* ===== 登录 / 注册 模态 ===== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.open { display: flex; }
.modal-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: #fff;
  color: var(--text);
  border-radius: 20px;
  padding: 28px 24px 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px;
}
.modal-card .logo { font-size: 48px; margin-bottom: 8px; }
.modal-card h1 { font-size: 23px; font-weight: 800; margin-bottom: 6px; color: var(--text); }
.modal-card .subtitle {
  opacity: 1;
  color: var(--text-light);
  margin-bottom: 20px;
  font-size: 13px;
}
.modal-card .auth-input {
  background: #F1F5F9;
  border: 1.5px solid var(--border);
  text-align: left;
  color: var(--text);
}
.modal-card .auth-input:focus {
  border-color: var(--primary);
  background: #fff;
}
.modal-card .auth-tip { color: var(--text-light); opacity: 1; }
.modal-card .auth-btn-ghost {
  background: #fff;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

/* ===== 对话回顾朗读播放器（当前句高亮） ===== */
.replay-player {
  margin-top: 16px;
  background: #F8FAFC;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  text-align: center;
  min-height: 74px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.replay-label {
  font-size: 12px;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 8px;
}
.replay-text {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--text);
  border-radius: 10px;
  padding: 4px 8px;
  animation: replayGlow 1.1s ease-in-out infinite;
}
.replay-text .who {
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  margin-right: 4px;
  letter-spacing: 0.5px;
}
@keyframes replayGlow {
  0%, 100% { background: transparent; }
  50% { background: #EEF2FF; box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.12); }
}

/* 回顾朗读：句子列表（点击单句重听） */
.replay-list {
  margin-top: 10px;
  max-height: 210px;
  overflow-y: auto;
  text-align: left;
  border-top: 1px dashed var(--border);
  padding-top: 6px;
}
.replay-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}
.replay-item:hover { background: #F1F5F9; }
.replay-item .who {
  flex: none;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  margin-top: 3px;
  letter-spacing: 0.5px;
  min-width: 38px;
}
.replay-item.playing {
  background: #EEF2FF;
  box-shadow: inset 3px 0 0 var(--primary);
  font-weight: 700;
}

/* ===== 登录模态：字段级错误 / 密码可见切换 / 移动端键盘适配 ===== */
.auth-field { margin-bottom: 10px; text-align: left; }

.pw-wrap { position: relative; }
.pw-toggle {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-60%);
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  color: var(--text-light);
}
.pw-wrap .auth-input { padding-right: 44px; margin-bottom: 0; }

.field-error {
  display: none;
  font-size: 12px;
  color: #DC2626;
  margin: 5px 2px 0;
  line-height: 1.4;
}
.field-error.show { display: block; }

.modal-card .auth-input.error {
  border-color: #DC2626;
  background: #FEF2F2;
}

.auth-link {
  margin-top: 4px;
  font-size: 13px;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* 登录按钮加载态：防重复提交 */
.auth-btn[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
}

/* 移动端：模态高度自适应 + 键盘不遮挡 + 底部安全区 */
@supports (height: 100dvh) {
  .modal { height: 100dvh; }
}
.modal-card {
  max-height: calc(90dvh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}
@media (max-height: 700px) {
  .modal-card .logo { font-size: 38px; margin-bottom: 4px; }
  .modal-card h1 { font-size: 20px; }
  .modal-card .subtitle { margin-bottom: 14px; }
  .modal { align-items: flex-start; padding: 12px; }
}

/* ===== 品牌：Alex 真人形象 logo ===== */
.logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  background: #EEEDFE;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.28);
  flex: none;
}
.logo-wrap .logo-sm { font-size: 17px; line-height: 1; }
/* 当 logo-sm 是图片（Alex 头像）时铺满父圆形容器 */
.logo-wrap img.logo-sm { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.logo-wrap.big {
  width: 82px;
  height: 82px;
  margin-bottom: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.logo-wrap.big .logo-sm { font-size: 40px; }

/* ===== 品牌 slogan ===== */
.hero-slogan {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.4px;
  margin-bottom: 14px;
}
.hero-slogan.light { color: rgba(255, 255, 255, 0.92); margin-bottom: 26px; }

/* ===== 社交证明条（真实全站数据） ===== */
.social-proof {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
  padding: 12px 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  animation: spIn 0.5s ease both;
}
.sp-item { flex: 1; min-width: 0; }
.sp-val {
  font-size: 19px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}
.sp-label {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}
.sp-divider { width: 1px; height: 26px; background: var(--border); flex: none; }
@keyframes spIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ===== 特性卡动效（可点击） ===== */
.feature-card {
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.feature-cta {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.feature-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
@media (hover: hover) {
  .feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 26px rgba(79, 70, 229, 0.16);
  }
  .feature-card:hover .feature-icon { transform: scale(1.12); }
  .feature-card:hover .feature-cta { opacity: 1; transform: none; }
}
.feature-card:active { transform: translateY(-1px) scale(0.985); }
.feature-icon { transition: transform 0.18s ease; }

/* ===== 页面切换过渡 ===== */
.screen.active {
  animation: screenIn 0.28s ease both;
}
@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* 无障碍：降低动态效果偏好 */
@media (prefers-reduced-motion: reduce) {
  .screen.active,
  .social-proof,
  .replay-text,
  .message {
    animation: none !important;
  }
  .feature-card, .feature-icon, .feature-cta { transition: none !important; }
}

/* ===== 口语水平测试：结果页 ===== */
.pr-badge {
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  color: #fff;
  border-radius: 16px;
  padding: 18px 16px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.28);
}
.pr-label { font-size: 13px; opacity: 0.85; margin-bottom: 4px; }
.pr-level { font-size: 40px; font-weight: 800; line-height: 1.1; letter-spacing: 1px; }
.pr-score { font-size: 14px; opacity: 0.9; margin-top: 4px; }
.pr-comment {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  font-style: italic;
  margin-bottom: 14px;
}
.pr-note {
  font-size: 12px;
  color: var(--text-light);
  background: #F1F5F9;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 14px 0 18px;
  line-height: 1.5;
  text-align: left;
}

/* ===== 我的页：英语能力档案卡 ===== */
.ability-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin: 14px 0;
  box-shadow: var(--shadow);
}
.ability-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.ability-title { font-size: 15px; font-weight: 700; }
.ability-sub { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.ability-level {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  background: #EEF2FF;
  padding: 6px 14px;
  border-radius: 12px;
}
.ability-bar {
  height: 8px;
  background: #E2E8F0;
  border-radius: 999px;
  overflow: hidden;
}
.ability-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #4F46E5, #7C3AED);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.ability-btn {
  margin-top: 14px;
  background: #F1F5F9;
  color: var(--primary);
  font-size: 14px;
  padding: 11px;
}

/* iOS 静音键提示条（聊天页顶部，一次性） */
.ios-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #FEF3C7;
  color: #92400E;
  font-size: 12.5px;
  padding: 8px 12px;
  border-bottom: 1px solid #FDE68A;
  flex: none;
}
.ios-hint .btn-mini { flex: none; }

/* ===== 学习报告 + 打卡卡片 ===== */
.report-grid {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.report-item {
  flex: 1;
  background: #F1F5F9;
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
}
.report-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary, #4F46E5);
  line-height: 1.2;
}
.report-label { font-size: 11.5px; color: var(--muted, #6B7280); margin-top: 2px; }
.week-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 64px;
  padding: 4px 2px 0;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border, #E5E7EB);
}
.week-bar {
  flex: 1;
  background: linear-gradient(180deg, #4F46E5, #8B5CF6);
  border-radius: 5px 5px 0 0;
  min-height: 3px;
  opacity: 0.85;
}
.week-bar.today { opacity: 1; box-shadow: 0 0 0 2px rgba(79,70,229,.2); }
.week-bars .bar-day { flex: 1; font-size: 0; }
.week-days {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.week-days span {
  flex: 1;
  text-align: center;
  font-size: 10px;
  color: #9CA3AF;
}

/* 打卡卡片预览模态 */
.card-preview-modal { max-width: 420px; padding-bottom: 6px; }
.card-img-wrap {
  margin: 10px 0 14px;
  border-radius: 12px;
  background: #f8f8fb;
  /* 图片按宽度 100% 显示，完整原图比例（高瘦 750x1150），
     整张卡片在 modal-card 内可滚动查看完整 */
  text-align: center;
}
.card-img-wrap img { display: block; width: 100%; height: auto; cursor: pointer; }
/* 移动端长按图片时禁用文字选中/高亮，长按菜单更干净 */
.card-img-wrap img { -webkit-touch-callout: inherit; user-select: none; -webkit-user-drag: none; }
/* 长按提示徽章（悬浮在图片右下角） */
.card-img-hint {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  background: #4F46E5;
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

/* ===== 管理员学员看板：登录/学习情况 ===== */
.license-study {
  font-size: 12px;
  color: var(--text-light, #6B7280);
  line-height: 1.6;
  margin: 6px 0 8px;
  padding: 6px 8px;
  background: #F8FAFC;
  border-radius: 8px;
}
.seen-tag {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #EEF2FF;
  color: #4F46E5;
}
.seen-tag.seen-today { background: #DCFCE7; color: #15803D; }
.seen-tag.seen-never { background: #F3F4F6; color: #9CA3AF; }
