/* ============================================
   消防逃生知识闯关小游戏 — 共享样式
   暗色火焰主题 · 移动端优先响应式
   ============================================ */

/* --- CSS 自定义属性（主题色） --- */
:root {
  --color-primary: #ef4444;        /* 火焰红 */
  --color-primary-dark: #b91c1c;   /* 深红 */
  --color-primary-light: #fca5a5;  /* 浅粉红 */
  --color-accent: #f97316;         /* 橙 */
  --color-accent-glow: #fb923c;    /* 亮橙 */
  --color-bg: #0f0f0f;            /* 纯黑底 */
  --color-bg-card: #1a1a2e;       /* 深蓝黑卡片 */
  --color-bg-card-hover: #222240;
  --color-text: #f0f0f0;          /* 主文字 */
  --color-text-dim: #a0a0b0;      /* 辅助文字 */
  --color-success: #22c55e;       /* 绿色（答对） */
  --color-danger: #ef4444;        /* 红色（答错） */
  --color-border: #2a2a4a;
  --shadow-card: 0 4px 20px rgba(239, 68, 68, 0.15);
  --shadow-card-hover: 0 8px 30px rgba(239, 68, 68, 0.3);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-round: 50px;
  --transition: 0.25s ease;
  --font-stack: -apple-system, BlinkMacSystemFont, "PingFang SC",
                "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

/* --- 全局重置 --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-stack);
  background: linear-gradient(145deg, #0f0f0f 0%, #1a0a0a 50%, #0f0f0f 100%);
  color: var(--color-text);
  min-height: 100vh;
  line-height: 1.6;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* --- 主容器 --- */
.container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px 0 60px;
}

/* --- 渐变标题（火焰文字） --- */
.title-glow {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  background: linear-gradient(135deg, #f97316, #ef4444, #dc2626);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
  letter-spacing: 2px;
  position: relative;
  display: inline-block;
  width: 100%;
}

.title-glow::after {
  content: '🔥';
  position: absolute;
  top: -8px;
  right: -10px;
  font-size: 1.2rem;
  -webkit-text-fill-color: initial;
  animation: titleFire 1.5s ease-in-out infinite;
}

@keyframes titleFire {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.6; }
  25% { transform: scale(1.2) rotate(-8deg); opacity: 1; }
  50% { transform: scale(0.9) rotate(5deg); opacity: 0.5; }
  75% { transform: scale(1.15) rotate(-3deg); opacity: 0.9; }
}

.subtitle {
  text-align: center;
  color: var(--color-text-dim);
  font-size: 0.95rem;
  margin-bottom: 28px;
}

/* --- 导航栏 --- */
.nav-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 32px;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
  position: relative;
}

.nav-bar::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 10%;
  width: 80%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-primary), var(--color-accent), var(--color-primary), transparent);
  background-size: 200% 100%;
  animation: navGlow 3s ease-in-out infinite;
  border-radius: 2px;
}

@keyframes navGlow {
  0% { background-position: 0% 50%; opacity: 0.3; }
  50% { background-position: 100% 50%; opacity: 0.8; }
  100% { background-position: 0% 50%; opacity: 0.3; }
}

.nav-bar a {
  color: var(--color-text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: var(--radius-round);
  transition: var(--transition);
  font-weight: 500;
  position: relative;
}

.nav-bar a::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--color-accent);
  border-radius: 2px;
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.nav-bar a:hover {
  color: var(--color-primary-light);
  background: rgba(239, 68, 68, 0.12);
  transform: translateY(-2px);
}

.nav-bar a:hover::after {
  width: 60%;
}

/* --- 卡片 --- */
.card {
  background: var(--color-bg-card);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: -2px; left: -2px;
  right: -2px; bottom: -2px;
  border-radius: calc(var(--radius) + 2px);
  background: linear-gradient(135deg, rgba(239,68,68,0.15), transparent 30%, transparent 70%, rgba(249,115,22,0.15));
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
  z-index: 0;
}

.card > * {
  position: relative;
  z-index: 1;
}

.card:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-primary-light);
}

.card:hover::before {
  opacity: 1;
  animation: cardBreath 2.5s ease-in-out infinite;
}

@keyframes cardBreath {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--color-primary-light);
}

.card-desc {
  color: var(--color-text-dim);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* --- 入口卡片网格（首页用） --- */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 600px) {
  .card-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.card-entry {
  display: block;
  background: var(--color-bg-card);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-decoration: none;
  color: var(--color-text);
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), box-shadow var(--transition),
              border-color var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.card-entry::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(239,68,68,0.06), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.card-entry:hover::before {
  opacity: 1;
}

.card-entry:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-primary);
}

.card-entry:active {
  transform: translateY(-2px) scale(0.98);
}

.card-entry .emoji-icon {
  font-size: 2.8rem;
  display: block;
  margin-bottom: 10px;
  transition: transform var(--transition);
}

.card-entry:hover .emoji-icon {
  transform: scale(1.2) rotate(-5deg);
}

.card-entry h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.card-entry p {
  font-size: 0.85rem;
  color: var(--color-text-dim);
}

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-stack);
  border: none;
  border-radius: var(--radius-round);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition),
              background var(--transition);
  text-decoration: none;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #fff;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 25px rgba(239, 68, 68, 0.45);
}

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

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

.btn-secondary:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--color-primary);
  transform: translateY(-3px) scale(1.03);
}

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

.btn-success {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: #fff;
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.btn-success:hover {
  transform: translateY(-3px) scale(1.05);
}

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

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

/* --- 答题选项 --- */
.option-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 20px 0;
}

.option-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 18px 22px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font-size: 1rem;
  font-family: var(--font-stack);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.option-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(239,68,68,0.08), transparent);
  transition: left 0.5s ease;
  pointer-events: none;
}

.option-btn:hover::before {
  left: 100%;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--color-primary);
  background: rgba(239, 68, 68, 0.06);
  transform: translateX(6px) scale(1.01);
}

.option-btn.correct {
  border-color: var(--color-success);
  background: rgba(34, 197, 94, 0.15);
  color: var(--color-success);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.2);
}

.option-btn.wrong {
  border-color: var(--color-danger);
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-danger);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
  animation: shake 0.4s ease;
}

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

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

/* --- 反馈弹窗（知识讲解） --- */
.feedback-box {
  margin-top: 20px;
  padding: 20px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border-left: 4px solid var(--color-accent);
  animation: fadeSlideIn 0.35s ease;
}

.feedback-box h4 {
  color: var(--color-accent);
  margin-bottom: 6px;
  font-size: 1rem;
}

.feedback-box p {
  font-size: 0.9rem;
  color: var(--color-text-dim);
  line-height: 1.6;
}

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

/* --- 状态栏（生命值 + 倒计时） --- */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: var(--radius);
  margin-bottom: 20px;
  border: 1px solid var(--color-border);
  backdrop-filter: blur(4px);
}

.status-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
}

.status-item .label {
  color: var(--color-text-dim);
  font-weight: 400;
}

.health-bar {
  display: flex;
  gap: 5px;
}

.health-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-primary);
  transition: var(--transition);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.health-dot.lost {
  background: #333;
  box-shadow: none;
}

.timer {
  color: var(--color-accent);
  font-size: 1.2rem;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
}

.timer.warning {
  color: var(--color-danger);
  animation: heartBeat 0.6s infinite;
}

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

/* --- 进度条 --- */
.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  margin-bottom: 20px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* --- 烟雾粒子背景（装饰） --- */
.smoke-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.smoke-particle {
  position: absolute;
  bottom: -20px;
  width: 60px;
  height: 60px;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.06), transparent);
  border-radius: 50%;
  animation: rise linear infinite;
}

@keyframes rise {
  0% {
    transform: translateY(0) scale(1);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  100% {
    transform: translateY(-110vh) scale(2);
    opacity: 0;
  }
}

/* --- 沉浸式开场动画（关卡页用） --- */
.scene-intro-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.85);
  animation: introFadeIn 0.5s ease;
  text-align: center;
  padding: 32px;
}

.scene-intro-overlay .intro-emoji {
  font-size: 5rem;
  margin-bottom: 16px;
  animation: introPulse 1.2s ease-in-out infinite;
}

.scene-intro-overlay .intro-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-accent);
  margin-bottom: 12px;
  text-shadow: 0 0 30px rgba(249, 115, 22, 0.5);
}

.scene-intro-overlay .intro-desc {
  font-size: 1.1rem;
  color: var(--color-text-dim);
  max-width: 500px;
  line-height: 1.7;
  margin-bottom: 24px;
}

.scene-intro-overlay .intro-btn {
  padding: 16px 48px;
  font-size: 1.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #fff;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-family: var(--font-stack);
}

.scene-intro-overlay .intro-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 50px rgba(239, 68, 68, 0.6);
}

.scene-intro-overlay .intro-btn:active {
  transform: scale(0.95);
}

@keyframes introFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes introPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* --- 火焰边框（答题时动态装饰） --- */
.fire-border {
  position: relative;
  overflow: hidden;
}

.fire-border::after {
  content: '';
  position: absolute;
  top: -2px; left: -2px;
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  background: linear-gradient(45deg, #ef4444, #f97316, #eab308, #ef4444, #f97316);
  background-size: 400% 400%;
  border-radius: inherit;
  z-index: -1;
  animation: fireGlow 3s ease infinite;
  opacity: 0.6;
}

@keyframes fireGlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* --- 烟雾弥漫效果（答题时背景动态） --- */
.smoke-haze {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(ellipse at 50% 80%, rgba(239,68,68,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 20% 60%, rgba(249,115,22,0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 40%, rgba(239,68,68,0.05) 0%, transparent 50%);
  animation: hazeShift 8s ease-in-out infinite alternate;
}

@keyframes hazeShift {
  0% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
  100% { opacity: 0.4; transform: scale(0.95); }
}

/* --- 场景描述增强（沉浸感） --- */
.scene-desc {
  position: relative;
  overflow: hidden;
}

.scene-desc::before {
  content: '🔥';
  position: absolute;
  top: -10px;
  right: -10px;
  font-size: 2rem;
  opacity: 0.2;
  animation: flicker 2s ease-in-out infinite;
}

@keyframes flicker {
  0%, 100% { opacity: 0.15; transform: scale(1) rotate(0deg); }
  25% { opacity: 0.3; transform: scale(1.1) rotate(-5deg); }
  50% { opacity: 0.1; transform: scale(0.9) rotate(3deg); }
  75% { opacity: 0.25; transform: scale(1.05) rotate(-2deg); }
}

/* --- 倒计时紧张特效 --- */
.timer.warning {
  animation: heartBeat 0.6s infinite;
}
@keyframes heartBeat {
  0%, 100% { transform: scale(1); color: #fff; text-shadow: 0 0 12px var(--color-danger); }
  50%      { transform: scale(1.3); color: #fff; text-shadow: 0 0 24px var(--color-danger), 0 0 48px rgba(239,68,68,0.4); }
}

/* --- 选项按钮点击弹跳 --- */
.option-btn.bounce {
  animation: btnBounce 0.35s ease;
}
@keyframes btnBounce {
  0%   { transform: scale(1); }
  40%  { transform: scale(0.95); }
  70%  { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* --- 通关庆祝 --- */
.celebration {
  text-align: center;
  padding: 40px 20px;
}

.celebration .big-emoji {
  font-size: 4rem;
  display: block;
  margin-bottom: 16px;
}

.celebration h2 {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.celebration p {
  color: var(--color-text-dim);
  margin-bottom: 24px;
}

/* --- 角色头像（用 emoji 代替） --- */
.character {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  animation: floatIn 0.5s ease;
  position: relative;
}

.character::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 20px;
  width: 60px;
  height: 60px;
  background: radial-gradient(circle, rgba(239,68,68,0.15), transparent 70%);
  border-radius: 50%;
  transform: translateY(-50%);
  animation: charGlow 2s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes charGlow {
  0% { transform: translateY(-50%) scale(0.8); opacity: 0.3; }
  100% { transform: translateY(-50%) scale(1.3); opacity: 0.7; }
}

.character .avatar {
  font-size: 3.2rem;
  line-height: 1;
  animation: bounce 2s ease-in-out infinite;
  filter: drop-shadow(0 4px 8px rgba(239, 68, 68, 0.3));
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.3s ease;
  user-select: none;
  position: relative;
  z-index: 2;
}

.character .avatar:hover {
  transform: scale(1.2) rotate(-8deg);
  filter: drop-shadow(0 0 20px rgba(239, 68, 68, 0.6));
}

.character .avatar:active {
  transform: scale(0.85) rotate(5deg);
}

.character .avatar.talk {
  animation: talkBounce 0.3s ease-in-out 3;
}

.character .avatar.happy {
  animation: happyJump 0.5s ease;
}

.character .avatar.sad {
  animation: sadShake 0.4s ease;
}

.character .avatar.celebrate {
  animation: celebrateSpin 0.6s ease;
}

@keyframes talkBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-12px) rotate(-5deg); }
  50% { transform: translateY(-4px) rotate(3deg); }
  75% { transform: translateY(-8px) rotate(-2deg); }
}

@keyframes happyJump {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-18px) scale(1.15) rotate(-5deg); }
  60% { transform: translateY(-6px) scale(1.05) rotate(3deg); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes sadShake {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  20% { transform: translateX(-8px) rotate(-5deg); }
  40% { transform: translateX(8px) rotate(5deg); }
  60% { transform: translateX(-5px) rotate(-3deg); }
  80% { transform: translateX(5px) rotate(3deg); }
}

@keyframes celebrateSpin {
  0% { transform: translateY(0) rotate(0deg) scale(1); }
  40% { transform: translateY(-20px) rotate(180deg) scale(1.2); }
  70% { transform: translateY(-8px) rotate(270deg) scale(1.1); }
  100% { transform: translateY(0) rotate(360deg) scale(1); }
}

.character .bubble {
  background: rgba(255, 255, 255, 0.08);
  padding: 12px 18px;
  border-radius: 16px 16px 16px 4px;
  font-size: 0.95rem;
  color: var(--color-text);
  max-width: 300px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  box-shadow: 0 2px 12px rgba(239, 68, 68, 0.1);
  transition: var(--transition);
  cursor: default;
}

.character .bubble:hover {
  border-color: var(--color-primary-light);
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.2);
}

.character .bubble .cursor-blink {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--color-accent);
  margin-left: 2px;
  animation: blink 0.6s step-end infinite;
  vertical-align: text-bottom;
}

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

.character .bubble.pop-in {
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

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

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

/* --- 场景描述 --- */
.scene-desc {
  text-align: center;
  padding: 20px;
  margin-bottom: 16px;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

/* --- 响应式 --- */
@media (max-width: 480px) {
  .title-glow {
    font-size: 1.5rem;
  }
  .card, .card-entry {
    padding: 16px;
  }
  .option-btn {
    padding: 14px 16px;
    font-size: 0.95rem;
  }
  .status-bar {
    flex-wrap: wrap;
    gap: 8px;
  }
}

/* --- 屏幕闪效果（答对/答错） --- */
.flash-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.flash-overlay.correct {
  background: rgba(34, 197, 94, 0.15);
  opacity: 1;
  animation: flashFade 0.6s ease forwards;
}
.flash-overlay.wrong {
  background: rgba(239, 68, 68, 0.2);
  opacity: 1;
  animation: flashFade 0.6s ease forwards;
}
@keyframes flashFade {
  0%   { opacity: 0.6; }
  100% { opacity: 0; }
}

/* --- 倒计时心跳 --- */
.timer.warning {
  animation: heartBeat 0.6s infinite;
}
@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.3); color: #fff; text-shadow: 0 0 12px var(--color-danger); }
}

/* --- 选项按钮点击弹跳 --- */
.option-btn.bounce {
  animation: btnBounce 0.35s ease;
}
@keyframes btnBounce {
  0%   { transform: scale(1); }
  40%  { transform: scale(0.95); }
  70%  { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* --- 撒花彩纸（通关用） --- */
.confetti-container {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 998;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  top: -20px;
  width: 10px; height: 10px;
  border-radius: 2px;
  animation: confettiFall linear infinite;
}
@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* --- 知识科普卡片网格 --- */
.knowledge-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 600px) {
  .knowledge-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.knowledge-card {
  display: flex;
  gap: 14px;
  background: var(--color-bg-card);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  animation: fadeSlideIn 0.4s ease both;
  cursor: default;
}

.knowledge-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-accent);
}

.knowledge-emoji {
  font-size: 2.4rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.knowledge-body {
  flex: 1;
  min-width: 0;
}

.knowledge-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-primary-light);
  margin-bottom: 4px;
}

.knowledge-content {
  font-size: 0.88rem;
  color: var(--color-text-dim);
  line-height: 1.6;
}

.knowledge-source {
  font-size: 0.75rem;
  color: var(--color-accent);
  margin-top: 8px;
  opacity: 0.7;
}

/* ============================================
   关卡专属动态背景
   ============================================ */

/* --- 关卡1：隐患识别 — 电火花闪烁 + 暗黄脉冲光 --- */
.level1-bg {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255,180,30,0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(255,100,0,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(200,80,0,0.04) 0%, transparent 60%);
  animation: l1Glow 3s ease-in-out infinite alternate;
}
.level1-bg::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(255,200,50,0.03) 2px,
      rgba(255,200,50,0.03) 4px
    );
  animation: l1Scan 4s linear infinite;
}
.level1-bg::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-image:
    radial-gradient(2px 2px at 8% 15%, rgba(255,220,80,0.9), transparent),
    radial-gradient(2px 2px at 25% 55%, rgba(255,220,80,0.7), transparent),
    radial-gradient(3px 3px at 45% 10%, rgba(255,200,50,0.8), transparent),
    radial-gradient(2px 2px at 65% 40%, rgba(255,200,50,0.6), transparent),
    radial-gradient(2px 2px at 85% 75%, rgba(255,220,80,0.8), transparent),
    radial-gradient(3px 3px at 12% 80%, rgba(255,200,50,0.7), transparent),
    radial-gradient(2px 2px at 55% 88%, rgba(255,220,80,0.6), transparent),
    radial-gradient(2px 2px at 78% 20%, rgba(255,200,50,0.8), transparent),
    radial-gradient(3px 3px at 92% 50%, rgba(255,220,80,0.7), transparent),
    radial-gradient(2px 2px at 35% 35%, rgba(255,200,50,0.5), transparent);
  animation: l1Sparkle 1.5s ease-in-out infinite alternate;
}
@keyframes l1Glow {
  0% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
  100% { opacity: 0.5; transform: scale(0.95); }
}
@keyframes l1Scan {
  0% { transform: translateY(0); }
  100% { transform: translateY(4px); }
}
@keyframes l1Sparkle {
  0% { opacity: 0.1; }
  50% { opacity: 0.7; }
  100% { opacity: 0.2; }
}

/* --- 关卡2：逃生选择 — 底部大火 + 浓烟翻滚 + 灰烬飘落 --- */
.level2-bg {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.level2-bg::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 100%; height: 70%;
  background:
    radial-gradient(ellipse at 20% 100%, rgba(255,50,0,0.25) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(255,150,0,0.20) 0%, transparent 40%),
    radial-gradient(ellipse at 80% 100%, rgba(255,50,0,0.18) 0%, transparent 50%),
    radial-gradient(ellipse at 35% 100%, rgba(255,200,50,0.10) 0%, transparent 30%),
    radial-gradient(ellipse at 65% 100%, rgba(255,100,0,0.12) 0%, transparent 40%);
  animation: l2Fire 1.5s ease-in-out infinite alternate;
}
.level2-bg::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    radial-gradient(ellipse at 40% 20%, rgba(120,120,140,0.15) 0%, transparent 40%),
    radial-gradient(ellipse at 70% 30%, rgba(100,100,120,0.12) 0%, transparent 35%),
    radial-gradient(ellipse at 20% 50%, rgba(110,110,130,0.10) 0%, transparent 40%),
    radial-gradient(ellipse at 60% 60%, rgba(90,90,110,0.08) 0%, transparent 35%);
  animation: l2Smoke 4s ease-in-out infinite alternate;
}
/* 灰烬粒子（用 box-shadow 模拟多个飘落小点） */
.level2-bg .ash-particle {
  position: absolute;
  top: -10px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: rgba(200,200,200,0.6);
  animation: l2Ash linear infinite;
}
@keyframes l2Fire {
  0% { opacity: 0.3; transform: scaleY(0.85) scaleX(0.95); }
  25% { opacity: 0.7; transform: scaleY(1.1) scaleX(1.03); }
  50% { opacity: 0.5; transform: scaleY(0.95) scaleX(0.98); }
  75% { opacity: 0.8; transform: scaleY(1.15) scaleX(1.05); }
  100% { opacity: 0.4; transform: scaleY(0.9) scaleX(0.97); }
}
@keyframes l2Smoke {
  0% { transform: translateX(-20px) scale(1); opacity: 0.2; }
  25% { transform: translateX(-10px) scale(1.08); opacity: 0.5; }
  50% { transform: translateX(10px) scale(1.12); opacity: 0.6; }
  75% { transform: translateX(20px) scale(1.05); opacity: 0.4; }
  100% { transform: translateX(-5px) scale(0.95); opacity: 0.3; }
}
@keyframes l2Ash {
  0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0.8; }
  100% { transform: translateY(100vh) translateX(30px) rotate(360deg); opacity: 0; }
}

/* --- 关卡3：避开错误 — 警报闪烁 + 危险红光 + 警示条纹 --- */
.level3-bg {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.level3-bg::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    radial-gradient(ellipse at 30% 30%, rgba(255,0,0,0.15) 0%, transparent 40%),
    radial-gradient(ellipse at 70% 70%, rgba(255,0,0,0.12) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 50%, rgba(200,0,0,0.08) 0%, transparent 50%);
  animation: l3Alarm 0.6s ease-in-out infinite alternate;
}
.level3-bg::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 20px,
      rgba(255,50,0,0.04) 20px,
      rgba(255,50,0,0.04) 40px
    ),
    radial-gradient(ellipse at 15% 25%, rgba(255,80,80,0.08) 0%, transparent 25%),
    radial-gradient(ellipse at 85% 75%, rgba(255,80,80,0.08) 0%, transparent 25%);
  animation: l3Flash 0.3s ease-in-out infinite alternate;
}
/* 旋转警示光晕 */
.level3-bg .warning-ring {
  position: absolute;
  top: 50%; left: 50%;
  width: 300px; height: 300px;
  margin: -150px 0 0 -150px;
  border: 2px solid rgba(255,50,0,0.08);
  border-radius: 50%;
  animation: l3Ring 3s linear infinite;
}
.level3-bg .warning-ring:nth-child(2) {
  width: 500px; height: 500px;
  margin: -250px 0 0 -250px;
  animation-direction: reverse;
  animation-duration: 4s;
}
@keyframes l3Alarm {
  0% { opacity: 0.15; }
  25% { opacity: 0.7; }
  50% { opacity: 0.2; }
  75% { opacity: 0.8; }
  100% { opacity: 0.1; }
}
@keyframes l3Flash {
  0% { opacity: 0.1; }
  50% { opacity: 0.6; }
  100% { opacity: 0.15; }
}
@keyframes l3Ring {
  0% { transform: rotate(0deg) scale(1); opacity: 0.5; }
  50% { transform: rotate(180deg) scale(1.1); opacity: 0.2; }
  100% { transform: rotate(360deg) scale(1); opacity: 0.5; }
}

/* ============================================
   灭火模拟器样式
   ============================================ */

.sim-canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 700px;
  margin: 0 auto 20px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--color-border);
  box-shadow: var(--shadow-card);
}

#simCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 700 / 440;
  background: #0f0f0f;
  cursor: pointer;
  touch-action: manipulation;
}

.sim-tools {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: var(--color-bg-card);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 0.8rem;
  font-family: var(--font-stack);
  cursor: pointer;
  transition: var(--transition);
  min-width: 70px;
}

.tool-btn:hover {
  border-color: var(--color-primary-light);
  transform: translateY(-3px);
  box-shadow: 0 4px 15px rgba(239,68,68,0.2);
}

.tool-btn.selected {
  border-color: var(--color-primary);
  background: rgba(239,68,68,0.15);
  box-shadow: 0 0 20px rgba(239,68,68,0.3);
  transform: translateY(-3px);
}

.tool-btn .tool-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.sim-result {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 16px 28px;
  border-radius: var(--radius);
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  z-index: 10;
  animation: fadeSlideIn 0.3s ease;
  pointer-events: none;
}

.sim-success {
  background: rgba(34,197,94,0.9);
  color: #fff;
  box-shadow: 0 0 30px rgba(34,197,94,0.4);
}

.sim-danger {
  background: rgba(239,68,68,0.9);
  color: #fff;
  box-shadow: 0 0 30px rgba(239,68,68,0.4);
}

.sim-neutral {
  background: rgba(249,115,22,0.85);
  color: #fff;
  box-shadow: 0 0 20px rgba(249,115,22,0.3);
}

.sim-score-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 14px 22px;
  background: rgba(0,0,0,0.4);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  margin-top: 16px;
  font-size: 0.95rem;
  color: var(--color-text-dim);
  flex-wrap: wrap;
}

.sim-score-bar span {
  display: flex;
  align-items: center;
  gap: 6px;
}

#fireCount, #scoreDisplay {
  color: var(--color-accent);
  font-weight: 700;
  font-size: 1.1rem;
}

/* --- 工具类 --- */
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.flex-center { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
