/* ==========================================================================
   塔罗牌占卜 · 神秘塔罗视觉规范
   深色底 + 烫金线条 / 午夜靛紫 / 暗夜星尘
   ========================================================================== */

:root {
  /* —— 配色（严格按规范） —— */
  --bg: #0b0a1f;
  --bg-2: #1c1740;
  --line: #2a2350;

  --gold: #d4af37;
  --gold-hi: #e8c874;
  --gold-dim: #a98a3f;

  --purple: #6b4fbb;
  --purple-hi: #8b6fd4;

  --text: #ede6d6;
  --text-2: #9a93b8;
  /* 正文级次要文字：规范色 #9A93B8 在深底上约 6.7:1，未达 7:1，
     此处提亮一档（约 8.5:1），仅用于承载内容的文字；
     纯装饰性元素仍使用规范原色 --text-2。 */
  --text-2-strong: #ada7c8;
  --disabled: #5a5478;
  --accent: #c9a227;

  /* —— 字体 —— */
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun",
    "STSong", "Noto Serif CJK SC", Georgia, serif;
  --sans: "Noto Sans SC", "Source Han Sans SC", "PingFang SC",
    "Microsoft YaHei", "Hiragino Sans GB", "Heiti SC", "Noto Sans CJK SC",
    system-ui, -apple-system, "Segoe UI", sans-serif;

  /* —— 尺度 —— */
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  --glow-gold: 0 0 0 1px rgba(212, 175, 55, 0.28),
    0 0 26px rgba(212, 175, 55, 0.13);
  --nav-h: 62px;
  --wrap: 1180px;

  /* —— 动效 —— */
  --dur-fast: 0.18s;
  --dur: 0.32s;
  --dur-slow: 0.62s;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* {
  box-sizing: border-box;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  /* 正文不小于 14px；行高 1.6 以上 */
  font-size: 16px;
  line-height: 1.75;
  min-height: 100vh;
  overflow-x: hidden;
  /* 禁止双击缩放 */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  /* 深色底上的浅色文字：关闭次像素渲染，消除彩边，观感更干净锐利 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}

/* 全局滚动：整页平滑滚动（尊重 reduced-motion，见文件末尾） */
html {
  scroll-behavior: smooth;
}

/* 深空底色：径向渐变 + 极淡星云，外缘压暗形成暗角，衬托星尘粒子 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(
      140% 105% at 50% 45%,
      transparent 46%,
      rgba(4, 3, 12, 0.5) 100%
    ),
    radial-gradient(
      1200px 700px at 18% -10%,
      rgba(107, 79, 187, 0.22),
      transparent 62%
    ),
    radial-gradient(
      900px 600px at 88% 8%,
      rgba(139, 111, 212, 0.13),
      transparent 60%
    ),
    radial-gradient(
      1000px 800px at 50% 118%,
      rgba(201, 162, 39, 0.07),
      transparent 65%
    ),
    var(--bg);
}

/* 星尘粒子画布 */
#starfield {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.85;
}

/* --------------------------------------------------------------------------
   排版
   -------------------------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 0.5em;
  letter-spacing: 0.02em;
}

h1 {
  font-size: 30px;
}
h2 {
  font-size: 24px;
}
h3 {
  font-size: 20px;
}
h4 {
  font-size: 17px;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--gold);
  text-decoration: none;
}
a:hover {
  color: var(--gold-hi);
}

/* 金色细线分隔（装饰，不压文字） */
.rule {
  height: 1px;
  border: 0;
  margin: 26px 0;
  background: linear-gradient(
    90deg,
    transparent,
    var(--line) 12%,
    var(--gold-dim) 50%,
    var(--line) 88%,
    transparent
  );
  opacity: 0.75;
}

.muted {
  color: var(--text-2-strong);
}
.meta {
  /* 用提亮后的次文字色：规范色 #9A93B8 在深底上约 6.7:1，未达 7:1 */
  color: var(--text-2-strong);
  font-size: 14px;
}
.center {
  text-align: center;
}
.nowrap {
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   布局外壳
   -------------------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 22px;
}

/* 顶部导航 */
.nav {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: rgba(11, 10, 31, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}

.nav .wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;          /* 只扩大点击热区，视觉不变 */
  font-family: var(--serif);
  font-size: 19px;
  color: var(--text);
  letter-spacing: 0.08em;
  white-space: nowrap;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.brand svg {
  flex: none;
}

.brand:hover {
  color: var(--gold-hi);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.nav-link {
  font-family: var(--sans);
  font-size: 15px;
  color: var(--text-2-strong);
  background: none;
  border: 0;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 44px;
  transition: color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease);
}

.nav-link:hover {
  color: var(--text);
  background: rgba(107, 79, 187, 0.18);
}

.nav-link[aria-current="true"] {
  color: var(--gold);
  background: rgba(212, 175, 55, 0.1);
}

/* 醒目的下载入口 */
.nav-link.is-download {
  color: var(--gold);
  border: 1px solid rgba(212, 175, 55, 0.5);
  margin-left: 6px;
  padding: 8px 16px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.nav-link.is-download:hover {
  color: var(--bg);
  background: var(--gold);
  border-color: var(--gold);
}

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(28, 23, 64, 0.7);
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* 主内容 */
main {
  padding: 34px 0 60px;
  min-height: calc(100vh - var(--nav-h) - 200px);
  /* 限制重绘范围，切换视图时不牵连整页 */
  contain: layout style;
}

.view[hidden] {
  display: none;
}

/* --------------------------------------------------------------------------
   视图切换动效
   切换时不直接「硬替换」：新视图做一次轻微的淡入上浮，配合导航高亮位移，
   读起来是连贯的推进而不是闪断。全部走 transform/opacity，只触发合成。
   -------------------------------------------------------------------------- */
.view.is-entering {
  animation: view-in var(--dur) var(--ease) both;
  will-change: opacity, transform;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translate3d(0, 12px, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* 视图内的区块依次入场，形成轻微的层次感（stagger 由 app.js 赋 --i） */
.view.is-entering .stagger {
  animation: stagger-in var(--dur) var(--ease) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

@keyframes stagger-in {
  from {
    opacity: 0;
    transform: translate3d(0, 14px, 0) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.view-head {
  margin-bottom: 26px;
}

.view-head p {
  max-width: 62ch;
}

/* --------------------------------------------------------------------------
   按钮
   -------------------------------------------------------------------------- */
.btn {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.2;
  color: var(--text);
  background: rgba(28, 23, 64, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 22px;
  min-height: 44px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: transform var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
}

.btn:hover {
  border-color: rgba(212, 175, 55, 0.55);
  background: rgba(43, 35, 88, 0.95);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 2px solid var(--gold-hi);
  outline-offset: 2px;
}

.btn:disabled {
  color: var(--disabled);
  border-color: var(--line);
  background: rgba(28, 23, 64, 0.5);
  cursor: not-allowed;
  transform: none;
}

/* 金色描边主按钮 */
.btn-gold {
  color: var(--gold);
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid var(--gold);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.btn-gold:hover {
  color: #14112e;
  background: var(--gold);
  border-color: var(--gold-hi);
  box-shadow: 0 0 26px rgba(212, 175, 55, 0.34);
}

.btn-gold:disabled {
  color: var(--disabled);
  background: transparent;
  border-color: var(--line);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text-2-strong);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--purple-hi);
  background: rgba(107, 79, 187, 0.16);
}

.btn-sm {
  font-size: 14px;
  padding: 9px 15px;
  min-height: 44px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

/* --------------------------------------------------------------------------
   面板 / 卡片
   -------------------------------------------------------------------------- */
.panel {
  background: linear-gradient(
    160deg,
    rgba(28, 23, 64, 0.92),
    rgba(20, 17, 48, 0.92)
  );
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  /* 顶边一道极淡的暖金高光，让面板从深底上「浮」起来，边界更清晰 */
  box-shadow: var(--shadow), inset 0 1px 0 rgba(232, 200, 116, 0.08);
}

.panel-gold {
  border-color: rgba(212, 175, 55, 0.32);
  box-shadow: var(--shadow), inset 0 0 42px rgba(212, 175, 55, 0.045);
}

.panel + .panel {
  margin-top: 20px;
}

/* 装饰角线（仅作边框，不覆盖文字） */
.corner-frame {
  position: relative;
}

.corner-frame::before,
.corner-frame::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(212, 175, 55, 0.45);
  pointer-events: none;
}

.corner-frame::before {
  top: 8px;
  left: 8px;
  border-right: 0;
  border-bottom: 0;
}

.corner-frame::after {
  bottom: 8px;
  right: 8px;
  border-left: 0;
  border-top: 0;
}

/* --------------------------------------------------------------------------
   首页：提问区
   （首页的 Hero、分隔线、四步流程、牌阵卡片、FAQ、页脚见文件末尾
     「界面优化 · 参考 tarot.run 的设计语言」一节）
   -------------------------------------------------------------------------- */
/* 提问区 */
.field-label {
  display: block;
  font-size: 15px;
  color: var(--text-2-strong);
  margin-bottom: 9px;
}

textarea.question {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  background: rgba(11, 10, 31, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  padding: 14px;
  transition: border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
}

textarea.question::placeholder {
  color: var(--disabled);
}

textarea.question:focus {
  outline: none;
  border-color: rgba(212, 175, 55, 0.6);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12);
}

.field-hint {
  font-size: 14px;
  color: var(--text-2-strong);
  margin-top: 8px;
}

/* 问题字数提示：紧跟输入框，右对齐、不抢视觉 */
.field-count {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-2-strong);
  text-align: right;
  font-variant-numeric: tabular-nums;
}


/* 每日一牌 */
.daily-card {
  display: flex;
  gap: 18px;
  align-items: center;
}

.daily-card .card-slot {
  flex: none;
  width: 108px;
}

.daily-card .daily-body {
  min-width: 0;
}

.daily-card .daily-title {
  font-family: var(--serif);
  font-size: 20px;
  margin: 0 0 4px;
  color: var(--gold-hi);
}

/* --------------------------------------------------------------------------
   塔罗牌面
   -------------------------------------------------------------------------- */
.card-slot {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  perspective: 1200px;
  /* 提升为独立合成层，翻牌时不与周围内容一起重绘 */
  transform: translateZ(0);
}

.card-3d {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform var(--dur-slow) cubic-bezier(0.2, 0.72, 0.24, 1);
  will-change: transform;
}

.card-3d.flipped {
  transform: rotateY(180deg) translateZ(0);
}

.card-face,
.card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(212, 175, 55, 0.42);
  background: #100e28;
}

.card-back {
  display: block;
}

.card-face {
  transform: rotateY(180deg);
}

.card-face img,
.card-back img {
  display: block;
  width: 100%;
  height: 100%;
  /* 位图牌面：等比装入容器，不拉伸变形 */
  object-fit: contain;
}

/* 逆位标记 */
.rev-badge {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  font-size: 13px;
  letter-spacing: 0.14em;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.5);
  background: rgba(11, 10, 31, 0.88);
  color: var(--gold-hi);
  white-space: nowrap;
}

.card-slot.is-reversed .card-face img {
  transform: rotate(180deg);
}

.card-slot.is-reversed .card-face {
  transform: rotateY(180deg);
}

/* 牌面下的牌名 */
.card-caption {
  margin-top: 9px;
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
}

.card-caption .cap-name {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--text);
  display: block;
}

.card-caption .cap-pos {
  color: var(--gold);
  font-size: 14px;
  letter-spacing: 0.06em;
}

/* --------------------------------------------------------------------------
   占卜流程
   -------------------------------------------------------------------------- */
.stage {
  display: none;
}

.stage.is-active {
  display: block;
  animation: fade-up var(--dur) var(--ease);
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.reading-question {
  font-family: var(--serif);
  font-size: 19px;
  color: var(--gold-hi);
  border-left: 2px solid var(--gold-dim);
  padding: 2px 0 2px 14px;
  margin-bottom: 20px;
  word-break: break-word;
}

.reading-question .rq-label {
  display: block;
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.18em;
  color: var(--text-2-strong);
  margin-bottom: 3px;
}

/* 问题正文最多 3 行，超出省略；完整文本挂在容器的 title 上 */
.reading-question .rq-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 洗牌 */
.shuffle-stage {
  text-align: center;
  padding: 20px 0 8px;
}

.shuffle-deck {
  position: relative;
  width: 150px;
  height: 225px;
  margin: 10px auto 26px;
}

.shuffle-deck .sh-card {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.42);
  background: #100e28;
  overflow: hidden;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}

.shuffle-deck .sh-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* 洗牌动画（1.5-2.5s），尊重 reduced-motion 时整体关闭 */
.shuffle-deck.is-shuffling .sh-card:nth-child(1) {
  animation: sh-a 1.05s var(--ease) infinite;
}
.shuffle-deck.is-shuffling .sh-card:nth-child(2) {
  animation: sh-b 0.92s var(--ease) infinite;
}
.shuffle-deck.is-shuffling .sh-card:nth-child(3) {
  animation: sh-c 1.18s var(--ease) infinite;
}
.shuffle-deck.is-shuffling .sh-card:nth-child(4) {
  animation: sh-d 0.86s var(--ease) infinite;
}

@keyframes sh-a {
  0%,
  100% {
    transform: translate(-2px, 0) rotate(-3deg);
  }
  50% {
    transform: translate(-34px, -12px) rotate(-15deg);
  }
}
@keyframes sh-b {
  0%,
  100% {
    transform: translate(2px, 0) rotate(3deg);
  }
  50% {
    transform: translate(34px, -10px) rotate(14deg);
  }
}
@keyframes sh-c {
  0%,
  100% {
    transform: translate(0, 1px) rotate(0deg);
  }
  50% {
    transform: translate(-14px, 14px) rotate(-8deg);
  }
}
@keyframes sh-d {
  0%,
  100% {
    transform: translate(0, -1px) rotate(0deg);
  }
  50% {
    transform: translate(16px, 12px) rotate(7deg);
  }
}

.progress-track {
  width: min(340px, 82%);
  height: 3px;
  margin: 0 auto 16px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold-hi));
  transition: width 0.2s linear;
}

/* 抽牌扇形 */
.pick-stage {
  text-align: center;
}

.pick-fan {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 22px auto 20px;
  max-width: 940px;
}

/* 发牌入场：逐张错开，形成「牌摊开」的连续感而不是整体闪现 */
.pick-fan.is-dealing .pick-card {
  animation: deal-in 0.42s cubic-bezier(0.16, 0.84, 0.28, 1) both;
  animation-delay: calc(var(--i, 0) * 26ms);
}

@keyframes deal-in {
  from {
    opacity: 0;
    transform: translate3d(0, 26px, 0) rotate(calc(var(--tilt, 0deg) * 2)) scale(0.9);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.pick-card {
  position: relative;
  width: 78px;
  aspect-ratio: 2 / 3;
  border-radius: 7px;
  border: 1px solid rgba(212, 175, 55, 0.4);
  background: #100e28;
  padding: 0;
  touch-action: manipulation;
  cursor: pointer;
  overflow: hidden;
  transition: transform var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease), opacity var(--dur) var(--ease);
}

.pick-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.pick-card:hover:not(:disabled) {
  transform: translateY(-10px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.55), var(--glow-gold);
}

.pick-card:focus-visible {
  outline: 2px solid var(--gold-hi);
  outline-offset: 3px;
}

.pick-card:disabled {
  cursor: default;
}

.pick-card.is-picked {
  opacity: 0.32;
  transform: translateY(6px) scale(0.94);
}

.pick-card.is-picked::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(11, 10, 31, 0.6);
}

.pick-counter {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--gold-hi);
  font-variant-numeric: tabular-nums;
}

/* 牌阵台面 */
.spread-stage {
  position: relative;
  width: 100%;
  margin: 0 auto;
}

.spread-board {
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: radial-gradient(
      120% 90% at 50% 0%,
      rgba(107, 79, 187, 0.16),
      transparent 70%
    ),
    linear-gradient(160deg, rgba(28, 23, 64, 0.75), rgba(11, 10, 31, 0.85));
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.spread-board[data-layout="single"] {
  --pw: 24%;
  aspect-ratio: 16 / 9;
}
.spread-board[data-layout="three"] {
  --pw: 18%;
  aspect-ratio: 16 / 7;
}
/* 十字牌阵：五张牌，横向间距 0.3、纵向间距 0.3。
   纵向要同时容纳牌高与下方牌位标签，所以牌阵比三张牌阵高。 */
.spread-board[data-layout="cross5"] {
  --pw: 12%;
  aspect-ratio: 21 / 20;
}
.spread-board[data-layout="celtic"] {
  /* 凯尔特十字右侧四张牌纵向间距只有 0.24*牌阵高，
     牌高必须连同比下方的牌位标签一起塞进这个间距，否则会互相压住。
     因此这里把牌缩小并把牌阵拉高，保证每张牌和它的标签都完整可读。 */
  --pw: 8.6%;
  aspect-ratio: 13 / 10;
}

/* 牌位外层：只负责定位（含翻牌入场动画），不接收点击；
   真正的点击目标是内部的 .board-pos 按钮，它的点击区会随旋转一起转。 */
.board-pos-wrap {
  position: absolute;
  width: var(--pw, 13%);
  transform: translate(-50%, -50%);
  will-change: transform;
  /* 外层只负责定位与入场动画，不接收点击：
     否则它那一整块竖矩形会盖住下面那张牌，点被压住的牌会命中上面这张。 */
  pointer-events: none;
}

.board-pos {
  position: relative;
  display: block;
  width: 100%;
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  will-change: transform;
  pointer-events: auto;
  /* 允许双指缩放后，双击不再被放大劫持，点击也不用等 300ms */
  touch-action: manipulation;
}

/* 牌落位入场：按牌位顺序依次落定 */
.spread-board.is-dealing .board-pos-wrap {
  animation: place-in 0.46s cubic-bezier(0.16, 0.84, 0.28, 1) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}

@keyframes place-in {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) translate3d(0, -26px, 0) scale(0.88);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.board-pos .card-slot {
  width: 100%;
}

/* 压在正中那张：旋转施加在按钮上，点击区随视觉一起变成横牌，
   否则它会和下面那张竖牌的可点区域完全重合，导致被压住的牌点不到。 */
.board-pos.rot-90 {
  transform: rotate(90deg);
}

.board-pos-wrap .pos-tag {
  margin-top: 7px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--gold);
  text-align: center;
  letter-spacing: 0.02em;
  pointer-events: auto;
  cursor: pointer;
}

.board-pos-wrap .pos-tag .num {
  display: block;
  color: var(--text-2-strong);
  font-size: 13px;
}

.board-pos:focus-visible {
  outline: 2px solid var(--gold-hi);
  outline-offset: 4px;
  border-radius: 8px;
}

.board-pos:hover .card-slot {
  box-shadow: var(--glow-gold);
  border-radius: 8px;
}

/* 牌阵上牌未翻开时的呼吸感 */
.board-pos:not(.is-open) .card-back {
  box-shadow: inset 0 0 20px rgba(212, 175, 55, 0.14);
}

/* 解读列表 */
.reading-list {
  margin-top: 24px;
  display: grid;
  gap: 12px;
}

.reading-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(28, 23, 64, 0.62);
  overflow: hidden;
}

.reading-item.is-open {
  border-color: rgba(212, 175, 55, 0.42);
}

.reading-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  background: none;
  border: 0;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  min-height: 44px;
}

.reading-head:hover {
  background: rgba(107, 79, 187, 0.12);
}

.reading-head .rh-pos {
  flex: none;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--gold);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

.reading-head .rh-name {
  font-family: var(--serif);
  font-size: 18px;
  min-width: 0;
}

.reading-head .rh-orient {
  font-size: 14px;
  color: var(--text-2-strong);
  white-space: nowrap;
}

.reading-head .rh-chev {
  margin-left: auto;
  flex: none;
  color: var(--text-2);
  transition: transform var(--dur-fast) var(--ease);
}

.reading-item.is-open .rh-chev {
  transform: rotate(180deg);
}

.reading-body {
  /* 用 grid-template-rows 的 0fr -> 1fr 过渡做高度动画：
     display:none 无法过渡，而 max-height 猜数值会导致动画忽快忽慢。
     不支持该特性的浏览器会退化为瞬时展开，功能不受影响。 */
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  overflow: hidden;
  transition: grid-template-rows var(--dur) var(--ease),
    opacity var(--dur) var(--ease);
}

.reading-item.is-open .reading-body {
  grid-template-rows: 1fr;
  opacity: 1;
}

.reading-body .rb-inner {
  min-height: 0;
  padding: 0 18px 18px;
}

/* 牌义区顶部的对应牌面小图 */
.reading-body .rb-card-fig {
  text-align: center;
  margin: 4px 0 16px;
  padding-bottom: 14px;
  border-bottom: 1px dashed rgba(212, 175, 55, 0.18);
}

.reading-body .rb-card-img {
  display: block;
  margin: 0 auto;
  width: 92px;
  aspect-ratio: 2 / 3;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.35);
  background: #100e28;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5);
}

/* 逆位与牌阵上那张保持一致：整张倒转 180° */
.reading-body .rb-card-img.is-reversed {
  transform: rotate(180deg);
}

.reading-body .rb-card-cap {
  margin-top: 8px;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--text-2-strong);
}

/* 牌阵总结（全部翻开后出现） */
.summary {
  margin-top: 22px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(28, 23, 64, 0.72), rgba(11, 10, 31, 0.86));
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.45);
  animation: view-in var(--dur) var(--ease) both;
}

.summary[hidden] {
  display: none;
}

.summary .sm-title {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--gold);
}

.summary .sm-list {
  display: grid;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px dashed rgba(212, 175, 55, 0.18);
}

.summary .sm-line {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: start;
  gap: 10px;
  font-size: 14px;
  line-height: 1.5;
}

.summary .sm-main {
  min-width: 0;
}

.summary .sm-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.summary .sm-sub {
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-2);
  opacity: 0.92;
}

.summary .sm-pos {
  color: var(--text-2-strong);
  font-variant-numeric: tabular-nums;
}

.summary .sm-name {
  color: var(--text);
}

.summary .sm-orient {
  margin-left: 4px;
  font-style: normal;
  font-size: 12px;
  color: var(--gold);
}

.summary .sm-kw {
  font-size: 13px;
  color: var(--text-2);
  text-align: right;
}

.summary .sm-text p {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-2);
}

.summary .sm-text p:last-child {
  margin-bottom: 0;
}

.summary .sm-text .sm-lead {
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.8;
}

.summary .sm-note {
  color: var(--gold);
  opacity: 0.85;
}

/* 占卜流程内部阶段切换（洗牌 → 抽牌 → 牌阵） */
.stage-anim {
  animation: view-in var(--dur) var(--ease) both;
}

.reading-body .rb-block + .rb-block {
  margin-top: 16px;
}

.reading-body .rb-label {
  font-size: 14px;
  letter-spacing: 0.14em;
  color: var(--gold);
  margin-bottom: 5px;
}

.reading-body .rb-text {
  color: var(--text);
  line-height: 1.8;
  margin: 0;
}

.keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.keywords li {
  font-size: 14px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.34);
  background: rgba(212, 175, 55, 0.07);
  color: var(--gold-hi);
}

.keywords.is-rev li {
  border-color: rgba(139, 111, 212, 0.45);
  background: rgba(107, 79, 187, 0.14);
  color: #c3b6ea;
}

.pos-meaning {
  font-size: 14px;
  color: var(--text-2-strong);
  font-style: italic;
}

/* --------------------------------------------------------------------------
   牌库
   -------------------------------------------------------------------------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  align-items: center;
}

.chip {
  font-size: 14px;
  padding: 8px 16px;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(28, 23, 64, 0.6);
  color: var(--text-2-strong);
  cursor: pointer;
  font-family: var(--sans);
  display: inline-flex;
  align-items: center;
  transition: all var(--dur-fast) var(--ease);
}

.chip:hover {
  color: var(--text);
  border-color: var(--purple-hi);
}

.chip[aria-pressed="true"] {
  color: var(--gold-hi);
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.12);
}

.search-box {
  flex: 1 1 200px;
  min-width: 160px;
  background: rgba(11, 10, 31, 0.7);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  padding: 10px 18px;
  min-height: 44px;
}

.search-box:focus {
  outline: none;
  border-color: rgba(212, 175, 55, 0.6);
}

.search-box::placeholder {
  color: var(--disabled);
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 18px;
}

.lib-item {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: center;
  border-radius: 10px;
  transition: transform var(--dur-fast) var(--ease);
}

.lib-item:hover {
  transform: translateY(-5px);
}

.lib-item:focus-visible {
  outline: 2px solid var(--gold-hi);
  outline-offset: 4px;
}

.lib-item .card-slot {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  border-radius: 8px;
}

.lib-item:hover .card-slot {
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5), var(--glow-gold);
}

/* --------------------------------------------------------------------------
   记录
   -------------------------------------------------------------------------- */
.history-list {
  display: grid;
  gap: 14px;
}

.history-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(28, 23, 64, 0.6);
  padding: 18px 20px;
}

.history-item .hi-top {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}

.history-item .hi-q {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--text);
  margin: 0;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-item .hi-meta {
  font-size: 14px;
  color: var(--text-2-strong);
  white-space: nowrap;
}

.history-item .hi-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0 14px;
}

.hi-card {
  font-size: 14px;
  padding: 4px 11px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(11, 10, 31, 0.6);
  color: var(--text-2-strong);
}

.hi-card .orient {
  color: var(--gold);
  margin-left: 5px;
}

.empty-state {
  text-align: center;
  padding: 52px 20px;
  color: var(--text-2-strong);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.empty-state .es-mark {
  color: var(--gold-dim);
  margin-bottom: 14px;
}

/* --------------------------------------------------------------------------
   下载中心
   -------------------------------------------------------------------------- */
.detect-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 1px solid rgba(212, 175, 55, 0.3);
  background: linear-gradient(
    120deg,
    rgba(107, 79, 187, 0.2),
    rgba(28, 23, 64, 0.8)
  );
  margin-bottom: 22px;
}

.detect-banner .db-icon {
  flex: none;
  color: var(--gold);
}

.detect-banner .db-text {
  min-width: 0;
  flex: 1 1 220px;
}

.detect-banner .db-main {
  font-size: 16px;
  color: var(--text);
}

.detect-banner .db-main strong {
  color: var(--gold-hi);
  font-weight: 600;
}

.detect-banner .db-sub {
  font-size: 14px;
  color: var(--text-2-strong);
}

.dl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}

.dl-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(
    160deg,
    rgba(28, 23, 64, 0.95),
    rgba(16, 14, 40, 0.95)
  );
  transition: border-color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.dl-item:hover {
  border-color: rgba(212, 175, 55, 0.34);
}

.dl-item.is-recommended {
  border-color: var(--gold);
  box-shadow: var(--shadow), inset 0 0 44px rgba(212, 175, 55, 0.06);
}

.dl-item.is-recommended::after {
  content: "推荐";
  position: absolute;
  top: -1px;
  right: 18px;
  font-size: 12px;
  letter-spacing: 0.16em;
  color: #14112e;
  background: var(--gold);
  padding: 3px 11px;
  border-radius: 0 0 7px 7px;
}

.dl-head {
  display: flex;
  gap: 15px;
  align-items: flex-start;
}

.dl-head .dl-icon {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 11px;
  border: 1px solid rgba(212, 175, 55, 0.34);
  background: rgba(11, 10, 31, 0.7);
  display: grid;
  place-items: center;
  color: var(--gold);
}

.dl-head .dl-title {
  min-width: 0;
}

.dl-head .dl-name {
  font-family: var(--serif);
  font-size: 19px;
  color: var(--text);
  margin: 0 0 3px;
}

.dl-head .dl-sub {
  font-size: 14px;
  color: var(--text-2-strong);
  margin: 0;
}

.dl-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px 16px;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.dl-fact .k {
  display: block;
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--text-2-strong);
}

.dl-fact .v {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.dl-item .btn-gold {
  width: 100%;
}

.dl-status {
  font-size: 14px;
  min-height: 22px;
  color: var(--text-2-strong);
}

.dl-status.is-err {
  color: #e8a0a0;
}

.dl-status.is-ok {
  color: var(--gold-hi);
}

/* SHA-256 折叠区 */
details.hash-box {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

details.hash-box summary {
  cursor: pointer;
  font-size: 14px;
  color: var(--text-2-strong);
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

details.hash-box summary::-webkit-details-marker {
  display: none;
}

details.hash-box summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid var(--text-2);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform var(--dur-fast) var(--ease);
}

details.hash-box[open] summary::before {
  transform: rotate(90deg) translateX(1px);
}

.hash-value {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-2-strong);
  word-break: break-all;
  background: rgba(11, 10, 31, 0.72);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  margin-top: 8px;
}

/* 其他版本折叠 */
details.more-versions {
  margin-top: 22px;
}

details.more-versions summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 11px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(28, 23, 64, 0.55);
  color: var(--text-2-strong);
  font-size: 15px;
  list-style: none;
}

details.more-versions summary::-webkit-details-marker {
  display: none;
}

details.more-versions summary:hover {
  color: var(--text);
  border-color: var(--purple-hi);
}

details.more-versions summary .chev {
  margin-left: auto;
  transition: transform var(--dur-fast) var(--ease);
}

details.more-versions[open] summary .chev {
  transform: rotate(180deg);
}

details.more-versions .dl-grid {
  margin-top: 18px;
}

/* 二维码 */
.qr-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 26px;
  align-items: center;
}

.qr-frame {
  flex: none;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(212, 175, 55, 0.5);
  background: #1a1436;
  box-shadow: 0 0 34px rgba(212, 175, 55, 0.1);
  line-height: 0;
}

.qr-frame canvas,
.qr-frame svg {
  display: block;
  width: 200px;
  height: 200px;
  image-rendering: pixelated;
}

.qr-body {
  min-width: 0;
}

.qr-body .qr-url {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
  color: var(--text-2-strong);
  word-break: break-all;
  background: rgba(11, 10, 31, 0.7);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 12px;
  margin: 10px 0 14px;
}

/* iOS / 不支持平台 */
.ios-guide {
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: var(--radius);
  background: linear-gradient(
    150deg,
    rgba(28, 23, 64, 0.9),
    rgba(16, 14, 40, 0.9)
  );
  padding: 24px;
}

.ios-steps {
  counter-reset: s;
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  gap: 12px;
}

.ios-steps li {
  counter-increment: s;
  position: relative;
  padding-left: 40px;
  font-size: 15px;
  color: var(--text-2-strong);
  line-height: 1.7;
}

.ios-steps li::before {
  content: counter(s);
  position: absolute;
  left: 0;
  top: 2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 55, 0.45);
  color: var(--gold);
  font-size: 13px;
  display: grid;
  place-items: center;
}

.ios-steps li strong {
  color: var(--text);
  font-weight: 500;
}

/* 首页底部下载区块 */
.footer-dl {
  border-top: 1px solid var(--line);
  margin-top: 40px;
  padding: 40px 0 30px;
  background: linear-gradient(180deg, transparent, rgba(107, 79, 187, 0.07));
}

.footer-dl .fd-head {
  margin-bottom: 22px;
}

.footer-dl .fd-head h2 {
  margin-bottom: 6px;
}

/* --------------------------------------------------------------------------
   设置
   -------------------------------------------------------------------------- */
.setting-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.setting-row:last-child {
  border-bottom: 0;
}

.setting-row .sr-text {
  flex: 1 1 auto;
  min-width: 0;
}

.setting-row .sr-name {
  font-size: 16px;
  color: var(--text);
  display: block;
}

.setting-row .sr-desc {
  font-size: 14px;
  color: var(--text-2-strong);
  line-height: 1.6;
  display: block;
  margin-top: 2px;
}

/* 开关 */
.switch {
  flex: none;
  position: relative;
  width: 54px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(11, 10, 31, 0.8);
  cursor: pointer;
  padding: 0;
  transition: background var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease);
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--text-2);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}

.switch[aria-checked="true"] {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--gold);
}

.switch[aria-checked="true"]::after {
  transform: translateX(24px);
  background: var(--gold);
}

.switch:focus-visible {
  outline: 2px solid var(--gold-hi);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   弹层 / 提示
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 5, 18, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 22px;
  padding-top: max(22px, env(safe-area-inset-top));
  padding-bottom: max(22px, env(safe-area-inset-bottom));
  animation: backdrop-in 0.22s var(--ease) both;
  will-change: opacity;
}

.modal-backdrop.is-closing {
  animation: backdrop-out 0.18s var(--ease) both;
}

@keyframes backdrop-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes backdrop-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal {
  width: min(760px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  border: 1px solid rgba(212, 175, 55, 0.34);
  border-radius: var(--radius);
  background: linear-gradient(
    165deg,
    rgba(28, 23, 64, 0.98),
    rgba(13, 11, 34, 0.99)
  );
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(212, 175, 55, 0.08),
    inset 0 1px 0 rgba(232, 200, 116, 0.1);
  padding: 26px;
  animation: modal-in 0.32s cubic-bezier(0.16, 0.84, 0.28, 1) both;
  will-change: opacity, transform;
}

.modal-backdrop.is-closing .modal {
  animation: modal-out 0.18s var(--ease) both;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translate3d(0, 18px, 0) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes modal-out {
  from {
    opacity: 1;
    transform: none;
  }
  to {
    opacity: 0;
    transform: translate3d(0, 8px, 0) scale(0.985);
  }
}

.modal-top {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.modal-top .modal-card {
  flex: none;
  width: 132px;
}

.modal-top .mt-body {
  min-width: 0;
}

.modal-top h2 {
  margin: 0 0 4px;
  font-size: 25px;
}

.modal-top .mt-en {
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--text-2-strong);
  margin-bottom: 12px;
}

.orient-tabs {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
}

.orient-tabs button {
  font-family: var(--sans);
  font-size: 14px;
  padding: 8px 20px;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--text-2-strong);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}

.orient-tabs button[aria-pressed="true"] {
  background: rgba(212, 175, 55, 0.16);
  color: var(--gold-hi);
}

.modal-close {
  position: sticky;
  float: right;
  top: 0;
  width: 44px;
  height: 44px;
  margin: -8px -8px 0 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(11, 10, 31, 0.9);
  color: var(--text-2-strong);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 20px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--gold);
  border-color: var(--gold);
}

.facts-table {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px 18px;
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.facts-table .k {
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--text-2-strong);
  display: block;
}

.facts-table .v {
  font-size: 15px;
  color: var(--text);
}

/* 轻量下载引导（不打断占卜） */
.result-dl-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--gold-dim);
  border-radius: var(--radius-sm);
  background: rgba(28, 23, 64, 0.5);
  font-size: 15px;
  color: var(--text-2-strong);
}

.result-dl-hint .btn {
  margin-left: auto;
}

/* 提示条 */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 200;
  display: grid;
  gap: 8px;
  justify-items: center;
  width: min(520px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  width: 100%;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(212, 175, 55, 0.4);
  background: rgba(20, 17, 48, 0.97);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  box-shadow: var(--shadow);
  animation: fade-up var(--dur-fast) var(--ease);
  text-align: center;
}

.toast.is-err {
  border-color: rgba(200, 110, 110, 0.6);
}

/* 屏幕阅读器专用 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 加载中 */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-2-strong);
}

.spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 16px;
  border: 2px solid var(--line);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --------------------------------------------------------------------------
   响应式：宽度 < 768px 为移动端布局
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  body {
    font-size: 16px;
  }

  .wrap {
    padding: 0 16px;
  }

  .nav .wrap {
    gap: 10px;
  }

  .brand {
    font-size: 17px;
  }

  /* 移动端：导航折叠为抽屉 */
  .nav-toggle {
    display: inline-flex;
  }

  .nav-links {
    position: fixed;
    top: calc(var(--nav-h) + env(safe-area-inset-top));
    left: 0;
    right: 0;
    z-index: 59;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    margin: 0;
    padding: 12px 16px calc(18px + env(safe-area-inset-bottom));
    background: rgba(11, 10, 31, 0.985);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--dur) var(--ease),
      transform var(--dur) var(--ease), visibility var(--dur);
  }

  .nav-links.is-open {
    transform: none;
    opacity: 1;
    visibility: visible;
  }

  .nav-link {
    width: 100%;
    text-align: left;
    font-size: 16px;
    padding: 13px 14px;
  }

  .nav-link.is-download {
    margin: 6px 0 0;
    justify-content: center;
  }

  main {
    padding: 22px 0 44px;
  }

  h1 {
    font-size: 24px;
  }
  h2 {
    font-size: 21px;
  }

  .panel {
    padding: 18px;
  }

  /* 移动端：牌阵等比缩放，牌位与标签整体收缩 */
  .spread-board[data-layout="single"] {
    --pw: 42%;
    aspect-ratio: 3 / 4;
  }

  .spread-board[data-layout="three"] {
    --pw: 26%;
    aspect-ratio: 3 / 4;
  }

  .spread-board[data-layout="cross5"] {
    --pw: 16%;
    aspect-ratio: 4 / 5;
  }

  .spread-board[data-layout="celtic"] {
    --pw: 15%;
    aspect-ratio: 3 / 5;
  }

.board-pos-wrap .pos-tag {
    font-size: 12px;
    margin-top: 4px;
    line-height: 1.3;
  }

.board-pos-wrap .pos-tag .num {
    font-size: 11.5px;
  }

  .pick-fan {
    gap: 7px;
  }

  .pick-card {
    width: 58px;
  }

  .shuffle-deck {
    width: 122px;
    height: 195px;
  }

  .library-grid {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 14px;
  }

  .qr-panel {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    text-align: center;
  }

  .qr-body {
    width: 100%;
    text-align: left;
  }

  .qr-frame canvas,
  .qr-frame svg {
    width: 172px;
    height: 172px;
  }

  .modal {
    padding: 20px;
    max-height: 92vh;
  }

  .modal-top {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
  }

  .modal-top .modal-card {
    width: 118px;
  }

  .reading-head {
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .reading-head .rh-chev {
    margin-left: auto;
  }

  .dl-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .result-dl-hint .btn {
    margin-left: 0;
    width: 100%;
  }

  .daily-card {
    gap: 14px;
  }

  .daily-card .card-slot {
    width: 88px;
  }
}

@media (max-width: 380px) {
  .pick-card {
    width: 50px;
  }
  .library-grid {
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  }
}

/* --------------------------------------------------------------------------
   减弱动效：系统开启 prefers-reduced-motion 或用户在设置中关闭动效
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    /* 必须一并清掉延迟：错峰入场用的是 animation-delay，
       只压时长的话元素仍会被推迟最多 1 秒才出现 */
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
}

body.no-motion *,
body.no-motion *::before,
body.no-motion *::after {
  animation-duration: 0.001ms !important;
  animation-delay: 0s !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  transition-delay: 0s !important;
}

body.no-motion #starfield {
  display: none;
}

/* 打印 / 导出图片时的干净背景 */
body.exporting #starfield,
body.exporting::before {
  display: none;
}

/* ==========================================================================
   界面优化 · 参考 tarot.run 的设计语言
   借鉴的是结构与细节手法，配色仍沿用本项目既定的神秘塔罗规范：
     · 导航顶部 1px 渐变金发丝线（紫 → 金 → 紫）
     · 满屏 Hero + 三张倾斜牌背作为主 CTA
     · 金色装饰分隔线 ◆ ✦ ◆
     · 牌阵卡片：牌数徽章 + 名称 + 英文小标签 + 描述，hover 金色高光
     · 双语点缀：中文为主，英文小标签做节奏
   ========================================================================== */

/* --------------------------------------------------- 导航细节 */

/* 顶部一道渐变金发丝线：比纯色边框更有层次，也不抢内容 */
.nav::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(107, 79, 187, 0.35),
    rgba(212, 175, 55, 0.34),
    rgba(107, 79, 187, 0.35)
  );
}

.nav-item {
  position: relative;
}

.nav-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 224px;
  padding: 8px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(18, 15, 44, 0.985);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.62);
  opacity: 0;
  transform: scale(0.96) translateY(-4px);
  transform-origin: top left;
  pointer-events: none;
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
  z-index: 70;
}

.nav-item.is-open .nav-menu {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* 菜单顶部一道渐隐金线 */
.nav-menu::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(212, 175, 55, 0.4),
    transparent
  );
}

.nav-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--text-2-strong);
  font-family: var(--sans);
  font-size: 15px;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease);
}

.nav-menu button:hover {
  color: var(--gold-hi);
  background: rgba(212, 175, 55, 0.08);
}

.nav-menu button .mk {
  color: rgba(212, 175, 55, 0.45);
  font-size: 12px;
}

.nav-menu .nm-badge {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 9px;
  font-variant-numeric: tabular-nums;
}

.nav-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 6px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 55, 0.3);
  background: rgba(28, 23, 64, 0.5);
  color: var(--text-2-strong);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease);
}

.icon-btn:hover {
  color: var(--gold);
  border-color: rgba(212, 175, 55, 0.62);
  background: rgba(107, 79, 187, 0.16);
}

.icon-btn[aria-current="true"] {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.12);
}

/* --------------------------------------------------- Hero */

.hero-lux {
  text-align: center;
  padding: 26px 0 4px;
}

.hero-eyebrow {
  font-size: 12px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin: 0 0 16px;
  padding-left: 0.42em;
}

.hero-title {
  font-size: clamp(30px, 5.2vw, 46px);
  line-height: 1.28;
  margin: 0 0 16px;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-dim));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-lede {
  max-width: 54ch;
  margin: 0 auto;
  font-size: 17px;
  color: var(--text-2-strong);
}

.hero-cards {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 236px;
  margin: 30px 0 6px;
  perspective: 1400px;
}

.hero-card {
  width: 128px;
  aspect-ratio: 2 / 3;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 55, 0.42);
  background: #100e28;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.6);
  transition: transform 0.4s cubic-bezier(0.16, 0.84, 0.28, 1),
    box-shadow 0.4s var(--ease), border-color 0.4s var(--ease);
  will-change: transform;
}

.hero-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hero-card:nth-child(1) {
  transform: rotate(-9deg) translate(16px, 10px);
}
.hero-card:nth-child(2) {
  transform: translateY(-12px);
  z-index: 2;
}
.hero-card:nth-child(3) {
  transform: rotate(9deg) translate(-16px, 10px);
}

.hero-card:hover,
.hero-card:focus-visible {
  transform: translateY(-20px) rotate(0deg) scale(1.07);
  z-index: 3;
  border-color: var(--gold);
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.72),
    0 0 0 1px rgba(212, 175, 55, 0.38), 0 0 44px rgba(212, 175, 55, 0.2);
}

.hero-hint {
  font-size: 14px;
  letter-spacing: 0.16em;
  color: var(--gold-dim);
  margin: 14px 0 22px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

/* --------------------------------------------------- 装饰分隔线 */

.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 54px 0;
  color: var(--gold-dim);
  font-size: 12px;
  letter-spacing: 0.6em;
  padding-left: 0.6em;
  user-select: none;
}

.ornament::before,
.ornament::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  max-width: 300px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(169, 138, 63, 0.6),
    transparent
  );
}

/* --------------------------------------------------- 区块标题 */

.section {
  scroll-margin-top: calc(var(--nav-h) + 20px);
}

.narrow-panel {
  max-width: 760px;
  margin: 0 auto;
}

.section-head {
  text-align: center;
  margin-bottom: 28px;
}

.section-head h2 {
  margin: 0 0 6px;
  font-size: clamp(22px, 3.4vw, 28px);
}

.section-en {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--gold-dim);
  padding-left: 0.34em;
}

/* --------------------------------------------------- 四步流程 */

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.step {
  position: relative;
  padding: 24px 20px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(
    160deg,
    rgba(28, 23, 64, 0.6),
    rgba(16, 14, 40, 0.6)
  );
  overflow: hidden;
}

.step::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(212, 175, 55, 0.4),
    transparent
  );
}

.step .st-num {
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1;
  color: var(--gold);
  opacity: 0.55;
  display: block;
  margin-bottom: 12px;
}

.step h3 {
  font-size: 17px;
  margin: 0 0 6px;
}

.step p {
  margin: 0;
  font-size: 14px;
  color: var(--text-2-strong);
  line-height: 1.7;
}

/* --------------------------------------------------- 牌阵卡片 */

.spread-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(268px, 1fr));
  gap: 16px;
}

.spread-card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(
    160deg,
    rgba(28, 23, 64, 0.94),
    rgba(15, 13, 38, 0.94)
  );
  color: var(--text);
  font-family: var(--sans);
  cursor: pointer;
  transition: transform 0.28s var(--ease), border-color 0.28s var(--ease),
    box-shadow 0.28s var(--ease);
}

.spread-card:hover {
  transform: translateY(-5px);
  border-color: rgba(212, 175, 55, 0.5);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(212, 175, 55, 0.16), 0 0 36px rgba(212, 175, 55, 0.1);
}

.spread-card[aria-pressed="true"] {
  border-color: var(--gold);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.55),
    inset 0 0 44px rgba(212, 175, 55, 0.07);
}

.sc-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.sc-icon {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.32);
  background: rgba(11, 10, 31, 0.66);
  display: grid;
  place-items: center;
  color: var(--gold);
}

.sc-badge {
  margin-left: auto;
  flex: none;
  font-size: 13px;
  color: var(--gold);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 999px;
  padding: 3px 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sc-name {
  font-family: var(--serif);
  font-size: 19px;
  margin: 0 0 2px;
}

.spread-card[aria-pressed="true"] .sc-name {
  color: var(--gold-hi);
}

.sc-en {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-dim);
}

.sc-desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-2-strong);
}

/* --------------------------------------------------- FAQ */

.faq {
  display: grid;
  gap: 10px;
  max-width: 840px;
  margin: 0 auto;
}

.faq-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(28, 23, 64, 0.5);
  overflow: hidden;
  transition: border-color var(--dur) var(--ease);
}

.faq-item[open] {
  border-color: rgba(212, 175, 55, 0.42);
}

.faq-item summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  min-height: 44px;
  cursor: pointer;
  list-style: none;
  font-size: 16px;
  color: var(--text);
  transition: color var(--dur-fast) var(--ease);
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::before {
  content: "✦";
  color: rgba(212, 175, 55, 0.45);
  font-size: 12px;
  flex: none;
}

.faq-item summary:hover {
  color: var(--gold-hi);
}

.faq-item[open] summary {
  color: var(--gold-hi);
}

.faq-body {
  padding: 0 20px 20px 48px;
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-2-strong);
}

.faq-body p {
  margin: 0;
}

/* --------------------------------------------------- 提问与开始 */

.setup-panel {
  max-width: 760px;
  margin: 0 auto;
}

.setup-selected {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(212, 175, 55, 0.32);
  background: rgba(212, 175, 55, 0.06);
  margin-bottom: 18px;
  font-size: 15px;
}

.setup-selected .ss-label {
  color: var(--text-2-strong);
}

.setup-selected .ss-name {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--gold-hi);
}

.setup-selected .ss-count {
  margin-left: auto;
  font-size: 13px;
  color: var(--gold);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 999px;
  padding: 3px 12px;
}

/* --------------------------------------------------- 底部 CTA */

.endcap {
  text-align: center;
  padding: 44px 24px;
  border-radius: var(--radius);
  border: 1px solid rgba(212, 175, 55, 0.3);
  background: radial-gradient(
      120% 150% at 50% 0%,
      rgba(107, 79, 187, 0.24),
      transparent 68%
    ),
    linear-gradient(160deg, rgba(28, 23, 64, 0.9), rgba(11, 10, 31, 0.92));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(232, 200, 116, 0.09);
}

.endcap h2 {
  margin: 0 0 10px;
  font-size: clamp(21px, 3.2vw, 26px);
  color: var(--gold-hi);
}

.endcap p {
  max-width: 52ch;
  margin: 0 auto 22px;
  color: var(--text-2-strong);
}

.endcap .hero-actions {
  justify-content: center;
}

/* --------------------------------------------------- 页脚 */

.footer-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 26px;
  padding: 34px 0 10px;
  border-top: 1px solid var(--line);
  margin-top: 40px;
}

.footer-col h4 {
  font-size: 14px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin: 0 0 12px;
}

.footer-col button,
.footer-col a {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 7px 0;
  min-height: 34px;
  color: var(--text-2-strong);
  font-family: var(--sans);
  font-size: 14px;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease);
}

.footer-col button:hover,
.footer-col a:hover {
  color: var(--gold-hi);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0 0;
  border-top: 1px solid var(--line);
  margin-top: 26px;
  font-size: 13px;
  color: var(--text-2);
}

/* --------------------------------------------------- 移动端适配 */

@media (max-width: 767px) {
  .nav-menu {
    position: static;
    min-width: 0;
    width: 100%;
    margin: 4px 0 8px;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    display: none;
    box-shadow: none;
    background: rgba(11, 10, 31, 0.6);
  }

  .nav-item.is-open .nav-menu {
    display: block;
  }

  .nav-tools {
    display: none;
  }

  /* 抽屉里把圆形图标按钮改成整行，避免在竖排列表里显得突兀 */
  .nav-links .icon-btn {
    width: 100%;
    border-radius: 9px;
    margin-top: 4px;
  }

  .hero-cards {
    height: 176px;
    margin: 22px 0 4px;
  }

  .hero-card {
    width: 92px;
  }

  .hero-card:nth-child(1) {
    transform: rotate(-8deg) translate(12px, 8px);
  }
  .hero-card:nth-child(3) {
    transform: rotate(8deg) translate(-12px, 8px);
  }

  .ornament {
    margin: 38px 0;
    letter-spacing: 0.4em;
  }

  .steps,
  .spread-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .step {
    padding: 20px 18px;
  }

  .spread-card {
    padding: 18px;
  }

  .faq-body {
    padding: 0 18px 18px 18px;
  }

  .endcap {
    padding: 32px 18px;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .setup-selected .ss-count {
    margin-left: 0;
  }
}
