/* ============================================
   世界奇妙物语 - 统一样式规范
   所有页面共用此样式文件
   ============================================ */

/* ---------- 颜色变量 ---------- */
:root {
  /* 主色调 */
  --primary-color: #e94560;
  --primary-light: #ff6b9d;
  --primary-gradient: linear-gradient(90deg, #e94560, #ff6b9d);
  
  /* 背景色 - 默认宇宙星空 */
  --bg-gradient: linear-gradient(135deg, #0d0221 0%, #1a0533 40%, #2d1b4e 70%, #0f0c29 100%);
  --bg-card: rgba(255, 255, 255, 0.08);
  --bg-card-light: rgba(255, 255, 255, 0.05);
  --bg-hover: rgba(255, 255, 255, 0.15);
  
  /* 文字颜色 */
  --text-primary: #eee;
  --text-secondary: #aaa;
  --text-muted: #888;
  --text-faint: #666;
  
  /* 状态颜色 */
  --success-color: #4caf50;
  --success-bg: rgba(76, 175, 80, 0.3);
  --error-color: #f44336;
  --error-bg: rgba(244, 67, 54, 0.3);
  --warning-color: #ffc107;
  --warning-bg: rgba(255, 193, 7, 0.1);
  --info-color: #2196f3;
  
  /* 积分颜色（统一金色） */
  --score-color: #ffc107;
  --score-gradient: linear-gradient(90deg, #ffc107, #ff9800);
  
  /* 连击颜色 */
  --combo-color: #ff6b9d;
  
  /* 边框 */
  --border-color: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(233, 69, 96, 0.5);
  
  /* 圆角 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 25px;
  
  /* 阴影 */
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ---------- 主题：宇宙星空 🌌 ---------- */
body.theme-cosmos {
  --bg-gradient: linear-gradient(135deg, #0d0221 0%, #1a0533 40%, #2d1b4e 70%, #0f0c29 100%);
  --primary-color: #a855f7;
  --primary-light: #c084fc;
  --primary-gradient: linear-gradient(90deg, #a855f7, #ec4899);
  --border-hover: rgba(168, 85, 247, 0.5);
  --combo-color: #f472b6;
}

/* ---------- 主题：深海奇幻 🌊 ---------- */
body.theme-ocean {
  --bg-gradient: linear-gradient(180deg, #001220 0%, #012a4a 30%, #013a63 60%, #01497c 100%);
  --primary-color: #06b6d4;
  --primary-light: #22d3ee;
  --primary-gradient: linear-gradient(90deg, #06b6d4, #3b82f6);
  --border-hover: rgba(6, 182, 212, 0.5);
  --combo-color: #22d3ee;
  --info-color: #06b6d4;
}

/* ---------- 主题：魔法森林 🦋 ---------- */
body.theme-forest {
  --bg-gradient: linear-gradient(135deg, #0a1f0a 0%, #143d14 40%, #1a4d1a 70%, #0d2b0d 100%);
  --primary-color: #84cc16;
  --primary-light: #a3e635;
  --primary-gradient: linear-gradient(90deg, #84cc16, #22c55e);
  --border-hover: rgba(132, 204, 22, 0.5);
  --combo-color: #a3e635;
  --info-color: #22c55e;
}

/* ---------- 主题：赛博霓虹 🔮 ---------- */
body.theme-cyber {
  --bg-gradient: linear-gradient(135deg, #0a0a0a 0%, #1a0a1a 40%, #0a1a2a 70%, #0a0a0a 100%);
  --primary-color: #f0abfc;
  --primary-light: #f5d0fe;
  --primary-gradient: linear-gradient(90deg, #f0abfc, #67e8f9);
  --border-hover: rgba(240, 171, 252, 0.5);
  --combo-color: #f0abfc;
  --info-color: #67e8f9;
  --shadow-card: 0 0 30px rgba(240, 171, 252, 0.1), 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ---------- 动态背景画布 ---------- */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
}

/* ---------- 右上角：显示风格（样式对齐 stock 的 style-picker） ---------- */
.style-picker {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 200;
}

.style-picker-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-hover);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
  transition: transform 0.2s;
}

.style-picker-btn:hover {
  transform: translateY(-1px);
}

.style-picker-panel {
  position: absolute;
  top: 46px;
  right: 0;
  width: 216px;
  padding: 7px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-card);
  display: none;
}

.style-picker.open .style-picker-panel {
  display: block;
  animation: stylePickerIn 0.22s ease;
}

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

.style-picker-title {
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 6px 9px 8px;
  letter-spacing: 0.5px;
}

.style-option {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: var(--radius-md);
  background: none;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.style-option:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.style-option .st-ico {
  font-size: 16px;
  line-height: 1;
}

.style-option .st-desc {
  display: block;
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 1px;
}

.style-option .st-check {
  margin-left: auto;
  color: var(--primary-color);
  font-weight: bold;
  opacity: 0;
}

.style-option.active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.style-option.active .st-check {
  opacity: 1;
}

/* ---------- 全局重置 ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

body {
  background: var(--bg-gradient);
  min-height: 100vh;
  padding: 20px;
  color: var(--text-primary);
}

/* ---------- 容器 ---------- */
.container {
  max-width: 800px;
  margin: 0 auto;
}

.container-narrow {
  max-width: 600px;
  margin: 0 auto;
}

/* ---------- 标题 ---------- */
.header {
  text-align: center;
  margin-bottom: 24px;
}

.header h1 {
  font-size: 28px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.header p {
  color: var(--text-muted);
  font-size: 14px;
}

.page-header {
  display: flex;
  align-items: center;
  margin-bottom: 30px;
}

.back-btn {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  margin-right: 16px;
}

.back-btn:hover {
  color: var(--primary-light);
}

.page-header h1 {
  font-size: 24px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---------- 统计栏 ---------- */
.stats-bar {
  display: flex;
  justify-content: space-between;
  background: var(--bg-card-light);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  backdrop-filter: blur(10px);
}

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

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 20px;
  font-weight: bold;
  color: var(--primary-color);
}

/* 积分统一金色 */
.stat-value.score {
  color: var(--score-color);
}

/* 错误统一红色 */
.stat-value.wrong {
  color: var(--error-color);
}

/* 连击统一粉色 */
.stat-value.combo {
  color: var(--combo-color);
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
}

.card-light {
  background: var(--bg-card-light);
  border-radius: var(--radius-md);
  padding: 20px;
}

/* ---------- 按钮 ---------- */
.btn {
  border: none;
  padding: 12px 32px;
  border-radius: var(--radius-full);
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn:hover {
  transform: scale(1.05);
}

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

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

.btn-success {
  background: linear-gradient(90deg, #4caf50, #8bc34a);
  color: white;
}

.btn-warning {
  background: var(--score-gradient);
  color: #1a1a2e;
  font-weight: bold;
}

.btn-danger {
  background: linear-gradient(90deg, #f44336, #ff5722);
  color: white;
}

.btn-block {
  display: block;
  width: 100%;
}

/* ---------- 菜单按钮 ---------- */
.menu-grid {
  display: grid;
  gap: 16px;
}

.menu-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 20px;
  text-decoration: none;
  color: var(--text-primary);
}

.menu-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.menu-icon {
  font-size: 32px;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(233, 69, 96, 0.2);
  border-radius: var(--radius-md);
}

.menu-text h3 {
  font-size: 18px;
  margin-bottom: 4px;
}

.menu-text p {
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------- 筛选按钮 ---------- */
.filter-bar {
  margin-bottom: 20px;
}

.filter-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ccc;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.filter-btn.active {
  background: var(--primary-gradient);
  border-color: transparent;
  color: white;
  font-weight: bold;
}

/* ---------- 答题相关 ---------- */
.category-tag {
  display: inline-block;
  background: rgba(233, 69, 96, 0.2);
  color: var(--primary-light);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  margin-bottom: 16px;
}

.question-box {
  font-size: 18px;
  line-height: 1.8;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.q-number {
  color: var(--primary-color);
  font-size: 14px;
  font-weight: bold;
}

.sp-img {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: var(--radius-md);
  margin: 16px auto;
  display: block;
  background: var(--bg-card-light);
}

.option-wrap {
  display: grid;
  gap: 12px;
  margin: 20px 0;
}

.opt-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  transition: all 0.3s ease;
}

.opt-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  transform: translateX(4px);
}

.opt-btn:disabled {
  cursor: not-allowed;
}

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

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

.opt-letter {
  display: inline-block;
  width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  background: rgba(233, 69, 96, 0.3);
  border-radius: 50%;
  margin-right: 8px;
  font-weight: bold;
  font-size: 13px;
}

/* ---------- 解析框 ---------- */
.explanation-box {
  background: var(--warning-bg);
  border-left: 4px solid var(--warning-color);
  padding: 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 16px 0;
  display: none;
}

.exp-title {
  font-weight: bold;
  margin-bottom: 8px;
  font-size: 16px;
}

.exp-content {
  font-size: 14px;
  line-height: 1.7;
  color: #ddd;
}

.combo-bonus {
  color: var(--combo-color);
  font-weight: bold;
  font-size: 15px;
  margin: 8px 0;
  padding: 8px 12px;
  background: rgba(255, 107, 157, 0.1);
  border-radius: var(--radius-sm);
}

/* ---------- 设置开关 ---------- */
.settings-list {
  background: var(--bg-card-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-item:last-child {
  border-bottom: none;
}

.setting-info h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.setting-info p {
  font-size: 13px;
  color: var(--text-muted);
}

.switch {
  position: relative;
  width: 50px;
  height: 28px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.3s;
}

.switch.on {
  background: var(--primary-gradient);
}

.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s;
}

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

/* 浏览器不支持时：开关置灰且不可开启 */
.switch.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---------- 排行榜 ---------- */
.hero-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  margin-bottom: 20px;
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
}

.hero-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.hero-title {
  font-size: 18px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.hero-value {
  font-size: 64px;
  font-weight: bold;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
}

.hero-desc {
  font-size: 14px;
  color: var(--text-faint);
}

.record-list {
  background: var(--bg-card-light);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.record-title {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.record-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.record-item:last-child {
  border-bottom: none;
}

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

.record-value {
  color: var(--combo-color);
  font-weight: bold;
  font-size: 18px;
}

.record-value.score {
  color: var(--score-color);
}

.record-value.wrong {
  color: var(--error-color);
}

/* ---------- 密码验证层 ---------- */
.password-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-gradient);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.password-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  max-width: 400px;
  width: 90%;
}

.password-box h2 {
  color: var(--text-primary);
  margin-bottom: 20px;
  font-size: 24px;
}

.password-box input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 16px;
  text-align: center;
  margin-bottom: 16px;
  outline: none;
}

.password-box input:focus {
  border-color: var(--primary-color);
}

.password-error {
  color: var(--error-color);
  margin-top: 12px;
  font-size: 14px;
  display: none;
}

/* ---------- 页脚 ---------- */
.footer {
  text-align: center;
  margin-top: 30px;
  color: var(--text-faint);
  font-size: 12px;
}

/* 页脚站点链接（样式对齐 lover/index.html 的 .site-footer a） */
.footer a {
  display: inline-block;
  margin-top: 6px;
  font-size: 12.5px;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition:
    color 0.2s,
    border-color 0.2s;
}
.footer a:hover {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

/* ---------- 统计预览（首页） ---------- */
.stats-preview {
  background: var(--bg-card-light);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 30px;
  display: flex;
  justify-content: space-around;
}

/* ---------- 重置区域 ---------- */
.reset-section {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.reset-title {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.reset-btn {
  background: rgba(244, 67, 54, 0.2);
  border: 1px solid rgba(244, 67, 54, 0.3);
  color: var(--error-color);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
}

.reset-btn:hover {
  background: rgba(244, 67, 54, 0.3);
}
