* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f6f2e6;
  color: #4a4636;
}
/* 全屏柔和插画背景（固定，中间留白，不抢主体）*/
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background: #f6f2e6 url('assets/bg-portrait.jpg') center center / cover no-repeat;
  opacity: .85;
}
.hidden { display: none !important; }

.app {
  width: 100%;
  min-height: 100vh;
  background: transparent;
}

/* ===== 顶部导航 ===== */
.topnav {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  background: linear-gradient(180deg, rgba(248,244,233,.78) 0%, rgba(248,244,233,.35) 100%);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: none;
}
.brand { font-size: 18px; font-weight: 700; color: #4a4636; letter-spacing: 1px; }
.brand-logo { margin-right: 4px; }
.nav-tabs { display: flex; gap: 6px; }
.nav-tab { font-size: 14px; color: #a89e82; padding: 7px 16px; border-radius: 999px; cursor: pointer; transition: .2s; }
.nav-tab.active { color: #fff; background: linear-gradient(90deg, #cba64e, #dcc06b); font-weight: 600; }

.page { padding: 20px; max-width: 1040px; margin: 0 auto; }

/* ===== hero 落地首页 ===== */
.hero { text-align: center; padding: 28px 0 8px; }
.deck-stack { position: relative; width: 128px; height: 190px; margin: 0 auto; }
.stack-card, .s1 { position: absolute; width: 128px; height: 190px; border-radius: 14px; background: #fffdf5; border: 1px solid #e7dfc4; overflow: hidden; box-shadow: 0 12px 28px rgba(120,100,200,.22); }
.s1 { z-index: 3; } .s1 img { width: 100%; height: 100%; object-fit: cover; }
.s2 { z-index: 2; transform: translate(9px,7px) rotate(5deg); }
.s3 { z-index: 1; transform: translate(18px,14px) rotate(10deg); }
.hero-title { margin: 26px 0 6px; font-size: 30px; font-weight: 800; letter-spacing: 3px; color: #4a4636; }
.hero-sub { margin: 0 auto; max-width: 460px; font-size: 14px; color: #a89e82; line-height: 1.7; }

/* ===== 面板 ===== */
.panel { margin: 22px auto 0; max-width: 560px; background: #fffdf5; border-radius: 18px; padding: 22px; border: 1px solid #efe8d2; box-shadow: 0 8px 22px rgba(120,100,200,.1); }
.field-label { font-size: 13px; color: #8f86c9; font-weight: 600; margin: 4px 0 8px; }
.field-label:not(:first-child) { margin-top: 18px; }
.q-wrap { position: relative; background: #fbf8ee; border-radius: 12px; padding: 12px 14px; }
.q-input { width: 100%; min-height: 44px; font-size: 15px; color: #4a4636; line-height: 1.5; border: none; outline: none; resize: none; background: transparent; font-family: inherit; }
.q-fake-ph { position: absolute; left: 14px; top: 12px; pointer-events: none; font-size: 15px; color: #c2b998; line-height: 1.5; }
.caret { color: #cba64e; font-weight: 700; animation: caretblink 1s step-end infinite; }
@keyframes caretblink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

.mode-row { display: flex; gap: 10px; }
.mode-item { flex: 1; padding: 12px 6px; border-radius: 12px; border: 1px solid #ece3c8; background: #fbf8ee; text-align: center; cursor: pointer; transition: .2s; }
.mode-item.active { background: #f6eccf; border-color: #d9b968; box-shadow: 0 2px 8px rgba(217,185,104,.3); }
.mode-label { display: block; font-size: 15px; font-weight: 600; color: #4a4636; }
.mode-desc { display: block; margin-top: 4px; font-size: 10px; color: #a89e82; }
.mode-item.active .mode-label { color: #8a6a24; }
.mode-item.active .mode-desc { color: #b08e40; }

.draw-btn { width: 100%; border: none; cursor: pointer; font-family: inherit; margin-top: 20px; background: linear-gradient(90deg, #cba64e, #dcc06b); color: #fff; font-weight: 700; font-size: 16px; border-radius: 999px; padding: 14px 0; box-shadow: 0 8px 18px rgba(203,166,78,.32); }
.draw-btn.again { background: #f0ecff; color: #8f86c9; box-shadow: none; }
.draw-btn:disabled { opacity: .6; }

/* ===== 洗牌 ===== */
#viewShuffle { display: flex; flex-direction: column; align-items: center; padding-top: 20px; max-width: 640px; margin: 0 auto; }
.shuffle-cards { position: relative; width: 100%; height: 320px; cursor: pointer; }
.shuffle-card { position: absolute; left: 50%; top: 46px; margin-left: -76px; width: 152px; height: 226px; border-radius: 15px; overflow: hidden; box-shadow: 0 10px 22px rgba(143,134,201,.32);
  transform: translate(var(--rx,0), var(--ry,0)) rotate(var(--rr,0deg)); transition: transform .45s ease; }
.shuffle-card img { width: 100%; height: 100%; object-fit: cover; }
.shuffle-cards.playing .shuffle-card { animation: shuffleMove 1.1s ease-in-out; }
@keyframes shuffleMove {
  0%, 100% { transform: translate(var(--rx,0), var(--ry,0)) rotate(var(--rr,0deg)); }
  40% { transform: translate(var(--mx,0), var(--my,0)) rotate(var(--mr,0deg)); }
}
.shuffle-text { margin-top: 16px; font-size: 16px; color: #cba64e; font-weight: 600; }
.shuffle-tip { margin-top: 6px; font-size: 13px; color: #a89e82; }
.shuffle-actions { display: flex; gap: 12px; margin-top: 22px; justify-content: center; }
.shuffle-actions .draw-btn { flex: initial; width: auto; margin-top: 0; padding: 9px 24px; font-size: 14px; box-shadow: 0 5px 12px rgba(203,166,78,.26); }

/* ===== 抽牌扇形 ===== */
#viewPick { max-width: 700px; margin: 0 auto; }
.pick-topbar { display: flex; justify-content: flex-end; margin: 2px 0 6px; }
.pick-cancel { font-size: 13px; color: #8f86c9; padding: 5px 14px; border-radius: 999px; background: #f0ecff; cursor: pointer; }
.pick-hint-bottom { text-align: center; font-size: 14px; color: #cba64e; font-weight: 600; margin-top: 12px; }
.fan { position: relative; width: 100%; }
.fan-card { position: absolute; transform-origin: center center; transition: transform .28s, opacity .28s; cursor: pointer; }
.fan-card .cb { width: 100%; height: 100%; border-radius: 8px; overflow: hidden; border: 2px solid #fff; box-shadow: 0 5px 12px rgba(143,134,201,.28); }
.fan-card .cb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fan-card.picked { opacity: .32; }
.pick-badge { position: absolute; top: -9px; left: 50%; margin-left: -11px; width: 22px; height: 22px; line-height: 22px; text-align: center; border-radius: 50%; background: #cba64e; color: #fff; font-weight: 700; font-size: 12px; z-index: 99; }

/* ===== 结果：两栏 ===== */
.result-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.back-home { font-size: 14px; color: #8f86c9; cursor: pointer; }
.mini-btn { font-family: inherit; cursor: pointer; font-size: 13px; color: #8f86c9; background: #f0ecff; border: none; border-radius: 999px; padding: 7px 16px; }
.result-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
.result-left, .result-right { min-width: 0; }
.result-q-card { display: flex; flex-direction: column; gap: 5px; background: #fffdf5; border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; border: 1px solid #efe8d2; border-left: 5px solid #8f86c9; box-shadow: 0 6px 16px rgba(143,134,201,.12); }
.result-q-label { font-size: 11px; color: #8f86c9; font-weight: 600; }
.result-q-text { font-size: 17px; color: #4a4636; font-weight: 600; line-height: 1.5; word-break: break-word; overflow-wrap: anywhere; }

.cards-scroll { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cards-row { align-items: flex-start; gap: 14px; padding: 4px 2px 12px; }
.cards-row.scroll { display: inline-flex; }
.cards-row.even { display: flex; width: 100%; justify-content: center; }
.cards-row.wrap { display: flex; flex-wrap: wrap; justify-content: center; row-gap: 18px; }
.cards-hint { text-align: center; font-size: 12px; color: #b39b6a; margin-top: 2px; }
.result-card-wrap { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.pos-label { font-size: 12px; color: #9a92ba; margin-bottom: 7px; }
.tarot-card { position: relative; width: 100%; aspect-ratio: 116 / 174; border-radius: 11px; overflow: hidden; background: #fbf8ee; border: 2px solid #fff; box-shadow: 0 6px 16px rgba(143,134,201,.24); display: flex; align-items: center; justify-content: center; animation: flipIn .5s ease; }
@keyframes flipIn { from { transform: rotateY(90deg); opacity: 0; } }
.tarot-card img { width: 100%; height: 100%; object-fit: cover; }
.tarot-card.reversed img { transform: rotate(180deg); }
.tc-fallback { text-align: center; }
.tc-symbol { font-size: 30px; color: #8f86c9; }
.tc-orient-tag { position: absolute; top: 6px; right: 6px; font-size: 10px; color: #fff; background: #8f86c9; padding: 2px 7px; border-radius: 999px; z-index: 2; }
.tc-orient-tag.rev { background: #d98aa8; }
.tc-name { margin-top: 8px; font-size: 15px; color: #4a4636; font-weight: 600; text-align: center; }
.meaning { margin-top: 6px; width: 100%; }
.meaning-title { display: block; font-size: 12px; color: #cba64e; margin-bottom: 4px; }
.meaning-text { font-size: 12px; color: #6a6350; line-height: 1.6; }
.tap-tip { margin-top: 7px; font-size: 11px; color: #b39b6a; }

.interpret-box { background: #fffdf5; border-radius: 12px; padding: 18px; border: 1px solid #efe8d2; box-shadow: 0 6px 16px rgba(143,134,201,.1); }
.interpret-title { font-size: 16px; color: #cba64e; font-weight: 700; margin-bottom: 10px; }
.interpret-text { font-size: 14.5px; color: #4a4636; line-height: 1.85; word-break: break-word; overflow-wrap: anywhere; }
.interpret-text strong { color: #8f86c9; }
.interpret-loading { display: flex; flex-direction: column; align-items: center; padding: 12px 0; }
.loading-orb { position: relative; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; }
.orb-ring { position: absolute; width: 48px; height: 48px; border-radius: 50%; border: 2px solid rgba(203,166,78,.25); border-top-color: #cba64e; animation: orbspin .9s linear infinite; }
.orb-emoji { font-size: 22px; animation: orbpulse 1.6s ease-in-out infinite; }
@keyframes orbspin { to { transform: rotate(360deg); } }
@keyframes orbpulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }
.loading-text { margin-top: 9px; font-size: 13px; color: #a89e82; }
.dots i { animation: dotblink 1.4s infinite both; font-style: normal; }
.dots i:nth-child(2){ animation-delay:.2s } .dots i:nth-child(3){ animation-delay:.4s }
@keyframes dotblink { 0%,80%,100%{opacity:0} 40%{opacity:1} }

/* 追问 */
.follow-list { margin-top: 14px; border-top: 1px dashed #e7dfc4; padding-top: 12px; }
.follow-item { margin-bottom: 12px; }
.follow-q { display: flex; gap: 6px; font-size: 14px; color: #4a4636; font-weight: 600; margin-bottom: 5px; }
.follow-q-badge { flex: 0 0 auto; font-size: 10px; color: #fff; background: #8f86c9; border-radius: 4px; padding: 1px 5px; height: 16px; line-height: 14px; margin-top: 3px; }
.follow-a { display: block; font-size: 13.5px; color: #4a4636; line-height: 1.75; background: #fbf6e7; border-radius: 8px; padding: 10px 12px; }
.follow-a strong { color: #8f86c9; }
.follow-a.pending { color: #a89e82; }
.follow-box { margin-top: 12px; }
.follow-entry { text-align: center; font-size: 13.5px; color: #cba64e; border: 1px dashed #d9c99a; border-radius: 8px; padding: 12px; cursor: pointer; }
.follow-progress { font-size: 12px; color: #cba64e; font-weight: 600; margin-bottom: 6px; text-align: right; }
.follow-done { text-align: center; font-size: 13px; color: #a89e82; padding: 12px; background: #f4efe0; border-radius: 8px; }
.follow-input { width: 100%; min-height: 46px; font-size: 14px; color: #4a4636; background: #fbf8ee; border: none; outline: none; resize: none; border-radius: 8px; padding: 10px 12px; line-height: 1.5; font-family: inherit; }
.follow-send { margin-top: 8px; }

/* 记录 */
#recordsWrap { max-width: 640px; margin: 0 auto; }
.rec-tip { text-align: center; margin-top: 70px; color: #a89e82; font-size: 14px; }
.rec { background: #fffdf5; border-radius: 12px; padding: 15px; margin-bottom: 12px; border: 1px solid #efe8d2; box-shadow: 0 4px 12px rgba(143,134,201,.1); }
.rec-head { display: flex; justify-content: space-between; align-items: center; }
.rec-time { font-size: 12px; color: #a89e82; }
.rec-head-right { display: flex; align-items: center; gap: 8px; }
.rec-mode { font-size: 11px; color: #fff; background: #8f86c9; border-radius: 999px; padding: 2px 8px; }
.rec-del { font-size: 11px; color: #d98aa8; border: 1px solid #eecdd9; border-radius: 999px; padding: 2px 9px; cursor: pointer; }
.rec-body { margin-top: 6px; cursor: pointer; }
.rec-q { font-size: 15px; color: #4a4636; font-weight: 600; }
.rec-cards { margin-top: 6px; font-size: 13px; color: #cba64e; line-height: 1.6; }
.rec-interpret { display: none; margin-top: 8px; font-size: 13px; color: #6a6350; line-height: 1.8; }
.rec-interpret.show { display: block; }
.rec-interpret strong { color: #8f86c9; }
.rec-toggle { margin-top: 8px; text-align: center; font-size: 12px; color: #b3abce; }

/* ===== 桌面（≥820px）：结果两栏 + 更大排版 ===== */
@media (min-width: 820px) {
  body { background: #f2ede0; }
  body::before { background-image: url('assets/bg-landscape.jpg'); }
  .hero-title { font-size: 38px; }
  .hero-sub { font-size: 15px; max-width: 520px; }
  .deck-stack { width: 150px; height: 222px; }
  .stack-card, .s1 { width: 150px; height: 222px; }
  .result-grid { grid-template-columns: 1.05fr 1fr; align-items: start; }
  .result-left { position: sticky; top: 78px; }
  .interpret-text { font-size: 15.5px; }
}
