/* === Base === */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Baloo Tamma 2', system-ui, sans-serif;
  color: #134e4a;
  background: #f0fdfa;
  -webkit-font-smoothing: antialiased;
}
.hanzi { font-family: 'ZCOOL XiaoWei', serif; }
.pinyin { font-family: 'Fira Sans', sans-serif; font-weight: 400; }

/* === Navigation === */
.top-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem; background: #e97a1f;
}
.nav-left { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; }
.nav-logo { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.nav-title { font-weight: 700; font-size: 1.1rem; color: white; }
.nav-right { display: flex; align-items: center; position: relative; }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
  background: rgba(255, 255, 255, 0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; color: white; font-weight: 600; cursor: pointer;
}
.dropdown-menu {
  position: absolute; top: 36px; right: 0; background: #134e4a;
  border-radius: 12px; padding: 1rem; min-width: 260px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3); z-index: 100;
}
.dropdown-heatmap { margin-bottom: 0.75rem; }
.heatmap-title {
  font-size: 0.7rem; color: rgba(255,255,255,0.6);
  letter-spacing: 0.05em; margin-bottom: 0.5rem;
}
.heatmap-grid {
  display: grid; grid-template-columns: repeat(18, 1fr);
  gap: 2px;
}
.heatmap-cell {
  width: 10px; height: 10px; border-radius: 2px; background: #1a3a38;
}
.heatmap-legend {
  display: flex; align-items: center; gap: 3px; margin-top: 0.4rem;
  font-size: 0.6rem; color: rgba(255,255,255,0.5);
}
.heatmap-legend .heatmap-cell { width: 8px; height: 8px; }
.dropdown-signout {
  width: 100%; background: rgba(255,255,255,0.1); color: white;
  border: none; padding: 0.5rem; border-radius: 8px; cursor: pointer;
  font-family: 'Baloo Tamma 2', system-ui, sans-serif; font-size: 0.85rem;
}
.dropdown-signout:hover { background: rgba(255,255,255,0.2); }

/* === Login Screen === */
.login-screen {
  min-height: 100vh;
  background: linear-gradient(180deg, #0d9488 0%, #0f766e 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-content { text-align: center; padding: 2rem; }
.login-logo {
  width: 120px; height: 120px; border-radius: 50%; object-fit: cover;
  margin-bottom: 1.5rem; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.login-title { font-size: 2.5rem; font-weight: 800; color: white; margin-bottom: 0.25rem; }
.login-subtitle { font-size: 1rem; color: rgba(255, 255, 255, 0.8); margin-bottom: 0.5rem; }
.login-tagline {
  font-size: 0.9rem; color: rgba(255, 255, 255, 0.7);
  margin-bottom: 1.5rem; max-width: 280px; margin-left: auto; margin-right: auto;
}
.login-slogan {
  font-size: 0.85rem; color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.25rem; max-width: 280px; margin-left: auto; margin-right: auto;
}
.login-slogan-en {
  font-size: 0.7rem; color: rgba(255, 255, 255, 0.4); font-style: italic;
  margin-bottom: 2rem; max-width: 280px; margin-left: auto; margin-right: auto;
}
.google-btn {
  background: white; color: #134e4a; padding: 0.85rem 2rem;
  border-radius: 999px; font-weight: 600; font-size: 1rem;
  font-family: 'Baloo Tamma 2', system-ui, sans-serif;
  border: none; cursor: pointer; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  display: inline-flex; align-items: center; gap: 0.75rem;
}
.google-btn:hover { box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25); }

/* === Dashboard === */
.dashboard {
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  min-height: calc(100vh - 56px); color: white; padding: 1.25rem;
}
.progress-section { text-align: center; margin-bottom: 1.5rem; }
.progress-label { font-size: 0.8rem; opacity: 0.8; letter-spacing: 0.05em; }
.progress-number { font-size: 2.5rem; font-weight: bold; }
.progress-total { font-size: 1rem; opacity: 0.7; }
.progress-bar {
  background: rgba(255, 255, 255, 0.2); border-radius: 999px; height: 8px; margin-top: 0.5rem;
}
.progress-fill {
  background: #facc15; border-radius: 999px; height: 8px; transition: width 0.3s ease;
}
.pace-message {
  margin-top: 0.6rem; font-size: 0.85rem; opacity: 0.9;
}
.pace-ahead { color: #facc15; }
.pace-ontrack { color: white; }
.pace-behind { color: #fca5a5; }
.section-label {
  font-size: 0.75rem; opacity: 0.7; margin-bottom: 0.5rem; letter-spacing: 0.05em;
}
.lesson-card {
  background: rgba(0, 0, 0, 0.15); border-radius: 12px; padding: 1rem; margin-bottom: 0.75rem;
}
.lesson-card.completed { background: rgba(0, 0, 0, 0.1); }
.lesson-card.locked { background: rgba(0, 0, 0, 0.1); opacity: 0.5; }
.lesson-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem;
}
.lesson-number { font-weight: 600; font-size: 1.1rem; }
.practice-btn {
  background: #facc15; color: #0d9488; padding: 0.4rem 1rem;
  border-radius: 999px; font-weight: bold; font-size: 0.85rem;
  text-decoration: none; display: inline-block; font-family: 'Baloo Tamma 2', system-ui, sans-serif;
}
.exam-btn {
  background: white; color: #0d9488; padding: 0.4rem 1rem;
  border-radius: 999px; font-weight: bold; font-size: 0.85rem;
  text-decoration: none; display: inline-block; font-family: 'Baloo Tamma 2', system-ui, sans-serif;
}
.lesson-pinyin { font-size: 0.85rem; opacity: 0.85; line-height: 1.8; }

/* === Exercise Screens === */
.exercise-container {
  background: #f0fdfa; min-height: calc(100vh - 56px); padding: 1.25rem; color: #134e4a;
}
.exercise-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem; font-size: 0.8rem; color: #0d9488;
}
.word-card {
  background: rgba(255, 255, 255, 0.8); border-radius: 16px; padding: 2rem;
  text-align: center; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); margin-bottom: 1.5rem;
}
.word-hanzi { font-size: 4rem; }
.word-pinyin { font-size: 1.2rem; color: #0d9488; margin-top: 0.25rem; }
.audio-btn {
  background: #facc15; width: 44px; height: 44px; border-radius: 50%;
  border: none; cursor: pointer; font-size: 1.2rem;
  display: inline-flex; align-items: center; justify-content: center; margin-top: 0.75rem;
}
.reveal-area {
  background: white; border-radius: 12px; padding: 1.25rem; text-align: center;
  border: 2px dashed #99f6e4; margin-bottom: 1rem; cursor: pointer;
}
.reveal-label { font-size: 0.75rem; color: #0d9488; margin-bottom: 0.25rem; }
.reveal-dots { color: #d1d5db; }
.grade-buttons { display: flex; gap: 0.75rem; }
.grade-btn {
  flex: 1; text-align: center; padding: 0.75rem; border-radius: 999px;
  font-weight: 600; border: none; cursor: pointer;
  font-family: 'Baloo Tamma 2', system-ui, sans-serif; font-size: 1rem; color: white;
}
.grade-btn.wrong { background: #ef4444; }
.grade-btn.correct { background: #0d9488; }
.input-group { margin-bottom: 1rem; }
.input-label { font-size: 0.75rem; color: #0d9488; margin-bottom: 0.25rem; font-weight: 600; }
.text-input {
  width: 100%; background: white; border: 2px solid #99f6e4; border-radius: 8px;
  padding: 0.6rem 1rem; font-size: 1rem;
  font-family: 'Baloo Tamma 2', system-ui, sans-serif; color: #134e4a;
}
.text-input:focus { outline: none; border-color: #0d9488; }
.text-input.pinyin-input { font-family: 'Fira Sans', sans-serif; }
.submit-btn {
  background: #facc15; color: #134e4a; text-align: center; padding: 0.75rem;
  border-radius: 999px; font-weight: bold; border: none; cursor: pointer;
  width: 100%; font-family: 'Baloo Tamma 2', system-ui, sans-serif; font-size: 1rem;
}
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 1rem; }
.choice-btn {
  background: white; border: 2px solid #99f6e4; border-radius: 12px;
  padding: 1rem; text-align: center; cursor: pointer; transition: all 0.2s;
}
.choice-btn:active, .choice-btn.selected { border-color: #facc15; background: #fefce8; }
.choice-btn .hanzi { font-size: 1.5rem; }
.choice-btn .pinyin { font-size: 0.75rem; color: #0d9488; margin-top: 0.25rem; }
.sentence-display {
  background: white; border-radius: 12px; padding: 1.25rem; text-align: center;
  margin-bottom: 1.5rem; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex; align-items: flex-start; justify-content: center; gap: 0.5rem; flex-wrap: wrap;
}
.sentence-char { text-align: center; }
.sentence-char .hanzi { font-size: 1.6rem; }
.sentence-char .pinyin { font-size: 0.7rem; color: #0d9488; }
.sentence-char.tappable { cursor: pointer; }
.sentence-char.tappable .hanzi { text-decoration: underline; text-decoration-color: #99f6e4; text-underline-offset: 3px; }
.word-info-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4); display: flex; align-items: center;
  justify-content: center; z-index: 200; padding: 1rem;
}
.word-info-modal {
  background: white; border-radius: 16px; padding: 1.5rem 2rem;
  text-align: center; min-width: 200px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  animation: modalPop 0.2s ease-out;
}
.sentence-blank { text-align: center; min-width: 2.5rem; }
.sentence-blank .hanzi {
  font-size: 1.6rem; border-bottom: 2px solid #facc15; min-height: 2rem;
  display: flex; align-items: center; justify-content: center;
}
.word-bag-label { font-size: 0.75rem; color: #0d9488; margin-bottom: 0.5rem; letter-spacing: 0.05em; }
.word-bag { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.word-chip {
  background: white; border: 2px solid #99f6e4; color: #134e4a;
  padding: 0.5rem 1rem; border-radius: 8px; font-weight: 600; text-align: center;
  cursor: grab; touch-action: none;
}
.word-chip.selected { background: #facc15; border-color: #facc15; }
.word-chip .hanzi { font-size: 1.1rem; }
.word-chip .pinyin { font-size: 0.7rem; color: #0d9488; }
.exam-header { font-size: 0.8rem; color: #ef4444; font-weight: 600; }
.exam-counter { font-size: 0.8rem; color: #0d9488; }
.feedback { text-align: center; padding: 1rem; border-radius: 12px; margin-bottom: 1rem; font-weight: 600; }
.feedback.correct { background: #d1fae5; color: #065f46; }
.feedback.wrong { background: #fee2e2; color: #991b1b; }

/* Feedback Modal */
.feedback-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); display: flex; align-items: center;
  justify-content: center; z-index: 200; padding: 1rem;
}
.feedback-modal {
  background: white; border-radius: 20px; padding: 2rem 1.5rem;
  text-align: center; max-width: 320px; width: 100%;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  animation: modalPop 0.25s ease-out;
}
@keyframes modalPop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.feedback-modal.correct { border-top: 4px solid #0d9488; }
.feedback-modal.wrong { border-top: 4px solid #ef4444; }
.feedback-icon {
  font-size: 2.5rem; margin-bottom: 0.5rem;
}
.feedback-modal.correct .feedback-icon { color: #0d9488; }
.feedback-modal.wrong .feedback-icon { color: #ef4444; }
.feedback-text { margin-bottom: 1.25rem; font-weight: 600; font-size: 1.1rem; color: #134e4a; }
.feedback-answer {
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  margin-top: 0.5rem; color: #134e4a;
}
.feedback-next-btn {
  display: block; text-align: center; text-decoration: none;
}
/* Practice Complete */
.complete-container {
  min-height: calc(100vh - 56px); display: flex; align-items: center;
  justify-content: center; background: linear-gradient(135deg, #0d9488, #14b8a6);
  padding: 1.5rem;
}
.complete-card {
  background: white; border-radius: 24px; padding: 2.5rem 2rem;
  text-align: center; max-width: 340px; width: 100%;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  animation: modalPop 0.4s ease-out;
}
.complete-emoji { font-size: 3.5rem; margin-bottom: 0.75rem; }
.complete-title {
  font-size: 1.6rem; color: #134e4a; margin-bottom: 0.25rem;
}
.complete-subtitle {
  font-size: 0.9rem; color: #0d9488; margin-bottom: 0.25rem;
}
.complete-lesson {
  font-size: 1.3rem; font-weight: 700; color: #134e4a; margin-bottom: 0.75rem;
}
.complete-words {
  font-size: 0.8rem; color: #0d9488; line-height: 1.7;
  margin-bottom: 2rem; padding: 0.75rem; background: #f0fdfa;
  border-radius: 12px;
}
.complete-actions { display: flex; flex-direction: column; gap: 0.75rem; }
.complete-exam-btn {
  background: #facc15; color: #134e4a; padding: 0.85rem;
  border-radius: 999px; font-weight: bold; font-size: 1rem;
  text-decoration: none; text-align: center;
  font-family: 'Baloo Tamma 2', system-ui, sans-serif;
  box-shadow: 0 4px 12px rgba(250,204,21,0.3);
}
.complete-dashboard-link {
  color: #0d9488; font-size: 0.85rem; text-decoration: none;
}

/* Exam Result */
.exam-result-card {
  background: white; border-radius: 24px; padding: 2rem 1.5rem;
  text-align: center; max-width: 380px; width: 100%;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  animation: modalPop 0.4s ease-out;
  max-height: 85vh; overflow-y: auto;
}
.exam-answers-list {
  text-align: left; margin-bottom: 1.5rem;
}
.exam-answer-row {
  display: flex; align-items: flex-start; gap: 0.6rem;
  padding: 0.6rem 0.75rem; border-radius: 10px; margin-bottom: 0.4rem;
}
.exam-answer-row.correct { background: #f0fdf4; }
.exam-answer-row.wrong { background: #fef2f2; }
.exam-answer-status { font-size: 1rem; font-weight: 700; flex-shrink: 0; padding-top: 0.1rem; }
.exam-answer-row.correct .exam-answer-status { color: #0d9488; }
.exam-answer-row.wrong .exam-answer-status { color: #ef4444; }
.exam-answer-content { flex: 1; }
.exam-answer-word {
  display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap;
}
.exam-answer-yours {
  font-size: 0.75rem; color: #991b1b; margin-top: 0.2rem;
}
