/* ============================================================
   塔罗牌阵 · 单页样式
   主题：黑金宇宙（近黑底 + 星野 + 金色星云 + 金线金饰面板）
   结构：合规条 → 页头 → 主区（牌面 + 操作侧栏）→ 图鉴 → 页脚
   ============================================================ */

:root {
  --bg: #050307;
  --bg-2: #0a070c;
  --surface: #120d12;
  --elevated: #1a1219;
  --line: rgba(212, 168, 92, 0.20);
  --line-strong: rgba(226, 186, 108, 0.46);
  --text: #f4ece0;
  --text-dim: #cdbca4;
  --muted: #9c8f7e;
  --gold: #e2be78;
  --gold-hi: #ffe6b0;
  --gold-deep: #a97c33;
  --gold-soft: rgba(212, 168, 92, 0.10);
  --major: #e2be78;
  --wand: #e8b07a;
  --cup: #9ec7e8;
  --sword: #cbb8e8;
  --pentacle: #c9d8a0;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 48px rgba(0, 0, 0, 0.62);
  --font-ui: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

/* ---------------- 宇宙背景（固定层：深空 + 星野 + 金紫星云） ---------------- */
.cosmos {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: var(--bg);
  background-image:
    /* 金色星云 */
    radial-gradient(ellipse 48% 34% at 20% 6%, rgba(226, 190, 120, 0.14), transparent 64%),
    radial-gradient(ellipse 42% 30% at 84% 14%, rgba(169, 124, 51, 0.12), transparent 62%),
    radial-gradient(ellipse 60% 40% at 50% 108%, rgba(120, 92, 178, 0.14), transparent 66%),
    /* 星野：三级白/金色小点 */
    radial-gradient(1.6px 1.6px at 12% 18%, rgba(255, 240, 214, 0.90), transparent 100%),
    radial-gradient(1.4px 1.4px at 28% 42%, rgba(255, 230, 176, 0.80), transparent 100%),
    radial-gradient(1.8px 1.8px at 44% 12%, rgba(255, 246, 226, 0.85), transparent 100%),
    radial-gradient(1.3px 1.3px at 62% 28%, rgba(255, 228, 176, 0.75), transparent 100%),
    radial-gradient(1.7px 1.7px at 78% 52%, rgba(255, 240, 214, 0.85), transparent 100%),
    radial-gradient(1.2px 1.2px at 88% 22%, rgba(255, 236, 200, 0.72), transparent 100%),
    radial-gradient(1.5px 1.5px at 8% 64%, rgba(255, 240, 214, 0.78), transparent 100%),
    radial-gradient(1.3px 1.3px at 34% 78%, rgba(255, 232, 190, 0.72), transparent 100%),
    radial-gradient(1.6px 1.6px at 56% 66%, rgba(255, 246, 226, 0.82), transparent 100%),
    radial-gradient(1.2px 1.2px at 72% 84%, rgba(255, 232, 190, 0.70), transparent 100%),
    radial-gradient(1.4px 1.4px at 94% 70%, rgba(255, 240, 214, 0.76), transparent 100%),
    radial-gradient(1.1px 1.1px at 18% 90%, rgba(255, 236, 200, 0.66), transparent 100%),
    radial-gradient(1.5px 1.5px at 48% 44%, rgba(255, 246, 226, 0.70), transparent 100%),
    radial-gradient(1.2px 1.2px at 66% 8%, rgba(255, 236, 200, 0.68), transparent 100%),
    radial-gradient(1.1px 1.1px at 4% 38%, rgba(255, 240, 214, 0.62), transparent 100%),
    radial-gradient(1.3px 1.3px at 96% 46%, rgba(255, 246, 226, 0.66), transparent 100%);
}

/* 星云缓慢漂移（尊重"减少动态效果"设置） */
.cosmos::after {
  content: "";
  position: absolute;
  inset: -12%;
  background-image:
    radial-gradient(ellipse 40% 28% at 32% 30%, rgba(226, 190, 120, 0.09), transparent 62%),
    radial-gradient(ellipse 36% 26% at 72% 62%, rgba(140, 104, 200, 0.10), transparent 62%);
  animation: nebula-drift 46s ease-in-out infinite alternate;
}
@keyframes nebula-drift {
  from { transform: translate3d(-1.2%, -0.8%, 0) scale(1); }
  to { transform: translate3d(1.4%, 1%, 0) scale(1.04); }
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

::selection { background: rgba(226, 190, 120, 0.3); color: #fffaf0; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: 0.02em; }
p { margin: 0; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 0.9em; color: var(--gold-hi); }

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

/* ---------------- 合规条 ---------------- */
.compliance {
  margin: 0;
  padding: 0.5rem 1rem;
  font-size: 0.78rem;
  text-align: center;
  color: var(--text-dim);
  background: linear-gradient(90deg, rgba(212, 168, 92, 0.06), rgba(120, 92, 178, 0.08), rgba(212, 168, 92, 0.06));
  border-bottom: 1px solid var(--line);
}
.compliance strong { color: var(--gold); font-weight: 600; }

/* ---------------- 页头 ---------------- */
.app-header {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  padding: 2.1rem 1.25rem 1.2rem;
  text-align: center;
}
/* 顶部的星芒光弧 */
.app-header::before {
  content: "";
  position: absolute;
  top: -6rem;
  left: 50%;
  width: min(46rem, 92vw);
  height: 14rem;
  transform: translateX(-50%);
  background: radial-gradient(ellipse 50% 60% at 50% 100%, rgba(226, 190, 120, 0.18), transparent 70%);
  pointer-events: none;
}
.brand { position: relative; display: inline-flex; align-items: center; gap: 0.6rem; }
.brand-mark {
  font-size: 1.1rem;
  color: var(--gold-hi);
  text-shadow: 0 0 14px rgba(226, 190, 120, 0.7);
}
.app-header h1 {
  font-size: clamp(1.6rem, 4.4vw, 2.2rem);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #fff6e2;
  text-shadow: 0 2px 18px rgba(226, 190, 120, 0.28);
}
.tagline {
  position: relative;
  margin-top: 0.45rem;
  font-size: 0.83rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.tagline::before,
.tagline::after {
  content: "✦";
  margin: 0 0.5rem;
  font-size: 0.62em;
  color: var(--gold-deep);
  vertical-align: middle;
}

/* 标题下的金色分隔线（中间一颗星） */
.app-header::after {
  content: "";
  display: block;
  width: min(22rem, 70%);
  height: 1px;
  margin: 1.05rem auto 0;
  background: linear-gradient(90deg, transparent, rgba(226, 190, 120, 0.55), transparent);
}

/* ---------------- 布局 ---------------- */
.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.5rem 1.25rem 2.2rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 21rem;
  gap: 1.15rem;
  align-items: start;
}
.side { display: grid; gap: 1.15rem; }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { order: 2; }
  .board-panel { order: 1; }
}

/* ---------------- 面板：金线 + 星尘 ---------------- */
.panel {
  position: relative;
  padding: 1.1rem 1.15rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(ellipse 80% 60% at 50% -30%, rgba(212, 168, 92, 0.09), transparent 70%),
    linear-gradient(168deg, rgba(28, 20, 28, 0.94), rgba(10, 7, 11, 0.96));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 230, 176, 0.05);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
/* 四角金饰 */
.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid var(--line-strong);
  pointer-events: none;
  opacity: 0.85;
}
.panel::before { top: 6px; left: 6px; border-right: none; border-bottom: none; border-radius: 4px 0 0 0; }
.panel::after { bottom: 6px; right: 6px; border-left: none; border-top: none; border-radius: 0 0 4px 0; }
.panel:hover { border-color: rgba(226, 186, 108, 0.3); }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.62rem;
  border-bottom: 1px solid rgba(212, 168, 92, 0.16);
}
.panel h2 {
  font-size: 0.97rem;
  letter-spacing: 0.04em;
  color: #f7e6c8;
}
.panel h2::before {
  content: "✦";
  margin-right: 0.5rem;
  font-size: 0.78em;
  color: var(--gold);
  text-shadow: 0 0 8px rgba(226, 190, 120, 0.5);
}

.hint-pill {
  padding: 0.1rem 0.6rem;
  font-size: 0.72rem;
  color: #1a1206;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(226, 190, 120, 0.25);
}
.hint-pill[hidden] { display: none; }

/* ---------------- 牌堆状态 ---------------- */
.deck-stat { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; margin-bottom: 0.85rem; }
.deck-stat > div {
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background:
    radial-gradient(ellipse 70% 80% at 50% 0%, rgba(226, 190, 120, 0.12), transparent 70%),
    rgba(212, 168, 92, 0.05);
  text-align: center;
}
.deck-stat small { display: block; font-size: 0.71rem; color: var(--muted); letter-spacing: 0.1em; }
.deck-stat strong {
  font-size: 1.34rem;
  font-weight: 600;
  color: var(--gold-hi);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px rgba(226, 190, 120, 0.28);
}
.deck-stat--tick { animation: stat-tick 0.45s ease; }
@keyframes stat-tick {
  0% { transform: scale(1); }
  40% { transform: scale(1.035); }
  100% { transform: scale(1); }
}

/* ---------------- 控件 ---------------- */
.btn-row { display: flex; flex-wrap: nowrap; gap: 0.5rem; }
.btn-row.tight { gap: 0.35rem; }
.btn-row > * { flex: 1 1 0; min-width: 0; }
.btn-row.end { margin-top: 0.62rem; }

button, .btn {
  padding: 0.52rem 0.78rem;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  color: #f1e4cd;
  background: linear-gradient(180deg, rgba(46, 34, 30, 0.96), rgba(20, 14, 18, 0.96));
  border: 1px solid rgba(212, 168, 92, 0.24);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
button:hover {
  color: var(--gold-hi);
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(226, 186, 108, 0.12) inset;
}
button:active { transform: translateY(0); }
button:disabled { opacity: 0.55; cursor: progress; }
button.primary {
  color: #1c1305;
  background: linear-gradient(180deg, #ffe9b8, var(--gold) 55%, #cda05a);
  border-color: rgba(255, 230, 176, 0.5);
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(226, 190, 120, 0.22);
}
button.primary:hover { color: #140d03; filter: brightness(1.05); }
button.danger { color: #f0c9b4; border-color: rgba(206, 140, 96, 0.4); }
button.danger:hover { color: #ffe2cd; border-color: rgba(226, 160, 110, 0.72); }
button.ghost { background: rgba(255, 255, 255, 0.015); }
button.wide { width: 100%; margin-top: 0.55rem; }

input[type="number"], input[type="text"], select {
  width: 100%;
  padding: 0.46rem 0.62rem;
  font-family: inherit;
  font-size: 0.84rem;
  color: #f2e6d2;
  background: rgba(6, 4, 8, 0.78);
  border: 1px solid rgba(212, 168, 92, 0.22);
  border-radius: var(--radius-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
input[type="number"] { min-width: 4.2rem; }
input[type="text"]:focus, input[type="number"]:focus, select:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(226, 190, 120, 0.1);
  outline: none;
}
input::placeholder { color: rgba(156, 143, 126, 0.65); }
select option { background: #120d12; color: var(--text); }

input[type="range"] {
  width: 100%;
  margin: 0.2rem 0 0;
  accent-color: var(--gold);
  background: transparent;
}

.field-row { display: flex; flex-wrap: nowrap; align-items: center; gap: 0.5rem; margin-top: 0.62rem; }
.field-row > select, .field-row > input[type="text"] { flex: 1 1 auto; }
.field-label { display: block; margin-bottom: 0.35rem; font-size: 0.77rem; color: var(--muted); letter-spacing: 0.04em; }
.inline-num { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; color: var(--muted); white-space: nowrap; }
.inline-num input { width: 4.6rem; }
.range-label { display: flex; justify-content: space-between; width: 100%; font-size: 0.82rem; color: var(--muted); }
.range-label output { color: var(--gold-hi); font-variant-numeric: tabular-nums; font-weight: 600; }
.switch { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; color: var(--muted); cursor: pointer; }
.switch input { accent-color: var(--gold); }
.status-line { margin-top: 0.5rem; min-height: 1.1rem; font-size: 0.78rem; color: var(--gold-deep); }
.timeflow-controls { margin-top: 0.72rem; padding-top: 0.72rem; border-top: 1px dashed rgba(212, 168, 92, 0.18); }
.oracle-weights { margin-top: 0.6rem; font-size: 0.8rem; color: var(--muted); }
.oracle-weights ul { margin: 0.3rem 0 0; padding-left: 1.1rem; }
.oracle-weights li { margin: 0.14rem 0; }
.oracle-weights b { color: var(--gold-hi); font-weight: 600; }
.oracle-weights em { color: var(--gold); font-style: normal; font-variant-numeric: tabular-nums; }

/* ---------------- 牌面区（主角） ---------------- */
.board-panel { min-height: 27rem; }
.board-progress {
  padding: 0.1rem 0.6rem;
  font-size: 0.74rem;
  color: var(--gold);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(212, 168, 92, 0.06);
}
.reading-board {
  position: relative;
  min-height: 20rem;
  padding: 1.2rem 1rem;
  border: 1px solid rgba(212, 168, 92, 0.14);
  border-radius: var(--radius);
  background:
    radial-gradient(ellipse 62% 46% at 50% 40%, rgba(226, 190, 120, 0.09), transparent 72%),
    radial-gradient(ellipse 90% 70% at 50% 120%, rgba(120, 92, 178, 0.10), transparent 70%),
    rgba(4, 3, 6, 0.66);
  overflow: hidden;
  transition: box-shadow 0.4s ease, border-color 0.4s ease;
}
/* 牌面区内的细星点，营造"占卜台"感 */
.reading-board::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.2px 1.2px at 18% 22%, rgba(255, 240, 214, 0.7), transparent 100%),
    radial-gradient(1.2px 1.2px at 74% 34%, rgba(255, 232, 190, 0.6), transparent 100%),
    radial-gradient(1.1px 1.1px at 42% 78%, rgba(255, 240, 214, 0.6), transparent 100%),
    radial-gradient(1.2px 1.2px at 88% 72%, rgba(255, 236, 200, 0.55), transparent 100%),
    radial-gradient(1.1px 1.1px at 8% 62%, rgba(255, 236, 200, 0.5), transparent 100%);
}
.reading-board--peek {
  border-color: rgba(226, 186, 108, 0.34);
  box-shadow: 0 0 0 1px rgba(226, 186, 108, 0.2), 0 0 34px rgba(226, 190, 120, 0.14);
}
.reading-placeholder {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 17rem;
  font-size: 0.86rem;
  letter-spacing: 0.06em;
  color: rgba(156, 143, 126, 0.85);
}
.reading-cards {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 1rem;
}

.board-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.95rem;
}
.board-actions > button { flex: 0 0 auto; }

/* ---------------- 牌位与牌面 ---------------- */
.position-slot { display: flex; flex-direction: column; align-items: center; gap: 0.42rem; width: 10.6rem; }
.position-label {
  position: relative;
  padding: 0 0.5rem;
  font-size: 0.73rem;
  letter-spacing: 0.14em;
  color: var(--gold);
}
.position-label::before,
.position-label::after {
  content: "·";
  margin: 0 0.3rem;
  color: var(--gold-deep);
}
.position-label--pending { color: var(--muted); }

.tarot-card {
  position: relative;
  width: 100%;
  border: 1px solid rgba(212, 168, 92, 0.26);
  border-radius: 12px;
  background: linear-gradient(170deg, rgba(28, 20, 26, 0.96), rgba(8, 6, 9, 0.96));
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
  transition: transform 0.34s cubic-bezier(0.22, 0.61, 0.36, 1), border-color 0.34s ease, box-shadow 0.34s ease;
}
.tarot-card:hover {
  border-color: rgba(226, 186, 108, 0.5);
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.62), 0 0 26px rgba(226, 190, 120, 0.14);
}
.tarot-card.suit-major { border-color: rgba(226, 190, 120, 0.42); }
.tarot-card.suit-wands { border-color: rgba(232, 176, 122, 0.34); }
.tarot-card.suit-cups { border-color: rgba(158, 199, 232, 0.3); }
.tarot-card.suit-swords { border-color: rgba(203, 184, 232, 0.3); }
.tarot-card.suit-pentacles { border-color: rgba(201, 216, 160, 0.3); }

.tarot-card--flip { cursor: pointer; perspective: 1200px; }
.tarot-card-inner {
  position: relative;
  width: 100%;
  aspect-ratio: 520 / 904;
  transform-style: preserve-3d;
  transition: transform 0.62s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.tarot-card--flip.is-flipped .tarot-card-inner { transform: rotateY(180deg); }
.tarot-card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* 牌背：优先用玫瑰金纹章图（.is-art），失败退回纯 CSS 星芒牌背 */
.tarot-card-back {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background-color: #0c0910;
  background-image:
    radial-gradient(circle at 50% 44%, rgba(58, 44, 30, 0.9), rgba(10, 8, 12, 0.98) 72%);
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(212, 168, 92, 0.2);
}
.tarot-card-back.is-art {
  background-image: url("/static/tarot/deck/card_back.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  box-shadow: inset 0 0 0 1px rgba(226, 186, 108, 0.24);
}
.tarot-card-back.is-art::before { content: none; }
.tarot-card-back::before {
  content: "✦";
  font-size: 1.7rem;
  color: rgba(255, 230, 176, 0.9);
  text-shadow: 0 0 16px rgba(226, 190, 120, 0.55);
}
.tarot-card-front { transform: rotateY(180deg); overflow: hidden; border-radius: 11px; }
.tarot-card--flip:not(.is-flipped) .tarot-card-front { pointer-events: none; }

.tarot-card-visual { position: relative; width: 100%; background: #070508; }
.tarot-card-visual img { display: block; width: 100%; height: auto; }
.tarot-card-visual.is-reversed img { transform: rotate(180deg); }

.tarot-card-caption { padding: 0.52rem 0.42rem 0.62rem; text-align: center; }
.tarot-card-caption .zh { font-size: 0.93rem; font-weight: 600; color: #f7ead2; }
.tarot-card-caption .en { margin-top: 0.12rem; font-size: 0.67rem; letter-spacing: 0.1em; color: var(--gold-deep); }
.tarot-card-caption .meta-row { margin-top: 0.2rem; font-size: 0.67rem; color: var(--muted); }
.title-row { display: flex; align-items: center; justify-content: center; gap: 0.4rem; }
.card-prob {
  padding: 0 0.38rem;
  font-size: 0.66rem;
  color: var(--gold-hi);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(212, 168, 92, 0.08);
}
.rev-badge {
  position: absolute;
  top: 0.36rem;
  left: 0.36rem;
  z-index: 2;
  padding: 0.05rem 0.42rem;
  font-size: 0.66rem;
  color: #1c1305;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.tarot-card--compact .tarot-card-visual img { max-height: 7rem; object-fit: cover; }
.tarot-card--compact .tarot-card-caption { padding: 0.3rem 0.25rem 0.42rem; }
.tarot-card--compact .tarot-card-caption .zh { font-size: 0.76rem; }
.tarot-card--compact .tarot-card-caption .en,
.tarot-card--compact .tarot-card-caption .meta-row { display: none; }

/* ---------------- 发牌动画 ---------------- */
@keyframes deal-in {
  0% { opacity: 0; transform: translateY(-16px) scale(0.97); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.reading-cards .tarot-card--deal-in {
  animation: deal-in 0.46s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  animation-delay: calc(var(--deal-i, 0) * 70ms);
}
/* 金环扩散，宣告"牌已落定" */
@keyframes board-pulse {
  0% { box-shadow: 0 0 0 0 rgba(226, 190, 120, 0.28); }
  70% { box-shadow: 0 0 0 14px rgba(226, 190, 120, 0); }
  100% { box-shadow: 0 0 0 0 rgba(226, 190, 120, 0); }
}
.reading-board--peek { animation: board-pulse 0.7s ease-out; }

@media (prefers-reduced-motion: reduce) {
  .reading-cards .tarot-card--deal-in,
  .deck-stat--tick,
  .reading-board--peek,
  .cosmos::after { animation: none; }
  .tarot-card-inner { transition: none; }
  .tarot-card:hover { transform: none; }
}

/* ---------------- 图鉴 ---------------- */
.gallery-panel { max-width: 1180px; margin: 0 auto 2.2rem; width: calc(100% - 2.5rem); }
.gallery-toolbar { margin-bottom: 0.85rem; }
.gallery-toolbar select { max-width: 14rem; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.2rem, 1fr));
  gap: 0.72rem;
}

/* ---------------- AI 输出 ---------------- */
.ai-output {
  margin: 0.62rem 0 0;
  padding: 0.75rem 0.85rem;
  max-height: 18rem;
  overflow: auto;
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1.72;
  white-space: pre-wrap;
  word-break: break-word;
  color: #f0e3ca;
  background: rgba(4, 3, 6, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

/* ---------------- 页脚 ---------------- */
.site-footer {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.8rem;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--muted);
}
.site-footer::before {
  content: "✦";
  position: absolute;
  top: -0.62rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 0.5rem;
  font-size: 0.7rem;
  color: var(--gold-deep);
  background: var(--bg);
}
.tbk-footer { margin-bottom: 1.2rem; }
.tbk-footer-title { font-size: 0.86rem; color: #f0e3ca; letter-spacing: 0.04em; }
.tbk-footer-disclosure { font-size: 0.72rem; color: rgba(156, 143, 126, 0.8); }
.tbk-footer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 0.62rem; margin: 0.72rem 0 0; padding: 0; list-style: none; }
.tbk-footer-item {
  padding: 0.58rem 0.72rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
}
.tbk-footer-item strong { display: block; color: #f0e3ca; }
.tbk-footer-item span { font-size: 0.72rem; }
.tbk-footer-config-hint { margin-top: 0.5rem; font-size: 0.7rem; }
.site-footer-disclaimer { padding: 0.62rem 0; border-top: 1px solid rgba(212, 168, 92, 0.12); }
.site-footer-disclaimer strong { color: var(--gold); }
.site-footer-meta p { margin: 0.36rem 0; }

/* ---------------- 提示浮层 ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.7rem;
  z-index: 40;
  padding: 0.52rem 1rem;
  font-size: 0.84rem;
  color: #f7ead2;
  background: rgba(18, 13, 18, 0.96);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(226, 190, 120, 0.08) inset;
  opacity: 0;
  transform: translate(-50%, 0.6rem);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.help-tooltip {
  position: fixed;
  z-index: 300;
  max-width: 16rem;
  padding: 0.42rem 0.62rem;
  font-size: 0.76rem;
  line-height: 1.5;
  color: #f0e3ca;
  background: rgba(14, 10, 15, 0.98);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  box-shadow: var(--shadow);
  pointer-events: none;
}
.help-tooltip[hidden] { display: none; }
.help-tip-active { border-color: var(--line-strong) !important; }

/* ---------------- 小屏 ---------------- */
@media (max-width: 640px) {
  .app-header { padding: 1.3rem 0.9rem 0.7rem; }
  .layout { padding: 0.4rem 0.9rem 1.5rem; gap: 0.9rem; }
  .panel { padding: 0.95rem 0.88rem 1.05rem; }
  .gallery-panel { width: calc(100% - 1.8rem); }
  .reading-cards { gap: 0.62rem; }
  .position-slot { width: 8.7rem; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(5.6rem, 1fr)); gap: 0.52rem; }
  .btn-row { flex-wrap: wrap; }
  .btn-row > * { flex: 1 1 45%; }
}
