/* ============================================
   Risk Hunter — 全局样式
   ============================================ */

/* ===== CSS 变量（主题系统） ===== */
:root {
  --primary: #7C5CBF;
  --primary-light: #A78BFA;
  --primary-dark: #5B3E9B;
  --primary-bg: rgba(124, 92, 191, 0.08);
  --success: #22C55E;
  --success-bg: rgba(34, 197, 94, 0.08);
  --error: #EF4444;
  --error-bg: rgba(239, 68, 68, 0.08);
  --warning: #F59E0B;
  --bg: #F0EDFA;
  --card: #FFFFFF;
  --border: #DDD8EF;
  --text: #141320;
  --text-light: #6B7280;
  --text-white: #FFFFFF;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 4px rgba(124,92,191,0.07);
  --shadow-md: 0 2px 12px rgba(124,92,191,0.10);
  --shadow-lg: 0 4px 24px rgba(124,92,191,0.14);
  --tab-height: 64px;
  --max-width: 480px;
  --transition-fast: 150ms ease-out;
  --transition-normal: 250ms ease-out;
  --font-display: 'Space Grotesk', -apple-system, sans-serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Noto Sans SC', sans-serif;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: #C9C2E0;
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
}

/* ===== 主容器（手机 App 感） ===== */
#app {
  width: 100%;
  max-width: var(--max-width);
  min-height: 100vh;
  background-color: var(--bg);
  background-image: radial-gradient(circle, rgba(124,92,191,0.055) 1px, transparent 1px);
  background-size: 24px 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(124,92,191,0.25);
}

/* ===== 页面系统 ===== */
.page {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: var(--tab-height);
}

.page.active {
  display: flex;
}

.sub-page {
  display: none;
  flex-direction: column;
  flex: 1;
}

.sub-page.active {
  display: flex;
}

/* ===== 页面头部 ===== */
.page-header {
  padding: 20px 16px 12px;
  background: var(--card);
  box-shadow: 0 1px 8px rgba(124,92,191,0.09);
}

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-display);
}

.page-desc {
  font-size: 14px;
  color: var(--text-light);
  margin-top: 4px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: var(--primary-bg);
  transform: scale(1.1);
}

.quiz-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quiz-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quiz-level {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  font-family: var(--font-display);
}

.quiz-type-badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--primary-bg);
  color: var(--primary);
}

/* ===== 积分条 ===== */
.score-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--card);
  box-shadow: 0 1px 6px rgba(124,92,191,0.07);
}

.score-bar-large {
  padding: 20px 16px;
  justify-content: center;
  gap: 16px;
}

.score-label {
  font-size: 14px;
  color: var(--text-light);
}

.score-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  font-family: var(--font-display);
}

.score-value-large {
  font-size: 48px;
  font-family: var(--font-display);
}

/* ===== 底部 Tab 导航栏 ===== */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  height: var(--tab-height);
  background: var(--card);
  box-shadow: 0 -1px 12px rgba(124,92,191,0.10);
  display: flex;
  align-items: center;
  z-index: 100;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 100%;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-light);
  transition: color var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.tab-item.active {
  color: var(--primary);
}

.tab-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 3px 3px;
}

.tab-item:hover {
  color: var(--primary-light);
}

.tab-icon {
  font-size: 22px;
  line-height: 1;
}

.tab-label {
  font-size: 11px;
  font-weight: 500;
}

/* ===== 按钮系统 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

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

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

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

.btn-primary:disabled {
  background: var(--border);
  color: var(--text-light);
  cursor: not-allowed;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary-bg);
}

.btn-full {
  width: 100%;
}

.btn-back {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--primary);
  cursor: pointer;
  padding: 4px 8px;
  -webkit-tap-highlight-color: transparent;
}

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

/* ===== 输入框 ===== */
input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  transition: border-color var(--transition-fast);
  outline: none;
}

input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 92, 191, 0.15);
}

/* ===== 弹窗/模态框 ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--card);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.btn-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 20px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
}

.btn-close:hover {
  background: var(--bg);
}

.modal-body {
  padding: 16px;
}

/* ===== 排行榜列表 ===== */
.leaderboard-list {
  padding: 0 16px;
  flex: 1;
  overflow-y: auto;
}

.leaderboard-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-light);
}

.leaderboard-empty p:first-child {
  font-size: 36px;
  margin-bottom: 8px;
}

.leaderboard-loading {
  text-align: center;
  padding: 32px;
  color: var(--text-light);
}

.leaderboard-filter {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
}

.filter-btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--card);
  font-size: 14px;
  cursor: pointer;
  color: var(--text-light);
  transition: all var(--transition-fast);
}

.filter-btn.active {
  background: var(--primary);
  color: var(--text-white);
  border-color: var(--primary);
}

/* 排行榜行 */
.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--card);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.leaderboard-row.is-me {
  background: var(--primary-bg);
  border: 2px solid var(--primary);
}

.lb-rank {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.lb-rank-num {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-light);
}

.lb-info {
  flex: 1;
  min-width: 0;
}

.lb-nickname {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-me-tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-full);
  margin-left: 4px;
  vertical-align: middle;
}

.lb-meta {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

.lb-score {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  font-family: var(--font-display);
  flex-shrink: 0;
}

.lb-score-label {
  font-size: 12px;
  font-weight: 500;
  margin-left: 2px;
}

/* ===== 昵称输入页 ===== */
.nickname-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 24px;
}

.nickname-logo {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon {
  font-size: 64px;
}

.logo-title {
  font-size: 32px;
  font-weight: 700;
  font-family: var(--font-display);
  background: linear-gradient(135deg, #7C5CBF 0%, #A78BFA 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-top: 12px;
}

.logo-subtitle {
  font-size: 16px;
  color: var(--text-light);
  margin-top: 4px;
}

.nickname-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.nickname-label {
  display: block;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  text-align: center;
}

.nickname-input {
  text-align: center;
  font-size: 20px;
}

.nickname-hint {
  min-height: 20px;
  font-size: 13px;
  color: var(--primary);
  text-align: center;
  margin: 8px 0 16px;
}

/* 语言切换按钮 */
.lang-toggle {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.lang-btn {
  padding: 6px 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--card);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-light);
  transition: all var(--transition-fast);
  font-family: inherit;
}

.lang-btn.active {
  background: var(--primary);
  color: var(--text-white);
  border-color: var(--primary);
}

.lang-btn:hover:not(.active) {
  border-color: var(--primary);
  color: var(--primary);
}

/* ===== 个人设置页 ===== */
.profile-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 16px 20px;
}

.avatar-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--text-white);
  font-weight: 700;
  margin-bottom: 12px;
}

.profile-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 0 16px 20px;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  font-family: var(--font-display);
}

.stat-label {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

.profile-section {
  padding: 16px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

.badge-wall {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.badge-item {
  text-align: center;
  width: 70px;
  padding: 10px 4px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

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

.badge-name {
  font-size: 10px;
  color: var(--text);
  margin-top: 4px;
  line-height: 1.2;
}

.skin-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skin-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--card);
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.skin-option.active {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.skin-option.locked {
  opacity: 0.5;
}

.skin-option-preview {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.skin-option-info {
  flex: 1;
}

.skin-option-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.skin-option-status {
  font-size: 12px;
  color: var(--text-light);
}

.profile-footer {
  padding: 24px 16px;
  text-align: center;
}

.version-text {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 12px;
}

.text-light {
  color: var(--text-light);
  font-size: 14px;
}

/* ===== 通用辅助类 ===== */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

/* ===== 商城区域 ===== */
.shop-section {
  padding: 16px;
}

.shop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.shop-item {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 2px solid transparent;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.shop-item:hover {
  box-shadow: var(--shadow-md);
}

.shop-item.owned {
  border-color: var(--success);
}

.shop-item.active {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.shop-item.locked {
  opacity: 0.5;
}

.shop-item-icon {
  font-size: 32px;
}

.shop-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.shop-item-desc {
  font-size: 11px;
  color: var(--text-light);
  line-height: 1.3;
}

.shop-item-cost {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

.shop-item.owned .shop-item-cost {
  color: var(--success);
}

.btn-sm {
  padding: 6px 16px;
  font-size: 13px;
  min-height: 32px;
}

/* 皮肤预览色条 */
.skin-item {
  position: relative;
}

.skin-item::before {
  content: '';
  display: block;
  width: 100%;
  height: 4px;
  background: var(--skin-primary, var(--primary));
  border-radius: 2px;
}

/* ===== Toast 提示 ===== */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: var(--max-width);
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: white;
  box-shadow: var(--shadow-lg);
  animation: slideDown 0.3s ease-out;
  pointer-events: auto;
  text-align: center;
}

.toast-success { background: #16A34A; }
.toast-error { background: #DC2626; }
.toast-info { background: var(--primary); }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 单元选择卡片 ===== */
.unit-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.unit-card {
  display: flex;
  gap: 16px;
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  border: 2px solid transparent;
  border-left: 5px solid var(--unit-color, var(--primary));
}

.unit-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--unit-color, var(--primary));
}

.unit-card:active {
  transform: scale(0.98);
}

.unit-card-icon {
  font-size: 42px;
  min-width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: var(--radius-md);
}

.unit-card-content {
  flex: 1;
}

.unit-card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-display);
}

.unit-card-subtitle {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

.unit-card-desc {
  font-size: 14px;
  color: var(--text-light);
  margin-top: 8px;
  line-height: 1.4;
}

.unit-card-levels {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}

.unit-level-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-bg);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.unit-progress {
  font-size: 13px;
  color: var(--success);
}

/* ===== 神秘单元卡片 ===== */
.unit-card-mystery .unit-card-title {
  font-size: 28px;
  letter-spacing: 4px;
  color: var(--unit-color, var(--primary));
}

.unit-card-hook {
  font-size: 14px;
  color: var(--text-light);
  margin-top: 6px;
  font-style: italic;
}

/* 内联输入框（openInputOption H 选项） */
.open-input-inline {
  padding: 12px 4px 4px;
}

.open-input-field {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition-fast);
}

.open-input-field:focus {
  border-color: var(--primary);
}

/* ===== 路径图标题揭示动画 ===== */
@keyframes titleReveal {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.title-reveal-anim {
  animation: titleReveal 1s ease forwards;
}

/* ===== 学习路径 ===== */
.path-container {
  flex: 1;
  padding: 24px 16px;
  overflow-y: auto;
}

.path-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 16px 0;
}

.path-node-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.path-node {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--card);
  border: 3px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  position: relative;
  z-index: 1;
}

.path-node.current {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--text-white);
  box-shadow: 0 0 0 6px rgba(124, 92, 191, 0.2);
  transform: scale(1.1);
  animation: pulse-node 2s infinite;
}

.path-node.completed {
  border-color: var(--success);
  background: var(--success);
  color: var(--text-white);
}

.path-node.locked {
  border-color: var(--border);
  background: var(--bg);
  opacity: 0.55;
}

.path-node[data-clickable="true"] {
  cursor: pointer;
}

.path-node[data-clickable="true"]:hover {
  transform: scale(1.08);
  box-shadow: var(--shadow-md);
}

.path-node-icon {
  font-size: 18px;
  line-height: 1;
}

.path-node-num {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-display);
}

.path-node.current .path-node-num {
  color: rgba(255,255,255,0.8);
}

.path-node-label {
  text-align: center;
  margin: 6px 0;
}

.path-type-tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg);
  color: var(--text-light);
}

.path-type-tag.tag-choice { background: #EDE9FE; color: #6D28D9; }
.path-type-tag.tag-image-click { background: #FEF3C7; color: #B45309; }
.path-type-tag.tag-truefalse { background: #DBEAFE; color: #1E40AF; }

.path-connector {
  width: 3px;
  height: 24px;
  background: var(--border);
  margin: 4px 0;
}

.path-node.completed + .path-connector,
.path-node-wrapper:has(.path-node.completed) .path-connector {
  background: var(--success);
}

.path-complete-banner {
  text-align: center;
  padding: 32px 16px;
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  margin-top: 16px;
}

.path-complete-banner span {
  font-size: 48px;
}

.path-complete-banner p {
  font-size: 18px;
  font-weight: 600;
  margin: 12px 0 20px;
  color: var(--text);
}

.path-complete-score {
  font-size: 20px !important;
  color: var(--primary) !important;
  margin-bottom: 16px !important;
}

.path-complete-score strong {
  font-size: 28px;
}

/* ===== 答题区域 ===== */
.quiz-area {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.quiz-question-card {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.quiz-question-text {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
  line-height: 1.65;
  padding: 16px;
  background: var(--card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.quiz-instruction {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 12px;
}

/* 选择题选项 */
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  position: relative;
  overflow: hidden;
}

.quiz-option::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: transparent;
  transition: background var(--transition-fast);
}

.quiz-option:hover:not(.answered)::before {
  background: var(--primary);
}

.quiz-option.correct::before {
  background: var(--success);
}

.quiz-option.wrong::before {
  background: var(--error);
}

.quiz-option:hover:not(.answered) {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.quiz-option:active:not(.answered) {
  transform: scale(0.98);
}

.option-letter {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-display);
  flex-shrink: 0;
}

.quiz-option.answered {
  cursor: default;
}

.quiz-option.correct {
  border-color: var(--success);
  background: var(--success-bg);
}

.quiz-option.correct .option-letter {
  background: var(--success);
  color: white;
}

.quiz-option.wrong {
  border-color: var(--error);
  background: var(--error-bg);
}

.quiz-option.wrong .option-letter {
  background: var(--error);
  color: white;
}

/* 判断题按钮 */
.quiz-tf-options {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.quiz-tf-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 28px 16px;
  border: 3px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  min-height: 120px;
}

.quiz-tf-btn:hover:not(.answered) {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.quiz-tf-btn:active:not(.answered) {
  transform: scale(0.95);
}

.tf-icon {
  font-size: 36px;
  line-height: 1;
}

.quiz-tf-btn.answered {
  cursor: default;
}

.quiz-tf-btn.correct {
  border-color: var(--success);
  background: var(--success-bg);
}

.quiz-tf-btn.wrong {
  border-color: var(--error);
  background: var(--error-bg);
}

/* 图片点击题 */
.quiz-image-area {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: var(--card);
  cursor: crosshair;
}

.quiz-image-area svg {
  width: 100%;
  height: auto;
  display: block;
}

.hotspot-zone {
  animation: pulse-hotspot 1.5s infinite;
  cursor: pointer;
}

.hotspot-zone:hover {
  fill: rgba(239, 68, 68, 0.6) !important;
}

.hotspot-zone.found {
  fill: rgba(34, 197, 94, 0.4) !important;
  stroke: #22C55E !important;
  animation: none;
}

.quiz-hotspot-progress {
  text-align: center;
  padding: 10px;
  font-size: 14px;
  color: var(--text-light);
}

.quiz-hotspot-progress span {
  font-weight: 700;
  color: var(--primary);
}

/* revealMode 热区状态 */
.hotspot-reveal.selected {
  fill: rgba(124, 92, 191, 0.35) !important;
  stroke: #7C5CBF !important;
  stroke-width: 3 !important;
  stroke-dasharray: 8, 4 !important;
  animation: none !important;
}
.hotspot-reveal.revealed-correct {
  fill: rgba(34, 197, 94, 0.35) !important;
  stroke: #22C55E !important;
  stroke-width: 3 !important;
  stroke-dasharray: none !important;
  animation: none !important;
}
.hotspot-reveal.revealed-wrong {
  fill: rgba(239, 68, 68, 0.25) !important;
  stroke: #EF4444 !important;
  stroke-width: 3 !important;
  animation: none !important;
}

/* revealMode 完成按钮行 */
.reveal-done-row {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}
.reveal-done-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 32px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.reveal-done-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* revealMode 说明列表 */
.hotspot-explanation-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: slideUp 0.3s ease-out;
}
.hotspot-explanation-item {
  padding: 10px 12px;
  background: var(--card);
  border-left: 3px solid var(--success);
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}

/* 答题反馈 */
.quiz-feedback {
  margin-top: 16px;
  padding: 20px 16px;
  border-radius: var(--radius-md);
  text-align: center;
  animation: slideUp 0.3s ease-out;
}

.feedback-correct {
  background: var(--success-bg);
  border: 2px solid var(--success);
}

.feedback-wrong {
  background: var(--error-bg);
  border: 2px solid var(--error);
}

.feedback-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.feedback-title {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-display);
  margin-bottom: 8px;
}

.feedback-correct .feedback-title {
  color: #15803D;
}

.feedback-wrong .feedback-title {
  color: #B91C1C;
}

.feedback-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  text-align: left;
  padding: 12px;
  background: rgba(255,255,255,0.7);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}

/* ===== 动画关键帧 ===== */
@keyframes pulse-node {
  0%, 100% { box-shadow: 0 0 0 6px rgba(124, 92, 191, 0.2); }
  50% { box-shadow: 0 0 0 14px rgba(124, 92, 191, 0.05); }
}

@keyframes pulse-hotspot {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

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

/* ===== 故事进度圆点 ===== */
.story-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0 16px;
  gap: 0;
}

.story-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.story-dot.completed {
  background: var(--success);
}

.story-dot.current {
  background: var(--primary);
  transform: scale(1.3);
  box-shadow: 0 0 0 3px rgba(124, 92, 191, 0.2);
}

.story-connector {
  width: 28px;
  height: 2px;
  background: var(--border);
  flex-shrink: 0;
  transition: background 0.3s ease;
}

/* 已完成子题之后的连接线也变绿 */
.story-dot.completed + .story-connector {
  background: var(--success);
}

/* ===== 故事子题容器 ===== */
.story-sub-content {
  /* 不加动画，保持简洁 */
}

/* ===== 场景插图 ===== */
.quiz-scene-illustration {
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.quiz-scene-illustration svg {
  width: 100%;
  height: auto;
  display: block;
}

/* ===== 路径类型标签（新增类型） ===== */
.path-type-tag.tag-incident-class { background: #FEE2E2; color: #B91C1C; }
.path-type-tag.tag-choice-all     { background: #FEF3C7; color: #92400E; }
.path-type-tag.tag-open-text      { background: #D1FAE5; color: #065F46; }
.path-type-tag.tag-story          { background: #EDE9FE; color: #5B21B6; }
.path-type-tag.tag-ranking        { background: #F3E8FF; color: #7C3AED; }

/* ===== 5选项布局（事件等级分类题） ===== */
.quiz-5-options .quiz-option {
  font-size: 14px;
  padding: 11px 14px;
  gap: 10px;
}

.quiz-5-options .option-letter {
  width: 24px;
  height: 24px;
  font-size: 11px;
  border-radius: 4px;
}

/* ===== 揭示卡（reveal-card） ===== */
.reveal-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 0 4px;
  padding: 12px 14px;
  background: #FFFBEB;
  border-left: 3px solid #3B82F6;
  border-radius: var(--radius-sm);
  text-align: left;
}

.reveal-card-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.reveal-card-title {
  font-size: 12px;
  font-weight: 700;
  color: #1D4ED8;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.reveal-card-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
}

/* ===== 时光回溯遮罩（choice-all 题过渡） ===== */
.rewind-overlay {
  position: fixed;
  inset: 0;
  background: rgba(124, 92, 191, 0.65);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: rewindIn 0.3s ease-out forwards;
}

.rewind-overlay.rewind-fade-out {
  animation: rewindOut 0.4s ease-in forwards;
}

.rewind-text {
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

@keyframes rewindIn {
  from { opacity: 0; transform: scale(1.04); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes rewindOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.96); }
}

/* ===== choice-all 高亮 ===== */
.choice-all-highlight {
  border-color: var(--primary) !important;
  background: rgba(124, 92, 191, 0.12) !important;
}

.choice-all-highlight .option-letter {
  background: var(--primary) !important;
  color: white !important;
}

/* ===== "以上全部" 文字 ===== */
.choice-all-final {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  padding: 10px 0 4px;
}

.choice-all-final-visible {
  animation: fadeIn 0.5s ease forwards;
}

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

/* ===== 开放文字题输入区 ===== */
.open-text-area {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.open-text-input {
  width: 100%;
  min-height: 90px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color var(--transition-fast);
  background: var(--card);
}

.open-text-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 92, 191, 0.15);
}

.open-text-input:disabled {
  background: var(--bg);
  color: var(--text-light);
}

.open-text-hint {
  font-size: 13px;
  min-height: 18px;
  margin-top: 4px;
}

/* ===== 开放题揭示区域 ===== */
.open-text-reveal {
  margin: 4px 0;
}

.open-text-reveal-scene {
  margin-bottom: 10px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.open-text-reveal-scene svg {
  width: 100%;
  height: auto;
  display: block;
}

.open-text-reveal-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.65;
  padding: 10px 12px;
  background: rgba(255,255,255,0.7);
  border-radius: var(--radius-sm);
  text-align: left;
}

/* ===== 排序题（ranking）===== */
.ranking-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.ranking-item:hover:not(.answered) {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.ranking-item:active:not(.answered) {
  transform: scale(0.98);
}

.ranking-item.selected {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.ranking-item.ranking-correct {
  border-color: var(--success);
  background: var(--success-bg);
  cursor: default;
}

.ranking-item.ranking-wrong {
  border-color: var(--error);
  background: var(--error-bg);
  cursor: default;
}

.ranking-item.answered {
  cursor: default;
}

.ranking-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-display);
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.ranking-item.ranking-correct .ranking-badge {
  background: var(--success);
  display: flex !important;
}

.ranking-item.ranking-wrong .ranking-badge {
  background: var(--success);
  display: flex !important;
}

.ranking-item-text {
  font-size: 15px;
  color: var(--text);
  line-height: 1.5;
  flex: 1;
}

.ranking-confirm-row {
  display: none;
  margin-top: 4px;
  margin-bottom: 8px;
}

/* ===== 响应式：桌面端 ===== */
@media (min-width: 769px) {
  #app {
    border-radius: var(--radius-lg);
    margin: 16px auto;
    min-height: calc(100vh - 32px);
  }

  .tab-bar {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }
}
