/* ===============================
   周易卦象 · Zen 宣纸风格
   （由原 Shopify section 样式抽出并中文化适配）
   =============================== */
:root {
  --zen-bg: #F9F7F2;
  --zen-ink: #2c2c2c;
  --zen-red: #BC2D2D;
  --zen-border: #dcd9d1;
  --zen-font-main: 'Noto Serif SC', 'Songti SC', 'STSong', serif;
  --zen-font-ui: 'Noto Serif SC', 'Helvetica Neue', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  position: relative;
  padding: 60px 16px 80px;
  min-height: 100vh;
  color: var(--zen-ink);
  background-color: var(--zen-bg);
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23dcd9d1' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  font-family: var(--zen-font-main);
  overflow-x: hidden;
}

.zen-circle-bg {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  max-width: 90vw;
  max-height: 90vw;
  border-radius: 50%;
  border: 1px solid rgba(44, 44, 44, 0.05);
  background-color: rgba(188, 45, 45, 0.02);
  pointer-events: none;
  z-index: 0;
}

.page-width {
  max-width: 960px;
  margin: 0 auto;
}
.relative { position: relative; }
.z-10 { z-index: 10; }
.text-center { text-align: center; }

/* 语言选择浮层 */
.lang-chooser {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(249, 247, 242, 0.96);
  backdrop-filter: blur(6px);
  padding: 24px;
}
.lang-chooser-card { text-align: center; max-width: 420px; }
.lang-chooser-title {
  font-family: var(--zen-font-main);
  font-size: clamp(26px, 6vw, 38px);
  font-weight: 700;
  letter-spacing: 0.15em;
  margin: 18px 0 4px;
}
.lang-chooser-title span { font-size: 0.5em; letter-spacing: 0.25em; color: #888; font-weight: 400; }
.lang-chooser-sub { color: #888; letter-spacing: 0.1em; margin-bottom: 28px; font-size: 0.95rem; }
.lang-chooser-btns { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.lang-chooser-btns .zen-btn { padding: 14px 32px; letter-spacing: 0.1em; }
.zen-seal.big { width: 72px; height: 72px; font-size: 1.8rem; margin: 0 auto; }

/* 语言切换按钮 */
.lang-toggle {
  position: absolute;
  top: 0;
  right: 0;
  background: transparent;
  border: 1px solid var(--zen-border);
  color: #777;
  font-family: var(--zen-font-ui);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.3s;
}
.lang-toggle:hover { border-color: var(--zen-red); color: var(--zen-red); }

/* Header & Seal */
.zen-header-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 40px;
}
.zen-seal {
  width: 56px;
  height: 56px;
  background-color: var(--zen-red);
  color: white;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.4rem;
  border: 2px solid #a02424;
  box-shadow: inset 0 0 5px rgba(0,0,0,0.3);
  font-family: var(--zen-font-main);
  margin-bottom: 16px;
  letter-spacing: 0.05em;
  mask-image: url("data:image/svg+xml,%3Csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.5' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.5'/%3E%3C/svg%3E");
}
.zen-h2 {
  font-family: var(--zen-font-main);
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--zen-ink);
  margin: 0;
}
.zen-subtitle {
  font-family: var(--zen-font-ui);
  font-size: 14px;
  letter-spacing: 0.3em;
  color: #666;
  margin-top: 12px;
}

/* Card */
.zen-form-card, .zen-result-card {
  max-width: 900px;
  margin: 0 auto 30px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(44, 44, 44, 0.1);
  padding: 40px;
  box-shadow: 0 10px 30px rgba(44, 44, 44, 0.05);
}
@media (max-width: 600px) {
  .zen-form-card, .zen-result-card { padding: 24px 18px; }
}

/* Button */
.zen-btn {
  background: transparent;
  border: 2px solid var(--zen-ink);
  padding: 14px 48px;
  font-family: var(--zen-font-main);
  font-size: 1.1rem;
  letter-spacing: 0.3em;
  cursor: pointer;
  transition: all 0.4s ease;
  color: var(--zen-ink);
  display: inline-block;
}
.zen-btn:hover { background-color: var(--zen-ink); color: var(--zen-bg); }
.zen-btn:disabled { opacity: 0.5; cursor: default; }
.zen-btn.casting { animation: shakePulse 0.5s ease-in-out infinite; }
@keyframes shakePulse {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-3px) rotate(-1deg); }
  75% { transform: translateX(3px) rotate(1deg); }
}

.mode-description { color: #777; }
.italic { font-style: italic; }
.mt-8 { margin-top: 32px; }
.mb-6 { margin-bottom: 24px; }

/* 起卦进度 */
.cast-progress {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 24px 0;
  min-height: 8px;
}
.cast-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--zen-border);
  transition: background 0.3s;
}
.cast-dot.filled { background: var(--zen-red); }

/* 摇铜钱动效 */
.coin-tray {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 22px;
  min-height: 86px;
  margin: 20px 0 6px;
  perspective: 700px;
}
.coin {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  background:
    radial-gradient(circle at 34% 30%, #d8b878 0%, #b8915a 38%, #97703f 72%, #7c5a30 100%);
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,0.45),
    inset 0 -3px 6px rgba(0,0,0,0.35),
    0 6px 10px rgba(60,40,20,0.28);
  border: 1px solid #6d4f2a;
  color: #5a3f20;
  font-family: var(--zen-font-main);
}
.coin::after { /* 方孔 */
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--zen-bg);
  border-radius: 2px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.4);
}
.coin .coin-face {
  position: relative;
  z-index: 2;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0;
  transform: translateY(-15px); /* 错开方孔，置于上方 */
  opacity: 0;
  transition: opacity 0.25s ease;
}
.coin.settled .coin-face { opacity: 1; }
.coin.settled.yang { color: var(--zen-red); box-shadow:
    inset 0 2px 4px rgba(255,255,255,0.5),
    inset 0 -3px 6px rgba(0,0,0,0.3),
    0 0 0 2px rgba(188,45,45,0.25),
    0 6px 10px rgba(60,40,20,0.28); }
.coin.settled.yin { color: #3a3a3a; }
.coin.tossing { animation: coinToss 0.88s cubic-bezier(0.3, 0.7, 0.3, 1) both; }
.coin:nth-child(2).tossing { animation-delay: 0.07s; }
.coin:nth-child(3).tossing { animation-delay: 0.14s; }
@keyframes coinToss {
  0%   { transform: translateY(0) rotateY(0deg) rotateX(0deg); }
  35%  { transform: translateY(-58px) rotateY(540deg) rotateX(180deg); }
  70%  { transform: translateY(-14px) rotateY(900deg) rotateX(320deg); }
  100% { transform: translateY(0) rotateY(1080deg) rotateX(360deg); }
}

.electronic-display { min-height: 60px; }
.electronic-display .line-result {
  font-family: var(--zen-font-main);
  font-size: 1.15rem;
  margin: 8px 0;
  animation: fadeInLine 0.5s ease;
}
.line-result .changing-mark { color: var(--zen-red); font-weight: bold; }
@keyframes fadeInLine { from { opacity:0; transform:translateY(10px);} to {opacity:1; transform:translateY(0);} }

.permission-note {
  font-size: 0.8rem;
  color: #999;
  margin-top: 14px;
}

/* Results */
.results-section { animation: fadeIn 0.8s ease-in-out; margin-top: 40px; }
@keyframes fadeIn { from { opacity:0; transform:translateY(20px);} to {opacity:1; transform:translateY(0);} }

.hexagram-row {
  display: flex;
  gap: 30px;
  justify-content: center;
  margin-bottom: 40px;
}
@media (max-width: 768px) { .hexagram-row { flex-direction: column; } }

.hexagram-card h2, .interpretation-card h2 {
  font-family: var(--zen-font-main);
  font-size: 1.6em;
  color: var(--zen-ink);
  border-bottom: 1px solid var(--zen-red);
  padding-bottom: 10px;
  margin-bottom: 20px;
  display: inline-block;
}
.hexagram-card .symbol {
  font-size: 6em;
  line-height: 1;
  color: var(--zen-ink);
  margin: 20px 0;
  text-shadow: 2px 2px 0px rgba(0,0,0,0.05);
}
.hexagram-card .name {
  font-family: var(--zen-font-main);
  font-size: 1.5em;
  font-weight: bold;
  letter-spacing: 0.08em;
}
.hexagram-card .pinyin { color: #999; font-size: 0.95rem; margin-top: 4px; }

.interpretation-title {
  font-family: var(--zen-font-ui);
  font-size: 0.9em;
  letter-spacing: 0.25em;
  color: #888;
  margin-top: 24px;
  margin-bottom: 12px;
  border-top: 1px solid #eee;
  padding-top: 20px;
}

.judgement-overview, .line-list { text-align: left; font-size: 0.97rem; line-height: 1.7; color: #444; }
.judgement-text { font-weight: bold; color: var(--zen-ink); margin-bottom: 6px; font-size: 1.05rem; }

.line-list .line { padding: 10px 8px; border-bottom: 1px dotted #eee; }
.line-list .line.changing { background-color: rgba(188, 45, 45, 0.06); border-left: 3px solid var(--zen-red); }
.line-text { font-weight: bold; color: var(--zen-ink); }
.line-meaning { color: #666; margin-top: 4px; }

/* 判读依据 提示条 */
.divination-hint {
  text-align: center;
  font-family: var(--zen-font-main);
  font-size: 1.1rem;
  color: var(--zen-red);
  background: rgba(188, 45, 45, 0.06);
  border: 1px dashed var(--zen-red);
  padding: 16px 20px;
  margin-bottom: 28px;
  letter-spacing: 0.05em;
}
.divination-hint .hint-label {
  display: block;
  font-family: var(--zen-font-ui);
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  color: #999;
  margin-bottom: 6px;
}

/* Final Reading Blocks */
.interpretation-block { margin-bottom: 30px; text-align: left; }
.interpretation-block .block-title {
  font-family: var(--zen-font-ui);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  color: var(--zen-red);
  margin-bottom: 10px;
}
.interpretation-block .original-text {
  font-family: var(--zen-font-main);
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--zen-ink);
  background: rgba(0,0,0,0.03);
  padding: 15px;
  border-left: 3px solid var(--zen-red);
  margin-bottom: 12px;
  line-height: 1.7;
}
.interpretation-block .meaning-text { line-height: 1.9; color: #555; }

/* 四方面（并入卦象判读卡） */
.aspects-inner {
  margin-top: 28px;
  border-top: 1px solid var(--zen-border);
  padding-top: 20px;
}
.aspects-subtitle {
  font-family: var(--zen-font-ui);
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  color: #888;
  margin-bottom: 16px;
}
.aspect-block { border-left: 3px solid var(--zen-border); padding-left: 14px; margin-bottom: 18px; }
.aspect-block .block-title { color: var(--zen-red); font-size: 0.9rem; letter-spacing: 0.2em; }

footer.zen-footer {
  text-align: center;
  margin-top: 48px;
  color: #aaa;
  font-size: 0.8rem;
  font-family: var(--zen-font-ui);
  letter-spacing: 0.1em;
}
