/* ============ 妮妮的塔罗 · 黑金皇室视觉 ============ */
:root {
  --bg0: #0b0b0f;
  --bg1: #171029;
  --bg2: #0d0a1a;
  --gold: #e8c766;
  --gold-hi: #f5e6b8;
  --gold-lo: #b8893a;
  --ink: #ece3d4;
  --ink-dim: #a99e88;
  --accent1: #e8c766;
  --accent2: #b8893a;
  --panel: rgba(28, 21, 48, 0.72);
  --line: rgba(232, 199, 102, 0.28);
  --radius: 18px;
  --serif: "Noto Serif SC", "Cormorant Garamond", serif;
  --serif-en: "Cormorant Garamond", "Noto Serif SC", serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
:root[data-theme="light"] {
  --bg0: #f7f2e9; --bg1: #f0e3ce; --bg2: #efe7d6;
  --ink: #3a2f22; --ink-dim: #7a6a52;
  --gold: #b8893a; --gold-hi: #c99a4a; --gold-lo: #8e6a2a;
  --panel: rgba(255, 252, 245, 0.82);
  --line: rgba(184, 137, 58, 0.3);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--serif);
  color: var(--ink);
  background: radial-gradient(120% 90% at 50% 0%, var(--bg1) 0%, var(--bg0) 55%, var(--bg2) 100%) fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
:root[data-theme="light"] body { background: radial-gradient(120% 90% at 50% 0%, #fbf6ec 0%, var(--bg1) 60%, var(--bg2) 100%) fixed; }

#stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.noise { position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

#app { position: relative; z-index: 2; max-width: 560px; margin: 0 auto; min-height: 100%;
  padding: calc(var(--safe-t) + 16px) 20px calc(var(--safe-b) + 28px); }

/* ===== 通用排版 ===== */
.title-serif { font-family: var(--serif); font-weight: 600; letter-spacing: 0.04em; }
.glow { background: linear-gradient(120deg, var(--gold-hi), var(--gold), var(--gold-lo)); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 14px rgba(232, 199, 102, 0.25)); }
.subtitle { color: var(--ink-dim); font-style: italic; letter-spacing: 0.08em; font-size: 0.95rem; margin: 6px 0 0; }
.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.6s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ===== 按钮 ===== */
.btn-gold, .btn-ghost, .btn-text {
  font-family: var(--serif); cursor: pointer; border-radius: 999px; transition: transform .15s, box-shadow .25s, background .25s;
}
.btn-gold {
  border: none; padding: 14px 34px; font-size: 1.05rem; font-weight: 600; color: #1c130a;
  background: linear-gradient(135deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo));
  box-shadow: 0 8px 26px rgba(232, 199, 102, 0.28), inset 0 1px 0 rgba(255,255,255,.5);
  letter-spacing: 0.05em;
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(232, 199, 102, 0.4); }
.btn-gold:active { transform: translateY(0) scale(.98); }
.btn-gold.big { padding: 16px 50px; font-size: 1.15rem; margin-top: 8px; }
.btn-gold.sm { padding: 9px 20px; font-size: 0.9rem; }
.btn-gold:disabled { opacity: .55; cursor: default; }
.btn-ghost {
  background: rgba(232,199,102,0.06); border: 1px solid var(--line); color: var(--gold);
  padding: 12px 28px; font-size: 1rem;
}
.btn-ghost:hover { background: rgba(232,199,102,0.14); }
.btn-ghost.sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-text { background: none; border: none; color: var(--ink-dim); padding: 10px; font-size: 0.92rem; }
.btn-text.danger { color: #d98a8a; }

/* ===== 我的 按钮 ===== */
.me-btn { position: fixed; top: calc(var(--safe-t) + 14px); right: 16px; z-index: 30;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel); backdrop-filter: blur(10px); color: var(--gold); font-size: 1.3rem; cursor: pointer;
  box-shadow: 0 4px 18px rgba(0,0,0,.3); display: grid; place-items: center; transition: transform .2s; }
.me-btn:hover { transform: rotate(15deg) scale(1.05); }

/* ===== Onboarding ===== */
.screen { display: flex; flex-direction: column; align-items: center; min-height: 80vh; }
.onb { justify-content: center; text-align: center; gap: 6px; padding-top: 6vh; }
.logo-mark { font-size: 1.6rem; letter-spacing: 0.5em; color: var(--gold); margin-bottom: 8px; }
.logo-mark.sm { font-size: 1.1rem; }
.onb h1, .onb h2 { font-size: 2.2rem; margin: 4px 0; }
.onb-q { margin-top: 26px; color: var(--ink-dim); letter-spacing: 0.1em; }
.lang-pick { display: flex; gap: 16px; margin-top: 18px; }
.lang-opt { min-width: 120px; }

/* ===== 表单 ===== */
.form { width: 100%; display: flex; flex-direction: column; gap: 16px; text-align: left; margin-top: 22px; }
.form.sm { margin-top: 8px; }
.form label, .set-field { display: flex; flex-direction: column; gap: 7px; font-size: 0.9rem; color: var(--ink-dim); letter-spacing: 0.03em; }
.form input, .form textarea, .set-field input, .enc-search, .q-input, .ask-more input {
  font-family: var(--serif); font-size: 1rem; color: var(--ink);
  background: rgba(255,255,255,0.04); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; width: 100%;
  transition: border .2s, box-shadow .2s;
}
:root[data-theme="light"] .form input, :root[data-theme="light"] .form textarea, :root[data-theme="light"] .set-field input { background: rgba(0,0,0,0.03); }
.form input:focus, .form textarea:focus, .set-field input:focus, .q-input:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232,199,102,0.12);
}
.form textarea { resize: vertical; }
.chips { display: flex; gap: 8px; }
.chips.wrap { flex-wrap: wrap; }
.chip { font-family: var(--serif); font-size: 0.88rem; padding: 8px 14px; border-radius: 999px; cursor: pointer;
  background: rgba(255,255,255,0.04); border: 1px solid var(--line); color: var(--ink-dim); transition: all .2s; }
.chip.on { background: linear-gradient(135deg, var(--accent1), var(--accent2)); color: #1c130a; border-color: transparent; font-weight: 600; }
.onb-actions { display: flex; align-items: center; gap: 14px; margin-top: 26px; }

/* ===== Home ===== */
.home { justify-content: flex-start; gap: 4px; text-align: center; padding-top: 4vh; }
.home-top { margin-bottom: 8px; }
.brand { font-size: 2.4rem; margin: 6px 0 0; }
.deck-stage { position: relative; height: 300px; width: 100%; display: grid; place-items: center; margin: 6px 0; }
.deck-stack { position: relative; width: 180px; height: 288px; transform-style: preserve-3d; }
.deck-card { position: absolute; inset: 0; transform: translate(calc(var(--i) * 3px - 6px), calc(var(--i) * -3px)) rotate(calc(var(--i) * 1deg - 2deg));
  animation: breathe 5s ease-in-out infinite; animation-delay: calc(var(--i) * 0.1s); }
.deck-card .card-svg { width: 100%; height: 100%; filter: drop-shadow(0 10px 24px rgba(0,0,0,.5)); }
@keyframes breathe { 0%,100% { transform: translate(calc(var(--i)*3px - 6px), calc(var(--i)*-3px)) rotate(calc(var(--i)*1deg - 2deg)); } 50% { transform: translate(calc(var(--i)*3px - 6px), calc(var(--i)*-3px - 8px)) rotate(calc(var(--i)*1deg - 2deg)); } }
.halo { position: absolute; width: 320px; height: 320px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(232,199,102,0.18) 0%, transparent 62%); animation: pulse 4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .5; transform: scale(.95); } 50% { opacity: .9; transform: scale(1.05); } }
.home-extras { margin-top: 18px; }
.extra-pill { font-family: var(--serif); background: var(--panel); border: 1px solid var(--line); color: var(--gold);
  padding: 9px 20px; border-radius: 999px; cursor: pointer; font-size: 0.92rem; transition: all .2s; }
.extra-pill:hover { background: rgba(232,199,102,0.14); }
.ambience { margin-top: 22px; color: var(--ink-dim); font-size: 0.82rem; letter-spacing: 0.06em; opacity: .85; }

/* ===== Flow header ===== */
.flow { gap: 14px; }
.flow-header { display: flex; align-items: center; width: 100%; margin-bottom: 6px; min-height: 36px; }
.back-btn { background: none; border: none; color: var(--ink-dim); font-family: var(--serif); font-size: 1rem; cursor: pointer; padding: 6px 4px; }
.flow-title { flex: 1; text-align: center; font-size: 1.25rem; color: var(--gold); }
.hdr-spacer, .back-btn { min-width: 56px; }

/* ===== 分类网格 ===== */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; }
.cat-card { display: flex; align-items: center; justify-content: center; aspect-ratio: 1 / 1; padding: 8px; cursor: pointer;
  border-radius: 16px; border: 1px solid var(--line); color: var(--ink);
  background: linear-gradient(160deg, rgba(255,255,255,0.05), rgba(0,0,0,0.12));
  position: relative; overflow: hidden; transition: transform .18s, box-shadow .25s; font-family: var(--serif); }
.cat-card::before { content: ""; position: absolute; inset: 0; opacity: 0; background: linear-gradient(160deg, var(--c1), var(--c2)); transition: opacity .25s; z-index: 0; }
.cat-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0,0,0,.35); }
.cat-card:hover::before { opacity: 0.92; }
.cat-card:hover .cat-name { color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.35); }
.cat-name { position: relative; z-index: 1; font-size: 1.02rem; font-weight: 500; text-align: center; line-height: 1.35;
  letter-spacing: 0.06em; color: var(--gold);
  background: linear-gradient(120deg, var(--gold-hi), var(--gold), var(--gold-lo));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.cat-card:hover .cat-name { -webkit-text-fill-color: #fff; }

/* ===== 问题输入 ===== */
.q-area { width: 100%; display: flex; flex-direction: column; gap: 10px; margin: 10px 0 18px; }
.q-cat { color: var(--gold); font-size: 1.05rem; }
.q-input { min-height: 120px; font-size: 1.05rem; line-height: 1.6; }
.q-hint { color: var(--ink-dim); font-size: 0.84rem; text-align: center; }

/* ===== 牌阵列表 ===== */
.spread-list { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.spread-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; cursor: pointer; text-align: left;
  border-radius: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-family: var(--serif); transition: all .2s; }
.spread-card:hover { border-color: var(--gold); transform: translateX(3px); }
.spread-info { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.spread-info b { color: var(--gold); font-weight: 600; }
.spread-info small { color: var(--ink-dim); font-size: 0.8rem; }
.spread-n { font-size: 0.85rem; color: var(--ink-dim); border: 1px solid var(--line); border-radius: 50%; width: 28px; height: 28px; display: grid; place-items: center; }

/* ===== 卡牌 SVG 通用 ===== */
.card-svg { display: block; width: 100%; height: 100%; }
.card-img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; display: block; }

/* ===== 洗牌 ===== */
.shuffle-screen { justify-content: center; gap: 26px; min-height: 76vh; }
.shuffle-hint { color: var(--ink-dim); text-align: center; letter-spacing: 0.05em; }
.shuffle-stage { position: relative; width: 200px; height: 300px; }
.sh-card { position: absolute; inset: 0; transition: transform .5s ease; transform: rotate(calc(var(--i) * 2deg - 8deg)) translateY(calc(var(--i) * -1px)); }
.sh-card .card-svg { filter: drop-shadow(0 8px 20px rgba(0,0,0,.5)); }
.shuffle-stage.shuffling .sh-card { animation: shuffleAnim 0.55s ease-in-out 3; }
@keyframes shuffleAnim {
  0% { transform: rotate(calc(var(--i)*2deg - 8deg)); }
  35% { transform: translateX(calc((var(--i) - 4) * 26px)) translateY(-30px) rotate(calc(var(--i)*22deg - 88deg)) scale(.92); }
  70% { transform: translateX(calc((var(--i) - 4) * -10px)) rotate(calc(var(--i)*-6deg + 24deg)); }
  100% { transform: rotate(calc(var(--i)*2deg - 8deg)); }
}

/* ===== 选牌扇形 ===== */
.pick-screen { justify-content: flex-start; gap: 6px; }
.pick-hint { color: var(--gold); text-align: center; font-size: 1.05rem; }
.pick-count { color: var(--ink-dim); font-size: 0.85rem; }
.fan { position: relative; width: 100%; height: 320px; margin-top: 26px; }
.fan-card { position: absolute; left: var(--left); top: 30px; width: 96px; height: 154px; cursor: pointer;
  transform-origin: center bottom;
  transform: translateX(-50%) translateY(var(--ty)) rotate(var(--rot));
  transition: transform .28s cubic-bezier(.34,1.3,.5,1), filter .28s;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.5));
  animation: fanIn .5s ease both; animation-delay: calc(var(--i) * 0.04s); }
.fan-card .card-svg { width: 100%; height: 100%; }
@keyframes fanIn { from { opacity: 0; transform: translateX(-50%) translateY(90px) rotate(var(--rot)); } to { opacity: 1; transform: translateX(-50%) translateY(var(--ty)) rotate(var(--rot)); } }
.fan-card.focus, .fan-card:hover { transform: translateX(-50%) translateY(calc(var(--ty) - 46px)) rotate(var(--rot)) scale(1.09);
  z-index: 20; filter: drop-shadow(0 18px 28px rgba(232,199,102,.55)); }
.fan-card.chosen { transform: translateX(-50%) translateY(-80px) scale(.45); opacity: 0; pointer-events: none; }

/* ===== 翻牌揭示 ===== */
.reveal-screen { gap: 10px; }
.reveal-hint { color: var(--ink-dim); text-align: center; font-size: 0.9rem; }
.board { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 12px; width: 100%; margin: 12px 0; }
.slot { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pos-label { font-size: 0.72rem; color: var(--ink-dim); letter-spacing: 0.05em; text-align: center; max-width: 100px; }
.reveal-orient { font-size: 0.7rem; letter-spacing: 0.08em; color: var(--ink-dim); opacity: 0; transition: opacity .4s .35s; height: 1em; }
.reveal-orient.rev { color: #d98a8a; }
.flip-card.done ~ .reveal-orient { opacity: 1; }
.flip-card { width: 104px; height: 166px; perspective: 1000px; cursor: pointer; }
.flip-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.4,.2,.2,1); }
.flip-card.done .flip-inner { transform: rotateY(180deg); }
.flip-back, .flip-front { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 12px; overflow: hidden; }
.flip-back .card-svg { filter: drop-shadow(0 6px 16px rgba(0,0,0,.5)); }
.flip-front { transform: rotateY(180deg); box-shadow: 0 6px 20px rgba(232,199,102,.25); border-radius: 12px; }
/* 牌阵布局微调 */
.layout-celtic .slot { width: 88px; }
.layout-celtic .flip-card { width: 88px; height: 140px; }

/* ===== 解读页 ===== */
.reading-screen { gap: 16px; align-items: stretch; }
.reading-cards { display: flex; flex-direction: column; gap: 10px; }
.rc { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.rc-img { width: 56px; height: 90px; flex-shrink: 0; border-radius: 8px; overflow: hidden; }
.rc-img .card-svg, .rc-img .card-img { border-radius: 8px; }
.rc-meta { display: flex; flex-direction: column; gap: 3px; }
.rc-pos { font-size: 0.72rem; color: var(--ink-dim); }
.rc-name { color: var(--gold); font-size: 1rem; }
.rc-orient { font-size: 0.68rem; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-dim); margin-left: 4px; }
.rc-orient.rev { color: #d98a8a; border-color: rgba(217,138,138,.4); }
.rc-kw { font-size: 0.78rem; color: var(--ink-dim); }

.meaning-fold { border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,0.02); padding: 4px 14px; }
.meaning-fold summary { cursor: pointer; padding: 10px 0; color: var(--gold); font-size: 0.95rem; letter-spacing: 0.05em; }
.meaning-body p { font-size: 0.88rem; line-height: 1.7; color: var(--ink-dim); margin: 8px 0; }
.meaning-body b { color: var(--ink); }

.ai-block { border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(232,199,102,0.06), rgba(28,21,48,0.4)); padding: 16px; }
.ai-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.ai-title { color: var(--gold); font-size: 1.1rem; letter-spacing: 0.05em; }
.mode-switch { display: flex; gap: 4px; background: rgba(0,0,0,0.25); border-radius: 999px; padding: 3px; }
.mode-opt { font-family: var(--serif); font-size: 0.78rem; padding: 5px 12px; border: none; border-radius: 999px; background: none; color: var(--ink-dim); cursor: pointer; transition: all .2s; }
.mode-opt.on { background: linear-gradient(135deg, var(--gold-hi), var(--gold-lo)); color: #1c130a; font-weight: 600; }
.ai-output { min-height: 60px; }
.ai-text { font-size: 1.02rem; line-height: 1.85; letter-spacing: 0.02em; white-space: pre-wrap; color: var(--ink); }
.caret { color: var(--gold); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.ai-nokey, .ai-error { text-align: center; color: var(--ink-dim); display: flex; flex-direction: column; gap: 12px; align-items: center; padding: 12px; }
.err-detail { font-size: 0.75rem; color: #d98a8a; word-break: break-all; }
.ai-tools { margin-top: 12px; }
.ask-more { display: flex; gap: 8px; margin-top: 14px; }
.ask-more input { flex: 1; }
.chat-block { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 14px; }
.chat-q { color: var(--gold); font-size: 0.95rem; margin-bottom: 8px; }
.chat-q::before { content: "❝ "; opacity: .6; }
.chat-a { font-size: 1rem; line-height: 1.8; white-space: pre-wrap; color: var(--ink); }

/* 水晶球等待 */
.crystal-wait { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 24px; color: var(--ink-dim); font-style: italic; }
.crystal { width: 90px; height: 90px; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.6), rgba(232,199,102,.35) 35%, rgba(108,77,184,.5) 70%, rgba(20,14,40,.9));
  box-shadow: 0 0 40px rgba(232,199,102,.4), inset 0 0 30px rgba(108,77,184,.6); animation: float 3s ease-in-out infinite; }
.crystal::after { content: ""; position: absolute; inset: -14px; border-radius: 50%; border: 1px solid var(--line);
  border-top-color: var(--gold); animation: spin 3s linear infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes spin { to { transform: rotate(360deg); } }

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

/* ===== Drawer 我的 ===== */
.drawer { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,0.55); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .3s; }
.drawer.open { opacity: 1; pointer-events: auto; }
.drawer-panel { position: absolute; top: 0; right: 0; height: 100%; width: min(420px, 88vw);
  background: linear-gradient(180deg, var(--bg1), var(--bg0)); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform .32s cubic-bezier(.4,.1,.2,1); display: flex; flex-direction: column;
  box-shadow: -12px 0 40px rgba(0,0,0,.5); }
.drawer.open .drawer-panel { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-t) + 18px) 22px 16px; border-bottom: 1px solid var(--line); }
.drawer-head .title-serif { font-size: 1.3rem; color: var(--gold); }
.drawer-close { background: none; border: none; color: var(--ink-dim); font-size: 1.3rem; cursor: pointer; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px calc(var(--safe-b) + 24px); }
.drawer-menu { display: flex; flex-direction: column; gap: 6px; }
.dmenu-item { display: flex; align-items: center; gap: 14px; padding: 16px 12px; border-radius: 12px; cursor: pointer;
  background: none; border: none; border-bottom: 1px solid rgba(232,199,102,0.08); color: var(--ink); font-family: var(--serif); font-size: 1.02rem; text-align: left; transition: background .2s; }
.dmenu-item:hover { background: rgba(232,199,102,0.07); }
.dmenu-item .arrow { margin-left: auto; color: var(--ink-dim); }
.sub-back { background: none; border: none; color: var(--ink-dim); font-family: var(--serif); cursor: pointer; padding: 6px 0; font-size: 0.95rem; }
.sub-title { font-size: 1.2rem; color: var(--gold); margin: 10px 0 16px; }
.guide-text, .about-text { white-space: pre-wrap; line-height: 1.9; color: var(--ink); font-size: 0.95rem; font-family: var(--serif); }
.about-ver { color: var(--ink-dim); font-size: 0.8rem; margin-top: 18px; }
.save-tip { color: var(--gold); font-size: 0.85rem; }

/* 历史 */
.hist-item { padding: 14px 0; border-bottom: 1px solid rgba(232,199,102,0.1); }
.hist-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--gold); font-size: 0.95rem; }
.hist-top small { color: var(--ink-dim); font-size: 0.74rem; white-space: nowrap; }
.hist-cards { font-size: 0.8rem; color: var(--ink-dim); margin: 5px 0; }
.hist-reading { font-size: 0.84rem; line-height: 1.6; color: var(--ink); opacity: .85; }
.empty { text-align: center; color: var(--ink-dim); padding: 40px 0; font-style: italic; }

/* 百科 */
.enc-search { margin-bottom: 14px; }
.enc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.enc-card { background: none; border: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; font-family: var(--serif); color: var(--ink-dim); }
.enc-thumb { width: 100%; aspect-ratio: 200/320; border-radius: 8px; overflow: hidden; transition: transform .2s; }
.enc-card:hover .enc-thumb { transform: translateY(-3px); box-shadow: 0 8px 18px rgba(0,0,0,.4); }
.enc-card span { font-size: 0.76rem; }

/* 设置 */
.settings { display: flex; flex-direction: column; gap: 16px; }
.set-row { display: flex; align-items: center; justify-content: space-between; }
.set-row > span { color: var(--ink); font-size: 0.95rem; }
.seg { display: flex; background: rgba(0,0,0,0.25); border-radius: 999px; padding: 3px; }
.seg button { font-family: var(--serif); border: none; background: none; color: var(--ink-dim); padding: 6px 16px; border-radius: 999px; cursor: pointer; font-size: 0.85rem; }
.seg button.on { background: linear-gradient(135deg, var(--gold-hi), var(--gold-lo)); color: #1c130a; font-weight: 600; }
.toggle { width: 50px; height: 28px; border-radius: 999px; border: 1px solid var(--line); background: rgba(0,0,0,0.25); position: relative; cursor: pointer; transition: background .2s; }
.toggle .knob { position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink-dim); transition: all .2s; }
.toggle.on { background: linear-gradient(135deg, var(--gold-hi), var(--gold-lo)); border-color: transparent; }
.toggle.on .knob { left: 24px; background: #1c130a; }
.set-divider { color: var(--gold); font-size: 0.9rem; letter-spacing: 0.08em; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 4px; }
.set-field { gap: 7px; }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px; animation: fadeIn .25s ease; overflow-y: auto; }
.modal { background: linear-gradient(170deg, var(--bg1), var(--bg0)); border: 1px solid var(--line); border-radius: 20px;
  padding: 24px; max-width: 420px; width: 100%; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.6); margin: auto; }
.modal h3 { color: var(--gold); font-size: 1.3rem; margin: 0; }
.daily-card-img, .enc-big { width: 150px; aspect-ratio: 200/320; border-radius: 12px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.daily-name, .enc-modal h3 { color: var(--gold); font-size: 1.1rem; }
.daily-kw, .enc-kw { color: var(--ink-dim); font-size: 0.85rem; }
.daily-meaning { line-height: 1.7; color: var(--ink); font-size: 0.95rem; }
.enc-el { color: var(--ink-dim); font-size: 0.82rem; }
.enc-sec { text-align: left; width: 100%; border-top: 1px solid var(--line); padding-top: 10px; }
.enc-sec b { color: var(--gold); font-size: 0.9rem; }
.enc-sec p { font-size: 0.9rem; line-height: 1.6; color: var(--ink); margin: 6px 0; }
.modal-actions { display: flex; gap: 12px; }
.modal-actions a { text-decoration: none; }
.share-preview { width: 100%; max-width: 300px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.share-tip { color: var(--ink-dim); font-size: 0.78rem; }

/* ===== 响应式 ===== */
@media (min-width: 600px) {
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 360px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .brand { font-size: 2rem; }
  .flip-card { width: 88px; height: 140px; }
}
@media (prefers-reduced-motion: reduce) {
  .deck-card, .halo, .crystal, .crystal::after { animation: none !important; }
}
