/* ========== 基础重置与变量 ========== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #10b981;
  --success-light: #d1fae5;
  --error: #ef4444;
  --error-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --text: #1e293b;
  --text-secondary: #64748b;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --radius: 16px;
  --radius-sm: 10px;
}

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

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

/* ========== 布局 ========== */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: 80px;
}

/* ========== 页面切换动画 ========== */
.page {
  animation: fadeIn 0.3s ease;
  padding: 16px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== 卡片 ========== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  -webkit-appearance: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 14px rgba(37,99,235,0.3);
}

.btn-secondary {
  background: var(--border);
  color: var(--text);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 8px;
  width: auto;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========== 顶部导航 ========== */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.nav-back {
  font-size: 20px;
  padding: 8px;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
}

.nav-title {
  font-size: 17px;
  font-weight: 600;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

/* ========== 首页 ========== */
.home-header {
  text-align: center;
  padding: 32px 16px 24px;
}

.home-logo {
  font-size: 56px;
  margin-bottom: 12px;
}

.home-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.home-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.version-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.flow-strip {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  text-align: center;
  color: var(--text);
}

.flow-step span {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: white;
  font-size: 14px;
  font-weight: 800;
}

.flow-step strong {
  font-size: 13px;
  line-height: 1.2;
}

.flow-arrow {
  color: var(--text-secondary);
  font-size: 24px;
  font-weight: 700;
}

/* 统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.stat-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-number {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ========== 步骤提示 ========== */
.step-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.3s;
}

.step-dot.active {
  background: var(--primary);
  color: white;
}

.step-dot.done {
  background: var(--success);
  color: white;
}

.step-line {
  width: 40px;
  height: 2px;
  background: var(--border);
}

.step-line.done {
  background: var(--success);
}

/* ========== 词性标注 ========== */
.pos-instruction {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.6;
}

.pos-skip {
  text-align: right;
  margin-bottom: 12px;
}

.word-pos-item {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.word-pos-label {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
}

.pos-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pos-btn {
  padding: 10px 18px;
  border: 2px solid var(--border);
  border-radius: 24px;
  background: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-appearance: none;
}

.pos-btn:active { transform: scale(0.95); }

.pos-btn.correct {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.pos-btn.wrong {
  background: var(--error);
  border-color: var(--error);
  color: white;
  animation: shake 0.4s;
}

.pos-btn.disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.word-pos-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 10px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ========== 做题界面 ========== */
.flow-status {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.flow-status.done {
  background: var(--success-light);
  color: #047857;
  border: 1px solid #a7f3d0;
}

.flow-status.skipped {
  background: var(--warning-light);
  color: #92400e;
  border: 1px solid #fde68a;
}

.passage-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  line-height: 2.2;
  font-size: 17px;
}

.blank-input {
  display: inline-block;
  min-width: 90px;
  padding: 6px 10px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  text-align: center;
  font-weight: 600;
  color: var(--primary);
  background: white;
  margin: 0 2px;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

.blank-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.blank-input.correct {
  border-color: var(--success);
  background: var(--success-light);
  color: var(--success);
}

.blank-input.wrong {
  border-color: var(--error);
  background: var(--error-light);
  color: var(--error);
}

/* 选项词提示区 */
.options-hint {
  background: var(--warning-light);
  border: 2px dashed var(--warning);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
}

.options-hint-title {
  font-weight: 700;
  color: #92400e;
  margin-bottom: 10px;
  font-size: 15px;
}

.options-hint-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-chip {
  padding: 8px 14px;
  background: white;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  border: 1px solid #fcd34d;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  transition: transform 0.15s, border-color 0.15s;
}

.option-chip:active {
  transform: scale(0.96);
  border-color: var(--primary);
}

.option-chip .pos-tag {
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: 4px;
}

.options-tip {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: #92400e;
}

/* 提示按钮 */
.hint-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: var(--primary-light);
  color: var(--primary);
  border: none;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
}

.hint-text {
  background: #eff6ff;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--primary-dark);
  animation: fadeIn 0.2s;
}

/* ========== 结果分析 ========== */
.score-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: conic-gradient(var(--success) var(--score-deg), var(--border) var(--score-deg));
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background 0.8s ease;
}

.score-circle::before {
  content: '';
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: white;
  position: absolute;
}

.score-text {
  position: relative;
  z-index: 1;
  font-size: 36px;
  font-weight: 800;
  color: var(--text);
}

.score-label {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.diagnosis-summary {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 12px;
}

.diagnosis-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.diagnosis-meta span {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.diagnosis-item {
  padding: 12px;
  background: var(--error-light);
  border-radius: 8px;
  margin-bottom: 8px;
}

.diagnosis-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--error);
  font-weight: 700;
}

.diagnosis-item-head span {
  flex: 0 0 auto;
  font-size: 12px;
}

.diagnosis-item-body {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.6;
}

/* 维度得分条 */
.dim-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.dim-name {
  width: 80px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}

.dim-track {
  flex: 1;
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
}

.dim-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s ease;
}

.dim-fill.good { background: var(--success); }
.dim-fill.warning { background: var(--warning); }
.dim-fill.bad { background: var(--error); }

.dim-value {
  width: 36px;
  text-align: right;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* 错题分析 */
.wrong-item {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--error);
}

.wrong-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.wrong-item-num {
  font-weight: 700;
  color: var(--error);
}

.wrong-item-category {
  font-size: 12px;
  padding: 2px 8px;
  background: var(--error-light);
  color: var(--error);
  border-radius: 10px;
}

.wrong-item-answer {
  font-size: 15px;
  margin-bottom: 6px;
}

.wrong-item-answer .wrong-ans {
  color: var(--error);
  text-decoration: line-through;
  margin-right: 8px;
}

.wrong-item-answer .correct-ans {
  color: var(--success);
  font-weight: 700;
}

.wrong-item-exp {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ========== 雷达图容器 ========== */
.radar-chart {
  width: 100%;
  height: 280px;
}

/* ========== 底部固定栏 ========== */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--card);
  padding: 12px 16px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  display: flex;
  gap: 10px;
  z-index: 100;
}

.bottom-bar .btn {
  flex: 1;
  width: auto;
}

/* ========== 帮助页面 ========== */
.help-section {
  margin-bottom: 20px;
}

.help-section h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--primary);
}

.help-section p {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary);
}

/* ========== 设置项 ========== */
.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.setting-label {
  font-size: 16px;
  font-weight: 600;
}

.setting-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* 开关 */
.toggle-switch {
  width: 50px;
  height: 28px;
  background: var(--border);
  border-radius: 14px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  -webkit-appearance: none;
  border: none;
}

.toggle-switch.on {
  background: var(--success);
}

.toggle-switch::after {
  content: '';
  width: 24px;
  height: 24px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch.on::after {
  transform: translateX(22px);
}

/* ========== 响应式微调 ========== */
@media (max-width: 400px) {
  .passage-box {
    font-size: 16px;
    padding: 16px;
  }
  .blank-input {
    min-width: 70px;
    font-size: 15px;
  }
  .btn {
    font-size: 16px;
    padding: 14px 20px;
  }
  .home-title {
    font-size: 22px;
  }
}

/* ========== 隐藏滚动条但保留功能 ========== */
.hide-scrollbar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.hide-scrollbar::-webkit-scrollbar {
  display: none;
}
