/* ============================================================
 * 灵算台 · 古法风水罗盘 · 页面样式（LING.compass 专属）
 * 深墨底 + 鎏金蚀刻 + 铜绿斑驳（盘面质感由 canvas 生成，此处负责
 * 容器/读数/按钮/图例）。前缀 .lz-cp-*，与全局 lz-* 不冲突。
 * 动画只动 transform/opacity；prefers-reduced-motion 全量降级。
 * ============================================================ */

/* 与 style.css 同值的变量兜底（test-compass.html 独立加载时可用） */
:root {
  --bg: #0a0a0e;
  --bg1: #101218;
  --bg2: #161a22;
  --line: rgba(212, 175, 55, 0.28);
  --gold: #d4af37;
  --gold-hi: #f0d78c;
  --red: #b03a2e;
  --tx: #e8e6df;
  --tx-dim: #9a978a;
  --serif: "Noto Serif SC", "Songti SC", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.lz-cp {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  font-family: var(--sans);
  color: var(--tx);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- 模式提示条 ---------- */
.lz-cp-notice {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(24, 28, 38, 0.85), rgba(16, 18, 24, 0.92));
  color: var(--tx-dim);
  font-size: 12.5px;
  line-height: 1.6;
  letter-spacing: 0.02em;
  text-align: center;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lz-cp-notice-sensor { color: #c9b26a; border-color: rgba(212, 175, 55, 0.4); }
.lz-cp-notice-denied { color: #c98980; border-color: rgba(176, 58, 46, 0.4); }

/* ---------- 盘面舞台 ---------- */
.lz-cp-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.28),
    0 0 34px rgba(212, 175, 55, 0.10),
    0 18px 44px rgba(0, 0, 0, 0.55),
    inset 0 0 60px rgba(0, 0, 0, 0.55);
  background:
    radial-gradient(circle at 50% 42%, #12161e, #0b0d12 78%);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.lz-cp-bg, .lz-cp-cv {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.lz-cp-bg { z-index: 1; }
.lz-cp-cv { z-index: 2; cursor: grab; }
.lz-cp-cv:active { cursor: grabbing; }

/* ---------- 朝向大字 ---------- */
.lz-cp-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 4px 8px 0;
}
.lz-cp-taiji {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  animation: lzcp-spin 40s linear infinite;
}
.lz-cp-taiji svg { display: block; width: 100%; height: 100%; }
@keyframes lzcp-spin { to { transform: rotate(360deg); } }
.lz-cp-degwrap { text-align: left; }
.lz-cp-deg {
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #f0d78c, #d4af37 62%, #b8912c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: lzcp-pulse 3.2s ease-in-out infinite;
}
@keyframes lzcp-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.72; }
}
.lz-cp-deg-unit {
  font-family: var(--serif);
  color: var(--gold);
  font-size: 19px;
  margin-left: 3px;
}
.lz-cp-fw {
  font-size: 12.5px;
  color: var(--tx-dim);
  letter-spacing: 0.1em;
  margin-top: 2px;
}

/* ---------- 坐向 ---------- */
.lz-cp-mountline {
  text-align: center;
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: 0.14em;
  color: var(--tx);
}
.lz-cp-mountline b { font-weight: 600; }
.lz-cp-zuo { color: var(--gold-hi); }
.lz-cp-xiang { color: #c98980; }
.lz-cp-seam {
  font-family: var(--sans);
  font-size: 11px;
  color: #c98980;
  letter-spacing: 0.06em;
}

/* ---------- 读数卡片 ---------- */
.lz-cp-reads {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.lz-cp-reads2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lz-cp-read {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid rgba(212, 175, 55, 0.16);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(24, 28, 38, 0.78), rgba(16, 18, 24, 0.9));
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.lz-cp-read:hover {
  border-color: rgba(212, 175, 55, 0.38);
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.07);
}
.lz-cp-read-label {
  font-size: 10.5px;
  color: var(--tx-dim);
  letter-spacing: 0.1em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lz-cp-read-val {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--gold-hi);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 控制按钮 ---------- */
.lz-cp-ctrls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.lz-cp-btn {
  min-height: 44px;
  padding: 10px 8px;
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.16), rgba(212, 175, 55, 0.06));
  color: var(--gold-hi);
  font-size: 13.5px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.lz-cp-btn:hover {
  border-color: rgba(212, 175, 55, 0.7);
  box-shadow: 0 0 18px rgba(212, 175, 55, 0.15);
}
.lz-cp-btn:active { transform: scale(0.96); }
.lz-cp-btn-ghost {
  background: rgba(16, 18, 24, 0.7);
  border-color: rgba(212, 175, 55, 0.22);
  color: var(--tx-dim);
}
.lz-cp-btn-ghost:hover { color: var(--tx); }

/* ---------- 口径图例 ---------- */
.lz-cp-legend {
  border: 1px solid rgba(212, 175, 55, 0.16);
  border-radius: 12px;
  background: rgba(16, 18, 24, 0.75);
  overflow: hidden;
}
.lz-cp-legend summary {
  cursor: pointer;
  padding: 11px 14px;
  font-size: 12.5px;
  color: var(--tx-dim);
  letter-spacing: 0.08em;
  list-style: none;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.lz-cp-legend summary::-webkit-details-marker { display: none; }
.lz-cp-legend summary::before {
  content: "▸";
  color: var(--gold);
  margin-right: 8px;
  transition: transform 0.2s ease;
}
.lz-cp-legend[open] summary::before { transform: rotate(90deg); }
.lz-cp-legend-body {
  padding: 2px 14px 12px;
  font-size: 11.5px;
  line-height: 1.9;
  color: #7e7b6e;
}
.lz-cp-legend-body p { margin: 6px 0 0; }

/* ---------- 动效降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  .lz-cp-taiji, .lz-cp-deg { animation: none; }
}

/* ---------- 窄屏兜底（≤360px） ---------- */
@media (max-width: 360px) {
  .lz-cp-deg { font-size: 36px; }
  .lz-cp-taiji { width: 46px; height: 46px; }
  .lz-cp-read-val { font-size: 15px; }
}
