/* ===========================================================
   月轮塔罗 · 设计系统
   暗夜星空 + 金线 + 衬线标题
   =========================================================== */

:root {
  --ink:        #0b0a12;
  --ink-1:      #12101d;
  --ink-2:      #1a1728;
  --ink-3:      #241f36;
  --line:       rgba(201, 169, 110, 0.22);
  --line-soft:  rgba(255, 255, 255, 0.07);

  --gold:       #c9a96e;
  --gold-hi:    #e8d3a4;
  --gold-dim:   #8f7a4e;
  --violet:     #8b7fd4;
  --violet-dim: #5a5290;
  --rose:       #c98a94;

  --text:       #ece8f3;
  --text-2:     #a9a3bb;
  --text-3:     #6f6a85;

  --ok:         #79c2a8;
  --warn:       #e0b268;
  --danger:     #d98a8a;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 30px;

  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;

  --serif: "Songti SC", "Source Han Serif SC", "Noto Serif SC", Georgia, "Times New Roman", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --dur-1: 180ms;
  --dur-2: 320ms;
  --dur-3: 620ms;

  --tab-h: 58px;
  --top-h: 56px;
  --site-h: 38px;
  --maxw: 1180px;
}

[data-theme="light"] {
  --ink:        #f5f1e8;
  --ink-1:      #faf7f0;
  --ink-2:      #efe9dc;
  --ink-3:      #e2d9c7;
  --line:       rgba(120, 95, 45, 0.26);
  --line-soft:  rgba(60, 45, 20, 0.1);
  --gold:       #8a6a2e;
  --gold-hi:    #a8873f;
  --gold-dim:   #b09a6c;
  --violet:     #6a5fb0;
  --text:       #2a2333;
  --text-2:     #5d566e;
  --text-3:     #8b849c;
}

* { box-sizing: border-box; }

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

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

body {
  font-family: var(--sans);
  /* body 必须有背景，否则 .starfield 的 z-index:-1 会沉到 body 背景之下而看不见 */
  background: var(--ink);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  padding-bottom: 0;
  /* 不要把 overflow-x: hidden 放在 body 上：iOS Safari 会因此把 body 变成滚动容器，
     fixed 的 .draw-foot 在滚动后定位/命中区域漂移，表现为"滚到底部按钮点不到"。
     overflow-x: clip 同样裁切横向溢出，但不建立滚动容器 */
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 var(--sp-3);
  letter-spacing: .01em;
}

h1 { font-size: clamp(26px, 6.2vw, 44px); }
h2 { font-size: clamp(20px, 4.4vw, 28px); }
h3 { font-size: clamp(17px, 3.4vw, 21px); }

p { margin: 0 0 var(--sp-3); }

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

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

/* ---------------- 星空背景 ---------------- */
.starfield {
  position: fixed; inset: 0;
  /* 保持 0：靠 DOM 顺序在 .app 之前绘制。若用 -1 会沉到 body 背景之下而不可见 */
  z-index: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% -10%, #1d1830 0%, #12101d 42%, #0b0a12 100%);
}
.stars {
  position: absolute; inset: -50%;
  background-repeat: repeat;
  opacity: .55;
}
.stars-a {
  background-image:
    radial-gradient(1.2px 1.2px at 20px 30px, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 120px 90px, #e8d3a4 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 200px 160px, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 300px 60px, #cfc4ea 50%, transparent 51%),
    radial-gradient(1.1px 1.1px at 380px 210px, #fff 50%, transparent 51%);
  background-size: 440px 300px;
  animation: drift 220s linear infinite;
}
.stars-b {
  background-image:
    radial-gradient(1px 1px at 60px 120px, #fff 50%, transparent 51%),
    radial-gradient(1.6px 1.6px at 260px 200px, #e8d3a4 50%, transparent 51%),
    radial-gradient(1px 1px at 340px 40px, #fff 50%, transparent 51%);
  background-size: 380px 260px;
  opacity: .35;
  animation: drift 340s linear infinite reverse;
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-400px, -260px, 0); }
}
.glow {
  position: absolute; border-radius: 50%; filter: blur(90px);
}
.glow-a {
  width: 46vw; height: 46vw; min-width: 320px; min-height: 320px;
  top: -12vw; right: -10vw;
  background: radial-gradient(circle, rgba(139,127,212,.28), transparent 70%);
}
.glow-b {
  width: 40vw; height: 40vw; min-width: 280px; min-height: 280px;
  bottom: -14vw; left: -12vw;
  background: radial-gradient(circle, rgba(201,169,110,.16), transparent 70%);
}

/* ---------------- 站点层级条（子站 → 主站） ---------------- */
.sitebar {
  position: sticky; top: 0; z-index: 41;
  height: var(--site-h);
  background: var(--ink-1);
  border-bottom: 1px solid var(--line);
}
.site-crumb {
  max-width: var(--maxw); margin: 0 auto;
  height: 100%;
  padding: 0 var(--sp-4);
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 12.5px;
  min-width: 0;
}
.site-parent { min-width: 0; flex: 0 1 auto; }
.site-parent-text,
.site-here {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.site-parent {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px 4px 8px; margin-left: -8px;
  border-radius: 999px;
  color: var(--gold-hi);
  background: rgba(201,169,110,.10);
  border: 1px solid rgba(201,169,110,.34);
  font-weight: 600;
  transition: background var(--dur-1), border-color var(--dur-1), color var(--dur-1);
}
.site-parent:hover,
.site-parent:focus-visible {
  background: rgba(201,169,110,.22);
  border-color: var(--gold);
  color: #fff;
}
.site-parent:focus-visible {
  outline: 2px solid var(--gold-hi);
  outline-offset: 2px;
}
.site-parent-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: rgba(201,169,110,.20);
  font-size: 11px; line-height: 1;
}
.site-parent-text { letter-spacing: .02em; }
.site-sep { color: var(--gold-dim); font-size: 12px; }
.site-here { color: var(--text-2); letter-spacing: .02em; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: var(--site-h); z-index: 40;
  height: var(--top-h);
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 0 var(--sp-4);
  background: color-mix(in srgb, var(--ink) 78%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.brand {
  display: flex; align-items: center; gap: var(--sp-2);
  font-family: var(--serif); font-size: 17px; letter-spacing: .06em;
  white-space: nowrap;
}
.brand-mark { color: var(--gold); font-size: 20px; line-height: 1; }
.brand-text {
  background: linear-gradient(100deg, var(--gold-hi), var(--gold) 60%, var(--violet));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.topnav { display: none; gap: var(--sp-1); margin-left: auto; }
.topnav a {
  padding: 8px 14px; border-radius: 999px;
  font-size: 14px; color: var(--text-2);
  transition: color var(--dur-1), background var(--dur-1);
}
.topnav a:hover { color: var(--text); background: var(--line-soft); }
.topnav a.active { color: var(--gold-hi); background: rgba(201,169,110,.11); }
.topbar-cta { display: none; }

/* ---------------- 移动端主导航（吸顶，独立一行） ---------------- */
.tabbar {
  position: sticky; top: calc(var(--site-h) + var(--top-h)); z-index: 39;
  height: var(--tab-h);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: var(--sp-2);
  padding: 6px var(--sp-2);
  background: color-mix(in srgb, var(--ink-2) 96%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
/* 每个入口是一个独立可点的胶囊：有边框、有底色，不再是裸文字 */
.tabbar a {
  display: flex; flex-direction: row; align-items: center; justify-content: center;
  gap: 6px; font-size: 13px; font-weight: 600; letter-spacing: .02em;
  color: var(--text-2);
  background: rgba(255,255,255,.045);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  transition: color var(--dur-1), background var(--dur-1), border-color var(--dur-1);
}
.tabbar a:hover {
  color: var(--text);
  background: rgba(255,255,255,.09);
  border-color: var(--line);
}
.tabbar a:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 1px;
}
.tab-ico { font-size: 15px; line-height: 1; opacity: .9; }
.tabbar a.active {
  color: #171224;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  border-color: var(--gold-hi);
  box-shadow: 0 2px 10px rgba(201,169,110,.3);
}
.tabbar a.active .tab-ico { opacity: 1; }

/* ---------------- 布局 ---------------- */
.app {
  /* 不要在这里设 z-index：它会建立层叠上下文，把 .draw-foot 等 fixed 子元素
     关在里面，导致滚到底部时被 .footer(z:1) 盖住、按钮点不到 */
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-4) var(--sp-7);
  min-height: calc(100vh - var(--site-h) - var(--top-h) - var(--tab-h));
  animation: page-in var(--dur-2) var(--ease);
}
@keyframes page-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.app.flush { padding-left: 0; padding-right: 0; padding-top: 0; }

.section { margin-bottom: var(--sp-7); }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--sp-3); margin-bottom: var(--sp-4);
}
.section-head h2 { margin: 0; }
.section-head .more { font-size: 13px; color: var(--text-3); }
.section-head .more:hover { color: var(--gold-hi); }

.eyebrow {
  font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--gold-dim); margin-bottom: var(--sp-2);
}

.lead { color: var(--text-2); font-size: 15px; max-width: 62ch; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); font-size: 13px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 46px; padding: 0 var(--sp-5);
  border-radius: 999px; border: 1px solid transparent;
  font-size: 15px; font-weight: 500; letter-spacing: .02em;
  transition: transform var(--dur-1) var(--ease), background var(--dur-1), border-color var(--dur-1), box-shadow var(--dur-2);
  white-space: nowrap;
}
.btn:active { transform: scale(.975); }
.btn-primary {
  background: linear-gradient(135deg, var(--gold-hi), var(--gold) 55%, var(--gold-dim));
  color: #241a06;
  box-shadow: 0 6px 26px -8px rgba(201,169,110,.65);
}
.btn-primary:hover { box-shadow: 0 10px 34px -8px rgba(201,169,110,.85); }
.btn-ghost {
  background: transparent; border-color: var(--line); color: var(--text);
}
.btn-ghost:hover { border-color: var(--gold-dim); background: rgba(201,169,110,.07); }
.btn-quiet {
  background: var(--line-soft); border-color: transparent; color: var(--text-2);
}
.btn-quiet:hover { color: var(--text); }
.btn-danger { background: transparent; border-color: rgba(217,138,138,.4); color: var(--danger); }
.btn-sm { min-height: 36px; padding: 0 var(--sp-4); font-size: 13px; }
.btn-lg { min-height: 54px; padding: 0 var(--sp-6); font-size: 16px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; pointer-events: none; }

/* ---------------- 卡片 ---------------- */
.card {
  background: linear-gradient(160deg, var(--ink-2), var(--ink-1));
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  position: relative;
  overflow: hidden;
}
.card.hairline::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  border: 1px solid var(--line);
  pointer-events: none;
  mask: linear-gradient(160deg, #000, transparent 60%);
}
.card-title { font-family: var(--serif); font-size: 17px; margin-bottom: var(--sp-2); }

/* ---------------- 首页 Hero ---------------- */
.hero { text-align: center; padding: var(--sp-6) 0 var(--sp-5); }
.hero h1 {
  background: linear-gradient(100deg, var(--gold-hi), #fff 42%, var(--violet) 88%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: var(--sp-3);
}
.hero .lead { margin: 0 auto var(--sp-5); font-size: 15px; }
.hero-actions { display: flex; flex-direction: column; gap: var(--sp-3); align-items: center; }
.hero-actions .btn { width: 100%; max-width: 340px; }
.hero-note { margin-top: var(--sp-4); font-size: 12px; color: var(--text-3); }

/* ---------------- 卡面 ---------------- */
.tarot-card {
  position: relative;
  aspect-ratio: 2 / 3.35;
  border-radius: 10px;
  background: linear-gradient(165deg, #211c33, #141020 55%, #0e0b18);
  border: 1px solid rgba(201,169,110,.5);
  box-shadow:
    0 1px 0 rgba(255,255,255,.07) inset,
    0 14px 30px -18px rgba(0,0,0,.9);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2);
}
.tarot-card::before {
  content: ""; position: absolute; inset: 5px;
  border: 1px solid rgba(201,169,110,.26);
  border-radius: 6px; pointer-events: none;
}
.tarot-card .tc-glyph {
  flex: 1; display: grid; place-items: center;
  font-size: clamp(22px, 5vw, 40px);
  color: var(--gold-hi);
  text-shadow: 0 0 24px rgba(232,211,164,.45);
  padding: var(--sp-2);
  text-align: center; line-height: 1.1;
}
.tarot-card .tc-name {
  font-family: var(--serif); font-size: clamp(10px, 2.4vw, 13px);
  text-align: center; padding: 0 6px var(--sp-2);
  color: var(--text); letter-spacing: .04em;
}
.tarot-card .tc-num {
  position: absolute; top: 8px; left: 9px;
  font-size: 9px; letter-spacing: .12em; color: var(--gold-dim);
}
.tarot-card.reversed .tc-glyph {
  transform: rotate(180deg);
  color: var(--rose);
  text-shadow: 0 0 22px rgba(201,138,148,.4);
}
.tarot-card.reversed { border-color: rgba(201,138,148,.45); }
.tarot-card .tc-badge {
  position: absolute; top: 7px; right: 7px;
  font-size: 9px; padding: 1px 5px; border-radius: 4px;
  background: rgba(201,138,148,.18); color: var(--rose);
  border: 1px solid rgba(201,138,148,.35);
}
.tarot-card.hoverable:hover { transform: translateY(-5px) scale(1.015); }

.card-grid {
  display: grid; gap: var(--sp-3);
  grid-template-columns: repeat(auto-fill, minmax(98px, 1fr));
}

/* ---------------- 首页牌阵速览 ---------------- */
.spread-strip {
  display: grid; gap: var(--sp-3);
  grid-template-columns: repeat(2, 1fr);
}
.spread-chip {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-md);
  background: var(--ink-2);
  border: 1px solid var(--line-soft);
  transition: border-color var(--dur-1), transform var(--dur-1), background var(--dur-1);
}
.spread-chip:hover {
  border-color: var(--gold-dim); transform: translateY(-2px);
  background: var(--ink-3);
}
.spread-chip .sc-count {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 15px; color: var(--gold-hi);
  background: rgba(201,169,110,.1); border: 1px solid var(--line);
}
.spread-chip .sc-name { font-size: 14px; font-weight: 500; }
.spread-chip .sc-desc { font-size: 11px; color: var(--text-3); }

/* ---------------- 今日一牌 ---------------- */
.daily-card {
  display: grid; grid-template-columns: 88px 1fr; gap: var(--sp-4);
  align-items: center;
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  background: linear-gradient(150deg, rgba(139,127,212,.15), rgba(201,169,110,.07));
  border: 1px solid var(--line);
}
.daily-card .dc-body > .eyebrow { margin-bottom: 2px; }
.daily-card .dc-name { font-family: var(--serif); font-size: 18px; margin-bottom: 2px; }
.daily-card .dc-kw { font-size: 12px; color: var(--gold-hi); margin-bottom: var(--sp-2); }
.daily-card .dc-tip { font-size: 12px; color: var(--text-2); line-height: 1.5; }

/* ---------------- 列表 / 表单 ---------------- */
.field { margin-bottom: var(--sp-4); }
.field > label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: var(--sp-2); }
.input, .textarea, .select {
  width: 100%; padding: 12px var(--sp-4);
  background: var(--ink-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  color: var(--text); font-size: 15px;
  transition: border-color var(--dur-1), background var(--dur-1);
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--gold-dim); background: var(--ink-2); outline: none;
}
.textarea { min-height: 92px; resize: vertical; line-height: 1.6; }
.counter { text-align: right; font-size: 11px; color: var(--text-3); margin-top: 4px; }

.theme-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip {
  padding: 8px 15px; border-radius: 999px; font-size: 13px;
  background: var(--ink-2); border: 1px solid var(--line-soft); color: var(--text-2);
  transition: all var(--dur-1);
}
.chip:hover { color: var(--text); border-color: var(--line); }
.chip.active {
  background: rgba(201,169,110,.14); border-color: var(--gold-dim); color: var(--gold-hi);
}

.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4); padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--line-soft);
}
.switch-row:last-child { border-bottom: 0; }
.switch-row .sr-title { font-size: 14px; }
.switch-row .sr-desc { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.switch {
  flex: none; width: 46px; height: 27px; border-radius: 999px;
  background: var(--ink-3); border: 1px solid var(--line-soft);
  position: relative; transition: background var(--dur-1);
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--text-3); transition: transform var(--dur-1) var(--ease), background var(--dur-1);
}
.switch[aria-checked="true"] { background: rgba(201,169,110,.28); border-color: var(--gold-dim); }
.switch[aria-checked="true"]::after { transform: translateX(19px); background: var(--gold-hi); }

/* ---------------- 牌阵选择 ---------------- */
.spread-list { display: grid; gap: var(--sp-3); }
.spread-item {
  display: grid; grid-template-columns: 1fr auto; gap: var(--sp-3);
  align-items: center;
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-lg);
  background: linear-gradient(150deg, var(--ink-2), var(--ink-1));
  border: 1px solid var(--line-soft);
  transition: border-color var(--dur-1), transform var(--dur-1);
  text-align: left; width: 100%;
}
.spread-item:hover { border-color: var(--gold-dim); transform: translateY(-2px); }
.spread-item.selected { border-color: var(--gold); background: linear-gradient(150deg, rgba(201,169,110,.13), var(--ink-2)); }
.spread-item .si-name { font-family: var(--serif); font-size: 17px; margin-bottom: 3px; }
.spread-item .si-meta { font-size: 12px; color: var(--text-3); }
.spread-item .si-desc { font-size: 13px; color: var(--text-2); margin-top: var(--sp-2); }
.badge {
  display: inline-block; font-size: 10px; padding: 2px 7px; border-radius: 4px;
  letter-spacing: .04em; margin-left: var(--sp-2); vertical-align: 2px;
}
.badge-beginner { background: rgba(121,194,168,.15); color: var(--ok); }
.badge-advanced { background: rgba(139,127,212,.16); color: var(--violet); }
.badge-p2 { background: rgba(224,178,104,.14); color: var(--warn); }

/* ---------------- 抽牌舞台 ---------------- */
.draw-stage {
  position: relative;
  max-width: 100%;
  min-height: calc(100vh - var(--site-h) - var(--top-h) - var(--tab-h) - 90px);
  display: flex; flex-direction: column;
  padding: var(--sp-4);
  gap: var(--sp-4);
}
.draw-steps {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 11px; color: var(--text-3); justify-content: center;
  letter-spacing: .06em;
}
.draw-steps .ds-item { display: flex; align-items: center; gap: 6px; }
.draw-steps .ds-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3);
  transition: background var(--dur-2), box-shadow var(--dur-2);
}
.draw-steps .ds-item.done .ds-dot { background: var(--gold-dim); }
.draw-steps .ds-item.now .ds-dot { background: var(--gold-hi); box-shadow: 0 0 10px var(--gold-hi); }
.draw-steps .ds-item.now { color: var(--gold-hi); }

.spread-board {
  position: relative;
  flex: 1;
  display: flex; flex-wrap: wrap;
  align-items: center; justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
}
.slot {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  opacity: 0; animation: slot-in var(--dur-2) var(--ease) forwards;
}
@keyframes slot-in { to { opacity: 1; } }
.slot-pad {
  width: clamp(64px, 20vw, 104px);
  aspect-ratio: 2 / 3.35;
  border-radius: 10px;
  border: 1px dashed var(--line);
  background: rgba(255,255,255,.015);
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 11px; color: var(--text-3);
  transition: border-color var(--dur-2), background var(--dur-2);
  position: relative;
  perspective: 900px;
}
.slot.filled .slot-pad { border-style: solid; border-color: transparent; background: transparent; }
.slot.active .slot-pad {
  border-color: var(--gold); background: rgba(201,169,110,.06);
  box-shadow: 0 0 0 3px rgba(201,169,110,.09), 0 0 30px -8px rgba(201,169,110,.5);
}
.slot-name { font-size: 10px; color: var(--text-3); text-align: center; line-height: 1.3; max-width: 108px; }

.flip3d { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; }
.flip3d.flipped { transform: rotateY(180deg); }
.flip3d { transition: transform var(--dur-3) var(--ease); }
.face {
  position: absolute; inset: 0; backface-visibility: hidden; border-radius: 10px; overflow: hidden;
}
.face-back {
  background:
    repeating-linear-gradient(45deg, rgba(201,169,110,.07) 0 2px, transparent 2px 9px),
    linear-gradient(165deg, #241d3a, #131021);
  border: 1px solid rgba(201,169,110,.45);
  display: grid; place-items: center;
  color: var(--gold); font-size: 20px;
}
.face-front { transform: rotateY(180deg); }

.deck-zone {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-3);
}
.deck-pile {
  position: relative; width: clamp(66px, 21vw, 96px); aspect-ratio: 2 / 3.35;
  cursor: pointer;
}
.deck-pile .mini {
  position: absolute; inset: 0; border-radius: 9px;
  background:
    repeating-linear-gradient(45deg, rgba(201,169,110,.08) 0 2px, transparent 2px 8px),
    linear-gradient(165deg, #2a2244, #141021);
  border: 1px solid rgba(201,169,110,.5);
  box-shadow: 0 8px 20px -12px #000;
}
.deck-pile .mini:nth-child(1) { transform: translate(-7px, -6px) rotate(-6deg); }
.deck-pile .mini:nth-child(2) { transform: translate(-3px, -3px) rotate(-3deg); }
.deck-pile .mini:nth-child(3) { transform: translate(2px, 0) rotate(1.5deg); }
.deck-pile .mini:nth-child(4) { transform: translate(6px, 4px) rotate(4deg); }
.deck-pile.shuffling .mini { animation: shuffle-jitter .5s var(--ease) infinite alternate; }
.deck-pile.shuffling .mini:nth-child(2) { animation-delay: .08s; }
.deck-pile.shuffling .mini:nth-child(3) { animation-delay: .16s; }
.deck-pile.shuffling .mini:nth-child(4) { animation-delay: .24s; }
@keyframes shuffle-jitter {
  from { transform: translate(0,0) rotate(0); }
  to   { transform: translate(var(--jx, 8px), var(--jy, -10px)) rotate(var(--jr, 9deg)); }
}

.draw-hint {
  text-align: center; font-size: 13px; color: var(--text-2);
  min-height: 20px;
}
.draw-hint strong { color: var(--gold-hi); font-weight: 500; }

.drawn-pocket {
  display: flex; gap: var(--sp-2); justify-content: center; flex-wrap: wrap;
}
.drawn-pocket .dp-card {
  width: clamp(44px, 13vw, 58px); aspect-ratio: 2/3.35; border-radius: 7px;
  background: linear-gradient(165deg, #241d3a, #131021);
  border: 1px solid rgba(201,169,110,.5);
  animation: pop-in var(--dur-2) var(--ease) both;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-18px) scale(.85); } }

.stage-actions {
  display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap;
  padding-top: var(--sp-2);
}

/* ---------------- 结果页 ---------------- */
.result-hero { text-align: center; margin-bottom: var(--sp-5); }
.result-hero .rh-meta { font-size: 12px; color: var(--text-3); letter-spacing: .1em; }
.result-hero h1 { margin: var(--sp-2) 0; }
.result-question {
  display: inline-block; padding: var(--sp-2) var(--sp-4);
  border-radius: 999px; background: rgba(139,127,212,.13);
  border: 1px solid rgba(139,127,212,.3);
  font-size: 13px; color: var(--text); max-width: 100%;
}

.result-cards {
  display: grid; gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: var(--sp-5);
}
.result-card-item {
  display: flex; flex-direction: column; gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  background: linear-gradient(160deg, var(--ink-2), var(--ink-1));
  border: 1px solid var(--line-soft);
  animation: rise var(--dur-2) var(--ease) both;
}
.result-card-item:nth-child(2) { animation-delay: .08s; }
.result-card-item:nth-child(3) { animation-delay: .16s; }
.result-card-item:nth-child(4) { animation-delay: .24s; }
.result-card-item:nth-child(n+5) { animation-delay: .3s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.result-card-item .rci-pos {
  font-size: 11px; letter-spacing: .12em; color: var(--gold-dim);
  text-transform: uppercase;
}
.result-card-item .rci-name { font-family: var(--serif); font-size: 16px; }
.result-card-item .rci-orient { font-size: 11px; color: var(--rose); }
.result-card-item .rci-text { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.result-card-item .rci-link { font-size: 11px; color: var(--gold-dim); }
.result-card-item .rci-link:hover { color: var(--gold-hi); }

.insight-block {
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  background: linear-gradient(150deg, rgba(139,127,212,.12), rgba(201,169,110,.06));
  border: 1px solid var(--line);
  margin-bottom: var(--sp-5);
}
.insight-block h3 { color: var(--gold-hi); }
.insight-block .ib-line { margin-bottom: var(--sp-3); font-size: 14px; line-height: 1.75; }
.insight-block .ib-line:last-child { margin-bottom: 0; }
.insight-block .ib-key { color: var(--gold-hi); }

.result-actions {
  display: flex; flex-direction: column; gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.result-actions .btn { width: 100%; }

/* ---------------- 牌库 ---------------- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: var(--sp-2);
  margin-bottom: var(--sp-4); align-items: center;
}
.toolbar .input { flex: 1; min-width: 150px; }
.toolbar .select { flex: none; min-width: 124px; width: auto; }
.filter-count { font-size: 12px; color: var(--text-3); margin-bottom: var(--sp-3); }

/* ---------------- 单牌详情 ---------------- */
.card-detail { display: grid; gap: var(--sp-5); }
.card-detail .cd-visual { max-width: 220px; margin: 0 auto; width: 100%; }
.card-detail .cd-en { font-size: 12px; letter-spacing: .18em; color: var(--text-3); text-transform: uppercase; }
.card-detail .cd-kw { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-3) 0 var(--sp-4); }
.card-detail .cd-kw span {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: rgba(201,169,110,.1); color: var(--gold-hi); border: 1px solid var(--line);
}
.meaning-pair {
  display: grid; gap: var(--sp-3); grid-template-columns: 1fr;
  margin-bottom: var(--sp-4);
}
.meaning-pair .mp {
  padding: var(--sp-4); border-radius: var(--r-md);
  background: var(--ink-1); border: 1px solid var(--line-soft);
}
.meaning-pair .mp h4 { margin: 0 0 var(--sp-2); font-size: 13px; color: var(--gold-hi); }
.meaning-pair .mp p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.7; }
.detail-nav { display: flex; gap: var(--sp-3); justify-content: space-between; margin-top: var(--sp-5); }
.detail-nav .btn { flex: 1; }

/* ---------------- 历史 ---------------- */
.history-list { display: grid; gap: var(--sp-3); }
.history-item {
  display: grid; grid-template-columns: 1fr auto; gap: var(--sp-3);
  align-items: center; padding: var(--sp-4) var(--sp-4);
  border-radius: var(--r-md); background: var(--ink-1);
  border: 1px solid var(--line-soft);
  transition: border-color var(--dur-1), background var(--dur-1);
}
.history-item:hover { border-color: var(--gold-dim); background: var(--ink-2); }
.history-item .hi-spread { font-family: var(--serif); font-size: 15px; }
.history-item .hi-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.history-item .hi-q { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line-soft); color: var(--text-3);
  transition: all var(--dur-1);
}
.icon-btn:hover { color: var(--danger); border-color: rgba(217,138,138,.4); }

/* ---------------- 空态 ---------------- */
.empty {
  text-align: center; padding: var(--sp-8) var(--sp-4);
  border: 1px dashed var(--line); border-radius: var(--r-lg);
}
.empty .empty-glyph { font-size: 34px; color: var(--gold-dim); margin-bottom: var(--sp-3); }
.empty h3 { margin-bottom: var(--sp-2); }
.empty p { color: var(--text-2); font-size: 13px; max-width: 40ch; margin: 0 auto var(--sp-4); }
.empty-actions { display: flex; flex-direction: column; gap: var(--sp-3); max-width: 300px; margin: 0 auto; }

/* ---------------- 弹层 ---------------- */
.modal-root {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  padding: var(--sp-4);
  background: rgba(6, 5, 12, .78);
  backdrop-filter: blur(8px);
  animation: fade var(--dur-1) ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 460px;
  max-height: 88vh; overflow: auto;
  background: var(--ink-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  animation: modal-in var(--dur-2) var(--ease);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.modal h3 { margin-bottom: var(--sp-3); }
.modal-actions { display: flex; gap: var(--sp-3); margin-top: var(--sp-5); }
.modal-actions .btn { flex: 1; }
.modal-img { width: 100%; border-radius: var(--r-md); border: 1px solid var(--line-soft); display: block; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  transform: translate(-50%, 16px);
  z-index: 95; pointer-events: none;
  padding: 10px var(--sp-4); border-radius: 999px;
  background: var(--ink-3); color: var(--text);
  border: 1px solid var(--line);
  font-size: 13px; opacity: 0;
  transition: opacity var(--dur-2), transform var(--dur-2) var(--ease);
  max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 页脚 ---------------- */
.footer {
  position: relative; z-index: 1;
  max-width: var(--maxw); margin: 0 auto;
  padding: var(--sp-5) var(--sp-4) var(--sp-7);
  border-top: 1px solid var(--line-soft);
  font-size: 12px; color: var(--text-3); text-align: center;
}
.footer p { margin: 0 0 var(--sp-2); }
.footer p:last-child { margin-bottom: 0; }
.footer .footer-copy {
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line-soft);
  color: var(--text-3);
  opacity: .85;
}
.footer a:hover { color: var(--gold-hi); }

/* ---------------- 工具类 ---------------- */
.row { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: var(--sp-4); }
.center { text-align: center; }
.mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); } .mt-5 { margin-top: var(--sp-5); }
.mt-6 { margin-top: var(--sp-6); }
.hidden { display: none !important; }
.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;
}

/* ===========================================================
   响应式：≥ 760px 平板/PC
   =========================================================== */
@media (min-width: 760px) {
  body { padding-bottom: 0; }
  .tabbar { display: none; }
  .topnav { display: flex; }
  .topbar-cta { display: inline-flex; }
  .app { padding: var(--sp-6) var(--sp-5) var(--sp-8); }

  .hero { padding: var(--sp-8) 0 var(--sp-7); }
  .hero-actions { flex-direction: row; justify-content: center; }
  .hero-actions .btn { width: auto; }

  .spread-strip { grid-template-columns: repeat(4, 1fr); }
  .daily-card { grid-template-columns: 104px 1fr; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: var(--sp-4); }

  .card-detail { grid-template-columns: 260px 1fr; align-items: start; }
  .card-detail .cd-visual { position: sticky; top: calc(var(--top-h) + 24px); margin: 0; }
  .meaning-pair { grid-template-columns: 1fr 1fr; }

  .result-actions { flex-direction: row; flex-wrap: wrap; }
  .result-actions .btn { width: auto; flex: 1; min-width: 150px; }
  .result-cards { gap: var(--sp-5); }
  .insight-block { padding: var(--sp-6); }
  .modal { padding: var(--sp-6); }
}

@media (min-width: 1024px) {
  .app { padding-top: var(--sp-7); }
  .spread-list { grid-template-columns: 1fr 1fr; }
}

/* 双栏占卜布局（抽牌页 PC） */
@media (min-width: 900px) {
  .draw-stage { padding: var(--sp-5) 0; }
  .slot-pad { width: 112px; }
  .deck-pile { width: 104px; }
}

/* ---------------- 减弱动效 ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .stars-a, .stars-b { animation: none; }
}
[data-motion="off"] *, [data-motion="off"] *::before, [data-motion="off"] *::after {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
}
[data-motion="off"] .stars-a, [data-motion="off"] .stars-b { animation: none; }
