/* ===== 错题侦探社 — 全局样式 ===== */
:root {
  --detective-blue: #4A90E2;
  --honey-yellow: #FFD93D;
  --bubblegum-pink: #FF8DA1;
  --mint-green: #5CC2A0;
  --bg-light: #F0F4FF;
  --text-dark: #2D3748;
  --text-gray: #718096;
  --card-shadow: 0 4px 20px rgba(74,144,226,0.12);
  --card-radius: 16px;
  --font-stack: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: var(--font-stack);
  background: var(--bg-light);
  color: var(--text-dark);
  min-height: 100vh;
  line-height: 1.6;
}

/* 标题渐变 */
.gradient-title {
  background: linear-gradient(135deg, var(--detective-blue), var(--bubblegum-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
  letter-spacing: 1px;
  transform: rotate(-0.5deg);
  display: inline-block;
}

/* 卡片通用 */
.card {
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: 20px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(74,144,226,0.18);
}

/* 按钮通用 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px;
  border: none;
  border-radius: 30px;
  font-family: var(--font-stack);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn:active { transform: scale(0.95); }
.btn-primary { background: var(--detective-blue); color: #fff; }
.btn-primary:hover { background: #3A7BD5; box-shadow: 0 4px 14px rgba(74,144,226,0.35); }
.btn-yellow { background: var(--honey-yellow); color: var(--text-dark); }
.btn-yellow:hover { background: #F5CC30; box-shadow: 0 4px 14px rgba(255,217,61,0.4); }
.btn-pink { background: var(--bubblegum-pink); color: #fff; }
.btn-pink:hover { background: #E87A8E; }

/* 返回首页链接 */
.back-home {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--detective-blue);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 0;
}
.back-home:hover { text-decoration: underline; }

/* 错因小标签 — 折角贴纸 */
.tag-sticker {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bubblegum-pink);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px 4px 8px;
  border-radius: 4px 12px 4px 4px;
  position: relative;
  cursor: pointer;
  transition: all 0.25s ease;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
}
.tag-sticker::before {
  content: "🔍";
  font-size: 11px;
  margin-right: 2px;
}
.tag-sticker:hover {
  transform: rotate(-1deg) scale(1.05);
  box-shadow: 0 2px 8px rgba(255,141,161,0.4);
}
.tag-sticker .tag-back {
  display: none;
  position: absolute;
  top: -28px;
  left: 0;
  background: var(--mint-green);
  color: #fff;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 8px;
  white-space: nowrap;
}
.tag-sticker:hover .tag-back { display: block; }

/* 薄弱点统计气泡 */
.stat-bubble {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
  padding: 24px 28px;
  z-index: 1000;
  min-width: 240px;
  max-width: 320px;
}
.stat-bubble h3 { margin-bottom: 12px; color: var(--detective-blue); }
.stat-bubble .stat-item { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #f0f0f0; }
.stat-bubble .stat-item:last-child { border: none; }
.stat-bubble .close-stat { margin-top: 12px; width: 100%; }

/* 彩虹进度条 */
.rainbow-bar {
  width: 100%;
  height: 24px;
  border-radius: 30px;
  background: linear-gradient(90deg, var(--mint-green), var(--honey-yellow));
  position: relative;
  overflow: hidden;
}
.rainbow-bar .bar-fill {
  height: 100%;
  border-radius: 30px;
  background: linear-gradient(90deg, var(--mint-green), var(--honey-yellow));
  transition: width 0.6s ease;
}
.rainbow-bar .bar-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* 快拍按钮 */
.snap-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--detective-blue);
  border: none;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(74,144,226,0.35);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.snap-btn::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px dashed rgba(74,144,226,0.4);
  animation: spin-dash 8s linear infinite;
}
.snap-btn:hover { box-shadow: 0 6px 28px rgba(74,144,226,0.5); }
.snap-btn:active { transform: scale(0.88); }
.snap-btn .camera-icon {
  width: 32px; height: 32px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.snap-btn .camera-icon::after {
  content: "📷";
}
@keyframes spin-dash {
  to { transform: rotate(360deg); }
}

/* 变式题卡片 */
.variant-card {
  border-radius: var(--card-radius);
  background: linear-gradient(135deg, #FFF8E1, #FFF3C4);
  padding: 20px;
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease;
}
.variant-card:hover { transform: translateY(-4px); }
.variant-card .magic-wand {
  position: absolute;
  top: 8px; right: 12px;
  font-size: 20px;
  animation: wand-glow 2s ease-in-out infinite;
}
@keyframes wand-glow {
  0%,100% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(-10deg) scale(1.15); }
}
.variant-card .old-num {
  text-decoration: line-through;
  color: #999;
  font-size: 13px;
}
.variant-card .new-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--detective-blue);
  display: inline-block;
  animation: num-pop 0.4s ease;
}
@keyframes num-pop {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}
.variant-card .sparkle {
  position: absolute;
  width: 6px; height: 6px;
  background: var(--honey-yellow);
  border-radius: 50%;
  animation: sparkle-fly 1s ease-out forwards;
}
@keyframes sparkle-fly {
  0% { transform: translate(0,0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

/* 迷你徽章弹跳 */
.badge-bounce {
  display: inline-block;
  animation: badge-bounce 0.5s ease;
}
@keyframes badge-bounce {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-12px) scale(1.2); }
  60% { transform: translateY(-6px) scale(0.95); }
  100% { transform: translateY(0) scale(1); }
}

/* 星星洒落 */
.star-rain {
  position: absolute;
  pointer-events: none;
  font-size: 14px;
  animation: star-fall 1s ease-out forwards;
}
@keyframes star-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(40px) rotate(180deg); opacity: 0; }
}

/* 线索板背景 */
.clue-board {
  background: 
    linear-gradient(rgba(74,144,226,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74,144,226,0.04) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* 响应式 */
.container { max-width: 800px; margin: 0 auto; padding: 16px; }

/* 页面头部 */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  flex-wrap: wrap;
  gap: 8px;
}

/* 科目分组 */
.subject-group { margin-bottom: 24px; }
.subject-group h2 {
  font-size: 18px;
  color: var(--detective-blue);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 错题卡片 */
.error-card {
  display: flex;
  gap: 12px;
  padding: 16px;
  margin-bottom: 10px;
  align-items: flex-start;
}
.error-card .card-content { flex: 1; }
.error-card .card-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.error-card .card-preview { font-size: 13px; color: var(--text-gray); margin-bottom: 8px; }
.error-card .tags-row { display: flex; flex-wrap: wrap; gap: 6px; }
.error-card .card-time { font-size: 11px; color: #aaa; margin-top: 6px; }

/* 录入页 */
.capture-area {
  width: 100%;
  height: 300px;
  border: 3px dashed var(--detective-blue);
  border-radius: var(--card-radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(74,144,226,0.04);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 16px;
}
.capture-area:hover { background: rgba(74,144,226,0.08); border-color: #3A7BD5; }
.capture-area .big-icon { font-size: 48px; margin-bottom: 8px; }
.capture-area .hint { font-size: 14px; color: var(--text-gray); }

/* 证据气泡 */
.evidence-bubble {
  background: var(--mint-green);
  color: #fff;
  padding: 10px 20px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  animation: bubble-in 0.4s ease;
}
@keyframes bubble-in {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

/* 擂台 tab */
.tab-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.tab-item {
  padding: 6px 16px;
  border-radius: 20px;
  background: #eee;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tab-item.active { background: var(--detective-blue); color: #fff; }
.tab-item:hover:not(.active) { background: #ddd; }

/* 进步曲线 */
.progress-chart {
  width: 100%;
  height: 80px;
  position: relative;
  margin: 12px 0;
}
.progress-chart canvas { width: 100%; height: 100%; border-radius: 8px; }

/* 输入框 */
.input-field {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-family: var(--font-stack);
  font-size: 14px;
  transition: border-color 0.2s ease;
  outline: none;
}
.input-field:focus { border-color: var(--detective-blue); }

/* 隐藏 */
.hidden { display: none !important; }

/* 加载动画 */
.loading-dots::after {
  content: "";
  animation: dots 1.2s steps(3, end) infinite;
}
@keyframes dots {
  0% { content: ""; }
  33% { content: "."; }
  66% { content: ".."; }
  100% { content: "..."; }
}
