:root {
  --primary: #4A90D9;
  --primary-light: #E8F0FE;
  --success: #52C41A;
  --warning: #FAAD14;
  --danger: #FF4D4F;
  --text: #333;
  --text-secondary: #999;
  --bg: #F5F7FA;
  --white: #FFFFFF;
  --border: #EBEDF0;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --radius: 12px;
}

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

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* 页面切换 */
.page { display: none; min-height: 100vh; padding-bottom: 70px; }
.page.active { display: block; }

/* 顶部导航 */
.nav-bar {
  position: sticky; top: 0; z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 600;
  backdrop-filter: blur(10px);
}
.nav-bar .back { position: absolute; left: 16px; font-size: 22px; cursor: pointer; }

/* 底部Tab */
.tab-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex; height: 60px;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 11px; color: var(--text-secondary);
  cursor: pointer; transition: all 0.2s;
  text-decoration: none;
}
.tab-item.active { color: var(--primary); font-weight: 600; }
.tab-item .icon { font-size: 22px; margin-bottom: 2px; }

/* 卡片 */
.card {
  background: var(--white);
  border-radius: var(--radius);
  margin: 12px 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 24px; border-radius: 8px;
  font-size: 15px; font-weight: 500;
  border: none; cursor: pointer; transition: all 0.2s;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:active { background: #3A7BC8; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 6px; }
.btn-lg { padding: 14px 32px; font-size: 17px; border-radius: 10px; }
.btn:disabled { opacity: 0.5; pointer-events: none; }

/* 输入框 */
.form-item { margin-bottom: 16px; }
.form-item label { display: block; font-size: 14px; color: var(--text-secondary); margin-bottom: 6px; }
.form-input {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 16px; outline: none; transition: border-color 0.2s;
  background: var(--bg);
}
.form-input:focus { border-color: var(--primary); background: white; }

/* 标签 */
.tag {
  display: inline-block; padding: 3px 8px;
  font-size: 11px; border-radius: 4px; font-weight: 500;
}
.tag-listening { background: #E6F7FF; color: #1890FF; }
.tag-reading { background: #F6FFED; color: #52C41A; }
.tag-writing { background: #FFF7E6; color: #FA8C16; }
.tag-danger { background: #FFF1F0; color: #FF4D4F; }
.tag-success { background: #F6FFED; color: #52C41A; }

/* 列表 */
.list-item {
  display: flex; align-items: center; padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }

/* 状态点 */
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 8px;
}
.dot-red { background: var(--danger); }
.dot-green { background: var(--success); }
.dot-yellow { background: var(--warning); }

/* 空状态 */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-secondary); font-size: 14px;
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }

/* 进度条 */
.progress-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.5s; }
.fill-blue { background: var(--primary); }
.fill-green { background: var(--success); }
.fill-orange { background: var(--warning); }

/* 弹窗 */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-overlay.hidden { display: none; }
.modal-content {
  background: white; border-radius: 16px 16px 0 0;
  width: 100%; max-width: 500px;
  padding: 20px; padding-bottom: 30px;
  max-height: 70vh; overflow-y: auto;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h3 { font-size: 17px; }
.modal-close { font-size: 20px; cursor: pointer; color: var(--text-secondary); }

/* Loading */
.loading { text-align: center; padding: 40px; color: var(--text-secondary); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 分数显示 */
.score-big { font-size: 48px; font-weight: 700; color: var(--primary); }
.score-medium { font-size: 28px; font-weight: 600; }

/* Flex工具 */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-1 { flex: 1; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.p-16 { padding: 16px; }

/* 对话气泡 */
.chat-bubble { max-width: 85%; padding: 10px 14px; border-radius: 12px; margin-bottom: 10px; font-size: 14px; line-height: 1.6; word-break: break-word; }
.chat-user { background: var(--primary); color: white; margin-left: auto; border-bottom-right-radius: 4px; }
.chat-ai { background: var(--bg); color: var(--text); margin-right: auto; border-bottom-left-radius: 4px; }

/* 打卡日历 */
.checkin-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.checkin-day { font-size: 11px; color: var(--text-secondary); padding: 4px 0; }
.checkin-dot { width: 24px; height: 24px; border-radius: 50%; margin: 2px auto; font-size: 10px; line-height: 24px; }
.checkin-done { background: var(--success); color: white; }
.checkin-today { background: var(--primary); color: white; }
.checkin-miss { background: var(--border); color: var(--text-secondary); }

/* 隐藏滚动条 */
::-webkit-scrollbar { display: none; }
html { scrollbar-width: none; }
