/* ============================================================================
 * demo-chart.css — 「基础知识 / 专业术语」双页共享的示例命盘样式
 * 结构与 quickread.html 的回字命盘逐行一致 (720px 坐标系, 等比缩放由页面 JS 驱动),
 * 外加术语条目驱动的星曜列高亮 (.hl-col)。
 * ============================================================================ */

/* 自适应容器 — 命盘内部保持 720px 坐标系, 等比缩放至容器宽 */
.qr-chart { text-align: center; }
.qr-chart__caption {
  margin-top: 0.7rem;
  font-family: "Noto Serif SC", serif;
  font-size: 0.82rem; letter-spacing: 0.14em;
  color: rgba(232, 213, 176, 0.75);
}
.qr-chart__caption em { font-style: normal; color: var(--gold-300, #E8D5B0); }

.qr-chart-frame {
  --qr-chart-scale: 0.78;
  width: 100%;
  max-width: 562px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  position: relative;
}
.qr-chart-frame .chart-scale {
  position: absolute; top: 0; left: 0;
  width: 720px; height: 720px;
  transform: scale(var(--qr-chart-scale));
  transform-origin: top left;
}

.chart-wrap {
  width: 720px; height: 720px; position: relative; display: grid;
  grid-template-columns: repeat(4, 180px); grid-template-rows: repeat(4, 180px);
  background: radial-gradient(ellipse at 30% 20%, rgba(91, 42, 134, 0.35) 0%, transparent 55%), radial-gradient(ellipse at 70% 80%, rgba(124, 58, 237, 0.25) 0%, transparent 55%), linear-gradient(135deg, rgba(20, 16, 31, 0.95) 0%, rgba(31, 14, 54, 0.92) 100%);
  border-radius: 6px; box-shadow: inset 0 0 0 1.5px rgba(167, 139, 250, 0.40), 0 4px 24px rgba(0, 0, 0, 0.45), 0 0 80px rgba(139, 92, 246, 0.20), inset 0 0 40px rgba(139, 92, 246, 0.08);
  overflow: hidden;
}
.chart-svg { position: absolute; inset: 0; pointer-events: none; width: 100%; height: 100%; z-index: 10; }
.trinity-line { stroke: rgba(232, 213, 176, 0.55); stroke-width: 0.9; stroke-dasharray: 4 3; fill: none; pointer-events: none; }
.trinity-line--sihua { stroke: rgba(232, 184, 109, 0.8); stroke-width: 1.2; }

/* 宫位单元 */
.palace {
  box-sizing: border-box; border: 1px solid rgba(139, 92, 246, 0.22); padding: 6px; background: transparent;
  display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
  transition: border-color 0.4s ease, background-color 0.4s ease, transform 0.4s ease, box-shadow 0.4s ease;
}
.palace:hover { border-color: rgba(232, 213, 176, 0.55); background: rgba(139, 92, 246, 0.08); }

/* 宫位位置映射表 */
.p-si   { grid-column: 1; grid-row: 1; }
.p-wu   { grid-column: 2; grid-row: 1; }
.p-wei  { grid-column: 3; grid-row: 1; }
.p-shen { grid-column: 4; grid-row: 1; }
.p-you  { grid-column: 4; grid-row: 2; }
.p-xu   { grid-column: 4; grid-row: 3; }
.p-hai  { grid-column: 4; grid-row: 4; }
.p-zi   { grid-column: 3; grid-row: 4; }
.p-chou { grid-column: 2; grid-row: 4; }
.p-yin  { grid-column: 1; grid-row: 4; }
.p-mao  { grid-column: 1; grid-row: 3; }
.p-chen { grid-column: 1; grid-row: 2; }

/* 状态高亮与选择 */
.palace.is-selected { border-color: var(--gold-300, #E8D5B0); background: rgba(232, 184, 109, 0.22); box-shadow: inset 0 0 22px rgba(232, 184, 109, 0.32), 0 0 24px rgba(232, 184, 109, 0.65); animation: palace-selected-pulse 2.4s ease-in-out infinite; }
.palace.is-related { border-color: rgba(232, 213, 176, 0.55); background: rgba(232, 184, 109, 0.06); box-shadow: inset 0 0 10px rgba(232, 184, 109, 0.08); }
@keyframes palace-selected-pulse { 0%, 100% { box-shadow: inset 0 0 22px rgba(232, 184, 109, 0.32), 0 0 24px rgba(232, 184, 109, 0.65); } 50% { box-shadow: inset 0 0 28px rgba(232, 184, 109, 0.45), 0 0 32px rgba(232, 184, 109, 0.85); } }

.body-tag { position: absolute; top: 10px; right: 6px; border: 1px solid rgba(255, 255, 255, 0.38); color: rgba(255, 255, 255, 0.82); font-size: 9px; font-weight: bold; padding: 2px 1px; border-radius: 3px; line-height: 1.1; width: 14px; text-align: center; background: rgba(20, 16, 31, 0.75); }

/* 星曜内部排版体系 — 星曜/亮度一律白, 金色只留给术语高亮 */
.stars-container { display: flex; justify-content: flex-start; gap: 6px; height: 82px; }
.star-column { display: flex; flex-direction: column; align-items: center; width: 15px; line-height: 1.05; }
.star-column .name-main { font-size: 16px; font-weight: bold; color: #FFFFFF; text-shadow: 0 0 6px rgba(255, 255, 255, 0.28); }
.star-column .name-aux { font-size: 12.5px; font-weight: bold; color: rgba(255, 255, 255, 0.92); }
.star-column .name-mini { font-size: 9.5px; font-weight: normal; color: rgba(255, 255, 255, 0.78); }
.star-column .status { font-size: 9px; color: rgba(255, 255, 255, 0.55); margin-top: 2px; }

.seal-container { display: flex; gap: 3px; min-height: 14px; margin-top: -2px; }
.seal-block { width: 14px; height: 14px; font-size: 9.5px; font-weight: bold; color: var(--amethyst-50, #F5F0FF); background: linear-gradient(135deg, var(--amethyst-500, #8B5CF6) 0%, var(--amethyst-700, #5B2A86) 100%); display: flex; align-items: center; justify-content: center; border-radius: 2px; box-shadow: 0 0 8px rgba(139, 92, 246, 0.45); }

.middle-container { display: flex; justify-content: space-between; align-items: center; font-size: 9px; color: var(--amethyst-300, #B894F5); line-height: 1.15; }
.middle-container .left-deities { text-align: left; transform: scale(0.95); }
.middle-container .right-deities { text-align: right; transform: scale(0.95); }
.middle-container .age-range { font-size: 12px; font-weight: bold; color: var(--amethyst-50, #F5F0FF); }

.time-container { text-align: center; font-size: 8.5px; color: var(--amethyst-400, #9F7AEA); line-height: 1.25; margin-top: 1px; }

.bottom-container { display: flex; justify-content: space-between; align-items: flex-end; position: relative; font-size: 10px; }
.bottom-container .life-stage { font-size: 10.5px; color: var(--amethyst-200, #D4BAFE); }
.bottom-container .gan-zhi { font-size: 11px; font-weight: 500; color: var(--amethyst-50, #F5F0FF); }
.bottom-container .palace-name { position: absolute; left: 50%; transform: translateX(-50%); color: #FFFFFF; font-weight: bold; font-size: 14px; }

/* 中宫控制面板 */
.center-panel {
  grid-column: 2 / span 2; grid-row: 2 / span 2; border: 0.5px solid rgba(167, 139, 250, 0.30); padding: 24px;
  display: flex; flex-direction: column; justify-content: space-between; background: radial-gradient(ellipse at center, rgba(31, 14, 54, 0.85) 0%, rgba(12, 9, 22, 0.95) 100%);
  z-index: 5; border-radius: 12px; margin: 6px; box-shadow: 0 0 30px rgba(139, 92, 246, 0.20), inset 0 0 20px rgba(139, 92, 246, 0.06);
}
.center-panel .brand-area { text-align: center; }
.center-panel .brand-area .title { color: #FFFFFF; text-shadow: 0 0 10px rgba(255, 255, 255, 0.18); font-size: 20px; font-weight: bold; letter-spacing: 2px; }
.center-panel .data-area { display: flex; flex-direction: column; gap: 14px; padding: 16px 0; }
.center-panel .data-line { display: flex; justify-content: space-between; align-items: center; font-size: 14px; border-bottom: 1px dashed rgba(139, 92, 246, 0.25); padding-bottom: 8px; }
.center-panel .data-flex { display: flex; justify-content: space-between; width: 100%; font-size: 13px; }
.center-panel .bold-val { font-weight: bold; color: var(--amethyst-50, #F5F0FF); }
.center-panel .label-grey { color: var(--amethyst-300, #B894F5); }
.center-panel .footer-area { border-top: 0.5px solid rgba(139, 92, 246, 0.25); padding-top: 10px; display: flex; justify-content: center; gap: 10px; font-size: 11px; }
.center-panel .footer-area .arrow-indicator { color: var(--amethyst-300, #B894F5); font-weight: bold; }

/* ==== 术语高亮 — 金色光晕呼吸 + 文字胀缩 (与 quickread 步骤高亮同款) ==== */
.palace .name-main, .palace .name-aux, .palace .name-mini,
.palace .status, .seal-block, .arrow-indicator {
  transition: color 0.35s ease, text-shadow 0.35s ease,
              box-shadow 0.35s ease, border-color 0.35s ease, transform 0.35s ease;
}
@keyframes hl-text-breathe {
  0%, 100% { text-shadow: 0 0 5px rgba(232, 184, 109, 0.40); }
  50%      { text-shadow: 0 0 12px rgba(232, 184, 109, 0.95), 0 0 24px rgba(232, 184, 109, 0.45); }
}
@keyframes hl-box-breathe {
  0%, 100% { box-shadow: 0 0 6px rgba(232, 184, 109, 0.40); }
  50%      { box-shadow: 0 0 16px rgba(232, 184, 109, 0.95), 0 0 28px rgba(232, 184, 109, 0.45); }
}
@keyframes hl-pump {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.3); }
}
@keyframes hl-pump-center {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50%      { transform: translateX(-50%) scale(1.3); }
}
/* 星曜列高亮 — 主/辅/杂三级错峰呼吸 + 胀缩 */
.star-column.hl-col .name-main { color: #FFF6E3; animation: hl-text-breathe 2.2s ease-in-out infinite, hl-pump 2.2s ease-in-out infinite; }
.star-column.hl-col .name-aux  { color: #FFF6E3; animation: hl-text-breathe 2.2s ease-in-out 0.25s infinite, hl-pump 2.2s ease-in-out 0.25s infinite; }
.star-column.hl-col .name-mini { color: var(--gold-300, #E8D5B0); animation: hl-text-breathe 2.2s ease-in-out 0.5s infinite, hl-pump 2.2s ease-in-out 0.5s infinite; }
.star-column.hl-col .status { font-weight: bold; color: #FFF6E3; animation: hl-text-breathe 2.2s ease-in-out infinite, hl-pump 2.2s ease-in-out infinite; }
/* 长生栏阶段高亮 (沐浴 等, 非星曜列) — inline-block 令 transform 生效 */
.right-deities .stage-tag.hl-stage {
  display: inline-block; font-weight: bold; color: #FFF6E3;
  animation: hl-text-breathe 2.2s ease-in-out infinite, hl-pump 2.2s ease-in-out infinite;
}
/* 四化印章 + 中宫箭头 */
.seal-block.hl-seal {
  color: #FFF6E3;
  border: 1px solid var(--gold-300, #E8D5B0);
  background: linear-gradient(135deg, rgba(232, 184, 109, 0.35) 0%, rgba(124, 58, 237, 0.65) 100%);
  animation: hl-box-breathe 2.2s ease-in-out infinite, hl-pump 2.2s ease-in-out infinite;
}
.arrow-indicator.hl-arrow { color: var(--gold-300, #E8D5B0); animation: hl-text-breathe 2.2s ease-in-out infinite, hl-pump 2.2s ease-in-out infinite; }
/* 宫名高亮 (居中定位, 保留 translateX(-50%)) */
.bottom-container .palace-name.hl-pname {
  color: #FFF6E3;
  animation: hl-text-breathe 2.2s ease-in-out infinite, hl-pump-center 2.2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .palace, .palace .name-main, .palace .name-aux, .palace .name-mini,
  .palace .status, .seal-block, .arrow-indicator, .palace .palace-name {
    transition: none !important; animation: none !important;
  }
}
