/* ============================================
   天天三国 - 战役系统
   章节列表 · 关卡地图 · 关卡详情
   ============================================ */

/* ============================================
   章节列表
   ============================================ */
.campaign-chapters {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  padding-bottom: var(--spacing-md);
}

.chapter-card {
  position: relative;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  cursor: pointer;
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
  overflow: hidden;
  animation: slideUp 0.4s ease-out both;
}

.chapter-card:active {
  transform: scale(0.98);
}

.chapter-card:hover {
  border-color: var(--color-border-light);
  box-shadow: var(--shadow-md);
}

/* 章节卡片左侧装饰条 */
.chapter-card::before {
  content: '';
  position: absolute;
  top: 0.5rem;
  bottom: 0.5rem;
  left: 0;
  width: 0.1875rem;
  background: linear-gradient(180deg, var(--color-gold), var(--color-primary), var(--color-gold-dark));
  border-radius: 0 0.125rem 0.125rem 0;
}

/* 章节卡片底部纹理 */
.chapter-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(218, 165, 32, 0.03) 0%, transparent 40%),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 8px,
      rgba(139, 0, 0, 0.015) 8px,
      rgba(139, 0, 0, 0.015) 16px
    );
  pointer-events: none;
}

.chapter-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
  position: relative;
  z-index: 1;
}

.chapter-card-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--color-gold);
  line-height: 1.3;
}

.chapter-card-stars {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8125rem;
  color: var(--color-gold);
  flex-shrink: 0;
  padding-top: 0.25rem;
}

.chapter-card-stars .star-icon {
  font-size: 0.875rem;
}

.chapter-card-desc {
  font-size: 0.8125rem;
  color: var(--color-text-dim);
  line-height: 1.5;
  margin-bottom: var(--spacing-md);
  position: relative;
  z-index: 1;
}

/* 章节进度条 */
.chapter-progress {
  position: relative;
  z-index: 1;
}

.chapter-progress-bar {
  width: 100%;
  height: 0.375rem;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 0.1875rem;
  overflow: hidden;
  margin-bottom: 0.375rem;
}

.chapter-progress-fill {
  height: 100%;
  border-radius: 0.1875rem;
  background: linear-gradient(90deg, var(--color-primary), var(--color-gold-dark), var(--color-gold));
  transition: width 0.6s ease-out;
  position: relative;
}

/* 进度条光泽 */
.chapter-progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.25), transparent);
  border-radius: 0.1875rem 0.1875rem 0 0;
}

.chapter-progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--color-text-dim);
}

.chapter-progress-text .progress-count {
  color: var(--color-text);
  font-weight: 600;
}

/* 锁定章节 */
.chapter-card.locked {
  cursor: not-allowed;
  opacity: 0.55;
  filter: grayscale(0.6);
}

.chapter-card.locked:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--color-border);
}

.chapter-card.locked:active {
  transform: none;
}

.chapter-card.locked::before {
  background: var(--color-border);
}

.chapter-lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 6, 6, 0.6);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.chapter-lock-icon {
  font-size: 1.75rem;
  margin-bottom: var(--spacing-xs);
  opacity: 0.8;
}

.chapter-lock-text {
  font-size: 0.8125rem;
  color: var(--color-text-dim);
  font-weight: 600;
}

/* ============================================
   关卡地图视图
   ============================================ */
.campaign-stages {
  position: relative;
}

/* 返回按钮 */
.stages-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-dim);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: var(--spacing-md);
}

.stages-back-btn:hover {
  color: var(--color-gold);
  border-color: var(--color-gold-dark);
}

.stages-back-btn:active {
  transform: scale(0.96);
}

.stages-back-arrow {
  font-size: 1rem;
  line-height: 1;
}

/* 章节标题区 */
.stages-chapter-header {
  text-align: center;
  margin-bottom: var(--spacing-lg);
  position: relative;
}

.stages-chapter-title {
  font-family: var(--font-display);
  font-size: 1.625rem;
  color: var(--color-gold);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  margin-bottom: 0.25rem;
}

.stages-chapter-desc {
  font-size: 0.75rem;
  color: var(--color-text-dim);
}

/* 关卡路径网格 */
.stages-path {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: var(--spacing-sm) 0 var(--spacing-lg);
  position: relative;
}

/* 中央连接线 */
.stages-path::before {
  content: '';
  position: absolute;
  top: 2.5rem;
  bottom: 2.5rem;
  left: 50%;
  width: 0.125rem;
  background: repeating-linear-gradient(
    180deg,
    var(--color-border) 0px,
    var(--color-border) 6px,
    transparent 6px,
    transparent 12px
  );
  transform: translateX(-50%);
  z-index: 0;
}

/* 关卡行 - 蛇形排列 */
.stage-row {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  position: relative;
  z-index: 1;
  padding: var(--spacing-sm) 0;
}

/* 奇偶行偏移，形成蛇形路径 */
.stage-row:nth-child(odd) {
  padding-left: 0;
  padding-right: 20%;
}

.stage-row:nth-child(even) {
  padding-left: 20%;
  padding-right: 0;
}

/* 关卡节点 */
.stage-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  cursor: pointer;
  transition: transform var(--transition-fast);
  animation: slideUp 0.35s ease-out both;
}

.stage-node:active {
  transform: scale(0.94);
}

/* 节点圆形主体 */
.stage-node-circle {
  width: 3.75rem;
  height: 3.75rem;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--color-bg-card), var(--color-bg-panel));
  border: 2px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--color-text);
  position: relative;
  transition: all var(--transition-base);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* 节点内部光泽 */
.stage-node-circle::before {
  content: '';
  position: absolute;
  top: 0.1875rem;
  left: 10%;
  right: 10%;
  height: 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent);
  border-radius: 50%;
  pointer-events: none;
}

/* 已完成节点 */
.stage-node.completed .stage-node-circle {
  border-color: var(--color-gold-dark);
  background: linear-gradient(145deg, #2a2418, #1e1a10);
  box-shadow: 0 0 10px rgba(218, 165, 32, 0.15);
}

/* 当前可挑战节点 */
.stage-node.available .stage-node-circle {
  border-color: var(--color-gold);
  animation: borderGlow 2.5s ease-in-out infinite;
}

/* Boss 节点 */
.stage-node.boss .stage-node-circle {
  width: 4.5rem;
  height: 4.5rem;
  border-width: 3px;
  border-color: var(--color-primary-light);
  background: linear-gradient(145deg, #2a1515, #1e0e0e);
  box-shadow: 0 0 16px rgba(139, 0, 0, 0.3), inset 0 0 12px rgba(139, 0, 0, 0.1);
}

.stage-node.boss.completed .stage-node-circle {
  border-color: var(--color-gold);
  box-shadow: 0 0 16px rgba(218, 165, 32, 0.25), inset 0 0 12px rgba(218, 165, 32, 0.05);
}

/* Boss 皇冠标记 */
.stage-boss-crown {
  position: absolute;
  top: -0.625rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1rem;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
  z-index: 2;
}

/* 节点名称 */
.stage-node-name {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--color-text);
  text-align: center;
  max-width: 5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 节点星级 */
.stage-node-stars {
  display: flex;
  gap: 0.0625rem;
  font-size: 0.6875rem;
}

.stage-node-stars .star-filled {
  color: var(--color-gold);
  text-shadow: 0 0 3px rgba(218, 165, 32, 0.4);
}

.stage-node-stars .star-empty {
  color: var(--color-border);
}

/* 体力消耗标签 */
.stage-node-cost {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  font-size: 0.625rem;
  color: var(--color-text-dim);
}

.stage-node-cost .cost-icon {
  font-size: 0.6875rem;
}

/* 锁定节点 */
.stage-node.locked {
  cursor: not-allowed;
  opacity: 0.4;
  filter: grayscale(0.8);
}

.stage-node.locked:active {
  transform: none;
}

.stage-node.locked .stage-node-circle {
  border-color: var(--color-border);
}

.stage-lock-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.25rem;
  z-index: 2;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8));
}

/* ============================================
   关卡详情模态框
   ============================================ */
.stage-detail {
  padding: var(--spacing-sm) 0;
}

.stage-detail-name {
  font-family: var(--font-display);
  font-size: 1.375rem;
  color: var(--color-gold);
  text-align: center;
  margin-bottom: 0.25rem;
}

.stage-detail-desc {
  font-size: 0.8125rem;
  color: var(--color-text-dim);
  text-align: center;
  line-height: 1.6;
  margin-bottom: var(--spacing-md);
}

/* Boss 徽章 */
.stage-detail-boss-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1875rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-primary-light);
  background: rgba(139, 0, 0, 0.15);
  border: 1px solid rgba(139, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  margin-bottom: var(--spacing-md);
}

.stage-detail-boss-badge .boss-crown {
  font-size: 0.875rem;
}

/* 详情信息行 */
.stage-detail-info {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.stage-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem var(--spacing-sm);
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(74, 48, 48, 0.3);
}

.stage-info-label {
  font-size: 0.75rem;
  color: var(--color-text-dim);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.stage-info-label .info-icon {
  font-size: 0.875rem;
}

.stage-info-value {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text);
}

.stage-info-value.power-value {
  color: var(--color-warning);
}

.stage-info-value.stamina-value {
  color: var(--color-success);
}

.stage-info-value.gold-value {
  color: var(--color-gold);
}

.stage-info-value.exp-value {
  color: var(--color-info);
}

/* 奖励预览 */
.stage-detail-rewards {
  margin-bottom: var(--spacing-md);
}

.stage-rewards-title {
  font-size: 0.75rem;
  color: var(--color-text-dim);
  margin-bottom: var(--spacing-sm);
  text-align: center;
}

.stage-rewards-grid {
  display: flex;
  justify-content: center;
  gap: var(--spacing-lg);
}

.stage-reward-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.stage-reward-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.stage-reward-amount {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text);
}

/* 星级记录 */
.stage-detail-stars {
  text-align: center;
  margin-bottom: var(--spacing-sm);
}

.stage-detail-stars .star-display {
  font-size: 1.375rem;
}

/* 体力不足提示 */
.stamina-warning {
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-danger);
  margin-top: var(--spacing-xs);
  animation: breathe 2s ease-in-out infinite;
}

/* ============================================
   连接线装饰
   ============================================ */
.stage-connector {
  width: 0.125rem;
  height: 1.25rem;
  background: var(--color-border);
  margin: 0 auto;
  position: relative;
  z-index: 0;
}

.stage-connector.completed {
  background: var(--color-gold-dark);
  box-shadow: 0 0 4px rgba(218, 165, 32, 0.2);
}

/* ============================================
   交错动画延迟
   ============================================ */
.chapter-card:nth-child(1) { animation-delay: 0.05s; }
.chapter-card:nth-child(2) { animation-delay: 0.1s; }
.chapter-card:nth-child(3) { animation-delay: 0.15s; }
.chapter-card:nth-child(4) { animation-delay: 0.2s; }
.chapter-card:nth-child(5) { animation-delay: 0.25s; }
.chapter-card:nth-child(6) { animation-delay: 0.3s; }
.chapter-card:nth-child(7) { animation-delay: 0.35s; }
.chapter-card:nth-child(8) { animation-delay: 0.4s; }

.stage-node:nth-child(1) { animation-delay: 0.05s; }
.stage-node:nth-child(2) { animation-delay: 0.12s; }
.stage-node:nth-child(3) { animation-delay: 0.19s; }
.stage-node:nth-child(4) { animation-delay: 0.26s; }
.stage-node:nth-child(5) { animation-delay: 0.33s; }
.stage-node:nth-child(6) { animation-delay: 0.4s; }
.stage-node:nth-child(7) { animation-delay: 0.47s; }
.stage-node:nth-child(8) { animation-delay: 0.54s; }

/* ============================================
   空状态
   ============================================ */
.campaign-empty {
  text-align: center;
  padding: var(--spacing-xl) var(--spacing-md);
}

.campaign-empty-icon {
  font-size: 3.5rem;
  margin-bottom: var(--spacing-md);
  opacity: 0.4;
}

.campaign-empty-text {
  font-size: 0.875rem;
  color: var(--color-text-dim);
}


/* ============================================
   章节背景图标
   ============================================ */
.chapter-card-bg {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.chapter-card-icon {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3.5rem;
  opacity: 0.15;
  filter: grayscale(0.3);
  pointer-events: none;
  line-height: 1;
}
