/* ==========================================================================
   驾照不翻车｜交通标志反应训练 - 纯前端样式表 (styles.css)
   设计语言：深夜沥青暗底、钠灯暖黄光晕、白色反光路牌、信号红警示
   ========================================================================== */

:root {
  --bg-deep: #090d16;
  --bg-card: #111827;
  --bg-card-hover: #172136;
  --bg-surface: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --road-yellow: #f59e0b;
  --road-yellow-glow: rgba(245, 158, 11, 0.28);
  --road-yellow-light: #fbbf24;
  --signal-red: #ef4444;
  --signal-red-glow: rgba(239, 68, 68, 0.3);
  --signal-green: #10b981;
  --signal-green-glow: rgba(16, 185, 129, 0.3);
  --sign-blue: #2563eb;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #fbbf24;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --transition-fast: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-family);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
  overflow-x: hidden;
}

/* 舞台容器：最大440px紧凑排版，移动端全宽贴合 */
.toy-stage {
  max-width: 440px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 12px 16px 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  background: 
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(245, 158, 11, 0.12), transparent 70%),
    radial-gradient(circle at 10% 20%, rgba(37, 99, 235, 0.08), transparent 50%),
    linear-gradient(180deg, #090d16 0%, #0c1220 100%);
  overflow-x: hidden;
}

/* 顶部状态条 */
.toy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px 10px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 12px;
}

.hud-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.hud-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--road-yellow);
  box-shadow: 0 0 6px var(--road-yellow);
  animation: pulseLight 2s infinite ease-in-out;
}

.hud-tag-text {
  font-size: 11px;
  font-weight: 500;
  color: #cbd5e1;
  letter-spacing: 0.3px;
}

.hud-status {
  font-size: 10px;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

/* 视图面板管理 */
.view-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
}

.view-panel[hidden] {
  display: none !important;
}

/* ==========================================================================
   首页视图 (Home View)
   ========================================================================== */
.hero-block {
  text-align: center;
  margin-bottom: 12px;
}

.hero-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
  text-shadow: 0 2px 12px rgba(255, 255, 255, 0.15);
  margin-bottom: 4px;
}

.hero-subtitle {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.4;
  padding: 0 4px;
}

/* 路牌扫描台交互主视觉 */
.scanner-deck {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 14px;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  margin-bottom: 14px;
}

.deck-frame {
  height: 168px;
  background: #090e1a;
  border-radius: var(--radius-md);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

/* 夜视雷达扫描线动画 */
.scanner-beam {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--road-yellow-light), transparent);
  box-shadow: 0 0 10px var(--road-yellow);
  opacity: 0.75;
  animation: scanSweep 2.8s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes scanSweep {
  0% { transform: translateY(8px); opacity: 0.3; }
  100% { transform: translateY(160px); opacity: 0.9; }
}

/* 准星 HUD 边角 */
.hud-crosshair {
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: rgba(245, 158, 11, 0.5);
  border-style: solid;
  pointer-events: none;
}
.hud-crosshair.top-left { top: 8px; left: 8px; border-width: 2px 0 0 2px; }
.hud-crosshair.top-right { top: 8px; right: 8px; border-width: 2px 2px 0 0; }
.hud-crosshair.bottom-left { bottom: 8px; left: 8px; border-width: 0 0 2px 2px; }
.hud-crosshair.bottom-right { bottom: 8px; right: 8px; border-width: 0 2px 2px 0; }

.scanner-podium {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
}

/* 顶部暖黄路灯投射光晕 */
.lamp-glow {
  position: absolute;
  top: -24px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.3) 0%, rgba(245, 158, 11, 0) 70%);
  pointer-events: none;
}

.deck-sign-stage {
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.6));
  transition: transform var(--transition-normal);
  cursor: pointer;
}

.deck-sign-stage:active {
  transform: scale(0.96);
}

.deck-indicator {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.deck-sign-name {
  font-size: 12px;
  font-weight: 600;
  color: #f1f5f9;
}

.deck-sign-badge {
  font-size: 10px;
  background: rgba(245, 158, 11, 0.16);
  color: var(--road-yellow-light);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

/* 缩略轮盘按钮组 */
.deck-dial {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.dial-node {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  height: 28px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dial-node:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.dial-node.active {
  background: var(--road-yellow);
  color: #0f172a;
  border-color: var(--road-yellow-light);
  box-shadow: 0 0 10px var(--road-yellow-glow);
}

/* 底部行动卡位 */
.action-dock {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-primary {
  width: 100%;
  height: 52px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #0f172a;
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 6px 20px var(--road-yellow-glow);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-primary:active {
  transform: scale(0.985);
}

.cta-pulse {
  animation: ctaBreath 2.4s infinite ease-in-out;
}

@keyframes ctaBreath {
  0%, 100% { box-shadow: 0 4px 16px var(--road-yellow-glow); }
  50% { box-shadow: 0 8px 26px rgba(245, 158, 11, 0.45); }
}

.disclaimer-text {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.45;
  padding: 0 6px;
}

/* ==========================================================================
   答题视图 (Quiz View)
   ========================================================================== */
.quiz-hud {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  background: rgba(15, 23, 42, 0.6);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.hud-step {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.step-label {
  font-size: 11px;
  color: var(--text-muted);
}

.step-num {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
}

.progress-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  box-shadow: 0 0 8px var(--road-yellow-glow);
  transition: width 0.3s ease;
}

.hud-timer {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--road-yellow-light);
  font-variant-numeric: tabular-nums;
}

/* 答题卡主体 */
.quiz-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 14px 14px 16px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

/* 标志展台 */
.sign-spotlight {
  height: 136px;
  background: radial-gradient(circle at 50% 30%, rgba(245, 158, 11, 0.18), rgba(15, 23, 42, 0.9) 75%);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  margin-bottom: 12px;
}

.sign-holder {
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.65));
}

.sign-holder svg, .deck-sign-stage svg {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

.quiz-prompt {
  margin-bottom: 10px;
}

.prompt-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--road-yellow-light);
  background: rgba(245, 158, 11, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 4px;
}

.question-text {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.4;
}

.key-hint-bar {
  display: flex;
  margin-bottom: 10px;
}

.key-hint-pill {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(255, 255, 255, 0.12);
}

/* 选项网格（四选一） */
.options-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-btn {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: #f1f5f9;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  min-height: 48px;
}

.option-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.22);
}

.option-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
  flex-shrink: 0;
}

.option-text {
  flex: 1;
  line-height: 1.35;
}

/* 对错高亮状态 */
.option-btn.state-correct {
  background: rgba(16, 185, 129, 0.15) !important;
  border-color: #10b981 !important;
  color: #ffffff !important;
  box-shadow: 0 0 12px var(--signal-green-glow);
}
.option-btn.state-correct .option-key {
  background: #10b981;
  color: #022c22;
}

.option-btn.state-wrong {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
  box-shadow: 0 0 12px var(--signal-red-glow);
}
.option-btn.state-wrong .option-key {
  background: #ef4444;
  color: #ffffff;
}

.option-btn:disabled {
  cursor: default;
}

/* 考点解析条 */
.feedback-box {
  margin-top: 12px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  animation: fadeIn 0.25s ease-out;
}

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

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

.feedback-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.feedback-badge.badge-correct {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.feedback-badge.badge-wrong {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.feedback-time {
  font-size: 11px;
  color: var(--text-muted);
}

.feedback-explanation {
  font-size: 12px;
  color: #e2e8f0;
  line-height: 1.45;
  margin-bottom: 8px;
}

.feedback-actions {
  display: flex;
  justify-content: flex-end;
}

.btn-compact {
  background: rgba(245, 158, 11, 0.2);
  color: var(--road-yellow-light);
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-compact:hover {
  background: var(--road-yellow);
  color: #0f172a;
}

.quiz-footer {
  margin-top: 10px;
}

.disclaimer-inline {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
}

/* ==========================================================================
   结果与复盘视图 (Result View)
   ========================================================================== */
.result-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 16px 14px 20px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.result-header {
  text-align: center;
  margin-bottom: 14px;
}

.result-trophy-ring {
  width: 58px;
  height: 58px;
  margin: 0 auto 8px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.25) 0%, rgba(15, 23, 42, 0.8) 75%);
  border: 2px solid var(--road-yellow);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px var(--road-yellow-glow);
}

.badge-icon {
  font-size: 28px;
}

.result-tier-label {
  display: inline-block;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 4px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--road-yellow-light);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.result-headline {
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
}

.result-eval-desc {
  font-size: 12px;
  color: #cbd5e1;
}

/* 核心指标 3 列卡片 */
.metrics-dashboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.metric-cell {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 10px 4px;
  text-align: center;
}

.metric-value {
  display: block;
  font-size: 17px;
  font-weight: 800;
  color: var(--road-yellow-light);
  margin-bottom: 2px;
  font-variant-numeric: tabular-nums;
}

.metric-title {
  font-size: 11px;
  color: var(--text-muted);
}

/* 战报长图导出 */
.poster-section {
  margin-bottom: 14px;
  text-align: center;
}

.btn-secondary {
  width: 100%;
  height: 40px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.poster-preview-box {
  margin-top: 10px;
  background: #090e1a;
  border-radius: var(--radius-md);
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.poster-tip {
  font-size: 11px;
  color: var(--road-yellow-light);
  margin-bottom: 8px;
}

.poster-render-img {
  width: 100%;
  max-width: 280px;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  display: inline-block;
}

/* 错题复盘与速记 */
.review-section {
  margin-bottom: 16px;
}

.review-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.tab-btn {
  flex: 1;
  height: 32px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab-btn.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.35);
  color: var(--road-yellow-light);
}

.review-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 2px;
}

/* 错题单项 */
.review-item {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.review-item-svg {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.review-item-svg svg {
  width: 100%;
  height: 100%;
}

.review-item-body {
  flex: 1;
}

.review-item-title {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 2px;
}

.review-item-detail {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 2px;
}

.review-item-detail .correct-tag {
  color: #34d399;
  font-weight: 600;
}

.review-item-detail .wrong-tag {
  color: #f87171;
  font-weight: 600;
}

.review-item-exp {
  font-size: 11px;
  color: #cbd5e1;
  line-height: 1.35;
}

.all-clear-badge {
  text-align: center;
  padding: 16px 8px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px dashed rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
}

.all-clear-badge .trophy {
  font-size: 24px;
  display: block;
  margin-bottom: 4px;
}

.all-clear-badge p {
  font-size: 12px;
  color: #34d399;
  font-weight: 600;
}

/* 结果底部按钮组 */
.result-action-dock {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.btn-outline {
  width: 100%;
  height: 44px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e2e8f0;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   可访问性与键盘 Focus 态 (Accessibility & Focus-Visible)
   ========================================================================== */
button:focus-visible,
[role="button"]:focus-visible,
.option-btn:focus-visible,
.dial-node:focus-visible,
.tab-btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  box-shadow: 0 0 10px var(--road-yellow-glow);
}

/* ==========================================================================
   移动端与高密屏响应式规范
   ========================================================================== */
@media (max-width: 400px) {
  .toy-stage {
    padding: 8px 12px 20px;
  }
  .hero-title {
    font-size: 23px;
  }
  .scanner-deck {
    padding: 10px;
  }
  .deck-frame {
    height: 148px;
  }
  .deck-sign-stage {
    width: 82px;
    height: 82px;
  }
  .option-btn {
    padding: 8px 10px;
    font-size: 12px;
  }
}
