/* ── Paper / Exam Module Styles ──────────────────── */

.paper-loading {
  text-align: center;
  padding: 40px 0;
  color: var(--text-soft, #888);
  font-size: 1.05rem;
}

/* Header bar (in paper-screen) */
.paper-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 14px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #fff7d6 0%, #ffe0a3 100%);
  border-radius: 14px;
  border: 2px solid #ffd370;
  box-shadow: 0 3px 0 #f4b53a;
}
#paper-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: #5b3a00;
  flex: 1;
  line-height: 1.3;
}
.paper-timer-box {
  background: #fff;
  border: 2px solid #f4b53a;
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 700;
  color: #b96a00;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Progress bar */
.paper-progress {
  margin: 4px 4px 10px;
}
.paper-progress-bar {
  background: #f0f0f0;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  border: 1px solid #e0e0e0;
}
.paper-progress-fill {
  background: linear-gradient(90deg, #4ECDC4, #B5EAD7);
  height: 100%;
  transition: width 0.3s ease;
}
.paper-progress-text {
  text-align: right;
  font-size: 0.85rem;
  color: #888;
  margin-top: 4px;
}

/* Question jump bar */
.paper-jumpbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 4px;
  margin-bottom: 12px;
  border-bottom: 1px dashed #e7e7e7;
}
.paper-jump {
  min-width: 40px;
  min-height: 40px;
  border-radius: 8px;
  border: 1.5px solid #d8d8d8;
  background: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  color: #888;
  cursor: pointer;
  transition: all 0.15s;
}
.paper-jump.done {
  background: #d6f5ee;
  border-color: #4ECDC4;
  color: #1d8a82;
}
.paper-jump.curr {
  background: #ffd370;
  border-color: #f4b53a;
  color: #5b3a00;
  transform: scale(1.1);
  box-shadow: 0 2px 0 #c98e15;
}

/* Question */
.paper-question {
  background: #fff;
  border: 2px solid #eee;
  border-radius: 18px;
  padding: 18px 16px;
  box-shadow: 0 3px 0 #e8e8e8;
  margin-bottom: 14px;
}
.paper-q-meta {
  font-size: 0.82rem;
  color: #b07f00;
  margin-bottom: 8px;
  font-weight: 600;
}
.paper-q-stem {
  font-size: 1.4rem;
  font-weight: 700;
  color: #2c2c2c;
  margin-bottom: 16px;
  line-height: 1.5;
  letter-spacing: 0.5px;
}

/* Image area for image_choice */
.paper-image {
  font-size: 1.6rem;
  text-align: center;
  padding: 14px;
  background: #fffbe6;
  border-radius: 14px;
  border: 2px dashed #ffd370;
  margin-bottom: 14px;
  line-height: 1.7;
  word-break: break-all;
}

/* Options */
.paper-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.paper-tf {
  grid-template-columns: repeat(2, 1fr);
}
.paper-opt {
  padding: 14px 8px;
  border: 2.5px solid #d8d8d8;
  background: #fff;
  border-radius: 14px;
  font-size: 1.2rem;
  font-weight: 700;
  color: #2c2c2c;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s, background 0.15s;
  box-shadow: 0 3px 0 #d0d0d0;
}
.paper-opt:active { transform: translateY(2px); box-shadow: 0 1px 0 #d0d0d0; }
.paper-opt.selected {
  background: #4ECDC4;
  color: #fff;
  border-color: #2eb1a6;
  box-shadow: 0 3px 0 #2eb1a6;
}

/* Fill */
.paper-fill {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}
.paper-fill-input {
  width: 60%;
  max-width: 220px;
  padding: 12px 14px;
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  border: 2.5px solid #ffd370;
  border-radius: 14px;
  background: #fffbe6;
  color: #5b3a00;
  outline: none;
  transition: border-color 0.15s;
}
.paper-fill-input:focus {
  border-color: #f4b53a;
  background: #fff;
}

/* Match */
.paper-match {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 4px 0;
}
.paper-match-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.paper-match-item {
  padding: 12px 8px;
  border: 2.5px solid #d8d8d8;
  background: #fff;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}
.paper-match-item.selected {
  background: #fff3b8;
  border-color: #f4b53a;
}
.paper-match-item.matched {
  background: #d6f5ee;
  border-color: #4ECDC4;
  color: #1d8a82;
}
.paper-match-state {
  text-align: center;
  font-size: 0.88rem;
  color: #888;
  margin-top: 8px;
}

/* Sort */
.paper-sort-picked {
  min-height: 50px;
  background: #fffbe6;
  border: 2px dashed #ffd370;
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.paper-sort-hint { color: #b07f00; font-size: 0.95rem; }
.paper-sort-chip {
  background: #ffd370;
  color: #5b3a00;
  padding: 5px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
}
.paper-sort-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.paper-sort-item {
  padding: 10px 14px;
  border: 2.5px solid #d8d8d8;
  background: #fff;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
}
.paper-sort-item.used { opacity: 0.35; cursor: default; }
.paper-sort-actions {
  text-align: right;
}
.paper-mini-btn {
  font-size: 0.85rem;
  padding: 4px 10px;
  border: 1.5px solid #ddd;
  background: #fafafa;
  border-radius: 8px;
  cursor: pointer;
}

/* Bottom navigation */
.paper-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}
.paper-nav-btn {
  flex: 1;
  padding: 14px 10px;
  border: 2.5px solid #d8d8d8;
  background: #fff;
  border-radius: 14px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 3px 0 #d0d0d0;
  transition: transform 0.1s;
}
.paper-nav-btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.paper-nav-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #d0d0d0; }
.paper-nav-btn.primary {
  background: #4ECDC4;
  color: #fff;
  border-color: #2eb1a6;
  box-shadow: 0 3px 0 #2eb1a6;
}
.paper-nav-btn.submit {
  background: linear-gradient(135deg, #ff8b94 0%, #ff6b6b 100%);
  color: #fff;
  border-color: #d94f4f;
  box-shadow: 0 3px 0 #d94f4f;
}

/* Result page */
.paper-result {
  text-align: center;
  padding: 12px 4px;
}
.paper-result-score {
  font-size: 4.2rem;
  font-weight: 800;
  color: #f4b53a;
  letter-spacing: -2px;
  text-shadow: 2px 3px 0 #fff7d6;
}
.paper-result-of { font-size: 1.6rem; color: #888; font-weight: 600; }
.paper-result-grade {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 6px 0 4px;
  color: #2c2c2c;
}
.paper-result-meta {
  font-size: 0.95rem;
  color: #888;
  margin-bottom: 14px;
}
.paper-result-perfect {
  background: linear-gradient(135deg, #fff7d6, #B5EAD7);
  padding: 16px;
  border-radius: 14px;
  font-size: 1.2rem;
  font-weight: 700;
  color: #1d8a82;
  margin: 14px 0;
}
.paper-wrongs {
  text-align: left;
  margin: 14px 0;
}
.paper-wrongs h3 {
  font-size: 1.05rem;
  color: #d94f4f;
  margin: 0 0 10px;
}
.wrong-item {
  background: #fff5f5;
  border: 2px solid #ffd5d5;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.wrong-stem  { font-weight: 700; margin-bottom: 4px; color: #2c2c2c; }
.wrong-line  { font-size: 0.95rem; margin: 2px 0; color: #555; }
.ans-bad     { color: #e25555; }
.ans-good    { color: #22a06b; }
.wrong-explain { font-size: 0.88rem; color: #888; margin-top: 4px; font-style: italic; }
.paper-result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* Paper list (within math/chinese/english tab) */
.paper-list-intro {
  text-align: center;
  color: #888;
  font-size: 0.95rem;
  margin: 8px 0 14px;
}
.paper-list-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.paper-card {
  text-align: left;
  padding: 14px 16px;
  border: 2.5px solid #ffd370;
  background: linear-gradient(135deg, #fff7d6 0%, #ffe9b8 100%);
  border-radius: 16px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 3px 0 #f4b53a;
  transition: transform 0.1s;
}
.paper-card:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #f4b53a; }
.paper-card.locked {
  background: #f4f4f4;
  border-color: #d8d8d8;
  box-shadow: 0 3px 0 #ccc;
  color: #999;
  cursor: not-allowed;
}
.paper-card-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: #5b3a00;
  margin-bottom: 4px;
}
.paper-card.locked .paper-card-name { color: #999; }
.paper-card-meta {
  font-size: 0.85rem;
  color: #b07f00;
  margin-bottom: 4px;
}
.paper-card.locked .paper-card-meta { color: #aaa; }
.paper-card-best {
  font-size: 0.88rem;
  color: #1d8a82;
  font-weight: 600;
}
.paper-card.locked .paper-card-best { color: #aaa; font-weight: 500; }

/* ══ Wrongbook Module ════════════════════════════════════════ */

/* Stats row */
.wb-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #f3eaff 0%, #e6d8ff 100%);
  border: 2px solid #c9b3f3;
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 12px;
  box-shadow: 0 3px 0 #b298e8;
  flex-wrap: wrap;
}
.wb-stat {
  flex: 1;
  min-width: 80px;
  text-align: center;
  background: #fff;
  border-radius: 12px;
  padding: 8px 4px;
  border: 1.5px solid #d8c4f5;
}
.wb-stat-num {
  font-size: 1.6rem;
  font-weight: 800;
  color: #6b3fb2;
  letter-spacing: -1px;
  line-height: 1.1;
}
.wb-stat-label {
  font-size: 0.78rem;
  color: #8a6dbf;
  font-weight: 600;
  margin-top: 2px;
}
.wb-clear-btn {
  flex: 0 0 auto;
  padding: 10px 14px;
  border: 2px solid #ffb3b3;
  background: linear-gradient(135deg, #fff5f5 0%, #ffe4e4 100%);
  color: #d94f4f;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.92rem;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 3px 0 #e8a4a4;
  transition: transform 0.1s;
}
.wb-clear-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #e8a4a4; }

/* Filter tabs */
.wb-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 4px 12px;
  margin-bottom: 8px;
  border-bottom: 1px dashed #e3d6f5;
}
.wb-filter-label {
  font-size: 0.88rem;
  color: #8a6dbf;
  font-weight: 600;
  margin-right: 4px;
}
.wb-tab {
  padding: 6px 14px;
  border: 2px solid #d8d8d8;
  background: #fff;
  color: #888;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.wb-tab.active {
  background: linear-gradient(135deg, #b298e8 0%, #8e6dd4 100%);
  border-color: #8e6dd4;
  color: #fff;
  box-shadow: 0 2px 0 #6b3fb2;
}
.wb-tab:active { transform: translateY(1px); }

/* List container — long lists scroll */
.wb-list {
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 4px;
  -webkit-overflow-scrolling: touch;
}
.wb-list::-webkit-scrollbar { width: 6px; }
.wb-list::-webkit-scrollbar-thumb { background: #d8c4f5; border-radius: 3px; }

/* Group header per subject */
.wb-group { margin-bottom: 14px; }
.wb-group-hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 8px;
  box-shadow: 0 2px 0 rgba(0,0,0,0.08);
}
.wb-group-icon { font-size: 1.1rem; }
.wb-group-name { flex: 1; }
.wb-group-count {
  background: rgba(255,255,255,0.25);
  border: 1.5px solid rgba(255,255,255,0.5);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}
.wb-subj-math    { background: linear-gradient(135deg, #F97316, #EA580C); }
.wb-subj-chinese { background: linear-gradient(135deg, #6366F1, #4F46E5); }
.wb-subj-english { background: linear-gradient(135deg, #10B981, #059669); }

/* Item card */
.wb-item {
  background: #fff;
  border: 2px solid #eee;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: 0 2px 0 #ececec;
}
.wb-stem {
  font-size: 1.05rem;
  font-weight: 700;
  color: #2c2c2c;
  margin-bottom: 8px;
  line-height: 1.45;
  word-break: break-word;
}
.wb-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  margin: 3px 0;
  flex-wrap: wrap;
}
.wb-tag-bad, .wb-tag-good {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  flex: 0 0 auto;
}
.wb-tag-bad  { background: #ffe4e4; color: #d94f4f; border: 1px solid #ffc4c4; }
.wb-tag-good { background: #d6f5e4; color: #1d8a4f; border: 1px solid #a5e3bf; }
.wb-ans-bad  { color: #e25555; font-weight: 700; word-break: break-word; }
.wb-ans-good { color: #22a06b; font-weight: 700; word-break: break-word; }

.wb-meta {
  font-size: 0.8rem;
  color: #999;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #f0f0f0;
}
.wb-meta b { color: #6b3fb2; font-weight: 600; }
.wb-meta-dot { margin: 0 4px; color: #ccc; }

/* Empty state */
.wb-empty {
  text-align: center;
  padding: 50px 20px;
  font-size: 1.1rem;
  color: #8a6dbf;
  font-weight: 600;
  background: #faf6ff;
  border: 2px dashed #c9b3f3;
  border-radius: 16px;
  margin-top: 8px;
}

/* Home entry card — purple variant */
.subject-header.wrongbook-hdr {
  background: linear-gradient(135deg, #8e6dd4 0%, #6b3fb2 100%);
}
.module-btn.wb-mod {
  background: linear-gradient(135deg, #f3eaff 0%, #e6d8ff 100%);
  border: 2px solid #c9b3f3;
  box-shadow: 0 3px 0 #b298e8, 0 2px 8px rgba(107,63,178,0.07);
  color: #5a2fa0;
}
.module-btn.wb-mod .m-label { color: #5a2fa0; }
.module-btn.wb-mod:hover    { background: linear-gradient(135deg, #ebdcff 0%, #ddc7ff 100%); }
.module-btn.wb-mod:active   { transform: scale(0.92) translateY(2px); }

/* ── PU2 Auto-Play Styles ─────────────────────────── */

/* 1. List row highlight (current line being read aloud) */
.pu2-ap-active {
  /* 高亮当前播放的行，橙色左边框+浅橙背景 */
  background: #fff7ed !important;
  border-left: 4px solid #f97316 !important;
  border-radius: 10px;
  transition: background 0.3s, border-color 0.3s;
}

/* 2. Control bar (floating at bottom) */
.pu2-ap-bar {
  position: sticky;
  bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1e293b;
  color: #fff;
  padding: 10px 16px;
  border-radius: 30px;
  margin: 16px auto 0;
  max-width: 420px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  z-index: 100;
  font-size: 0.9rem;
}
.pu2-ap-bar-label {
  flex: 1;
  font-weight: 500;
}
.pu2-ap-bar-btn {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 10px 16px;
  min-height: 44px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s;
}
.pu2-ap-bar-btn:hover { background: rgba(255,255,255,0.28); }
.pu2-ap-bar-btn.stop { background: rgba(239,68,68,0.35); }
.pu2-ap-bar-btn.stop:hover { background: rgba(239,68,68,0.55); }

/* 3. "▶ 自动播放全部" toolbar button */
.pu2-ap-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 4px 0 10px;
}
.pu2-ap-autoplay-btn {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(249,115,22,0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}
.pu2-ap-autoplay-btn:active {
  transform: scale(0.96);
  box-shadow: 0 1px 4px rgba(249,115,22,0.2);
}

/* 4. Vocabulary slideshow container */
.pu2-ap-slide-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px;
  gap: 12px;
  min-height: 320px;
}
.pu2-ap-slide-progress {
  font-size: 0.9rem;
  color: var(--text-soft, #9ca3af);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.pu2-ap-slide-card {
  width: 100%;
  max-width: 360px;
  background: linear-gradient(135deg, #fff7ed, #fff);
  border: 2px solid #fed7aa;
  border-radius: 24px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 6px 24px rgba(249,115,22,0.12);
}
.pu2-ap-slide-emoji {
  font-size: 3.5rem;
  line-height: 1.2;
  margin-bottom: 12px;
}
.pu2-ap-slide-word {
  font-size: 2.2rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 10px;
  line-height: 1.2;
  animation: pu2SlideWordIn 0.35s ease;
}
.pu2-ap-slide-cn {
  font-size: 1.15rem;
  color: #64748b;
  font-weight: 500;
}
.pu2-ap-slide-nav {
  margin-top: 4px;
}
@keyframes pu2SlideWordIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
