:root {
  --bg-primary: #0a0b0d;
  --bg-panel: rgba(22, 24, 29, 0.85);
  --gold-main: #d4af37;
  --gold-light: #f7e7b4;
  --gold-dark: #8c6d1f;
  --vermilion: #b93a32;
  --cinnabar-glow: rgba(185, 58, 50, 0.4);
  --text-main: #f0ede6;
  --text-muted: #8d929a;
  --border-color: rgba(212, 175, 55, 0.25);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: 'Noto Serif SC', 'PingFang SC', serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 30px 15px;
  overflow-x: hidden;
  position: relative;
}

/* 背景光效与太极暗纹 */
.bg-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.08) 0%, rgba(0,0,0,0) 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
}

.taiji-bg {
  position: fixed;
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, transparent 40%, rgba(10, 11, 13, 0.9) 80%),
              repeating-radial-gradient(circle, transparent 0, transparent 40px, rgba(212,175,55,0.03) 41px, transparent 42px);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
}

.container {
  width: 100%;
  max-width: 680px;
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  border-radius: 20px;
  padding: 36px 30px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--border-color);
  position: relative;
  z-index: 1;
}

/* 头部 */
header {
  text-align: center;
  margin-bottom: 30px;
}

.bagua-badge {
  font-size: 14px;
  letter-spacing: 6px;
  color: var(--gold-dark);
  margin-bottom: 6px;
}

header h1 {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 4px;
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold-main) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: 2px;
  margin-top: 8px;
}

/* 3D 投币台 */
.cast-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  margin-bottom: 32px;
}

.plate-base {
  width: 100%;
  max-width: 440px;
  height: 160px;
  background: radial-gradient(ellipse at center, #1e2229 0%, #101216 100%);
  border-radius: 50%;
  border: 2px solid rgba(212, 175, 55, 0.3);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.9), 0 10px 20px rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1000px;
}

.coins-group {
  display: flex;
  gap: 32px;
}

/* 3D 铜钱实体 */
.coin-3d {
  width: 68px;
  height: 68px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.3, 1.2);
}

.coin-face {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  backface-visibility: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.8), 0 4px 10px rgba(0,0,0,0.6);
  border: 3px solid #8b6d23;
  background: radial-gradient(circle, #f3d87d 20%, #b88d2a 70%, #5e440f 100%);
}

/* 方孔造型 */
.coin-face::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background-color: #101216;
  border: 2px solid #684f15;
}

/* 字面 (正面/阳) */
.coin-front {
  color: #382402;
  font-size: 10px;
  font-weight: 900;
  text-align: center;
  line-height: 1.1;
  text-shadow: 0 1px 1px rgba(255,255,255,0.3);
}

/* 背面 (阴) */
.coin-back {
  transform: rotateY(180deg);
}

.coin-back .manchu-pattern {
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, transparent 30%, rgba(70, 48, 8, 0.3) 70%);
  border-radius: 50%;
}

/* 翻转动画 */
.coin-3d.flipping {
  animation: coinFly 0.75s ease-in-out infinite;
}

@keyframes coinFly {
  0% { transform: translateY(0) rotateX(0deg) rotateY(0deg) scale(1); }
  50% { transform: translateY(-40px) rotateX(540deg) rotateY(360deg) scale(1.15); }
  100% { transform: translateY(0) rotateX(1080deg) rotateY(720deg) scale(1); }
}

/* 按钮区 */
.action-bar {
  display: flex;
  gap: 16px;
  align-items: center;
}

.btn {
  border: none;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  border-radius: 30px;
  transition: all 0.25s ease;
}

.btn-gold {
  background: linear-gradient(135deg, #e6c86e 0%, #b88d2a 100%);
  color: #1a1202;
  padding: 12px 30px;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.btn-gold:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
}

.btn-gold:disabled {
  background: #2a2d34;
  color: #555a64;
  cursor: not-allowed;
  box-shadow: none;
}

.step-tag {
  font-size: 12px;
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 8px;
  border-radius: 12px;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 12px 20px;
  font-size: 14px;
}

.btn-outline:hover {
  color: var(--gold-light);
  border-color: var(--gold-main);
}

/* 爻位展示面板 */
.board-panel {
  background: rgba(12, 13, 16, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 24px;
}

.panel-header {
  display: grid;
  grid-template-columns: 60px 80px 1fr 60px;
  font-size: 12px;
  color: var(--text-muted);
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
}

.lines-track {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.yao-slot {
  display: grid;
  grid-template-columns: 60px 80px 1fr 60px;
  align-items: center;
  background: rgba(25, 28, 35, 0.4);
  padding: 10px 0;
  border-radius: 8px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.yao-slot.active {
  background: rgba(35, 40, 50, 0.8);
  color: var(--text-main);
}

/* 图形化爻条 */
.yao-graphic {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  height: 12px;
}

/* 阳爻：一条通贯金条 */
.yao-yang-bar {
  width: 140px;
  height: 8px;
  background: linear-gradient(90deg, #9b2820, #d94b40, #9b2820);
  border-radius: 4px;
  box-shadow: 0 0 8px var(--cinnabar-glow);
}

/* 阴爻：两断条 */
.yao-yin-seg {
  width: 62px;
  height: 8px;
  background: linear-gradient(90deg, #2b4c7e, #4a7ab5, #2b4c7e);
  border-radius: 4px;
}

.is-changing {
  position: relative;
}
.is-changing::after {
  content: '● 动';
  position: absolute;
  right: -24px;
  color: #f39c12;
  font-size: 11px;
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* 解卦卡片 */
.result-section {
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-card {
  position: relative;
  background: linear-gradient(180deg, #181b22 0%, #121419 100%);
  border: 1px solid var(--gold-main);
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 0 30px rgba(212, 175, 55, 0.15);
}

/* 四角中式暗纹装饰 */
.card-ornament {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid var(--gold-main);
}
.top-left { top: 6px; left: 6px; border-right: none; border-bottom: none; }
.top-right { top: 6px; right: 6px; border-left: none; border-bottom: none; }
.bottom-left { bottom: 6px; left: 6px; border-right: none; border-top: none; }
.bottom-right { bottom: 6px; right: 6px; border-left: none; border-top: none; }

.hexagram-header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  margin-bottom: 20px;
}

.hex-item {
  text-align: center;
}

.hex-badge {
  font-size: 11px;
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-light);
  border: 1px solid var(--gold-dark);
  padding: 2px 10px;
  border-radius: 10px;
  display: inline-block;
  margin-bottom: 6px;
}

.badge-change {
  background: rgba(185, 58, 50, 0.2);
  border-color: var(--vermilion);
  color: #ff8b83;
}

.gold-gradient-text {
  font-size: 24px;
  font-weight: 900;
  background: linear-gradient(180deg, #ffffff 0%, var(--gold-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.trans-indicator {
  color: var(--gold-main);
  font-size: 14px;
  font-weight: bold;
}

.divider-line {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-color), transparent);
  margin-bottom: 20px;
}

.analysis-box {
  margin-bottom: 18px;
}

.analysis-box h3 {
  font-size: 14px;
  color: var(--gold-light);
  margin-bottom: 6px;
}

.text-body {
  font-size: 15px;
  line-height: 1.8;
  color: #d1d5db;
}

.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.grid-card {
  background: rgba(10, 11, 14, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 14px;
  border-radius: 10px;
}

.grid-card h4 {
  font-size: 13px;
  color: var(--gold-main);
  margin-bottom: 6px;
}

.grid-card p {
  font-size: 13px;
  line-height: 1.6;
  color: #a0a6b2;
}

.changing-note {
  margin-top: 16px;
  font-size: 13px;
  color: #e59866;
  text-align: center;
}

.btn-reset {
  width: 100%;
  margin-top: 24px;
  padding: 14px;
  justify-content: center;
}

.hidden {
  display: none !important;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.ancient-text {
  font-size: 16px;
  color: var(--gold-light);
  letter-spacing: 1px;
  font-weight: 600;
}

.trans-text {
  color: #d1d5db;
  font-size: 14px;
  line-height: 1.7;
}

.image-text {
  color: #e5c07b;
  font-size: 14px;
  font-style: italic;
  line-height: 1.7;
}

.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}