/* ============================================
   校园火灾逃生模拟 - 共享样式表
   暗色 · 火焰暖橙 · 紧张氛围 · 沉浸式UI
   ============================================ */

/* --- CSS 自定义属性（主题色） --- */
:root {
  --color-bg: #0a0a0f;
  --color-bg-card: #14141e;
  --color-bg-overlay: rgba(10, 10, 15, 0.85);
  --color-primary: #f97316;
  --color-primary-glow: #fb923c;
  --color-secondary: #dc2626;
  --color-accent: #facc15;
  --color-text: #e2e2e8;
  --color-text-dim: #9ca3af;
  --color-text-bright: #ffffff;
  --color-border: rgba(249, 115, 22, 0.25);
  --color-danger: #ef4444;
  --color-success: #22c55e;
  --shadow-glow: 0 0 20px rgba(249, 115, 22, 0.3);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.25s ease;
}

/* --- 重置 & 基础 --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* 背景火焰微光动画 */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse 60% 40% at 20% 80%, rgba(249, 115, 22, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 40% 30% at 80% 20%, rgba(220, 38, 38, 0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* --- 排版 --- */
h1, h2, h3, h4 {
  color: var(--color-text-bright);
  font-weight: 700;
  line-height: 1.3;
}

h1 {
  font-size: 2.2rem;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: 1.6rem;
  margin-bottom: 1rem;
}

p {
  margin-bottom: 0.8rem;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-primary-glow);
}

/* --- 布局容器 --- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
  position: relative;
  z-index: 1;
}

/* --- 导航栏 --- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.5rem;
  background: rgba(20, 20, 30, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-links {
  display: flex;
  gap: 1.2rem;
  list-style: none;
}

.navbar-links a {
  color: var(--color-text-dim);
  font-size: 0.95rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.navbar-links a:hover,
.navbar-links a.active {
  color: var(--color-primary);
  background: rgba(249, 115, 22, 0.1);
}

/* --- 卡片 --- */
.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: all var(--transition);
}

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

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.6rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

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

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(249, 115, 22, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(249, 115, 22, 0.1);
  color: var(--color-primary);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: rgba(249, 115, 22, 0.2);
  border-color: var(--color-primary);
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-2px);
}

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

/* --- 输入框 --- */
input, select, textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  padding: 0.6rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color var(--transition);
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

/* --- 游戏画布 --- */
canvas {
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: #000;
}

/* --- 进度条 --- */
.progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

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

/* --- 提示 / Toast --- */
.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-sm);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-weight: 500;
  z-index: 999;
  animation: slideIn 0.3s ease;
  max-width: 360px;
}

.toast-success {
  border-color: var(--color-success);
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.2);
}

.toast-error {
  border-color: var(--color-danger);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* --- 模态框 --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  animation: scaleIn 0.25s ease;
}

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

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* --- 游戏内特殊效果 --- */
.screen-shake {
  animation: shake 0.3s ease;
}

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

.screen-flash {
  animation: flash 0.15s ease;
}

@keyframes flash {
  0% { background: rgba(255, 200, 0, 0.6); }
  100% { background: transparent; }
}

/* 火焰粒子效果容器 */
.flame-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

/* 黑雾效果 */
.black-fog {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 300;
  animation: fogFade 3s ease forwards;
}

@keyframes fogFade {
  0% { opacity: 1; }
  70% { opacity: 0.8; }
  100% { opacity: 0; pointer-events: none; }
}

/* 屏幕倾斜效果 */
.screen-tilt {
  animation: tilt 1.5s ease;
}

@keyframes tilt {
  0% { transform: rotate(0deg); }
  30% { transform: rotate(3deg); }
  60% { transform: rotate(-2deg); }
  100% { transform: rotate(0deg); }
}

/* 屏幕裂开效果 */
.screen-crack {
  position: fixed;
  inset: 0;
  z-index: 250;
  pointer-events: none;
  background:
    linear-gradient(45deg, transparent 48%, rgba(249, 115, 22, 0.4) 49%, rgba(249, 115, 22, 0.4) 51%, transparent 52%),
    linear-gradient(-45deg, transparent 48%, rgba(220, 38, 38, 0.3) 49%, rgba(220, 38, 38, 0.3) 51%, transparent 52%);
  animation: crackFade 1s ease forwards;
}

@keyframes crackFade {
  0% { opacity: 0; }
  20% { opacity: 1; }
  100% { opacity: 0; }
}

/* --- 响应式 --- */
@media (max-width: 768px) {
  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.3rem; }
  .container { padding: 1rem; }
  .navbar { flex-direction: column; gap: 0.5rem; }
  .card-grid { grid-template-columns: 1fr; }
  .btn { padding: 0.6rem 1.2rem; font-size: 0.9rem; }
}

@media (max-width: 480px) {
  .navbar-links { gap: 0.6rem; flex-wrap: wrap; justify-content: center; }
  .navbar-links a { font-size: 0.85rem; }
}

/* --- 首页火焰粒子装饰（纯视觉，不影响功能） --- */
.flame-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.flame-particle {
  position: absolute;
  bottom: -20px;
  width: 8px;
  height: 8px;
  background: radial-gradient(circle, rgba(249,115,22,0.7), rgba(220,38,38,0.2));
  border-radius: 50%;
  animation: flameRise linear infinite;
  opacity: 0.4;
}
.p1 { left: 10%; width: 10px; height: 10px; animation-duration: 3s; animation-delay: 0s; }
.p2 { left: 25%; width: 6px; height: 6px; animation-duration: 4s; animation-delay: 1s; }
.p3 { left: 50%; width: 12px; height: 12px; animation-duration: 3.5s; animation-delay: 0.5s; }
.p4 { left: 70%; width: 7px; height: 7px; animation-duration: 4.5s; animation-delay: 2s; }
.p5 { left: 85%; width: 9px; height: 9px; animation-duration: 3.2s; animation-delay: 1.5s; }
@keyframes flameRise {
  0% { transform: translateY(0) scale(1); opacity: 0.4; }
  50% { opacity: 0.8; }
  100% { transform: translateY(-100vh) scale(0.3); opacity: 0; }
}

/* 警告牌 + 消防员装饰条 */
.deco-bar {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  padding: 0.6rem 0;
  background: rgba(249, 115, 22, 0.06);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  overflow: hidden;
  position: relative;
  z-index: 1;
  animation: decoScroll 20s linear infinite;
}
.deco-item {
  font-size: 1.4rem;
  flex-shrink: 0;
}
@keyframes decoScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* --- 道具商店 --- */
.shop-header { text-align:center; padding:2rem 0; }
.shop-coins { display:inline-flex; align-items:center; gap:0.5rem; background:rgba(250,204,21,0.1); border:1px solid rgba(250,204,21,0.3); border-radius:var(--radius-sm); padding:0.5rem 1.2rem; font-size:1.1rem; font-weight:600; color:var(--color-accent); }
.shop-cats { display:flex; gap:0.5rem; flex-wrap:wrap; justify-content:center; margin:1.5rem 0; }
.shop-cat-btn { padding:0.5rem 1rem; border-radius:var(--radius-sm); background:rgba(255,255,255,0.04); border:1px solid var(--color-border); color:var(--color-text-dim); cursor:pointer; transition:all var(--transition); font-size:0.9rem; }
.shop-cat-btn:hover { border-color:var(--color-primary); color:var(--color-text); }
.shop-cat-btn.active { background:rgba(249,115,22,0.15); border-color:var(--color-primary); color:var(--color-primary); }
.shop-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:1rem; margin:1.5rem 0; }
.shop-item { background:var(--color-bg-card); border:1px solid var(--color-border); border-radius:var(--radius); padding:1rem; text-align:center; transition:all var(--transition); }
.shop-item:hover { border-color:var(--color-primary); box-shadow:var(--shadow-glow); transform:translateY(-2px); }
.shop-item .item-emoji { font-size:2rem; display:block; margin-bottom:0.3rem; }
.shop-item .item-name { font-weight:600; font-size:0.95rem; margin-bottom:0.2rem; }
.shop-item .item-desc { font-size:0.8rem; color:var(--color-text-dim); margin-bottom:0.5rem; }
.shop-item .item-price { font-size:0.9rem; color:var(--color-accent); font-weight:600; }
.shop-item .item-owned { font-size:0.8rem; color:var(--color-success); }
.shop-item .btn { font-size:0.85rem; padding:0.4rem 1rem; margin-top:0.3rem; }
.shop-pagination { display:flex; justify-content:center; align-items:center; gap:1rem; margin:1.5rem 0; }
.shop-pagination .page-btn { padding:0.4rem 1rem; border-radius:var(--radius-sm); background:rgba(255,255,255,0.04); border:1px solid var(--color-border); color:var(--color-text-dim); cursor:pointer; transition:all var(--transition); }
.shop-pagination .page-btn:hover { border-color:var(--color-primary); color:var(--color-text); }
.shop-pagination .page-btn:disabled { opacity:0.3; cursor:not-allowed; }
.shop-pagination .page-info { font-size:0.9rem; color:var(--color-text-dim); }
.shop-search { max-width:400px; margin:0 auto 1rem; }
.shop-search input { text-align:center; }
@media (max-width:600px) { .shop-grid { grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); } }

/* ============================================
   首页 Hero 区域 — 大号动漫消防员 + 建筑着火 + 科技感
   ============================================ */

/* 建筑着火 Canvas */
#hero-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
}

/* Hero 容器 — 盖在 Canvas 上面 */
.hero-section {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 0 0.5rem;
  overflow: hidden;
  min-height: 280px;
}

/* 消防员小队 — 横排 */
.hero-crew {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  align-items: center;
}

/* 大号动漫消防员 */
.hero-firefighter {
  position: relative;
  font-size: 5rem;
  line-height: 1;
  animation: heroFloat 3s ease-in-out infinite;
  filter: drop-shadow(0 0 30px rgba(249, 115, 22, 0.5));
}

/* 消防车 */
.hero-truck {
  font-size: 4rem;
  line-height: 1;
  margin-top: 0.3rem;
  animation: truckBounce 2s ease-in-out infinite;
}

.truck-emoji {
  display: block;
}

/* 两根水管 — 水花效果 */
.hero-hoses {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-top: 0.2rem;
}

.hero-hose {
  font-size: 2rem;
  line-height: 1;
  animation: hoseSpray 1.2s ease-in-out infinite alternate;
}

.hose-1 {
  animation-delay: 0s;
}

.hose-2 {
  animation-delay: 0.6s;
}

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

@keyframes hoseSpray {
  0% { transform: translateX(0) scale(1); opacity: 0.6; }
  100% { transform: translateX(15px) scale(1.3); opacity: 1; }
}

.firefighter-emoji {
  display: block;
  font-size: inherit;
}

/* 消防员背后的光晕 */
.firefighter-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200px;
  height: 200px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(249, 115, 22, 0.3) 0%, rgba(249, 115, 22, 0.05) 50%, transparent 70%);
  border-radius: 50%;
  z-index: -1;
  animation: glowPulse 2s ease-in-out infinite;
}

/* 消防员浮动动画 */
@keyframes heroFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* 光晕脉冲 */
@keyframes glowPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
  50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
}

/* 科技感徽章 */
.hero-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.4rem 1.2rem;
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.3);
  border-radius: 50px;
  font-size: 0.9rem;
  color: var(--color-primary);
  backdrop-filter: blur(4px);
  animation: badgePulse 2s ease-in-out infinite;
}

.badge-icon { font-size: 1.2rem; }
.badge-text { font-weight: 600; letter-spacing: 1px; }

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 10px rgba(249, 115, 22, 0.2); }
  50% { box-shadow: 0 0 25px rgba(249, 115, 22, 0.4); }
}

/* 扫描线效果（科技感） */
.hero-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(249, 115, 22, 0.03) 2px,
    rgba(249, 115, 22, 0.03) 4px
  );
  pointer-events: none;
  z-index: 0;
}

/* 网格线（科技感） */
.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(249, 115, 22, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(249, 115, 22, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* 首页标题区域微调 — 让标题浮在 hero 上面 */
.container {
  position: relative;
  z-index: 2;
}

/* 响应式 — 小屏消防员缩小 */
@media (max-width: 600px) {
  .hero-firefighter { font-size: 5rem; }
  .hero-section { min-height: 180px; padding: 1rem 0 0; }
  .firefighter-glow { width: 120px; height: 120px; }
}
