/* =======================================================
   SpellingWell (听写宝) - Modern High-Contrast Stylesheet
   ======================================================= */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius-lg: 16px;
  --radius-md: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 6px 18px rgba(0,0,0,0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.5;
  padding-bottom: 50px;
}

/* 顶部导航条 */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.grade-badge {
  background: #ede9fe;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* 中文辅助开关 */
.cn-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.cn-toggle input {
  display: none;
}

.toggle-slider {
  width: 38px;
  height: 22px;
  background-color: #cbd5e1;
  border-radius: 20px;
  position: relative;
  transition: 0.25s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.25s;
}

.cn-toggle input:checked + .toggle-slider {
  background-color: var(--primary);
}

.cn-toggle input:checked + .toggle-slider::before {
  transform: translateX(16px);
}

/* 积分胶囊徽章 */
.points-pill {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.points-pill:hover {
  transform: scale(1.05);
}

/* 容器与标签页 */
.main-container {
  max-width: 820px;
  margin: 20px auto;
  padding: 0 16px;
}

.nav-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 20px;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.nav-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* 通用卡片 */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.card h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 20px;
}

/* 按钮规范 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--text-main);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-success {
  background: var(--success);
  color: white;
}
.btn-warning {
  background: var(--warning);
  color: white;
}
.btn-block {
  width: 100%;
}
.btn-lg {
  padding: 14px 28px;
  font-size: 1.05rem;
}

/* TAB 1: 录入网格 */
.upload-box-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 640px) {
  .upload-box-grid {
    grid-template-columns: 1fr;
  }
}

.upload-dropzone {
  border: 2px dashed #cbd5e1;
  background: #f8fafc;
  border-radius: var(--radius-md);
  padding: 30px 20px;
  text-align: center;
}

.upload-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 10px;
}

.text-input-box textarea {
  width: 100%;
  height: 140px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 0.9rem;
  margin-bottom: 12px;
  resize: vertical;
}

/* 词卡网格 */
.words-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.word-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  position: relative;
}

.word-card.bonus-word {
  border-color: #f59e0b;
  background: #fffbeb;
}

.word-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}

.word-card-syllables {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.word-card-trap {
  font-size: 0.8rem;
  background: #fee2e2;
  color: #991b1b;
  padding: 4px 8px;
  border-radius: 6px;
  margin-top: 6px;
}

/* TAB 2: 考场卡片 */
.exam-container {
  max-width: 640px;
  margin: 0 auto;
}

.exam-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.round-badge {
  background: #e0e7ff;
  color: var(--primary);
  font-weight: 800;
  font-size: 0.85rem;
  padding: 4px 12px;
  border-radius: 20px;
}

.progress-indicator {
  font-weight: 700;
  color: var(--text-muted);
}

.bonus-alert {
  background: #fef3c7;
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.player-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.sound-wave-icon {
  font-size: 4rem;
  margin-bottom: 12px;
  animation: pulseWave 1.8s infinite;
}

@keyframes pulseWave {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.status-msg {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 24px;
}

.control-cluster {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 380px;
  margin: 0 auto 16px;
}

.btn-next {
  background: var(--primary);
  color: white;
  padding: 18px 24px;
  font-size: 1.25rem;
  font-weight: 800;
  border-radius: var(--radius-md);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}

.btn-replay {
  background: #f1f5f9;
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 12px 20px;
  font-size: 1rem;
}

.btn-text-link {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: underline;
}

.hint-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 20px;
  text-align: left;
}

.syllables-display {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 6px;
}

.trap-display {
  font-size: 0.88rem;
  color: #b91c1c;
}

.cn-display {
  font-size: 0.88rem;
  color: #047857;
  margin-top: 4px;
}

.exam-footer-tip {
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

/* TAB 3: 批改结果 */
.grading-flow-box {
  text-align: center;
  padding: 30px;
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.camera-big-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 10px;
}

.score-banner {
  display: flex;
  justify-content: space-around;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.score-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  display: block;
}

.points-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--warning);
  display: block;
}

.score-label, .points-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.grading-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.grade-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.grade-row.wrong {
  border-color: #fca5a5;
  background: #fef2f2;
}

.grade-word-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-symbol {
  font-size: 1.25rem;
}

/* TAB 4: 订正卡片 */
.correction-card {
  border: 1px solid #fde68a;
  background: #fffbeb;
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 14px;
}

.correction-card.verified {
  border-color: #a7f3d0;
  background: #ecfdf5;
}

.correction-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.correction-target-word {
  font-size: 1.3rem;
  font-weight: 800;
  color: #92400e;
}

.correction-task-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* TAB 5: 心愿商城 */
.rewards-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  background: #faf5ff;
  border: 1px solid #f3e8ff;
  border-radius: var(--radius-md);
  padding: 18px 24px;
}

.wallet-badge {
  text-align: right;
}

.wallet-label {
  font-size: 0.8rem;
  color: #7e22ce;
  display: block;
}

.wallet-val {
  font-size: 2rem;
  font-weight: 900;
  color: #6b21a8;
}

.wishes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.wish-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: white;
  box-shadow: var(--shadow-sm);
}

.wish-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.wish-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.wish-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  flex-grow: 1;
}

.wish-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.wish-cost {
  font-weight: 800;
  color: var(--primary);
}

/* 提醒设置 */
.reminder-settings-card {
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.reminder-form {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.reminder-form input {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
}

.feedback-msg {
  font-size: 0.88rem;
  margin-top: 8px;
  font-weight: 600;
}

/* 弹窗 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 30px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2);
}

.modal-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
}
