/* ========================================
   魔法禁书目录 幻想收束 - 玩家纪念站
   全局样式
   ======================================== */

/* --- CSS 变量 --- */
:root {
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-dark: #1d4ed8;
  --accent: #f59e0b;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);
  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 1200px;

  /* 卡牌稀有度颜色 */
  --rarity-1: #9ca3af;
  --rarity-2: #3b82f6;
  --rarity-3: #f59e0b;
  --rarity-awaken: #ef4444;

  /* 属性颜色 */
  --attr-red: #ef4444;
  --attr-green: #22c55e;
  --attr-blue: #3b82f6;
  --attr-yellow: #eab308;
  --attr-purple: #a855f7;

  /* 阵营颜色 */
  --faction-science: #f59e0b;
  --faction-magic: #3b82f6;
  --faction-normal: #6b7280;
}

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

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }

/* --- 导航栏 --- */
.navbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.navbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 64px;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-dark);
}
.nav-logo img { height: 36px; }
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: all .2s;
}
.nav-links a:hover,
.nav-links a.active {
  background: var(--primary);
  color: #fff;
}
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all .3s;
}
.nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* --- 主要内容 --- */
.main-content { flex: 1; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 20px;
}

/* --- 页面头部 --- */
.page-hero {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  text-align: center;
  padding: 80px 20px;
}
.page-hero h1 { font-size: 40px; margin-bottom: 12px; }
.page-hero p { font-size: 18px; opacity: .85; max-width: 600px; margin: 0 auto; }

/* --- Hero 按钮 --- */
.hero-buttons { display: flex; gap: 16px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  transition: all .2s;
  border: none;
  cursor: pointer;
}
.btn-primary { background: #fff; color: var(--primary); }
.btn-primary:hover { background: #f1f5f9; color: var(--primary-dark); }
.btn-outline { background: transparent; color: #fff; border: 2px solid rgba(255,255,255,.4); }
.btn-outline:hover { background: rgba(255,255,255,.1); border-color: #fff; }

/* --- 章节标题 --- */
.section-title {
  text-align: center;
  margin-bottom: 40px;
}
.section-title h2 { font-size: 28px; color: var(--text); margin-bottom: 8px; }
.section-title p { color: var(--text-secondary); font-size: 15px; }

/* --- 卡片网格 --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: all .3s;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.card-image {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  background: #f1f5f9;
}
.card-body { padding: 16px; }
.card-body h3 { font-size: 16px; margin-bottom: 6px; }
.card-body p { font-size: 13px; color: var(--text-secondary); }

/* --- 标签 --- */
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
}
.tag-red { background: #fef2f2; color: var(--attr-red); }
.tag-green { background: #f0fdf4; color: #16a34a; }
.tag-blue { background: #eff6ff; color: var(--attr-blue); }
.tag-yellow { background: #fefce8; color: #ca8a04; }
.tag-purple { background: #faf5ff; color: var(--attr-purple); }
.tag-rarity { background: #fffbeb; color: #b45309; }
.tag-science { background: #fff7ed; color: #c2410c; }
.tag-magic { background: #eff6ff; color: #1d4ed8; }

/* --- 页脚 --- */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 24px 20px;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: auto;
}
.footer a { color: var(--text-secondary); }

/* --- 筛选栏 --- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
  align-items: center;
}
.filter-bar select,
.filter-bar input {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text);
  outline: none;
  transition: border-color .2s;
}
.filter-bar select:focus,
.filter-bar input:focus { border-color: var(--primary); }
.search-input { min-width: 220px; }

/* --- 分页 --- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
}
.pagination button {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 14px;
  transition: all .2s;
}
.pagination button:hover { border-color: var(--primary); }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* --- 弹窗/灯箱 --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 28px;
  cursor: pointer;
  color: var(--text-secondary);
  background: none;
  border: none;
  line-height: 1;
}
.modal-body { padding: 32px; }

/* 阶段切换按钮 */
.stage-dot {
  transition: all 0.2s;
  user-select: none;
}
.stage-dot:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

/* --- 灯箱（画廊）--- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.9);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 90%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
}
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  transition: background .2s;
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover { background: rgba(255,255,255,.3); }
.lightbox-close { top: 20px; right: 20px; width: 44px; height: 44px; font-size: 28px; }
.lightbox-prev { left: 20px; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; font-size: 24px; }
.lightbox-next { right: 20px; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; font-size: 24px; }

/* --- 时间线 --- */
.timeline { position: relative; padding-left: 30px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 28px; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg);
}
.timeline-date { font-size: 13px; color: var(--text-muted); }
.timeline-title { font-size: 18px; font-weight: 600; margin: 4px 0; }
.timeline-body { color: var(--text-secondary); font-size: 14px; }

/* --- 折叠面板 --- */
.accordion { margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.accordion-header {
  background: var(--bg-card);
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}
.accordion-header:hover { background: #f8fafc; }
.accordion-header::after { content: '▾'; transition: transform .3s; font-size: 12px; }
.accordion.open .accordion-header::after { transform: rotate(180deg); }
.accordion-body { display: none; padding: 16px 20px; background: #fafbfc; }
.accordion.open .accordion-body { display: block; }

/* --- 表格 --- */
.table-wrap { overflow-x: auto; margin: 20px 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f8fafc; font-weight: 600; white-space: nowrap; }

/* --- 画廊网格 --- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.gallery-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .3s;
}
.gallery-grid img:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

/* --- 联动卡片 --- */
.collab-card {
  display: flex;
  gap: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  transition: box-shadow .3s;
}
.collab-card:hover { box-shadow: var(--shadow-md); }
.collab-card img { width: 80px; height: 80px; border-radius: var(--radius-sm); object-fit: cover; }

/* --- 响应式 --- */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    flex-direction: column;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: flex; }
  .page-hero { padding: 60px 20px; }
  .page-hero h1 { font-size: 28px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .collab-card { flex-direction: column; text-align: center; }
  .collab-card img { margin: 0 auto; }
  .filter-bar { flex-direction: column; }
  .search-input { width: 100%; }
}
