/* ==========================================================================
   起势转念万象盘 - 核心样式表
   ========================================================================== */

:root {
  --bg-color: #050707;
  --panel-bg: rgba(13, 17, 17, 0.85);
  --gold: #fbce00;
  --gold-dim: #c8a200;
  --gold-glow: rgba(251, 206, 0, 0.25);
  --red: #e4171a;
  --red-glow: rgba(228, 23, 26, 0.3);
  --green: #32cd32;
  --text-gold: #ffd700; /* 亮黄金色（原 #f0d570 偏暗，改亮） */
  --text-white: #ffffff;
  --text-gray: #8a9a9a;
  --border-gold: rgba(251, 206, 0, 0.2);
  --font-zh: "PingFang SC", "Microsoft YaHei", "SimHei", "KaiTi", serif; /* 本地字体降级（移除 Google Fonts 外链） */
  --font-en: "Helvetica Neue", "Arial", sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  color: var(--text-white);
  font-family: var(--font-zh);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
}

/* 动态背景环境光 */
.bg-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90vmin;
  height: 90vmin;
  background: radial-gradient(
    circle,
    var(--gold-glow) 0%,
    rgba(0, 0, 0, 0) 70%
  );
  z-index: 1;
  pointer-events: none;
  animation: pulse-glow 8s infinite alternate ease-in-out;
}

@keyframes pulse-glow {
  0% {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
  }
}

/* 粒子层 */
.particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  background-image:
    radial-gradient(
      1px 1px at 20px 30px,
      rgba(251, 206, 0, 0.2),
      rgba(0, 0, 0, 0)
    ),
    radial-gradient(
      2px 2px at 40px 70px,
      rgba(251, 206, 0, 0.15),
      rgba(0, 0, 0, 0)
    ),
    radial-gradient(
      1.5px 1.5px at 120px 240px,
      rgba(251, 206, 0, 0.2),
      rgba(0, 0, 0, 0)
    ),
    radial-gradient(
      2.5px 2.5px at 280px 140px,
      rgba(251, 206, 0, 0.1),
      rgba(0, 0, 0, 0)
    );
  background-repeat: repeat;
  background-size: 300px 300px;
  opacity: 0.25; /* 降低透明度使星空更虚（原 0.5） */
  filter: blur(2px); /* 虚化星空，不抢主体 */
}

/* 主界面布局 */
.app-container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 500px;
  height: 100vh;
  padding: 24px 16px;
  z-index: 10;
}

/* 标题样式 */
.app-header {
  text-align: center;
  margin-top: 12px;
}

.glow-text {
  font-size: 28px;
  font-weight: 900;
  color: var(--text-gold);
  text-shadow: 0 0 12px var(--gold-glow);
  letter-spacing: 4px;
  margin-bottom: 6px;
}

.subtitle {
  font-size: 13px;
  font-family: var(--font-en);
  color: var(--text-gray);
  letter-spacing: 2px;
}

/* 罗盘显示区块 */
.compass-section {
  position: relative;
  width: min(84vw, 84vh, 400px);
  height: min(84vw, 84vh, 400px);
  margin: auto 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 固定在顶部的指针：白色小三角 + 白色延线（从里向外）
   旋转时由 JS 加 .hidden 类隐藏 */
.compass-pointer {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  z-index: 50;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: opacity 0.3s ease;
}

/* 旋转时隐藏指针 */
.compass-pointer.hidden {
  opacity: 0;
}

/* 白色小三角（朝下，尖指向圆心方向） */
.pointer-arrow {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 10px solid #ffffff;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.6));
}

/* 白色延线：从三角向罗盘外延伸到沿边 */
.pointer-line {
  width: 2px;
  height: 30px;
  background: linear-gradient(to top, #ffffff, rgba(255, 255, 255, 0.2));
  margin-top: -1px;
}

/* 3D 旋转容器 */
.compass-wrapper {
  width: 100%;
  height: 100%;
  perspective: 500px; /* 3D 视距 (缩短以增强隧道透视) */
  transform-style: preserve-3d;
  transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

.compass-card {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.2);
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

/* 翻转类 */
.compass-card.flipped {
  transform: rotateY(180deg) translate3d(0, 0, 0);
}

/* 正反盘面 */
.compass-face {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: visible; /* 允许 3D Z轴层级穿出，不裁剪 */
  transform-style: preserve-3d;
  background-color: transparent; /* 改为透明以露出底下的防裁剪背板 */
  box-shadow: 0 0 36px rgba(0, 0, 0, 0.95);
  will-change: transform;
}

/* 3D 深度防裁剪背板 */
.compass-backplate {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background-color: #050707;
  border-radius: 50%;
  transform: translateZ(-150px); /* 挪到深处以防止倾斜的Canvas层穿透 */
  pointer-events: none;
}

.compass-front {
  z-index: 2;
  transform: rotate(0deg) translate3d(0, 0, 0);
}

.compass-back {
  transform: rotateY(180deg) translate3d(0, 0, 0);
}

/* 3D 浮合图层样式 */
.compass-layer {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background-color: transparent;
  pointer-events: none;
  transform-style: preserve-3d;
  will-change: transform;
  display: block;
  transform-origin: 50% 50%; /* 旋转中心固定在 canvas 正中，各层绕同一点转动 */
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* 3D 浮动星轨光晕 */
.orbit-rings {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 110%;
  height: 110%;
  pointer-events: none;
  z-index: 5;
  transform-style: preserve-3d;
  perspective: 500px; /* 3D 视距 (与wrapper一致) */
}

.orbit-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  transform-style: preserve-3d;
  transform: translate(-50%, -50%);
}

.orbit-1 {
  width: 86vmin;
  height: 86vmin;
  border: 1px dashed rgba(251, 206, 0, 0.2);
  box-shadow:
    0 0 15px rgba(251, 206, 0, 0.05),
    inset 0 0 15px rgba(251, 206, 0, 0.05);
  transform: translate(-50%, -50%) rotateX(65deg) rotateY(20deg) rotateZ(0deg);
  animation: orbit-rotate-1 25s linear infinite;
}

.orbit-2 {
  width: 98vmin;
  height: 98vmin;
  border: 1px double rgba(228, 23, 26, 0.15);
  box-shadow: 0 0 20px rgba(228, 23, 26, 0.05);
  transform: translate(-50%, -50%) rotateX(-60deg) rotateY(-25deg) rotateZ(0deg);
  animation: orbit-rotate-2 30s linear infinite;
}

.orbit-3 {
  width: 112vmin;
  height: 112vmin;
  border: 1px solid rgba(251, 206, 0, 0.1);
  box-shadow: 0 0 30px rgba(251, 206, 0, 0.03);
  transform: translate(-50%, -50%) rotateX(75deg) rotateY(-10deg) rotateZ(0deg);
  animation: orbit-rotate-3 35s linear infinite;
}

@keyframes orbit-rotate-1 {
  0% {
    transform: translate(-50%, -50%) rotateX(65deg) rotateY(20deg) rotateZ(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotateX(65deg) rotateY(20deg)
      rotateZ(360deg);
  }
}

@keyframes orbit-rotate-2 {
  0% {
    transform: translate(-50%, -50%) rotateX(-60deg) rotateY(-25deg)
      rotateZ(360deg);
  }
  100% {
    transform: translate(-50%, -50%) rotateX(-60deg) rotateY(-25deg)
      rotateZ(0deg);
  }
}

@keyframes orbit-rotate-3 {
  0% {
    transform: translate(-50%, -50%) rotateX(75deg) rotateY(-10deg)
      rotateZ(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotateX(75deg) rotateY(-10deg)
      rotateZ(360deg);
  }
}

/* 控制面板 */
.control-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  margin-bottom: 12px;
}

/* 通用按钮 */
.btn {
  border: none;
  border-radius: 25px;
  font-family: var(--font-zh);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  outline: none;
}

.btn-primary {
  width: 70%;
  max-width: 260px;
  height: 50px;
  font-size: 17px;
  color: #000000;
  background: linear-gradient(135deg, #ffe042 0%, var(--gold) 100%);
  box-shadow: 0 4px 15px rgba(251, 206, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-primary:active {
  transform: scale(0.95);
  box-shadow: 0 2px 6px rgba(251, 206, 0, 0.2);
}

.btn-secondary {
  width: 55%;
  max-width: 200px;
  height: 40px;
  font-size: 14px;
  color: var(--text-gold);
  background: rgba(251, 206, 0, 0.08);
  border: 1px solid var(--border-gold);
}

.btn-secondary:active {
  transform: scale(0.95);
  background: rgba(251, 206, 0, 0.15);
}

.controls-row {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 4px;
}

.btn-icon-only {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-white);
  font-size: 18px;
}

.btn-icon-only:active {
  transform: scale(0.9);
  background: rgba(255, 255, 255, 0.15);
}

/* 状态角标 */
.btn-icon-only {
  position: relative;
}

.badge-status {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-gray);
}

.badge-status.active {
  background-color: var(--green);
  box-shadow: 0 0 6px var(--green);
}

/* 结算弹窗 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  padding: 20px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 100%;
  max-width: 380px;
  background: rgba(15, 20, 20, 0.85);
  border: 1px solid var(--border-gold);
  border-radius: 24px;
  padding: 30px 24px;
  text-align: center;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.8),
    0 0 15px rgba(251, 206, 0, 0.1);
  transform: scale(0.85) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.15);
  position: relative;
}

.modal-overlay.active .modal-card {
  transform: scale(1) translateY(0);
}

/* 弹窗头部 */
.modal-pre-title {
  display: block;
  font-size: 12px;
  color: var(--text-gray);
  letter-spacing: 3px;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.modal-title {
  font-size: 24px;
  color: var(--text-gold);
  font-weight: 900;
  letter-spacing: 2px;
  margin-bottom: 16px;
}

.divider {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 0 auto 20px;
}

/* 弹窗内容 */
.modal-body {
  margin-bottom: 24px;
}

/* 吉凶徽章 */
.luck-badge {
  display: inline-block;
  font-size: 15px;
  font-weight: 900;
  color: #000000;
  background-color: var(--gold);
  padding: 4px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  letter-spacing: 1px;
  box-shadow: 0 0 8px rgba(251, 206, 0, 0.3);
}

.incense-info,
.direction-info {
  font-size: 15px;
  margin-bottom: 12px;
}

.incense-info .label,
.direction-info .label {
  color: var(--text-gray);
}

.incense-info .val,
.direction-info .val {
  color: var(--text-gold);
  font-weight: 700;
}

/* 宜忌框 */
.yiji-container {
  display: flex;
  gap: 16px;
  margin: 20px 0;
}

.yiji-box {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.yiji-box.yi {
  border: 1px solid rgba(50, 205, 50, 0.2);
}

.yiji-box.ji {
  border: 1px solid rgba(228, 23, 26, 0.2);
}

.yiji-label {
  font-size: 12px;
  font-weight: 900;
  border-radius: 4px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.yi .yiji-label {
  background-color: rgba(50, 205, 50, 0.2);
  color: var(--green);
}

.ji .yiji-label {
  background-color: rgba(228, 23, 26, 0.2);
  color: var(--red);
}

.yiji-text {
  font-size: 13px;
  color: var(--text-white);
  line-height: 1.4;
}

/* 八卦专属布局 */
.bagua-diagram {
  font-size: 56px;
  color: var(--gold);
  line-height: 1.2;
  margin-bottom: 16px;
  text-shadow: 0 0 16px var(--gold-glow);
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.info-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-item .label {
  font-size: 11px;
  color: var(--text-gray);
}

.info-item .val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-gold);
}

/* 占卜谶语 */
.divination-words {
  font-size: 14px;
  color: var(--text-gray);
  line-height: 1.6;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  padding-top: 16px;
  margin-top: 16px;
  font-style: italic;
}

/* 弹窗关闭按钮 */
.btn-modal-close {
  width: 100%;
  height: 45px;
  font-size: 15px;
  color: #000;
  background: var(--gold);
  border: none;
  border-radius: 22px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(251, 206, 0, 0.2);
  transition: all 0.2s;
}

.btn-modal-close:active {
  transform: scale(0.97);
  box-shadow: 0 2px 4px rgba(251, 206, 0, 0.1);
}

/* ===== 顶部状态栏（会员身份 + 剩余次数）===== */
.status-bar {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.user-status-card {
  width: 90%;
  max-width: 600px;
  background: rgba(15, 20, 20, 0.6);
  border: 1px solid rgba(251, 206, 0, 0.2);
  border-radius: 15px;
  padding: 6px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(10px);
}

.status-left, .status-right { display: flex; align-items: center; }
.status-label { font-size: 12px; color: #8A9A9A; }
.status-val { font-size: 13px; color: #FFFFFF; font-weight: bold; margin-left: 4px; }
.member-text { color: #FBCE00; text-shadow: 0 0 5px rgba(251, 206, 0, 0.6); }
.unlimited-text { color: #32CD32; text-shadow: 0 0 5px rgba(50, 205, 50, 0.6); }
.attempts-text { color: #F0D570; }

/* ===== 会员验证弹窗（复用 modal-overlay 结构）===== */
.member-input-desc {
  font-size: 13px;
  color: #8A9A9A;
  text-align: left;
  line-height: 1.5;
  margin-bottom: 12px;
}

.member-input {
  width: 100%;
  height: 44px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(251, 206, 0, 0.3);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 15px;
  color: #FFFFFF;
  outline: none;
}

.member-modal-footer {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  width: 100%;
}
.member-modal-footer .btn {
  flex: 1;
  height: 40px;
  padding: 0;
}

/* ===== 消息提示条 ===== */
.msg {
  padding: 8px 12px;
  border-radius: 6px;
  margin-top: 10px;
  font-size: 13px;
  display: none;
}
.msg.show { display: block; }
.msg.ok { background: rgba(50, 205, 50, 0.15); color: #32CD32; }
.msg.err { background: rgba(228, 23, 26, 0.15); color: #E4171A; }

/* ===== 历史记录抽屉 ===== */
.drawer-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  z-index: 110;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.drawer-overlay.active { opacity: 1; pointer-events: auto; }

.drawer-content {
  position: absolute;
  top: 0; right: 0;
  width: 75%;
  max-width: 380px;
  height: 100%;
  background: rgba(15, 20, 20, 0.95);
  border-left: 1px solid rgba(251, 206, 0, 0.2);
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  padding: 20px 15px;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}

.drawer-overlay.active .drawer-content { transform: translateX(0); }

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(251, 206, 0, 0.1);
  padding-bottom: 10px;
}

.drawer-title { font-size: 16px; color: #F0D570; font-weight: bold; }
.drawer-close-btn { font-size: 18px; color: #8A9A9A; cursor: pointer; padding: 5px; }

.drawer-list-view { flex: 1; width: 100%; overflow-y: auto; }

.empty-history {
  font-size: 13px;
  color: #8A9A9A;
  text-align: center;
  margin-top: 50px;
  font-style: italic;
}

.history-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.history-item-top { display: flex; justify-content: space-between; align-items: center; }
.history-item-title { font-size: 14px; color: #F0D570; font-weight: bold; }
.history-item-time { font-size: 11px; color: #8A9A9A; }
.history-item-bottom { display: flex; justify-content: space-between; align-items: flex-end; }
.history-item-detail { font-size: 12px; color: #FFFFFF; flex: 1; margin-right: 8px; }

.history-item-side-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: bold;
}
.badge-a { background: rgba(228, 23, 26, 0.15); color: #E4171A; border: 1px solid rgba(228, 23, 26, 0.3); }
.badge-b { background: rgba(251, 206, 0, 0.15); color: #FBCE00; border: 1px solid rgba(251, 206, 0, 0.3); }

