/* ============================================
 * 观鼎山首页 · 九宫格样式 grid.css
 * 板块：九宫格
 * 布局：3×3 后天洛书 · 卦符 · 颜色指纹
 * ============================================ */

/* ---------- 九宫格容器 ---------- */
.gds-palace {
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  position: relative;
}

.gds-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: var(--gap);
  padding: var(--pad);
  aspect-ratio: 1;
  position: relative;
}

/* ---------- 单宫基础 ---------- */
.gds-cell {
  --gds-cell-radius: var(--radius);
  --gds-cell-color: var(--border-dark);

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
  border-radius: var(--gds-cell-radius);
  border: 1.5px solid var(--gds-cell-color);
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

/* ---------- 卦符 ---------- */
.gds-cell-gua {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--gds-cell-color);
  text-shadow:
    0 0 12px color-mix(in srgb, var(--gds-cell-color) 50%, transparent),
    0 0 24px color-mix(in srgb, var(--gds-cell-color) 30%, transparent);
  transition: text-shadow var(--transition), transform var(--transition);
}

/* ---------- 图标 ---------- */
.gds-cell-icon {
  font-size: 1.6rem;
  line-height: 1;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--gds-cell-color) 40%, transparent));
}

/* ---------- 名称 ---------- */
.gds-cell-name {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #e8edf5;
  opacity: 0.95;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.5), 0 0 16px rgba(0, 0, 0, 0.3);
  transition: color var(--transition), text-shadow var(--transition);
}

/* ---------- 序号（角落）---------- */
.gds-cell-num {
  position: absolute;
  top: 8px;
  right: 10px;
  font-family: var(--font-serif);
  font-size: 0.7rem;
  font-weight: 400;
  color: #8ab4d6;
  opacity: 0.85;
  text-shadow: 0 0 6px rgba(138, 180, 214, 0.15);
  transition: color var(--transition), opacity var(--transition);
}

/* ---------- 内容预览区 ---------- */
.gds-cell-preview {
  font-family: var(--font-sans);
  font-size: 0.6rem;
  font-weight: 400;
  line-height: 1.2;
  color: var(--text);
  opacity: 0.45;
  text-align: center;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity var(--transition);
}

/* 中宫"五" */
.gds-cell--center .gds-cell-num {
  color: #D4A843;
  opacity: 0.7;
}

/* ---------- 先天数（左上角） ---------- */
.gds-cell-innate {
  position: absolute;
  top: 8px;
  left: 10px;
  font-family: var(--font-serif);
  font-size: 0.7rem;
  font-weight: 400;
  color: #8ab4d6;
  opacity: 0.85;
  text-shadow: 0 0 6px rgba(138, 180, 214, 0.15);
  transition: color var(--transition), opacity var(--transition);
}

/* ---------- 九宫颜色指纹（每宫独立边框+底色+光晕） ---------- */

/* 巽4 古数学 蓝 */
.gds-cell--xun {
  --gds-cell-color: var(--c-xun);
  background: linear-gradient(135deg, rgba(74, 144, 217, 0.08), rgba(74, 144, 217, 0.02));
  box-shadow: inset 0 0 20px rgba(74, 144, 217, 0.05);
}

/* 离9 好运来 金 */
.gds-cell--li {
  --gds-cell-color: var(--c-li);
  background: linear-gradient(135deg, rgba(212, 168, 67, 0.08), rgba(212, 168, 67, 0.02));
  box-shadow: inset 0 0 20px rgba(212, 168, 67, 0.05);
}

/* 坤2 双同源 绿 */
.gds-cell--kun {
  --gds-cell-color: var(--c-kun);
  background: linear-gradient(135deg, rgba(91, 174, 110, 0.08), rgba(91, 174, 110, 0.02));
  box-shadow: inset 0 0 20px rgba(91, 174, 110, 0.05);
}

/* 震3 观鼎历 青 */
.gds-cell--zhen {
  --gds-cell-color: var(--c-zhen);
  background: linear-gradient(135deg, rgba(69, 181, 170, 0.08), rgba(69, 181, 170, 0.02));
  box-shadow: inset 0 0 20px rgba(69, 181, 170, 0.05);
}

/* 兑7 养生道 橙 */
.gds-cell--dui {
  --gds-cell-color: var(--c-dui);
  background: linear-gradient(135deg, rgba(232, 145, 79, 0.08), rgba(232, 145, 79, 0.02));
  box-shadow: inset 0 0 20px rgba(232, 145, 79, 0.05);
}

/* 艮8 玄机盘 紫 */
.gds-cell--gen {
  --gds-cell-color: var(--c-gen);
  background: linear-gradient(135deg, rgba(123, 97, 165, 0.08), rgba(123, 97, 165, 0.02));
  box-shadow: inset 0 0 20px rgba(123, 97, 165, 0.05);
}

/* 坎1 择风水 棕 */
.gds-cell--kan {
  --gds-cell-color: var(--c-kan);
  background: linear-gradient(135deg, rgba(139, 107, 74, 0.08), rgba(139, 107, 74, 0.02));
  box-shadow: inset 0 0 20px rgba(139, 107, 74, 0.05);
}

/* 乾6 鼎商城 红 */
.gds-cell--qian {
  --gds-cell-color: var(--c-qian);
  background: linear-gradient(135deg, rgba(200, 80, 67, 0.08), rgba(200, 80, 67, 0.02));
  box-shadow: inset 0 0 20px rgba(200, 80, 67, 0.05);
}

/* ---------- 中宫（观鼎山 · 特殊处理） ---------- */
.gds-cell--center {
  --gds-cell-color: var(--c-li);
  background:
    radial-gradient(circle at center, rgba(212, 168, 67, 0.12) 0%, rgba(139, 105, 20, 0.04) 60%, transparent 100%);
  border-width: 2px;
  border-color: rgba(212, 168, 67, 0.6);
  box-shadow:
    inset 0 0 30px rgba(212, 168, 67, 0.08),
    0 0 20px rgba(212, 168, 67, 0.1);
}

.gds-center-gua {
  font-size: 3rem;
  color: #D4A843;
  text-shadow:
    0 0 16px rgba(212, 168, 67, 0.5),
    0 0 32px rgba(212, 168, 67, 0.3);
  animation: gds-center-breath 4s ease-in-out infinite;
}

@keyframes gds-center-breath {
  0%, 100% {
    text-shadow: 0 0 16px rgba(212, 168, 67, 0.5), 0 0 32px rgba(212, 168, 67, 0.3);
  }
  50% {
    text-shadow: 0 0 24px rgba(212, 168, 67, 0.7), 0 0 48px rgba(212, 168, 67, 0.4);
  }
}

.gds-center-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #D4A843;
  opacity: 1;
}

/* ---------- 中宫鼎字印（金银铜光晕） ---------- */
.gds-center-seal {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  transition: text-shadow var(--transition), transform var(--transition);
}

/* 金级（主推） */
.gds-center-seal[data-seal-level="gold"] {
  color: #D4A843;
  text-shadow:
    0 0 12px rgba(212, 168, 67, 0.6),
    0 0 24px rgba(212, 168, 67, 0.4),
    0 0 48px rgba(212, 168, 67, 0.2);
  animation: gds-seal-gold-glow 3s ease-in-out infinite;
}

@keyframes gds-seal-gold-glow {
  0%, 100% {
    text-shadow:
      0 0 12px rgba(212, 168, 67, 0.6),
      0 0 24px rgba(212, 168, 67, 0.4),
      0 0 48px rgba(212, 168, 67, 0.2);
  }
  50% {
    text-shadow:
      0 0 20px rgba(212, 168, 67, 0.8),
      0 0 40px rgba(212, 168, 67, 0.5),
      0 0 60px rgba(212, 168, 67, 0.3);
  }
}

/* 银级 */
.gds-center-seal[data-seal-level="silver"] {
  color: #C0C8D8;
  text-shadow:
    0 0 12px rgba(192, 200, 216, 0.5),
    0 0 24px rgba(192, 200, 216, 0.3),
    0 0 48px rgba(192, 200, 216, 0.15);
  animation: gds-seal-silver-glow 3s ease-in-out infinite;
}

@keyframes gds-seal-silver-glow {
  0%, 100% {
    text-shadow:
      0 0 12px rgba(192, 200, 216, 0.5),
      0 0 24px rgba(192, 200, 216, 0.3),
      0 0 48px rgba(192, 200, 216, 0.15);
  }
  50% {
    text-shadow:
      0 0 20px rgba(192, 200, 216, 0.7),
      0 0 40px rgba(192, 200, 216, 0.4),
      0 0 60px rgba(192, 200, 216, 0.2);
  }
}

/* 铜级 */
.gds-center-seal[data-seal-level="bronze"] {
  color: #CD7F4B;
  text-shadow:
    0 0 12px rgba(205, 127, 75, 0.5),
    0 0 24px rgba(205, 127, 75, 0.3),
    0 0 48px rgba(205, 127, 75, 0.15);
  animation: gds-seal-bronze-glow 3s ease-in-out infinite;
}

@keyframes gds-seal-bronze-glow {
  0%, 100% {
    text-shadow:
      0 0 12px rgba(205, 127, 75, 0.5),
      0 0 24px rgba(205, 127, 75, 0.3),
      0 0 48px rgba(205, 127, 75, 0.15);
  }
  50% {
    text-shadow:
      0 0 20px rgba(205, 127, 75, 0.7),
      0 0 40px rgba(205, 127, 75, 0.4),
      0 0 60px rgba(205, 127, 75, 0.2);
  }
}

/* ---------- 响应式 ---------- */
@media (max-width: 480px) {
  .gds-grid {
    gap: 8px;
    padding: 6px;
  }
  .gds-cell-gua {
    font-size: 1.8rem;
  }
  .gds-cell-icon {
    font-size: 1.3rem;
  }
  .gds-cell-name {
    font-size: 0.82rem;
  }
  .gds-cell-num {
    font-size: 0.62rem;
    top: 5px;
    right: 7px;
  }
  .gds-center-gua {
    font-size: 2.4rem;
  }
  .gds-center-seal {
    font-size: 1.8rem;
  }
}

/* ---------- 单宫R角/直角切换 ---------- */
/* 外宫直角模式（中宫始终圆角） */
.gds-palace--square .gds-cell:not(.gds-cell--center) {
  --gds-cell-radius: 0;
  border-radius: 0;
}