/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.6;
  min-height: 100vh;
}
a { color: #4a90d9; text-decoration: none; }
a:hover { color: #357abd; }

/* ===== Layout ===== */
.container { max-width: 480px; margin: 0 auto; padding: 16px; }

/* ===== Header ===== */
.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 16px 20px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header h1 { font-size: 1.2rem; font-weight: 600; }
.header .sub { font-size: 0.8rem; opacity: 0.85; margin-top: 2px; }
.header .nav-links { display: flex; gap: 12px; justify-content: center; margin-top: 8px; flex-wrap: wrap; }
.header .nav-links a { color: rgba(255,255,255,0.9); font-size: 0.85rem; padding: 4px 10px; border-radius: 12px; background: rgba(255,255,255,0.15); }
.header .nav-links a:hover { background: rgba(255,255,255,0.25); }
.header .user-info { font-size: 0.8rem; opacity: 0.8; margin-top: 4px; }
.header .user-info a { color: rgba(255,255,255,0.8); margin-left: 8px; text-decoration: underline; }

/* ===== Cards ===== */
.card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: 12px; color: #444; }

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  font-weight: 500;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: #667eea; color: white; }
.btn-primary:hover { background: #5a6fd6; }
.btn-success { background: #48bb78; color: white; }
.btn-success:hover { background: #38a169; }
.btn-danger { background: #f56565; color: white; }
.btn-danger:hover { background: #e53e3e; }
.btn-warning { background: #ed8936; color: white; }
.btn-warning:hover { background: #dd6b20; }
.btn-outline { background: transparent; border: 2px solid #667eea; color: #667eea; }
.btn-outline:hover { background: #667eea; color: white; }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-block { display: block; width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Forms ===== */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 0.9rem; font-weight: 500; margin-bottom: 4px; color: #555; }
.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
  background: white;
}
.form-input:focus { outline: none; border-color: #667eea; }
.form-select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.95rem;
  background: white;
  appearance: auto;
}
textarea.form-input { min-height: 80px; resize: vertical; }

/* ===== Student Card ===== */
.student-card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.student-card .info h3 { font-size: 1.05rem; color: #333; }
.student-card .info .meta { font-size: 0.8rem; color: #888; margin-top: 2px; }
.student-card .status { text-align: right; }
.student-card .status .badge { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 0.75rem; font-weight: 600; }
.badge-done { background: #c6f6d5; color: #276749; }
.badge-pending { background: #fefcbf; color: #975a16; }
.badge-partial { background: #feebc8; color: #9c4221; }

/* ===== Word/Sentence Item ===== */
.item-card {
  background: #f8fafc;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  border-left: 4px solid #667eea;
}
.item-card .en { font-size: 1.1rem; font-weight: 600; color: #2d3748; }
.item-card .zh { font-size: 0.95rem; color: #718096; margin-top: 4px; }
.item-card .phonetic { font-size: 0.85rem; color: #a0aec0; font-style: italic; }
.item-card .example { font-size: 0.85rem; color: #718096; margin-top: 6px; padding: 6px 10px; background: #edf2f7; border-radius: 6px; }

/* ===== Dictation ===== */
.dictation-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: #718096;
}
.dictation-progress .count { font-weight: 600; color: #667eea; }
.question-card {
  background: white;
  border-radius: 12px;
  padding: 24px 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  text-align: center;
}
.question-card .prompt { font-size: 1.2rem; color: #2d3748; margin-bottom: 16px; line-height: 1.6; }
.question-card .result { margin-top: 16px; padding: 12px; border-radius: 8px; font-size: 0.95rem; }
.question-card .result.correct { background: #c6f6d5; color: #276749; }
.question-card .result.wrong { background: #fed7d7; color: #9b2c2c; }

/* ===== Calendar ===== */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 12px;
}
.calendar-grid .day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
}
.calendar-grid .day.done { background: #c6f6d5; color: #276749; }
.calendar-grid .day.missed { background: #fed7d7; color: #9b2c2c; }
.calendar-grid .day.empty { background: transparent; }
.calendar-grid .day.future { background: #edf2f7; color: #a0aec0; }

/* ===== Login ===== */
.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-card {
  background: white;
  border-radius: 16px;
  padding: 32px 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}
.login-card h2 { text-align: center; font-size: 1.3rem; color: #333; margin-bottom: 24px; }
.login-card .error { background: #fed7d7; color: #9b2c2c; padding: 10px; border-radius: 8px; font-size: 0.85rem; margin-bottom: 16px; text-align: center; }
.login-card .logo { text-align: center; margin-bottom: 16px; }
.login-card .logo .icon { font-size: 2.5rem; }

/* ===== Alerts ===== */
.alert {
  padding: 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 12px;
}
.alert-success { background: #c6f6d5; color: #276749; }
.alert-error { background: #fed7d7; color: #9b2c2c; }

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal-content {
  background: white;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-content h3 { font-size: 1.1rem; margin-bottom: 16px; }

/* ===== Stats ===== */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.stat-card {
  background: #f8fafc;
  padding: 14px;
  border-radius: 10px;
  text-align: center;
}
.stat-card .num { font-size: 1.5rem; font-weight: 700; color: #667eea; }
.stat-card .label { font-size: 0.8rem; color: #888; margin-top: 2px; }

/* ===== Progress Bar ===== */
.progress-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0;
}
.progress-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* ===== Table ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { padding: 8px 6px; text-align: left; border-bottom: 1px solid #e2e8f0; }
th { font-weight: 600; color: #555; }

/* ===== Responsive ===== */
@media (min-width: 768px) {
  .container { max-width: 640px; }
}
@media (max-width: 360px) {
  html { font-size: 14px; }
}
