/* ===== 全局变量 & 重置 ===== */
:root {
  --primary: #00D4FF;
  --primary-dim: rgba(0, 212, 255, 0.15);
  --primary-glow: rgba(0, 212, 255, 0.4);
  --accent: #7B2FFF;
  --success: #00E676;
  --warning: #FFD740;
  --danger: #FF5252;
  --bg: #0a0a12;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --text: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.5);
  --text-mid: rgba(255, 255, 255, 0.7);
  --radius: 16px;
  --radius-sm: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ===== 页面切换 ===== */
.page {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--safe-bottom) + 20px);
}
.page.page-current { display: block; }
.page::-webkit-scrollbar { display: none; }

.page-inner {
  max-width: 420px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== 首页 ===== */
#page-home {
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--bg);
  overflow: hidden;
}
#page-home.page-current { display: flex; }

.home-bg {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(0, 212, 255, 0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 50% 80%, rgba(123, 47, 255, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.home-content {
  position: relative;
  z-index: 1;
  padding: 20px;
}

.brand-icon {
  width: 120px; height: 120px;
  margin: 0 auto 24px;
  animation: float 4s ease-in-out infinite;
}
.brand-icon svg { width: 100%; height: 100%; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.brand-name {
  font-size: 52px;
  font-weight: 800;
  letter-spacing: 8px;
  background: linear-gradient(135deg, #00D4FF 0%, #7B2FFF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.brand-subtitle {
  font-size: 18px;
  color: var(--text-mid);
  margin-bottom: 12px;
}

.brand-desc {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 36px;
  line-height: 1.8;
}

/* ===== 按钮 ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 40px;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, #00D4FF 0%, #7B2FFF 100%);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  letter-spacing: 2px;
}
.btn-primary:active { transform: scale(0.96); opacity: 0.9; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary:disabled:active { transform: none; }

.btn-glow { box-shadow: 0 0 30px rgba(0, 212, 255, 0.3), 0 0 60px rgba(123, 47, 255, 0.15); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 32px;
  border: 1px solid var(--border);
  border-radius: 50px;
  background: transparent;
  color: var(--text-mid);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s;
}
.btn-secondary:active { background: var(--bg-card); }

/* 科技蓝按钮 */
.btn-cyan {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border: none;
  border-radius: 50px;
  background: #00D4FF;
  color: #0a0a12;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  letter-spacing: 1px;
  box-shadow: 0 2px 20px rgba(0, 212, 255, 0.35);
}
.btn-cyan:active { transform: scale(0.96); opacity: 0.85; box-shadow: 0 1px 10px rgba(0, 212, 255, 0.25); }

.btn-block { width: 100%; justify-content: center; }

.btn-small {
  padding: 6px 16px;
  border: 1px solid var(--primary);
  border-radius: 20px;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
}

.btn-back {
  width: 40px; height: 40px;
  border: none; background: var(--bg-card);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-mid);
}

/* ===== 首页权威说明 ===== */
.home-authority {
  margin-top: 36px;
  padding: 14px 20px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(0,212,255,0.08);
  font-size: 11px;
  line-height: 1.8;
  color: var(--text-dim);
  text-align: center;
  letter-spacing: 0.3px;
}

/* ===== 首页版权 ===== */
.home-copyright {
  margin-top: 50px;
  padding-bottom: 20px;
  font-size: 10px;
  color: var(--text-faint);
  text-align: center;
  letter-spacing: 0.5px;
  opacity: 0.6;
}

/* ===== 设置页 ===== */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(var(--safe-top) + 12px) 0 20px;
}
.page-header h2 { font-size: 20px; font-weight: 600; }

.setup-step {
  margin-bottom: 32px;
}
.step-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00D4FF, #7B2FFF);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
.step-title { font-size: 16px; font-weight: 600; }

/* 品牌选择 */
.brand-grid, .city-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.brand-btn, .city-btn {
  padding: 12px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-mid);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.brand-btn:active, .city-btn:active { background: var(--bg-card-hover); }
.brand-btn.selected, .city-btn.selected {
  border-color: var(--primary);
  background: var(--primary-dim);
  color: var(--primary);
  font-weight: 600;
}
.brand-other, .city-other {
  position: relative;
  font-size: 13px;
  color: var(--text-dim);
}
.brand-other input, .city-other input {
  width: 100%;
  padding: 4px;
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0,0,0,0.3);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.wake-word-display {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--primary-dim);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-mid);
  animation: fadeIn 0.3s;
}
.wake-word-display strong { color: var(--primary); }
.wake-word-display svg { flex-shrink: 0; }

.wake-word-edit {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.wake-word-edit input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.3);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

/* 准备提示 */
.ready-tips { margin-bottom: 20px; }
.tip-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text-mid);
}
.tip-item svg { flex-shrink: 0; }

.ready-note {
  text-align: center;
  font-size: 13px;
  color: var(--warning);
  margin-top: 12px;
}

/* ===== 评测主页 ===== */
#page-eval { background: var(--bg); padding-top: 0; }

/* 评测进度条 */
.eval-progress {
  padding: 12px 16px 0;
}
.progress-steps {
  display: flex;
  gap: 4px;
}
.progress-step {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.3s;
}
.progress-step.done { background: var(--primary); }
.progress-step.active { background: var(--primary-glow); animation: pulse 1.5s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 评测内容区 */
.eval-content {
  padding: 16px;
  max-width: 420px;
  margin: 0 auto;
}

/* 评测卡片 */
.eval-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  margin-bottom: 16px;
  animation: slideUp 0.3s;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.eval-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.eval-card-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--primary-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.eval-card-title { font-size: 18px; font-weight: 600; }
.eval-card-subtitle { font-size: 12px; color: var(--text-dim); }

/* 语音指令展示 */
.voice-command {
  padding: 16px;
  background: rgba(0, 212, 255, 0.06);
  border: 1px solid rgba(0, 212, 255, 0.15);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  text-align: center;
}
.voice-command-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.6;
}
.voice-command-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 8px;
}

/* 计时器 */
.timer-display {
  text-align: center;
  padding: 16px;
  margin-bottom: 16px;
}
.timer-value {
  font-size: 36px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
}
.timer-label {
  font-size: 12px;
  color: var(--text-dim);
}

/* 操作按钮组 */
.eval-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.eval-btn {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-mid);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.eval-btn:active { background: var(--bg-card-hover); }
.eval-btn.success { border-color: var(--success); color: var(--success); background: rgba(0, 230, 118, 0.08); }
.eval-btn.fail { border-color: var(--danger); color: var(--danger); background: rgba(255, 82, 82, 0.08); }
.eval-btn.primary-action {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-dim);
  font-weight: 600;
}

/* 选项卡片 */
.option-list { display: flex; flex-direction: column; gap: 8px; }
.option-item {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  color: var(--text-mid);
}
.option-item:active { background: var(--bg-card-hover); }
.option-item.selected {
  border-color: var(--primary);
  background: var(--primary-dim);
  color: var(--primary);
}

/* 维度标题卡片 */
.dimension-intro {
  text-align: center;
  padding: 32px 20px;
}
.dimension-intro-icon { font-size: 48px; margin-bottom: 12px; }
.dimension-intro-title { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.dimension-intro-desc { font-size: 14px; color: var(--text-dim); line-height: 1.6; }

/* 多指令递增轮次显示 */
.round-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}
.round-badge {
  padding: 4px 14px;
  border-radius: 20px;
  background: var(--primary-dim);
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
}

/* 步数计数器 */
.step-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 16px 0;
}
.step-counter-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: var(--primary-dim);
  color: var(--primary);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.step-counter-btn:active { background: rgba(0, 212, 255, 0.3); }
.step-counter-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
  min-width: 40px;
  text-align: center;
}

/* ===== 报告页 ===== */
.report-page { padding-top: calc(var(--safe-top) + 16px); }
.report-header { text-align: center; margin-bottom: 24px; }
.report-header h2 { font-size: 24px; font-weight: 700; }
.report-meta {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 8px;
}

.total-score-card {
  position: relative;
  text-align: center;
  padding: 20px;
  margin-bottom: 24px;
}
.total-score-card canvas {
  display: block;
  margin: 0 auto;
}
.total-score-number {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  font-weight: 800;
  color: var(--primary);
}
.total-score-label {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: -10px;
}

.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* 维度得分列表 */
.dim-score-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.dim-score-item:last-child { border-bottom: none; }
.dim-score-name {
  font-size: 14px;
  color: var(--text-mid);
}
.dim-score-bar-wrap {
  flex: 1;
  margin: 0 16px;
  height: 6px;
  background: var(--bg-card-hover);
  border-radius: 3px;
  overflow: hidden;
}
.dim-score-bar {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #00D4FF, #7B2FFF);
  transition: width 0.8s ease-out;
}
.dim-score-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  min-width: 40px;
  text-align: right;
}

/* 语音能力矩阵 */
.capability-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.cap-item {
  padding: 12px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
}
.cap-item:active { background: var(--bg-card-hover); }
.cap-item.cap-yes {
  border-color: var(--success);
  color: var(--success);
  background: rgba(0, 230, 118, 0.06);
}
.cap-item.cap-no {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(255, 82, 82, 0.06);
}
.cap-item.cap-unknown {
  border-style: dashed;
}
.cap-item .cap-icon { font-size: 20px; display: block; margin-bottom: 4px; }

.report-actions {
  display: flex;
  gap: 8px;
  padding: 20px 0 40px;
}
.report-actions .btn-primary,
.report-actions .btn-cyan {
  flex: 1;
  font-size: 13px;
  padding: 14px 6px;
  letter-spacing: 0;
  text-align: center;
  justify-content: center;
  line-height: 1.3;
}
.report-actions .btn-report-save { font-size: 14px; }

/* ===== 二维码页面 ===== */
.qrcode-page {
  text-align: center;
}
.qrcode-content {
  margin-top: 32px;
}
.qrcode-img {
  width: 80%;
  max-width: 320px;
  border-radius: 16px;
  box-shadow: 0 4px 30px rgba(0,0,0,0.3);
}
.qrcode-tip {
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-mid);
  line-height: 1.8;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 40px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 24px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 50px;
  color: var(--text);
  font-size: 14px;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  z-index: 1000;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== 粒子背景 ===== */
.particle {
  position: absolute;
  width: 2px; height: 2px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0;
  animation: particleFloat linear infinite;
}
@keyframes particleFloat {
  0% { opacity: 0; transform: translateY(100vh) scale(0); }
  10% { opacity: 0.6; }
  90% { opacity: 0.6; }
  100% { opacity: 0; transform: translateY(-10vh) scale(1); }
}

/* ===== 辅助 ===== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-dim { color: var(--text-dim); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }