/* 奇门遁甲 · 九宫格四盘 - 深色星象风格 */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body, #root {
  width: 100%;
  height: 100%;
  overflow: hidden;
  /* 标准中文字体栈 - 系统字体优先 */
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Heiti SC", "WenQuanYi Micro Hei", sans-serif;
  color: #d4d8e0;
  background: #04060d;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* 衬线字体专用类 - 用于盘面主要汉字 */
.serif {
  font-family: "Songti SC", "STSong", "SimSun", "Source Han Serif SC", "Noto Serif CJK SC", serif;
}

body {
  background:
    radial-gradient(ellipse at 30% 20%, rgba(40, 60, 110, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 80%, rgba(80, 50, 110, 0.16) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(20, 30, 60, 0.4) 0%, #04060d 70%);
}

/* 星点背景 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 70% 80%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 40% 60%, rgba(255,255,255,0.4), transparent),
    radial-gradient(2px 2px at 90% 20%, rgba(220,200,255,0.5), transparent),
    radial-gradient(1px 1px at 15% 85%, rgba(200,220,255,0.6), transparent),
    radial-gradient(1px 1px at 55% 15%, rgba(255,240,220,0.4), transparent),
    radial-gradient(2px 2px at 85% 50%, rgba(180,200,255,0.4), transparent),
    radial-gradient(1px 1px at 30% 70%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 65% 35%, rgba(255,255,255,0.4), transparent);
  pointer-events: none;
  opacity: 0.6;
  animation: twinkle 6s ease-in-out infinite;
}

/* 流动光晕雾气 */
body::after {
  content: '';
  position: fixed;
  inset: -20%;
  background:
    radial-gradient(circle at 20% 30%, rgba(74, 143, 199, 0.08) 0%, transparent 30%),
    radial-gradient(circle at 80% 70%, rgba(232, 81, 76, 0.06) 0%, transparent 35%),
    radial-gradient(circle at 50% 50%, rgba(212, 192, 138, 0.05) 0%, transparent 40%);
  pointer-events: none;
  animation: nebula 24s ease-in-out infinite;
  z-index: 0;
}

@keyframes nebula {
  0%, 100% { transform: rotate(0deg) scale(1); }
  33% { transform: rotate(120deg) scale(1.1); }
  66% { transform: rotate(240deg) scale(0.95); }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

.app {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  --board-size: min(94vw, calc(100dvh - 128px), 1040px);
  --grid-inset: 5%;
  --grid-gap: clamp(4px, 0.75vmin, 7px);
}

/* ============ 顶部信息栏 ============ */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  background: linear-gradient(180deg, rgba(10, 14, 30, 0.92) 0%, rgba(10, 14, 30, 0.6) 100%);
  border-bottom: 1px solid rgba(212, 192, 138, 0.12);
  backdrop-filter: blur(12px);
  z-index: 10;
}

.title-zone {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.title-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.home-entry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid rgba(212, 192, 138, 0.18);
  border-radius: 2px;
  color: #8a96b8;
  background: rgba(255, 255, 255, 0.025);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 0.18em;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.home-entry:hover,
.home-entry.primary {
  color: #ecd6a4;
  border-color: rgba(232, 207, 133, 0.42);
  background: rgba(232, 207, 133, 0.08);
}

.logo {
  font-size: 24px;
  font-weight: 600;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  color: #ecd6a4;
  letter-spacing: 0.4em;
  text-shadow: 0 0 14px rgba(232, 207, 133, 0.25);
  padding-right: 0.3em;
}

.subtitle {
  font-size: 11px;
  color: #6a7595;
  letter-spacing: 0.35em;
  font-weight: 400;
}

.info-zone {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px 14px;
  min-width: 0;
}

.info-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 48px;
}

.info-label {
  font-size: 10px;
  color: #6a7595;
  letter-spacing: 0.25em;
  font-weight: 400;
}

.info-value {
  font-size: 14px;
  color: #e0e4ec;
  font-weight: 500;
  letter-spacing: 0.05em;
}

.info-value.mono {
  font-family: "Songti SC", "STSong", serif;
  font-size: 16px;
  font-weight: 600;
}

.info-value.accent {
  color: #ecd6a4;
}

.info-sep {
  width: 1px;
  height: 28px;
  background: linear-gradient(180deg, transparent, rgba(212, 192, 138, 0.2), transparent);
}

/* ============ 主体 ============ */
.main {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

/* ============ 背景太极图 - 徐徐转动若隐若现 ============ */
.taiji-bg {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(112vh, 112vw);
  height: min(112vh, 112vw);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
  animation: taijiSpin 90s linear infinite, taijiBreath 12s ease-in-out infinite;
  filter: blur(0.5px);
  mix-blend-mode: screen;
}

.taiji-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 30px rgba(232, 207, 133, 0.12)) drop-shadow(0 0 60px rgba(74, 143, 199, 0.08));
}

@keyframes taijiSpin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 透明度呼吸 - 通过包裹元素或单独动画 */
@keyframes taijiBreath {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.7; }
}

.disc-wrap {
  position: relative;
  z-index: 1;
  width: var(--board-size);
  height: var(--board-size);
  max-width: calc(100vw - 32px);
  max-height: 100%;
  aspect-ratio: 1 / 1;
  display: block;
  flex: 0 0 auto;
}

.disc-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.disc-bg {
  position: absolute;
  inset: -4%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle, rgba(80, 100, 180, 0.10) 0%, rgba(20, 30, 60, 0.05) 40%, transparent 70%);
  border-radius: 50%;
  animation: bgPulse 8s ease-in-out infinite;
}

@keyframes bgPulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.05); opacity: 1; }
}

@keyframes ringspin {
  to { transform: rotate(360deg); }
}
@keyframes ringspin-rev {
  to { transform: rotate(-360deg); }
}

/* ============ 九宫格 ============ */
.grid-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}

.grid-9 {
  position: absolute;
  inset: var(--grid-inset);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  gap: var(--grid-gap);
  padding: var(--grid-gap);
  background: linear-gradient(135deg, rgba(212, 192, 138, 0.08), rgba(212, 192, 138, 0.02));
  border: 1px solid rgba(212, 192, 138, 0.2);
  border-radius: 6px;
  box-shadow:
    0 0 60px rgba(80, 100, 180, 0.10),
    0 0 100px rgba(212, 192, 138, 0.06),
    inset 0 0 30px rgba(0, 0, 0, 0.25);
  z-index: 2;
}

.grid-9::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 7px;
  background: linear-gradient(135deg,
    rgba(232, 207, 133, 0.3),
    transparent 25%,
    transparent 75%,
    rgba(232, 207, 133, 0.3)
  );
  z-index: -1;
  animation: gridBorderShimmer 8s linear infinite;
}

@keyframes gridBorderShimmer {
  0% { background: linear-gradient(135deg, rgba(232,207,133,0.4), transparent 25%, transparent 75%, rgba(232,207,133,0.4)); }
  50% { background: linear-gradient(315deg, rgba(74,143,199,0.4), transparent 25%, transparent 75%, rgba(74,143,199,0.4)); }
  100% { background: linear-gradient(135deg, rgba(232,207,133,0.4), transparent 25%, transparent 75%, rgba(232,207,133,0.4)); }
}

/* 八卦字符外环 */
.bagua-ring {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.bagua-glyph {
  position: absolute;
  font-size: 36px;
  color: rgba(232, 207, 133, 0.65);
  text-shadow: 0 0 16px rgba(232, 207, 133, 0.85), 0 0 32px rgba(232, 207, 133, 0.4);
  transform: translate(-50%, -50%);
  animation: glyphPulse 4s ease-in-out infinite;
  font-family: "Songti SC", "STSong", serif;
  user-select: none;
  filter: drop-shadow(0 0 6px rgba(232, 207, 133, 0.5));
}

@keyframes glyphPulse {
  0%, 100% { opacity: 0.5; text-shadow: 0 0 10px rgba(232, 207, 133, 0.5); }
  50% { opacity: 1; text-shadow: 0 0 24px rgba(232, 207, 133, 1), 0 0 40px rgba(232, 207, 133, 0.4); }
}

/* 粒子 */
.particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.particle {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #ecd6a4;
  box-shadow: 0 0 8px #ecd6a4, 0 0 16px rgba(232,207,133,0.6);
  opacity: 0;
}

.is-rotating .particle {
  animation: particleFloat 1.6s ease-out forwards;
  animation-delay: var(--delay);
}

@keyframes particleFloat {
  0% { opacity: 0; transform: translateY(20px) scale(0.4); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-60px) scale(1.2); }
}

/* 旋转触发时整个网格的辉光增强 */
.is-rotating .grid-9 {
  animation: gridFlash 1.4s ease-out;
}

@keyframes gridFlash {
  0% { box-shadow: 0 0 60px rgba(80,100,180,0.18), 0 0 120px rgba(212,192,138,0.12), inset 0 0 40px rgba(0,0,0,0.5); }
  30% { box-shadow: 0 0 80px rgba(232,207,133,0.6), 0 0 160px rgba(232,207,133,0.4), inset 0 0 60px rgba(232,207,133,0.15); }
  100% { box-shadow: 0 0 60px rgba(80,100,180,0.18), 0 0 120px rgba(212,192,138,0.12), inset 0 0 40px rgba(0,0,0,0.5); }
}

.cell {
  position: relative;
  background:
    linear-gradient(180deg, rgba(15, 20, 38, 0.40) 0%, rgba(8, 12, 26, 0.55) 100%);
  border: 1px solid rgba(212, 192, 138, 0.10);
  border-radius: 4px;
  padding: 12px 8px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s, background 0.3s;
  isolation: isolate;
  min-width: 0;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.cell::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at var(--mx, 50%) var(--my, 50%), var(--wx-color, transparent) 0%, transparent 50%);
  opacity: 0.08;
  pointer-events: none;
  transition: opacity 0.4s;
  z-index: 0;
}

/* 流光扫过 - shimmer */
.cell::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 35%,
    rgba(255, 255, 255, 0.06) 50%,
    transparent 65%
  );
  transform: translateX(-100%);
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  z-index: 1;
}

.anno-tip {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed rgba(212, 192, 138, 0.18);
  font-size: 11px;
  color: #6a7595;
  letter-spacing: 0.05em;
  font-style: italic;
}

.cell:hover {
  border-color: var(--wx-color, rgba(212, 192, 138, 0.5));
  box-shadow:
    0 0 24px rgba(0, 0, 0, 0.6),
    0 0 32px var(--wx-color, rgba(212, 192, 138, 0.2)),
    inset 0 0 24px rgba(212, 192, 138, 0.04);
  transform: translateY(-2px);
}

.cell:hover::before {
  opacity: 0.15;
}

.cell:hover::after {
  transform: translateX(100%);
}

/* 五行水印 - 大号背景文字 */
.palace-wx {
  position: absolute;
  right: 8px;
  bottom: 4px;
  font-size: 38px;
  font-family: "Songti SC", "STSong", serif;
  font-weight: 700;
  opacity: 0.06;
  pointer-events: none;
  user-select: none;
  line-height: 1;
}

/* 宫位标签 - 左上角 */
.palace-tag {
  position: absolute;
  top: 6px;
  left: 8px;
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: "Songti SC", "STSong", serif;
  pointer-events: none;
  z-index: 2;
}

.pt-name {
  font-size: 14px;
  color: #ecd6a4;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.pt-num {
  font-size: 11px;
  color: #8a96b8;
  font-weight: 500;
}

.pt-dir {
  font-size: 10px;
  color: #6a7595;
  letter-spacing: 0.1em;
  margin-left: 2px;
}

.palace-marks {
  position: absolute;
  top: 6px;
  right: 8px;
  display: flex;
  gap: 4px;
  z-index: 3;
  pointer-events: none;
}

.mini-mark {
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  border: 1px solid rgba(212, 192, 138, 0.25);
  background: rgba(10, 14, 28, 0.72);
}

.mark-empty {
  color: #e8514c;
  border-color: rgba(232, 81, 76, 0.45);
  box-shadow: 0 0 10px rgba(232, 81, 76, 0.18);
}

.mark-yima {
  color: #8ab7e8;
  border-color: rgba(74, 143, 199, 0.45);
  box-shadow: 0 0 10px rgba(74, 143, 199, 0.18);
}

/* ============ 行 - 四盘的四个层级 ============ */
.row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 22px;
  position: relative;
  z-index: 2;
}

.row-shen { margin-top: 12px; }
.row-sky { gap: 4px; }
.row-earth { margin-bottom: 0; }

/* ============ 神盘 - 八神 (顶部, 较小) ============ */
.chip-shen {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: "Songti SC", "STSong", serif;
  font-size: 14px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(212, 192, 138, 0.12);
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.chip-shen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,0.15) 50%, transparent 65%);
  transform: translateX(-100%);
  transition: transform 0.6s;
}

.chip-shen .chip-tag {
  font-size: 9px;
  color: #6a7595;
  letter-spacing: 0.2em;
  font-weight: 400;
}

.chip-shen .chip-text {
  letter-spacing: 0.05em;
  text-shadow: 0 0 8px currentColor;
}

.chip-shen:hover {
  background: rgba(212, 192, 138, 0.10);
  border-color: rgba(212, 192, 138, 0.4);
  transform: translateY(-1px);
}

.chip-shen:hover::after {
  transform: translateX(100%);
}

.chip-shen.sel {
  background: rgba(212, 192, 138, 0.20);
  border-color: rgba(212, 192, 138, 0.7);
  box-shadow: 0 0 16px rgba(212, 192, 138, 0.4), inset 0 0 8px rgba(212, 192, 138, 0.2);
  animation: chipSelPulse 2s ease-in-out infinite;
}

@keyframes chipSelPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(212, 192, 138, 0.3), inset 0 0 8px rgba(212, 192, 138, 0.15); }
  50% { box-shadow: 0 0 22px rgba(212, 192, 138, 0.55), inset 0 0 12px rgba(212, 192, 138, 0.3); }
}

/* ============ 天盘 - 九星 + 天盘奇仪 (主体, 最大) ============ */
.row-sky {
  flex-direction: column;
  gap: 2px;
}

.chip-gan-sky {
  font-family: "Songti SC", "STSong", serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  text-shadow:
    0 1px 2px rgba(0,0,0,0.7),
    0 0 8px currentColor;
  transition: transform 0.3s, text-shadow 0.3s;
  animation: chipBreath 4s ease-in-out infinite;
}

.chip-gan-sky:hover {
  transform: scale(1.15) rotate(-2deg);
  text-shadow:
    0 1px 2px rgba(0,0,0,0.7),
    0 0 16px currentColor,
    0 0 28px currentColor;
}

.chip-gan-hidden {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 13px;
  opacity: 0.82;
  animation: none;
}

.chip-gan-hidden span {
  font-size: 9px;
  color: #6a7595;
  font-family: -apple-system, "PingFang SC", sans-serif;
  font-weight: 500;
  text-shadow: none;
}

@keyframes chipBreath {
  0%, 100% { text-shadow: 0 1px 2px rgba(0,0,0,0.7), 0 0 6px currentColor; }
  50% { text-shadow: 0 1px 2px rgba(0,0,0,0.7), 0 0 14px currentColor, 0 0 22px currentColor; }
}

.star {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: "Songti SC", "STSong", serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  text-shadow:
    0 2px 4px rgba(0,0,0,0.8),
    0 0 14px currentColor;
  transition: all 0.3s;
  position: relative;
}

.star::before {
  content: '';
  position: absolute;
  inset: -4px -8px;
  border-radius: 4px;
  background: radial-gradient(ellipse, currentColor, transparent 70%);
  opacity: 0;
  filter: blur(8px);
  transition: opacity 0.3s;
  z-index: -1;
}

.star:hover {
  filter: brightness(1.3);
  transform: scale(1.05);
}

.star:hover::before {
  opacity: 0.25;
}

.star.sel {
  animation: starSel 2s ease-in-out infinite;
}

.star.sel::before {
  opacity: 0.35;
  animation: starSelGlow 2s ease-in-out infinite;
}

@keyframes starSel {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
@keyframes starSelGlow {
  0%, 100% { opacity: 0.3; filter: blur(8px); }
  50% { opacity: 0.5; filter: blur(12px); }
}

.badge {
  font-family: -apple-system, "PingFang SC", sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 1px 4px;
  border-radius: 2px;
  background: rgba(232, 207, 133, 0.18);
  color: #ecd6a4;
  border: 1px solid rgba(232, 207, 133, 0.4);
  white-space: nowrap;
  text-shadow: none;
  animation: badgePulse 2.5s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(232, 207, 133, 0.2);
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 6px rgba(232, 207, 133, 0.2); border-color: rgba(232, 207, 133, 0.4); }
  50% { box-shadow: 0 0 16px rgba(232, 207, 133, 0.55); border-color: rgba(232, 207, 133, 0.8); }
}

/* ============ 人盘 - 八门 ============ */
.door {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: "Songti SC", "STSong", serif;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  text-shadow:
    0 1px 3px rgba(0,0,0,0.7),
    0 0 10px currentColor;
  transition: all 0.3s;
  position: relative;
}

.door::before {
  content: '';
  position: absolute;
  inset: -3px -6px;
  border-radius: 3px;
  background: radial-gradient(ellipse, currentColor, transparent 70%);
  opacity: 0;
  filter: blur(6px);
  transition: opacity 0.3s;
  z-index: -1;
}

.door:hover {
  filter: brightness(1.3);
  transform: scale(1.05);
}

.door:hover::before {
  opacity: 0.2;
}

.door.sel {
  animation: starSel 2s ease-in-out infinite;
}

.door.sel::before {
  opacity: 0.3;
  animation: starSelGlow 2s ease-in-out infinite;
}

/* ============ 地盘 - 奇仪 (底部) ============ */
.chip-gan-earth {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: "Songti SC", "STSong", serif;
  font-size: 16px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(212, 192, 138, 0.15);
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
  text-shadow: 0 0 8px currentColor;
}

.chip-gan-earth::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,0.15) 50%, transparent 65%);
  transform: translateX(-100%);
  transition: transform 0.6s;
}

.chip-gan-earth .chip-tag {
  font-size: 9px;
  color: #6a7595;
  letter-spacing: 0.2em;
  font-weight: 400;
  font-family: -apple-system, "PingFang SC", sans-serif;
  text-shadow: none;
}

.chip-gan-earth:hover {
  background: rgba(212, 192, 138, 0.12);
  border-color: rgba(212, 192, 138, 0.5);
  transform: translateY(-1px);
}

.chip-gan-earth:hover::after {
  transform: translateX(100%);
}

.chip-gan-earth.sel {
  background: rgba(212, 192, 138, 0.20);
  border-color: rgba(212, 192, 138, 0.7);
  box-shadow: 0 0 16px rgba(212, 192, 138, 0.4), inset 0 0 8px rgba(212, 192, 138, 0.2);
  animation: chipSelPulse 2s ease-in-out infinite;
}

.chip-gan-earth-hidden {
  padding-inline: 7px;
  opacity: 0.82;
  background: rgba(212, 192, 138, 0.05);
}

.chip-gan-angan {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: "Songti SC", "STSong", serif;
  font-size: 13px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 2px;
  background: rgba(74, 143, 199, 0.06);
  border: 1px solid rgba(74, 143, 199, 0.16);
  cursor: pointer;
  letter-spacing: 0.05em;
  text-shadow: 0 0 8px currentColor;
}

.chip-gan-angan .chip-tag {
  font-size: 9px;
  color: #6a7595;
  letter-spacing: 0.12em;
  font-family: -apple-system, "PingFang SC", sans-serif;
  text-shadow: none;
}

/* ============ 中宫 ============ */
.center-cell {
  background:
    linear-gradient(135deg, rgba(40, 30, 20, 0.55) 0%, rgba(20, 14, 30, 0.65) 100%);
  border: 1px solid rgba(212, 192, 138, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  gap: 2px;
  box-shadow:
    inset 0 0 30px rgba(212, 192, 138, 0.08),
    0 0 40px rgba(212, 192, 138, 0.18);
  animation: centerBorder 6s ease-in-out infinite;
}

@keyframes centerBorder {
  0%, 100% { border-color: rgba(212, 192, 138, 0.4); box-shadow: inset 0 0 30px rgba(212, 192, 138, 0.06), 0 0 30px rgba(212, 192, 138, 0.12); }
  50% { border-color: rgba(232, 207, 133, 0.7); box-shadow: inset 0 0 40px rgba(212, 192, 138, 0.12), 0 0 50px rgba(212, 192, 138, 0.28); }
}

.center-cell::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(212, 192, 138, 0.15), transparent 70%);
  pointer-events: none;
  animation: centerglow 4s ease-in-out infinite;
}

/* 中宫八卦点旋转环 */
.center-cell::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 90%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    repeating-conic-gradient(
      from 0deg,
      transparent 0deg, transparent 22deg,
      rgba(232, 207, 133, 0.6) 22deg, rgba(232, 207, 133, 0.6) 23deg
    );
  -webkit-mask: radial-gradient(circle, transparent 70%, #000 71%, #000 73%, transparent 74%);
          mask: radial-gradient(circle, transparent 70%, #000 71%, #000 73%, transparent 74%);
  animation: ringspin 30s linear infinite;
  pointer-events: none;
  z-index: 1;
  opacity: 0.4;
}

@keyframes centerglow {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

.c-jieqi, .c-yindun, .c-num, .c-label, .c-divider, .c-meta {
  position: relative;
  z-index: 2;
}

.c-jieqi {
  font-size: 11px;
  color: #8a96b8;
  letter-spacing: 0.15em;
}

.c-yindun {
  font-size: 13px;
  color: #ecd6a4;
  letter-spacing: 0.2em;
  font-weight: 600;
  font-family: "Songti SC", "STSong", serif;
  margin-bottom: 4px;
  text-shadow: 0 0 10px rgba(232, 207, 133, 0.5);
}

.c-num {
  font-family: "Songti SC", "STSong", serif;
  font-size: 56px;
  font-weight: 700;
  color: #ecd6a4;
  line-height: 1;
  letter-spacing: 0;
  background: linear-gradient(180deg, #fff4d0 0%, #ecd6a4 40%, #a8843c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter:
    drop-shadow(0 2px 6px rgba(0,0,0,0.8))
    drop-shadow(0 0 18px rgba(232, 207, 133, 0.6));
  animation: numFloat 5s ease-in-out infinite;
}

@keyframes numFloat {
  0%, 100% { transform: translateY(0) scale(1); filter: drop-shadow(0 2px 6px rgba(0,0,0,0.8)) drop-shadow(0 0 18px rgba(232, 207, 133, 0.5)); }
  50% { transform: translateY(-3px) scale(1.04); filter: drop-shadow(0 4px 10px rgba(0,0,0,0.8)) drop-shadow(0 0 28px rgba(232, 207, 133, 0.85)); }
}

.c-label {
  font-size: 11px;
  color: #6a7595;
  letter-spacing: 0.4em;
  margin-top: 2px;
}

.c-divider {
  width: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 192, 138, 0.3), transparent);
  margin: 6px 0 4px;
}

.c-meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
}

.c-meta-label {
  font-size: 9px;
  color: #6a7595;
  letter-spacing: 0.2em;
  font-weight: 400;
}

.c-meta-val {
  font-family: "Songti SC", "STSong", serif;
  font-size: 14px;
  color: #d4d8e0;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.c-meta.accent .c-meta-val {
  color: #ecd6a4;
  text-shadow: 0 0 10px rgba(232, 207, 133, 0.4);
}

.c-meta.muted .c-meta-val {
  color: #8a96b8;
  font-size: 12px;
}

/* ============ 旋转动画 - 时辰切换时三动盘扫入 ============ */
@keyframes layer-fade-shen {
  0% { opacity: 0; transform: translateY(-6px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes layer-fade-sky {
  0% { opacity: 0; transform: translateY(-3px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes layer-fade-man {
  0% { opacity: 0; transform: translateY(3px); }
  100% { opacity: 1; transform: translateY(0); }
}

.cell.rotating .r-shen-anim {
  animation: layer-fade-shen 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.cell.rotating .r-sky-anim {
  animation: layer-fade-sky 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
}
.cell.rotating .r-man-anim {
  animation: layer-fade-man 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

/* 时辰脉冲指示 */
.time-pulse {
  position: absolute;
  top: -40px;
  right: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  pointer-events: none;
  z-index: 5;
}

.pulse-zhi {
  font-family: "Songti SC", "STSong", serif;
  font-size: 32px;
  color: #ecd6a4;
  font-weight: 700;
  text-shadow: 0 0 14px rgba(212, 192, 138, 0.6);
  animation: pulse 3s ease-in-out infinite;
}

.pulse-time {
  font-size: 11px;
  color: #8a96b8;
  letter-spacing: 0.3em;
  font-weight: 400;
}

@keyframes pulse {
  0%, 100% { text-shadow: 0 0 12px rgba(212, 192, 138, 0.5); }
  50% { text-shadow: 0 0 28px rgba(212, 192, 138, 1), 0 0 40px rgba(232, 207, 133, 0.5); }
}

/* ============ 注解抽屉 ============ */
.anno-drawer {
  position: absolute;
  top: 28px;
  right: 28px;
  bottom: 28px;
  width: 360px;
  max-width: 38vw;
  background: linear-gradient(180deg, rgba(15, 20, 38, 0.96) 0%, rgba(8, 12, 26, 0.96) 100%);
  border: 1px solid rgba(212, 192, 138, 0.25);
  border-radius: 4px;
  padding: 24px 26px;
  overflow-y: auto;
  backdrop-filter: blur(20px);
  z-index: 20;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(212, 192, 138, 0.05) inset;
  animation: drawerIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes drawerIn {
  0% { opacity: 0; transform: translateX(20px); }
  100% { opacity: 1; transform: translateX(0); }
}

.anno-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.anno-layer {
  font-size: 11px;
  color: #ecd6a4;
  letter-spacing: 0.4em;
  padding: 4px 10px;
  border: 1px solid rgba(212, 192, 138, 0.4);
  border-radius: 2px;
  background: rgba(212, 192, 138, 0.08);
}

.anno-close {
  background: none;
  border: 1px solid rgba(212, 192, 138, 0.2);
  color: #8a96b8;
  width: 28px;
  height: 28px;
  border-radius: 2px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.anno-close:hover {
  color: #ecd6a4;
  border-color: rgba(212, 192, 138, 0.5);
  background: rgba(212, 192, 138, 0.1);
}

.anno-title {
  font-family: "Songti SC", "STSong", serif;
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
}

.anno-sub {
  font-size: 12px;
  color: #6a7595;
  letter-spacing: 0.15em;
  margin-bottom: 14px;
}

.anno-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.pill {
  font-size: 11px;
  padding: 4px 12px;
  border: 1px solid;
  border-radius: 2px;
  letter-spacing: 0.2em;
}

.anno-desc {
  font-size: 14px;
  line-height: 1.85;
  color: #c4cad8;
  letter-spacing: 0.05em;
  text-align: justify;
  margin-bottom: 18px;
}

.extra-block {
  padding: 14px 16px;
  background: rgba(212, 192, 138, 0.04);
  border-left: 2px solid rgba(212, 192, 138, 0.3);
  margin-bottom: 18px;
}

.extra-label {
  font-size: 10px;
  color: #ecd6a4;
  letter-spacing: 0.3em;
  margin-bottom: 6px;
}

.extra-value {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.extra-value .big {
  font-family: "Songti SC", "STSong", serif;
  font-size: 22px;
  color: #fff;
  font-weight: 600;
}

.extra-value .muted {
  font-size: 12px;
  color: #8a96b8;
  line-height: 1.6;
}

.pattern-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pattern-item {
  display: grid;
  grid-template-columns: minmax(88px, auto) 1fr;
  gap: 10px;
  align-items: baseline;
  font-size: 12px;
  line-height: 1.6;
  color: #8a96b8;
}

.pattern-item b {
  color: #d4d8e0;
  font-weight: 600;
}

.pattern-item.good b { color: #a8d49a; }
.pattern-item.bad b { color: #d97a76; }
.pattern-item.neutral b { color: #d4c590; }

.anno-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 192, 138, 0.2), transparent);
  margin: 18px 0;
}

.anno-layer-info {
  font-size: 12px;
}

.ll-title {
  color: #ecd6a4;
  font-size: 11px;
  letter-spacing: 0.3em;
  margin-bottom: 8px;
}

.ll-role {
  color: #d4d8e0;
  font-size: 13px;
  margin-bottom: 8px;
  font-weight: 500;
}

.ll-detail {
  color: #8a96b8;
  font-size: 12px;
  line-height: 1.8;
  text-align: justify;
}

/* ============ 时间控制 ============ */
.time-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 10px 24px;
  background: linear-gradient(0deg, rgba(10, 14, 30, 0.92) 0%, rgba(10, 14, 30, 0.6) 100%);
  border-top: 1px solid rgba(212, 192, 138, 0.15);
  backdrop-filter: blur(12px);
  z-index: 10;
}

.tc-group {
  display: flex;
  gap: 6px;
}

.tc-btn {
  background: rgba(212, 192, 138, 0.05);
  border: 1px solid rgba(212, 192, 138, 0.2);
  color: #c4cad8;
  padding: 7px 12px;
  border-radius: 2px;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tc-btn:hover {
  background: rgba(212, 192, 138, 0.12);
  border-color: rgba(212, 192, 138, 0.45);
  color: #ecd6a4;
}

.tc-btn.live {
  background: rgba(95, 184, 120, 0.12);
  border-color: rgba(95, 184, 120, 0.5);
  color: #5fb878;
}

.tc-btn.alt {
  background: rgba(170, 184, 224, 0.05);
  border-color: rgba(170, 184, 224, 0.2);
}

.tc-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: livedot 2s ease-in-out infinite;
}

@keyframes livedot {
  0%, 100% { opacity: 0.4; box-shadow: 0 0 0 0 currentColor; }
  50% { opacity: 1; box-shadow: 0 0 8px currentColor; }
}

/* ============ 图例 ============ */
.legend {
  position: absolute;
  bottom: 28px;
  left: 28px;
  background: rgba(10, 14, 30, 0.7);
  border: 1px solid rgba(212, 192, 138, 0.2);
  border-radius: 2px;
  padding: 12px 16px;
  font-size: 11px;
  color: #8a96b8;
  letter-spacing: 0.15em;
  pointer-events: none;
  backdrop-filter: blur(8px);
  z-index: 5;
}

.legend-title {
  color: #ecd6a4;
  margin-bottom: 6px;
  font-size: 10px;
  letter-spacing: 0.3em;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.lg-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

/* 滚动条 */
.anno-drawer::-webkit-scrollbar {
  width: 4px;
}
.anno-drawer::-webkit-scrollbar-thumb {
  background: rgba(212, 192, 138, 0.3);
  border-radius: 2px;
}
.anno-drawer::-webkit-scrollbar-track {
  background: transparent;
}

/* 响应式 */
@media (max-width: 900px) {
  .app {
    --board-size: min(96vw, calc(100dvh - 190px));
    --grid-inset: 4.5%;
    --grid-gap: 4px;
  }
  .top-bar {
    padding: 10px 14px;
    gap: 10px;
  }
  .logo { font-size: 20px; }
  .subtitle { display: none; }
  .info-zone { gap: 12px; }
  .info-block { min-width: 50px; }
  .info-value { font-size: 12px; }
  .info-value.mono { font-size: 13px; }
  .anno-drawer {
    width: 320px;
    max-width: 90vw;
  }
  .star { font-size: 18px; }
  .door { font-size: 16px; }
  .chip-gan-sky { font-size: 16px; }
  .chip-gan-earth { font-size: 14px; }
  .chip-shen { font-size: 12px; }
  .palace-wx { font-size: 28px; }
  .c-num { font-size: 42px; }
  .time-controls {
    gap: 8px;
    padding: 8px 10px;
    flex-wrap: wrap;
  }
  .tc-btn {
    padding: 6px 9px;
    font-size: 11px;
  }
}

@media (max-width: 520px) {
  .app {
    --board-size: min(98vw, calc(100dvh - 198px));
    --grid-inset: 7.5%;
  }

  .top-bar {
    align-content: flex-start;
  }

  .logo {
    font-size: 21px;
  }

  .info-zone {
    row-gap: 6px;
  }

  .info-label {
    font-size: 9px;
  }

  .info-value,
  .info-value.mono {
    font-size: 13px;
  }

  .cell {
    gap: 2px;
    padding: 22px 4px 12px;
  }

  .palace-tag {
    top: 8px;
    left: 8px;
    gap: 2px;
  }

  .palace-marks {
    top: 8px;
    right: 8px;
  }

  .mini-mark {
    min-width: 14px;
    height: 14px;
    font-size: 8px;
  }

  .chip-shen {
    font-size: 10px;
    padding: 1px 5px;
  }

  .chip-shen .chip-tag,
  .chip-gan-earth .chip-tag {
    font-size: 8px;
  }

  .chip-gan-sky {
    font-size: 15px;
  }

  .chip-gan-hidden {
    font-size: 10px;
    gap: 2px;
  }

  .star {
    font-size: 15px;
    gap: 2px;
  }

  .door {
    font-size: 14px;
  }

  .chip-gan-earth {
    font-size: 10px;
    padding: 2px 5px;
    gap: 2px;
  }

  .badge {
    font-size: 7px;
    padding: 1px 3px;
  }

  .palace-wx {
    font-size: 34px;
  }

  .c-jieqi {
    font-size: 9px;
  }

  .c-yindun {
    font-size: 12px;
  }

  .c-num {
    font-size: 44px;
  }

  .c-divider {
    margin: 4px 0 3px;
  }

  .c-meta {
    gap: 4px;
  }

  .c-meta-label {
    font-size: 8px;
  }

.c-meta-val {
  font-size: 12px;
}
}

/* 最终显示比例：取消页面缩放，放大盘面，压低宫内字号 */
.app {
  width: 100vw !important;
  height: 100dvh !important;
  zoom: 1 !important;
  transform: none !important;
  grid-template-rows: 68px minmax(0, 1fr) 50px !important;
  --board-size: min(calc(100vw - 12px), calc(100dvh - 128px), 980px);
  --grid-inset: 5.5%;
  --grid-gap: 4px;
}

.top-bar {
  height: 68px !important;
  min-height: 68px !important;
  padding: 0 14px !important;
  flex-wrap: nowrap !important;
}

.title-zone {
  min-width: 150px !important;
}

.logo {
  font-size: 20px !important;
}

.subtitle {
  font-size: 9px !important;
  letter-spacing: 0.32em !important;
}

.info-zone {
  width: auto !important;
  height: 100% !important;
  flex-wrap: nowrap !important;
  justify-content: flex-end !important;
}

.info-block,
.info-block:first-child {
  min-width: auto !important;
  padding: 0 10px !important;
}

.info-label {
  font-size: 8px !important;
}

.info-value {
  font-size: 11px !important;
}

.info-value.mono,
.info-value.accent {
  font-size: 13px !important;
}

.main {
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
}

.disc-wrap {
  width: var(--board-size) !important;
  height: var(--board-size) !important;
  max-width: calc(100vw - 12px) !important;
  max-height: calc(100dvh - 128px) !important;
}

.grid-9 {
  inset: var(--grid-inset) !important;
  gap: var(--grid-gap) !important;
  padding: var(--grid-gap) !important;
}

.cell {
  gap: clamp(1px, 0.42vmin, 5px) !important;
  padding: clamp(17px, 1.9vmin, 30px) 4px clamp(7px, 1vmin, 15px) !important;
  overflow: hidden !important;
}

.palace-tag {
  top: 6px !important;
  left: 6px !important;
  gap: 2px !important;
}

.palace-marks {
  top: 6px !important;
  right: 6px !important;
}

.pt-name {
  font-size: clamp(9px, 0.82vmin, 12px) !important;
}

.pt-num,
.pt-dir {
  font-size: clamp(7px, 0.65vmin, 9px) !important;
}

.mini-mark {
  min-width: 13px !important;
  height: 13px !important;
  font-size: 7px !important;
}

.row {
  gap: 1px !important;
  line-height: 1.05 !important;
}

.chip-shen {
  font-size: clamp(8px, 0.72vmin, 11px) !important;
  padding: 0 4px !important;
  gap: 1px !important;
}

.chip-shen .chip-tag,
.chip-gan-earth .chip-tag {
  font-size: 7px !important;
}

.chip-gan-sky {
  font-size: clamp(11px, 1.05vmin, 16px) !important;
}

.chip-gan-hidden {
  font-size: clamp(8px, 0.78vmin, 11px) !important;
  gap: 1px !important;
}

.star {
  font-size: clamp(11px, 1.16vmin, 18px) !important;
  gap: 1px !important;
  line-height: 1.08 !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  max-width: 100% !important;
}

.door {
  font-size: clamp(11px, 1.08vmin, 16px) !important;
  line-height: 1.08 !important;
}

.chip-gan-earth {
  font-size: clamp(8px, 0.78vmin, 11px) !important;
  padding: 0 4px !important;
  gap: 1px !important;
}

.chip-gan-earth-hidden {
  padding-inline: 3px !important;
}

.badge {
  font-size: 6px !important;
  padding: 0 2px !important;
}

.palace-wx {
  font-size: clamp(26px, 3.5vmin, 46px) !important;
}

.center-cell {
  gap: 2px !important;
  padding: clamp(12px, 1.6vmin, 22px) 4px !important;
}

.c-jieqi,
.c-label {
  font-size: clamp(7px, 0.7vmin, 9px) !important;
}

.c-yindun {
  font-size: clamp(9px, 0.9vmin, 12px) !important;
}

.c-num {
  font-size: clamp(25px, 3.1vmin, 44px) !important;
  margin: 0 !important;
}

.c-divider {
  margin: 3px 0 !important;
}

.c-meta {
  gap: 3px !important;
}

.c-meta-label {
  font-size: 7px !important;
}

.c-meta-val {
  font-size: clamp(9px, 0.9vmin, 12px) !important;
}

.time-controls {
  min-height: 50px !important;
  padding: 6px 8px !important;
  gap: 5px !important;
  flex-wrap: wrap !important;
}

.tc-btn {
  min-height: 28px !important;
  padding: 4px 8px !important;
  font-size: 10px !important;
}

/* 最终压缩：盘面文字再小一档，优先保证不截断 */
.cell {
  gap: clamp(2px, 0.42vmin, 6px);
  padding: clamp(20px, 2.1vmin, 30px) 8px clamp(10px, 1.45vmin, 18px);
}

.row {
  gap: 2px;
  line-height: 1.05;
}

.chip-shen {
  font-size: clamp(8px, 0.78vmin, 11px);
  padding: 1px 5px;
}

.chip-shen .chip-tag,
.chip-gan-earth .chip-tag {
  font-size: 7px;
}

.chip-gan-sky {
  font-size: clamp(12px, 1.15vmin, 16px);
}

.chip-gan-hidden {
  font-size: clamp(8px, 0.8vmin, 11px);
}

.star {
  font-size: clamp(13px, 1.25vmin, 18px);
  gap: 2px;
  line-height: 1.12;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
}

.star-name,
.door-name,
.chip-text {
  max-width: 100%;
  white-space: normal;
}

.door {
  font-size: clamp(12px, 1.15vmin, 16px);
  line-height: 1.12;
}

.chip-gan-earth {
  font-size: clamp(8px, 0.85vmin, 11px);
  padding: 1px 6px;
  gap: 2px;
}

.badge {
  font-size: 6px;
  padding: 1px 2px;
  letter-spacing: 0.04em;
}

.palace-wx {
  font-size: clamp(28px, 3.8vmin, 46px);
}

.c-num {
  font-size: clamp(28px, 3.5vmin, 44px);
}

.c-yindun {
  font-size: 12px;
}

.c-jieqi,
.c-label {
  font-size: 9px;
}

.c-meta-val {
  font-size: 11px;
}

@media (max-width: 520px) {
  .cell {
    gap: 0;
    padding: 16px 2px 7px;
  }

  .chip-shen {
    font-size: 8px;
    padding: 0 3px;
  }

  .chip-gan-sky {
    font-size: 11px;
  }

  .chip-gan-hidden {
    font-size: 8px;
  }

  .star {
    font-size: 11px;
  }

  .door {
    font-size: 11px;
  }

  .chip-gan-earth {
    font-size: 8px;
    padding: 0 3px;
  }

  .c-num {
    font-size: 26px;
  }
}

/* 固定为接近浏览器 50% 缩放：用 CSS zoom 参与布局，不用 transform 硬压画面 */
.app {
  width: 200vw;
  height: 200dvh;
  zoom: 0.5;
  grid-template-rows: 76px minmax(0, 1fr) 62px;
  --board-size: min(190vw, calc(200dvh - 166px), 1320px);
  --grid-inset: 8%;
  --grid-gap: 6px;
}

.top-bar {
  height: 76px;
  min-height: 76px;
  flex-wrap: nowrap;
  padding: 0 28px;
}

.title-zone {
  min-width: 230px;
}

.subtitle {
  display: block;
}

.info-zone {
  width: auto;
  height: 100%;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.info-block,
.info-block:first-child {
  min-width: 88px;
  padding: 0 22px;
}

.info-block:first-child {
  min-width: 210px;
}

.disc-wrap {
  width: var(--board-size);
  height: var(--board-size);
}

.cell {
  gap: clamp(4px, 0.62vmin, 10px);
  padding: clamp(24px, 2.5vmin, 36px) 10px clamp(12px, 1.6vmin, 22px);
}

.chip-shen {
  font-size: clamp(10px, 0.95vmin, 13px);
  padding: 2px 6px;
}

.chip-gan-sky {
  font-size: clamp(15px, 1.35vmin, 19px);
}

.chip-gan-hidden {
  font-size: clamp(10px, 0.92vmin, 12px);
}

.star {
  font-size: clamp(15px, 1.45vmin, 20px);
  line-height: 1.12;
}

.door {
  font-size: clamp(14px, 1.32vmin, 18px);
  line-height: 1.12;
}

.chip-gan-earth {
  font-size: clamp(10px, 0.95vmin, 13px);
  padding: 2px 7px;
}

.badge {
  font-size: 7px;
}

.center-cell {
  padding: 18px 8px 16px;
}

.c-num {
  font-size: clamp(34px, 4vmin, 50px);
}

.time-controls {
  min-height: 62px;
  flex-wrap: nowrap;
}

/* 盘面字体压缩：保证每宫信息完整露出 */
.cell {
  gap: clamp(4px, 0.68vmin, 10px);
  padding: clamp(24px, 2.55vmin, 36px) 10px clamp(14px, 1.85vmin, 24px);
}

.palace-tag {
  top: 10px;
  left: 10px;
}

.palace-marks {
  top: 10px;
  right: 10px;
}

.pt-name {
  font-size: 12px;
}

.pt-num,
.pt-dir {
  font-size: 9px;
}

.mini-mark {
  min-width: 16px;
  height: 16px;
  font-size: 9px;
}

.chip-shen {
  font-size: clamp(10px, 0.95vmin, 13px);
  padding: 2px 6px;
}

.chip-shen .chip-tag {
  font-size: 8px;
}

.chip-gan-sky {
  font-size: clamp(16px, 1.55vmin, 22px);
}

.chip-gan-hidden {
  font-size: clamp(10px, 1vmin, 13px);
}

.star {
  font-size: clamp(17px, 1.7vmin, 24px);
  line-height: 1.18;
}

.door {
  font-size: clamp(16px, 1.55vmin, 22px);
  line-height: 1.18;
}

.chip-gan-earth {
  font-size: clamp(11px, 1.05vmin, 14px);
  padding: 2px 8px;
}

.chip-gan-earth .chip-tag {
  font-size: 8px;
}

.chip-gan-earth-hidden {
  padding-inline: 5px;
}

.badge {
  font-size: 8px;
  padding: 1px 3px;
}

.palace-wx {
  font-size: clamp(34px, 4.8vmin, 58px);
}

.center-cell {
  padding: clamp(16px, 2.1vmin, 24px) 8px;
  gap: 4px;
}

.c-jieqi {
  font-size: 10px;
}

.c-yindun {
  font-size: 13px;
}

.c-num {
  font-size: clamp(34px, 4.1vmin, 52px);
}

.c-label {
  font-size: 9px;
}

.c-meta {
  gap: 4px;
}

.c-meta-label {
  font-size: 8px;
}

.c-meta-val {
  font-size: 13px;
}

@media (max-width: 520px) {
  .app {
    --board-size: min(99vw, calc(100dvh - 188px));
    --grid-inset: 6.5%;
  }

  .cell {
    gap: 1px;
    padding: 18px 3px 9px;
  }

  .palace-tag {
    top: 6px;
    left: 6px;
  }

  .palace-marks {
    top: 6px;
    right: 6px;
  }

  .pt-name {
    font-size: 10px;
  }

  .pt-num,
  .pt-dir {
    font-size: 8px;
  }

  .mini-mark {
    min-width: 13px;
    height: 13px;
    font-size: 7px;
  }

  .chip-shen {
    font-size: 9px;
    padding: 1px 4px;
    gap: 1px;
  }

  .chip-gan-sky {
    font-size: 13px;
  }

  .chip-gan-hidden {
    font-size: 9px;
  }

  .star {
    font-size: 13px;
    gap: 1px;
  }

  .door {
    font-size: 13px;
  }

  .chip-gan-earth {
    font-size: 9px;
    padding: 1px 4px;
  }

  .badge {
    font-size: 7px;
  }

  .c-num {
    font-size: 30px;
  }

  .c-meta-val {
    font-size: 11px;
  }
}

/* ============ 截图式盘面比例重置 ============ */
.app {
  grid-template-rows: 76px minmax(0, 1fr) 62px;
  --board-size: min(88vw, calc(100dvh - 112px), 1180px);
  --grid-inset: 11%;
  --grid-gap: clamp(4px, 0.45vmin, 6px);
  background:
    radial-gradient(ellipse at 50% 48%, rgba(36, 43, 64, 0.56) 0%, rgba(7, 10, 18, 0.12) 48%, rgba(2, 5, 12, 0.8) 100%),
    linear-gradient(135deg, #050913 0%, #090b18 48%, #08030b 100%);
}

.top-bar {
  height: 76px;
  padding: 0 28px;
  background: rgba(7, 10, 22, 0.92);
  border-bottom: 1px solid rgba(196, 180, 121, 0.13);
}

.title-line {
  display: none;
}

.title-zone {
  gap: 5px;
  min-width: 230px;
}

.logo {
  font-size: 26px;
  letter-spacing: 0.34em;
  color: #d7bd72;
  text-shadow: 0 0 14px rgba(215, 189, 114, 0.18);
}

.subtitle {
  font-size: 11px;
  letter-spacing: 0.5em;
  color: rgba(127, 136, 169, 0.72);
}

.info-zone {
  height: 100%;
  flex-wrap: nowrap;
  gap: 0;
}

.info-block {
  min-width: 88px;
  padding: 0 22px;
  border-left: 1px solid rgba(196, 180, 121, 0.09);
}

.info-block:first-child {
  min-width: 210px;
}

.info-label {
  font-size: 10px;
  letter-spacing: 0.3em;
  color: rgba(129, 138, 172, 0.72);
}

.info-value {
  font-size: 15px;
  line-height: 1.15;
  color: rgba(224, 229, 240, 0.82);
  white-space: nowrap;
}

.info-value.mono {
  font-size: 18px;
  color: rgba(232, 220, 188, 0.9);
}

.info-value.accent {
  color: #d7bd72;
}

.info-sep {
  display: none;
}

.main {
  align-items: center;
  justify-content: center;
  padding: 0;
  background:
    radial-gradient(circle at 46% 46%, rgba(78, 90, 124, 0.16) 0%, transparent 38%),
    radial-gradient(circle at 68% 70%, rgba(165, 126, 75, 0.12) 0%, transparent 30%);
}

.taiji-bg {
  width: min(132vw, 132vh, 1360px);
  height: min(132vw, 132vh, 1360px);
  opacity: 0.5;
  filter: blur(0.8px);
}

.disc-wrap {
  width: var(--board-size);
  height: var(--board-size);
  max-width: calc(100vw - 40px);
  max-height: 100%;
}

.disc-wrap::before,
.disc-wrap::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.disc-wrap::before {
  inset: -7%;
  border: 2px solid rgba(196, 180, 121, 0.09);
  box-shadow:
    0 0 0 11px rgba(196, 180, 121, 0.025),
    inset 0 0 80px rgba(196, 180, 121, 0.04);
  z-index: 0;
}

.disc-wrap::after {
  inset: -3.5%;
  border: 1px solid rgba(196, 180, 121, 0.12);
  box-shadow: 0 0 90px rgba(57, 64, 94, 0.28);
  z-index: 0;
}

.disc-bg {
  inset: -8%;
  background:
    radial-gradient(circle at 50% 50%, rgba(215, 189, 114, 0.05) 0%, rgba(42, 54, 84, 0.09) 40%, transparent 67%),
    conic-gradient(from 210deg, transparent 0deg, rgba(215, 189, 114, 0.05) 80deg, transparent 160deg, rgba(82, 104, 153, 0.05) 250deg, transparent 360deg);
  opacity: 0.82;
}

.grid-wrap {
  z-index: 2;
}

.grid-9 {
  inset: var(--grid-inset);
  gap: var(--grid-gap);
  padding: var(--grid-gap);
  border: 1px solid rgba(215, 189, 114, 0.18);
  border-radius: 5px;
  background: rgba(23, 27, 40, 0.22);
  box-shadow:
    0 0 0 1px rgba(215, 189, 114, 0.07),
    0 0 80px rgba(29, 37, 62, 0.46),
    inset 0 0 26px rgba(0, 0, 0, 0.24);
}

.grid-9::before {
  inset: -2px;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(215, 189, 114, 0.25), transparent 28%, transparent 72%, rgba(215, 189, 114, 0.22));
  animation: none;
}

.bagua-glyph {
  font-size: clamp(25px, 2.5vmin, 36px);
  color: rgba(215, 189, 114, 0.7);
  text-shadow: 0 0 12px rgba(215, 189, 114, 0.72), 0 0 28px rgba(215, 189, 114, 0.26);
}

.cell {
  justify-content: center;
  gap: clamp(8px, 1vmin, 15px);
  padding: clamp(30px, 3.2vmin, 44px) 12px clamp(18px, 2.2vmin, 30px);
  background:
    radial-gradient(circle at 48% 58%, rgba(255, 255, 255, 0.03), transparent 40%),
    linear-gradient(145deg, rgba(29, 34, 49, 0.66) 0%, rgba(12, 16, 29, 0.76) 100%);
  border-color: rgba(215, 189, 114, 0.11);
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.16);
}

.cell:hover {
  transform: none;
}

.palace-cell:nth-child(1),
.palace-cell:nth-child(9) {
  border-color: rgba(215, 189, 114, 0.26);
  box-shadow:
    inset 0 0 30px rgba(215, 189, 114, 0.035),
    0 0 24px rgba(215, 189, 114, 0.06);
}

.palace-tag {
  top: 14px;
  left: 14px;
}

.pt-name {
  font-size: 14px;
  color: rgba(215, 189, 114, 0.9);
}

.pt-num,
.pt-dir {
  color: rgba(129, 138, 172, 0.72);
}

.palace-marks {
  top: 14px;
  right: 14px;
}

.palace-wx {
  right: 12px;
  bottom: 8px;
  font-size: clamp(42px, 5.8vmin, 72px);
  opacity: 0.045;
}

.row {
  min-height: auto;
  gap: 5px;
}

.row-shen {
  margin-top: 0;
}

.row-sky {
  gap: 5px;
}

.row-earth {
  margin-top: 2px;
}

.chip-shen,
.chip-gan-earth,
.chip-gan-angan {
  border-color: rgba(215, 189, 114, 0.13);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.025);
}

.chip-shen {
  font-size: clamp(12px, 1.1vmin, 15px);
  padding: 3px 8px;
}

.chip-shen .chip-tag,
.chip-gan-earth .chip-tag,
.chip-gan-angan .chip-tag {
  color: rgba(129, 138, 172, 0.72);
}

.chip-gan-sky {
  font-size: clamp(19px, 2vmin, 27px);
}

.chip-gan-hidden {
  font-size: clamp(12px, 1.2vmin, 15px);
}

.star {
  font-size: clamp(20px, 2.25vmin, 30px);
  white-space: nowrap;
}

.door {
  font-size: clamp(19px, 2.05vmin, 27px);
  white-space: nowrap;
}

.chip-gan-earth {
  font-size: clamp(14px, 1.35vmin, 17px);
  padding: 4px 12px;
}

.badge {
  font-size: 9px;
  padding: 2px 5px;
  vertical-align: middle;
}

.center-cell {
  gap: 4px;
  padding: 20px 10px;
  background:
    radial-gradient(circle at 50% 43%, rgba(215, 189, 114, 0.1), transparent 58%),
    linear-gradient(145deg, rgba(46, 33, 24, 0.58) 0%, rgba(24, 18, 31, 0.76) 100%);
  border-color: rgba(215, 189, 114, 0.32);
}

.c-jieqi {
  font-size: 12px;
  color: rgba(185, 177, 145, 0.84);
}

.c-yindun {
  font-size: 16px;
  margin-bottom: 1px;
}

.c-num {
  font-size: clamp(56px, 7.2vmin, 86px);
}

.c-label {
  font-size: 11px;
}

.c-divider {
  margin: 8px 0 5px;
}

.c-meta {
  font-size: 13px;
}

.c-meta-val {
  font-size: 16px;
}

.legend {
  bottom: 0;
  left: 24px;
  transform: translateY(-2px);
  border-color: rgba(215, 189, 114, 0.25);
  background: rgba(7, 10, 22, 0.76);
}

.time-controls {
  min-height: 62px;
  gap: 7px;
  padding: 10px 24px;
  background: rgba(7, 10, 22, 0.92);
}

.tc-group {
  gap: 6px;
}

.tc-btn {
  min-height: 36px;
  padding: 7px 15px;
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(215, 189, 114, 0.14);
}

@media (max-width: 900px) {
  .app {
    grid-template-rows: auto minmax(0, 1fr) auto;
    --board-size: min(98vw, calc(100dvh - 168px));
    --grid-inset: 7%;
    --grid-gap: 4px;
  }

  .top-bar {
    height: auto;
    min-height: 76px;
    flex-wrap: wrap;
    padding: 10px 14px;
  }

  .title-zone {
    min-width: 0;
  }

  .info-zone {
    width: 100%;
    height: auto;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .info-block,
  .info-block:first-child {
    min-width: auto;
    padding: 4px 10px;
  }

  .cell {
    gap: 5px;
    padding: 28px 6px 18px;
  }

  .pt-name {
    font-size: 12px;
  }

  .pt-num,
  .pt-dir {
    font-size: 9px;
  }

  .star {
    font-size: 17px;
  }

  .door {
    font-size: 16px;
  }

  .chip-gan-sky {
    font-size: 17px;
  }

  .chip-gan-earth {
    font-size: 12px;
    padding: 3px 7px;
  }

  .chip-shen {
    font-size: 11px;
  }

  .bagua-glyph {
    font-size: 24px;
  }

  .time-controls {
    gap: 8px;
    padding: 8px 10px;
    flex-wrap: wrap;
  }

  .tc-btn {
    min-height: 32px;
    padding: 6px 9px;
    font-size: 11px;
  }
}

/* 中宫比例修正：避免“五”过大抢盘面 */
.center-cell {
  gap: 5px;
  padding: 22px 10px 18px;
}

.c-yindun {
  font-size: 15px;
  margin-bottom: 0;
}

.c-num {
  font-size: clamp(42px, 4.9vmin, 62px);
  margin: 2px 0;
}

.c-divider {
  margin: 6px 0 5px;
}

@media (max-width: 520px) {
  .app {
    --board-size: min(98vw, calc(100dvh - 198px));
    --grid-inset: 7.5%;
  }

  .cell {
    gap: 2px;
    padding: 22px 4px 12px;
  }

  .chip-shen {
    font-size: 10px;
    padding: 1px 5px;
  }

  .chip-gan-sky {
    font-size: 15px;
  }

  .star {
    font-size: 15px;
    gap: 2px;
    flex-wrap: wrap;
    justify-content: center;
    line-height: 1.15;
    max-width: 96%;
  }

  .door {
    font-size: 14px;
  }

  .chip-gan-earth {
    font-size: 10px;
    padding: 2px 5px;
    gap: 2px;
  }

  .badge {
    font-size: 7px;
    padding: 1px 3px;
  }

  .c-yindun {
    font-size: 12px;
  }

  .c-num {
    font-size: 34px;
  }

  .c-meta-val {
    font-size: 12px;
  }
}

/* 真正最终覆盖：必须放在文件末尾 */
.app {
  width: 100vw !important;
  height: 100dvh !important;
  zoom: 1 !important;
  transform: none !important;
  grid-template-rows: 68px minmax(0, 1fr) 50px !important;
  --board-size: min(calc(100vw - 12px), calc(100dvh - 128px), 980px) !important;
  --grid-inset: 5.5% !important;
  --grid-gap: 4px !important;
}

.disc-wrap {
  width: var(--board-size) !important;
  height: var(--board-size) !important;
  max-width: calc(100vw - 12px) !important;
  max-height: calc(100dvh - 128px) !important;
}

.grid-9 {
  inset: var(--grid-inset) !important;
  gap: var(--grid-gap) !important;
  padding: var(--grid-gap) !important;
}

.cell {
  gap: 1px !important;
  padding: clamp(17px, 1.9vmin, 30px) 4px clamp(7px, 1vmin, 15px) !important;
}

.chip-shen { font-size: clamp(8px, 0.72vmin, 11px) !important; padding: 0 4px !important; }
.chip-gan-sky { font-size: clamp(11px, 1.05vmin, 16px) !important; }
.chip-gan-hidden { font-size: clamp(8px, 0.78vmin, 11px) !important; }
.star { font-size: clamp(11px, 1.16vmin, 18px) !important; line-height: 1.08 !important; flex-wrap: wrap !important; justify-content: center !important; }
.door { font-size: clamp(11px, 1.08vmin, 16px) !important; line-height: 1.08 !important; }
.chip-gan-earth { font-size: clamp(8px, 0.78vmin, 11px) !important; padding: 0 4px !important; }
.badge { font-size: 6px !important; padding: 0 2px !important; }
.c-num { font-size: clamp(25px, 3.1vmin, 44px) !important; }

/* 盘面字距：比上一版疏一点，但不拉爆宫格 */
.palace-cell .star-name,
.palace-cell .door-name,
.palace-cell .chip-text,
.palace-cell .chip-gan-sky,
.center-cell .c-num,
.center-cell .c-meta-val {
  letter-spacing: 0.04em !important;
}

.palace-cell .chip-tag,
.palace-cell .pt-name,
.palace-cell .pt-num,
.palace-cell .pt-dir,
.center-cell .c-jieqi,
.center-cell .c-yindun,
.center-cell .c-label,
.center-cell .c-meta-label {
  letter-spacing: 0.08em !important;
}
