* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: #f5f5f5;
  color: #333; min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
.skills-app { max-width: 520px; margin: 0 auto; padding: 16px 12px 40px; }
.skills-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.skills-top h1 { font-size: 20px; margin: 0; color: #ff8c42; }
.back-btn { color: #666; text-decoration: none; font-size: 14px; }
.student-badge { font-size: 13px; color: #999; }

.panel { background: #fff; border-radius: 20px; padding: 20px 16px; box-shadow: 0 2px 10px rgba(0,0,0,0.06); margin-bottom: 16px; }
.btn { display: inline-block; padding: 10px 20px; border-radius: 12px; border: none; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn-primary { background: linear-gradient(135deg, #ffb347, #ffcc70); color: white; }
.btn-ghost { background: white; color: #ff8c42; border: 2px solid #ffcc70; }
.btn-block { width: 100%; text-align: center; }
.hint { font-size: 12px; color: #999; text-align: center; margin-top: 8px; }
.intro { font-size: 14px; color: #666; margin: 4px 0 16px; text-align: center; }

#student-list .student-item {
  padding: 14px 16px; background: #fff9ef; border-radius: 12px;
  margin-bottom: 8px; cursor: pointer; border: 2px solid transparent;
}
#student-list .student-item.active { border-color: #ffb347; background: #fff3dd; }
#student-list .student-item .name { font-size: 16px; font-weight: 600; }
#student-list .student-item .age { font-size: 12px; color: #999; margin-left: 8px; }

.skills-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.skill-card {
  background: #fff; border-radius: 16px; padding: 16px 10px;
  text-align: center; box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  text-decoration: none; color: #333; transition: transform 0.15s;
  cursor: pointer;
}
.skill-card.active:active { transform: scale(0.97); }
.skill-card.disabled { opacity: 0.5; cursor: not-allowed; background: #f4f4f4; }
.skill-card .icon { font-size: 38px; display: block; margin-bottom: 6px; }
.skill-card .title { font-size: 14px; font-weight: 600; }
.skill-card .desc { font-size: 11px; color: #aaa; margin-top: 4px; }

/* ====== speak-test 共用 ====== */
.speak-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.speak-top h1 { font-size: 20px; margin: 0; color: #ff8c42; }
.progress-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
#progress-text { font-size: 13px; color: #666; min-width: 52px; text-align: right; }
.progress-bar { flex: 1; height: 8px; background: #eee; border-radius: 4px; overflow: hidden; }
#progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, #ffb347, #ffcc70); transition: width 0.3s ease; }

.question-image {
  aspect-ratio: 1; max-width: 320px; margin: 16px auto; background: #fff;
  border-radius: 16px; box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.question-image img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }

.mic-area { text-align: center; margin: 20px 0; }
.mic-btn {
  width: 120px; height: 120px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, #ffb347, #ffcc70);
  font-size: 54px; color: white;
  box-shadow: 0 4px 16px rgba(255,179,71,0.4);
  cursor: pointer;
  user-select: none; -webkit-user-select: none;
  touch-action: none;
}
.mic-btn:active, .mic-btn.recording { transform: scale(0.94); background: linear-gradient(135deg, #ff7675, #fd79a8); }
.mic-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.mic-hint { font-size: 13px; color: #666; margin-top: 10px; }

.feedback { text-align: center; margin-top: 16px; font-size: 18px; min-height: 40px; }
.feedback.correct { color: #4CAF50; }
.feedback.wrong { color: #f44336; }

.toast {
  position: fixed; top: 20%; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.75); color: white; padding: 10px 18px;
  border-radius: 20px; font-size: 14px; z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.toast.show { opacity: 1; }

.result-summary {
  display: flex; justify-content: space-around; background: #fff9ef;
  border-radius: 14px; padding: 16px 4px; margin: 16px 0;
}
.result-summary .stat { flex: 1; text-align: center; }
.result-summary .num { font-size: 24px; font-weight: 700; color: #ff8c42; }
.result-summary .lbl { font-size: 11px; color: #999; margin-top: 2px; }
.missed-list { background: #fff9ef; border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.missed-list h4 { font-size: 13px; color: #666; margin: 0 0 8px; }
.missed-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f0e6d0; }
.missed-item:last-child { border-bottom: none; }
.missed-item .word { flex: 1; font-size: 14px; }
.missed-item .score { font-size: 13px; color: #d9591f; }
.missed-item button {
  background: #ffe9d6; color: #d9591f; border: none;
  padding: 4px 10px; border-radius: 12px; font-size: 12px; cursor: pointer;
}
.result-cta { display: flex; gap: 10px; }
.result-cta .btn { flex: 1; padding: 12px 0; font-size: 15px; border-radius: 14px; }

.mic-gate { text-align: center; padding: 16px 0; }
.mic-gate .icon { font-size: 48px; margin-bottom: 10px; }
.mic-gate p { font-size: 13px; color: #666; margin: 4px 0; }

/* ====== word-sprint 专用 ====== */
.wp-cat-list { display: flex; flex-direction: column; gap: 8px; }
.wp-cat-item {
  display: flex; align-items: center; padding: 12px 14px;
  background: #fff9ef; border-radius: 12px; cursor: pointer;
  border: 2px solid transparent; transition: border-color 0.15s, transform 0.15s;
}
.wp-cat-item:active { transform: scale(0.98); border-color: #ffb347; }
.wp-cat-item .emoji { font-size: 28px; width: 40px; }
.wp-cat-item .name-block { flex: 1; margin-left: 6px; }
.wp-cat-item .name-en { font-size: 15px; font-weight: 600; }
.wp-cat-item .name-cn { font-size: 11px; color: #888; }
.wp-cat-item .best {
  font-size: 12px; color: #d9591f; background: #ffe9d6;
  padding: 3px 10px; border-radius: 10px; font-weight: 600;
}
.wp-cat-item .best.unplayed { color: #aaa; background: #eee; }
.wp-cat-item .arrow { color: #ccc; font-size: 20px; margin-left: 8px; }

.wp-play-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.wp-timer {
  background: #fff; border-radius: 14px; padding: 8px 18px;
  font-size: 26px; font-weight: 700; color: #ff6b35;
  box-shadow: 0 2px 6px rgba(255,107,53,0.2);
  font-variant-numeric: tabular-nums;
}
.wp-timer.urgent { color: #d32f2f; animation: timer-beat 1s infinite; }
@keyframes timer-beat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.wp-score {
  background: linear-gradient(135deg, #ffb347, #ffcc70); color: white;
  padding: 8px 16px; border-radius: 14px; font-weight: 700; font-size: 16px;
}
.wp-prompt {
  background: #fff; border-radius: 16px; padding: 14px;
  text-align: center; margin-bottom: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.wp-prompt .cat-emoji { font-size: 40px; display: block; }
.wp-prompt .cat-cn { font-size: 18px; font-weight: 700; color: #ff8c42; margin-top: 4px; }
.wp-prompt .cat-en { font-size: 13px; color: #888; margin-top: 2px; }

.wp-words {
  background: #fff; border-radius: 16px; padding: 12px;
  min-height: 130px; margin-bottom: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.wp-words .w-header { font-size: 12px; color: #999; margin-bottom: 8px; }
.wp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wp-chip {
  background: #e8f5e9; color: #2e7d32;
  padding: 4px 10px; border-radius: 12px;
  font-size: 13px; font-weight: 500;
}
.wp-chip.new { background: #fff3cd; color: #856404; animation: chip-pulse 0.5s; }
@keyframes chip-pulse {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.wp-input-row { display: flex; gap: 8px; margin-bottom: 8px; }
.wp-input {
  flex: 1; padding: 12px 14px; border-radius: 14px;
  border: 2px solid #ffcc70; font-size: 16px;
  background: white; outline: none;
}
.wp-input:focus { border-color: #ff8c42; }
.wp-input:disabled { background: #f4f4f4; color: #aaa; }

.wp-result-hero { text-align: center; margin: 10px 0 4px; }
.wp-result-hero .big {
  font-size: 56px; font-weight: 800; color: #ff6b35; line-height: 1;
}
.wp-result-hero .label { font-size: 14px; color: #999; margin-top: 4px; }
.wp-result-hero .new-best {
  display: inline-block; margin-top: 6px;
  background: linear-gradient(135deg, #ff8c42, #ffb347); color: white;
  padding: 3px 12px; border-radius: 10px; font-size: 12px; font-weight: 600;
}

.wp-missed {
  background: #fff9ef; border-radius: 14px; padding: 12px; margin-bottom: 14px;
}
.wp-missed h4 { margin: 0 0 8px; font-size: 13px; color: #666; }
.wp-missed .mchips { display: flex; flex-wrap: wrap; gap: 6px; }
.wp-missed .mchip {
  background: #ffe9d6; color: #d9591f;
  padding: 3px 10px; border-radius: 10px;
  font-size: 12px;
}

.wp-cta { display: flex; gap: 10px; }
.wp-cta .btn { flex: 1; padding: 12px 0; font-size: 15px; border-radius: 14px; }

/* ============ Part 3 · 相似词辨析 .sw-* ============ */

#panel-menu .sw-stats {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin: 1.5rem 0 1.5rem;
}
#panel-menu .sw-stats .stat { text-align: center; }
#panel-menu .sw-stats .num {
  font-size: 2rem;
  font-weight: 700;
  color: #f7943c;
}
#panel-menu .sw-stats .lbl {
  font-size: .85rem;
  color: #888;
  margin-top: .2rem;
}

.sw-start-btn {
  display: block;
  width: 85%;
  margin: 1rem auto;
  padding: 1rem;
  font-size: 1.1rem;
}

.sw-play-top {
  display: flex;
  justify-content: space-between;
  font-size: .95rem;
  color: #a86;
  margin-bottom: 1rem;
}

.sw-image-wrap {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 0 auto 1rem;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  overflow: hidden;
}
.sw-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sw-image-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
}

.sw-hint {
  text-align: center;
  color: #7a5;
  font-size: .95rem;
  margin-bottom: 1rem;
}

.sw-btns {
  display: flex;
  gap: .8rem;
  padding: 0 .3rem;
}
.sw-btn {
  flex: 1;
  padding: 1rem;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 600;
  background: #fff;
  border: 2px solid #f7b267;
  border-radius: 12px;
  cursor: pointer;
  color: #333;
  transition: all .15s;
}
.sw-btn:hover:not(:disabled) { background: #ffecd1; }
.sw-btn:disabled { cursor: default; opacity: .6; }
.sw-btn.correct { background: #d6f5d6; border-color: #4caf50; color: #2d6d2d; }
.sw-btn.wrong { background: #ffe0e0; border-color: #e57373; color: #a33; }

.sw-feedback {
  min-height: 1.8rem;
  margin-top: 1rem;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 600;
}
.sw-feedback.correct { color: #2d6d2d; }
.sw-feedback.wrong { color: #c44; }

.sw-result-hero {
  text-align: center;
  margin: 1.5rem 0 1rem;
}
.sw-result-hero .big {
  font-size: 4rem;
  font-weight: 800;
  color: #f7943c;
  line-height: 1;
}
.sw-result-hero .label {
  font-size: 1rem;
  color: #888;
  margin-top: .4rem;
}
.sw-result-hero .new-best {
  display: inline-block;
  margin-left: .4rem;
  color: #e94;
  font-weight: 700;
}

.sw-missed {
  margin: 1.2rem 0;
  padding: 1rem;
  background: #fff7ea;
  border-radius: 10px;
}
.sw-missed h4 {
  margin: 0 0 .6rem;
  font-size: .95rem;
  color: #a86;
}
.sw-missed-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.sw-missed-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem;
  background: #fff;
  border-radius: 8px;
  font-size: .9rem;
}
.sw-missed-item img {
  width: 40px; height: 40px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.sw-missed-item .q-text { flex: 1; color: #555; }
.sw-missed-item .q-text .wrong-x { color: #c44; text-decoration: line-through; }
.sw-missed-item .q-text .right { color: #2d6d2d; font-weight: 600; }

/* ============ Part 4 · 读句选图 .sp-* ============ */

.sp-sentence {
  background: #fff;
  border-radius: 12px;
  padding: 1.2rem;
  margin-bottom: 1.2rem;
  font-size: 1.15rem;
  line-height: 1.5;
  color: #333;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
}

.sp-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .7rem;
}
.sp-grid.locked .sp-choice { cursor: default; }

.sp-choice {
  background: #fff;
  border: 2px solid #f7b267;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: all .15s;
  display: flex;
  flex-direction: column;
}
.sp-choice:hover:not(.correct):not(.wrong) { background: #ffecd1; }
.sp-choice img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}
.sp-choice-fallback {
  width: 100%;
  height: 120px;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: #faf0e2;
}
.sp-choice-word {
  padding: .5rem;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  color: #444;
  background: #fff;
}
.sp-choice.correct { background: #d6f5d6; border-color: #4caf50; }
.sp-choice.correct .sp-choice-word { background: #d6f5d6; color: #2d6d2d; }
.sp-choice.wrong { background: #ffe0e0; border-color: #e57373; }
.sp-choice.wrong .sp-choice-word { background: #ffe0e0; color: #a33; }

/* ============ Part 5 · 视觉匹配 .vm-* ============ */

.vm-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .6rem;
  padding: 0 .3rem;
}
.vm-grid.locked .vm-btn { cursor: default; }
.vm-btn {
  padding: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  background: #fff;
  border: 2px solid #f7b267;
  border-radius: 12px;
  cursor: pointer;
  color: #333;
  transition: all .15s;
}
.vm-btn:hover:not(:disabled):not(.correct):not(.wrong) { background: #ffecd1; }
.vm-btn.correct { background: #d6f5d6; border-color: #4caf50; color: #2d6d2d; }
.vm-btn.wrong { background: #ffe0e0; border-color: #e57373; color: #a33; }

/* ============ Part 6 · 指认部位 .np-* ============ */

.np-cn {
  text-align: center;
  color: #888;
  font-size: .95rem;
  margin-bottom: .8rem;
}

.np-input-row {
  display: flex;
  gap: .5rem;
  padding: 0 .3rem;
}
.np-input {
  flex: 1;
  padding: .9rem;
  font-size: 1.1rem;
  background: #fff;
  border: 2px solid #f7b267;
  border-radius: 10px;
  outline: none;
  color: #333;
}
.np-input:focus { border-color: #e88; }
.np-input:disabled { background: #faf0e2; opacity: .7; }
.np-submit {
  padding: 0 1.2rem;
  font-size: 1rem;
}

/* ============ 内联添加学生表单（skills & vocab 共用） ============ */

.add-student-inline {
  background: #fffaf0;
  border-radius: 10px;
  padding: 1rem;
  margin: 1rem 0;
}
.add-student-inline h3 {
  margin: 0 0 .8rem;
  font-size: 1rem;
  color: #a86;
}
.add-student-inline .form-row {
  display: flex;
  gap: .8rem;
  margin-bottom: .8rem;
}
.add-student-inline .form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.add-student-inline .form-group label {
  font-size: .85rem;
  color: #888;
  margin-bottom: .3rem;
}
.add-student-inline .form-group input,
.add-student-inline .form-group select {
  padding: .6rem;
  border: 2px solid #f7d4a8;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  background: #fff;
}
.add-student-inline .form-group input:focus,
.add-student-inline .form-group select:focus {
  border-color: #f7b267;
}
.add-student-inline #btn-add-student {
  width: 100%;
  padding: .7rem;
}

.student-item {
  display: flex;
  justify-content: space-between;
  padding: .8rem 1rem;
  background: #fff;
  border: 2px solid #f7d4a8;
  border-radius: 10px;
  margin-bottom: .5rem;
  cursor: pointer;
  transition: all .15s;
}
.student-item:hover {
  background: #fff1d8;
  border-color: #f7b267;
}
.student-item .name { font-weight: 600; color: #333; }
.student-item .age { color: #888; }

.student-item { position: relative; align-items: center; }
.student-item .student-del {
  background: transparent;
  border: 1px solid #ddd;
  color: #c44;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  padding: 0;
  cursor: pointer;
  margin-left: .5rem;
  font-size: .8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.student-item .student-del:hover {
  background: #ffe0e0;
  border-color: #c44;
}
.student-badge {
  cursor: pointer;
  user-select: none;
}
.student-badge:hover { opacity: .8; }

/* ============ 练习历史 / 成长趋势 ============ */

.history-tabs {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  overflow-x: auto;
  padding-bottom: .3rem;
}
.mod-tab {
  flex: 0 0 auto;
  padding: .6rem .8rem;
  background: #fff;
  border: 2px solid #f7d4a8;
  border-radius: 10px;
  text-decoration: none;
  color: #555;
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .9rem;
  transition: all .15s;
}
.mod-tab .icon { font-size: 1.1rem; }
.mod-tab .count {
  background: #faf0e2;
  color: #a86;
  padding: 0 .4rem;
  border-radius: 8px;
  font-size: .75rem;
  margin-left: .3rem;
}
.mod-tab:hover { background: #fff1d8; border-color: #f7b267; }
.mod-tab.active {
  background: #f7943c;
  border-color: #f7943c;
  color: #fff;
}
.mod-tab.active .count { background: rgba(255,255,255,.3); color: #fff; }
.mod-tab.empty { opacity: .7; }

.history-subtabs {
  display: flex;
  gap: 1.5rem;
  border-bottom: 2px solid #f0ddc0;
  margin-bottom: 1rem;
}
.history-subtabs a {
  padding: .6rem 0;
  color: #888;
  text-decoration: none;
  font-weight: 600;
  position: relative;
}
.history-subtabs a.active {
  color: #f7943c;
}
.history-subtabs a.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: #f7943c;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .8rem 1rem;
  background: #fff;
  border: 1px solid #f0ddc0;
  border-radius: 8px;
}
.history-item .left { display: flex; flex-direction: column; gap: .2rem; }
.history-item .left .name { font-weight: 600; color: #333; }
.history-item .left .date { font-size: .8rem; color: #999; }
.history-item .score {
  font-size: 1.2rem;
  font-weight: 700;
  color: #f7943c;
}

.growth-wrap {
  padding: 1rem 0;
}

.skills-history-btn {
  display: block;
  margin: 1rem auto 0;
  width: 85%;
  padding: .7rem;
  background: #fff;
  border: 2px solid #f7d4a8;
  border-radius: 10px;
  text-align: center;
  color: #a86;
  text-decoration: none;
  font-weight: 600;
}
.skills-history-btn:hover { background: #fff1d8; }

/* First Letter Hint */
.flh-card { position: relative; padding: 1.2rem 1rem; background: #f5f9ff; border-radius: 12px; margin-bottom: 1rem; min-height: 220px; }
.flh-sentence { font-size: 1.4rem; text-align: center; margin: .8rem 0 .6rem; }
.flh-visual { text-align: center; min-height: 160px; }
.flh-emoji { font-size: 4rem; line-height: 1.2; }
.flh-visual img { max-height: 200px; border-radius: 8px; }
.flh-hint-pill {
  display: inline-block; padding: .35rem .75rem; background: #2196f3; color: white;
  border-radius: 999px; font-family: ui-monospace, monospace; letter-spacing: .15em;
  position: absolute; right: 1rem; top: 1rem;
}

/* Spoken Name the Part */
.snp-svg { text-align: center; margin: .8rem 0; }
.snp-svg svg { display: inline-block; max-width: 280px; height: auto; background: white; border-radius: 8px; }
.snp-prompt { text-align: center; margin: .8rem 0 .4rem; }
.snp-secondary { display: flex; gap: .6rem; justify-content: center; margin: .6rem 0; }
.big-score { font-size: 2.4rem; text-align: center; margin: 1rem 0; font-weight: 700; }

/* Comprehensive test banner card (sits above the regular skill grid) */
.comp-banner-card {
  display: block;
  background: linear-gradient(135deg, #1976d2, #42a5f5);
  color: white;
  padding: 1rem 1.2rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  text-decoration: none;
}
.comp-banner-card .icon { font-size: 1.6rem; margin-right: .6rem; vertical-align: middle; }
.comp-banner-card .title { display: inline-block; font-size: 1.2rem; font-weight: 700; vertical-align: middle; }
.comp-banner-card .desc { font-size: .85rem; opacity: .92; margin-top: .2rem; }
