/* 外企英语 · 地铁学习 —— 移动端优先样式 */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --success: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 14px;
  --tab-h: 58px;
  --header-h: 52px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  overscroll-behavior: none;
}

/* 头部 */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
  padding-top: env(safe-area-inset-top);
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding-left: 16px; padding-right: 16px; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.app-header h1 { font-size: 18px; font-weight: 600; }
.badge { font-size: 13px; background: rgba(255,255,255,.2); padding: 4px 10px; border-radius: 20px; }

/* 主区域 */
#app-main {
  position: fixed;
  top: calc(var(--header-h) + env(safe-area-inset-top));
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
  left: 0; right: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 14px;
}
.view { display: none; animation: fade .2s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 底部 tab */
.tab-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--border);
  display: flex; z-index: 100;
}
.tab {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--text-light); font-size: 11px; transition: color .15s;
}
.tab.active { color: var(--primary); }
.tab-icon { font-size: 22px; line-height: 1; }

/* 子 tab */
.sub-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.sub-tab {
  flex: 1; padding: 8px; border: 1px solid var(--border); background: var(--card);
  border-radius: 10px; font-size: 14px; color: var(--text-light); cursor: pointer;
}
.sub-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.filter-row { margin-bottom: 12px; }
.filter-row select {
  width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--card); font-size: 15px; color: var(--text);
}

/* 通用卡片 */
.card {
  background: var(--card); border-radius: var(--radius); padding: 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06); margin-bottom: 12px;
}

/* 单词卡 */
.flashcard {
  background: var(--card); border-radius: 18px; padding: 28px 20px; min-height: 260px;
  box-shadow: 0 4px 16px rgba(0,0,0,.08); display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; margin-bottom: 14px;
}
.flashcard .fc-word { font-size: 34px; font-weight: 700; color: var(--text); word-break: break-word; }
.flashcard .fc-phonetic { font-size: 18px; color: var(--primary); margin-top: 8px; }
.flashcard .fc-meaning { font-size: 22px; color: var(--text); margin-top: 16px; }
.flashcard .fc-example { font-size: 15px; color: var(--text-light); margin-top: 14px; font-style: italic; }
.fc-hint { color: var(--text-light); font-size: 15px; margin-top: 18px; }

.btn {
  border: none; border-radius: 12px; padding: 13px 18px; font-size: 16px;
  cursor: pointer; background: var(--primary); color: #fff; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.97); opacity: .9; }
.btn-block { width: 100%; }
.btn-ghost { background: var(--card); color: var(--primary); border: 1px solid var(--primary); }
.btn-gray { background: #eef1f5; color: var(--text); }
.btn-lg { padding: 16px; font-size: 17px; }

.grade-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grade-btn { border: none; border-radius: 10px; padding: 12px 4px; font-size: 13px; cursor: pointer; color: #fff; }
.grade-btn small { display: block; font-size: 10px; opacity: .85; margin-top: 2px; }
.g-again { background: var(--danger); }
.g-hard { background: var(--warn); }
.g-good { background: var(--primary); }
.g-easy { background: var(--success); }

.progress-line { font-size: 13px; color: var(--text-light); text-align: center; margin-bottom: 10px; }
.bar { height: 6px; background: var(--border); border-radius: 4px; overflow: hidden; margin-bottom: 14px; }
.bar > i { display: block; height: 100%; background: var(--primary); transition: width .3s; }

/* 列表项 */
.list-item {
  background: var(--card); border-radius: 12px; padding: 14px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-size: 17px; font-weight: 600; }
.list-item .li-sub { font-size: 13px; color: var(--text-light); margin-top: 3px; }
.icon-btn {
  border: none; background: #eef2ff; color: var(--primary); width: 42px; height: 42px;
  border-radius: 50%; font-size: 19px; cursor: pointer; flex-shrink: 0;
}
.icon-btn:active { transform: scale(.92); }

/* 音标 */
.phon-group-title { font-size: 15px; color: var(--text-light); margin: 16px 0 8px; font-weight: 600; }
.phon-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.phon-cell {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 4px; text-align: center; cursor: pointer; font-size: 20px; color: var(--primary);
}
.phon-cell:active { background: var(--primary); color: #fff; }
.phon-cell small { display: block; font-size: 11px; color: var(--text-light); margin-top: 4px; }
.phon-detail { text-align: center; }
.phon-detail .pd-symbol { font-size: 54px; color: var(--primary); font-weight: 700; }
.phon-detail .pd-row { margin-top: 12px; font-size: 15px; }
.phon-detail .pd-label { color: var(--text-light); font-size: 13px; }

/* 跟读 */
.shadow-target {
  background: var(--card); border-radius: var(--radius); padding: 22px; text-align: center;
  margin-bottom: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.shadow-target .st-en { font-size: 21px; font-weight: 600; line-height: 1.5; }
.shadow-target .st-zh { font-size: 15px; color: var(--text-light); margin-top: 10px; }
.mic-btn {
  width: 76px; height: 76px; border-radius: 50%; border: none; margin: 10px auto;
  background: var(--danger); color: #fff; font-size: 32px; cursor: pointer; display: block;
}
.mic-btn.recording { animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.5); } 50% { box-shadow: 0 0 0 16px rgba(239,68,68,0); } }
.score-box { text-align: center; margin: 14px 0; }
.score-num { font-size: 46px; font-weight: 700; }
.score-num.good { color: var(--success); } .score-num.mid { color: var(--warn); } .score-num.bad { color: var(--danger); }
.diff-word { padding: 1px 3px; border-radius: 4px; }
.diff-ok { color: var(--text); }
.diff-bad { background: #fee2e2; color: var(--danger); text-decoration: line-through; }
.you-said { font-size: 16px; color: var(--text-light); margin-top: 8px; }

/* 场景句型 */
.cat-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; }
.chip {
  flex-shrink: 0; padding: 8px 14px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--card); font-size: 14px; cursor: pointer; color: var(--text-light);
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.sent-item { background: var(--card); border-radius: 12px; padding: 14px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.sent-en { font-size: 16px; font-weight: 500; line-height: 1.5; }
.sent-zh { font-size: 14px; color: var(--text-light); margin-top: 6px; }
.sent-actions { display: flex; gap: 8px; margin-top: 10px; }
.sent-actions .btn { padding: 8px 12px; font-size: 13px; }

/* 统计 */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 20px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.stat-card .sc-num { font-size: 32px; font-weight: 700; color: var(--primary); }
.stat-card .sc-label { font-size: 13px; color: var(--text-light); margin-top: 6px; }

.empty { text-align: center; color: var(--text-light); padding: 50px 20px; font-size: 15px; }
.empty .em-icon { font-size: 46px; display: block; margin-bottom: 12px; }

/* 加载 */
.loading-box { text-align: center; padding: 80px 20px; color: var(--text-light); }
.spinner { width: 38px; height: 38px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; margin: 0 auto 16px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + 24px); transform: translateX(-50%) translateY(20px);
  background: rgba(31,41,55,.94); color: #fff; padding: 11px 20px; border-radius: 22px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 200; max-width: 84%;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.section-note { font-size: 13px; color: var(--text-light); background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; line-height: 1.5; }
