/* 卜 · BU — 温暖雅致的术数文化站 */
:root {
  --paper: #F5EEE0;
  --paper-2: #EDE2CE;
  --surface: #FFFCF4;
  --ink: #24231D;
  --ink-2: #49463C;
  --muted: #7B7565;
  --gold: #B28A45;
  --gold-deep: #8C6730;
  --seal: #9A4A3B;
  --jade: #4E6A5E;
  --line: #D8CBB2;
  --sans: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --serif: 'Songti SC', 'STSong', 'Noto Serif SC', Georgia, serif;
  --max: 1180px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.85 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
::selection { background: var(--gold); color: #fff; }
.container { width: min(100% - 36px, var(--max)); margin: 0 auto; }
.narrow { width: min(100% - 36px, 760px); margin: 0 auto; }
.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; }

/* 页头 */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(245,238,224,.94); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 24px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 12px; margin-right: auto; }
.brand-mark { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--seal); color: var(--seal); border-radius: 3px; font: 700 22px/1 var(--serif); transform: rotate(-2deg); }
.brand-text { display: inline-flex; align-items: baseline; gap: 6px; }
.brand-name { font: 700 24px/1 var(--serif); letter-spacing: .08em; }
.brand-en { font: 600 10px/1 var(--sans); letter-spacing: .18em; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 14px; }
.nav a { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--ink-2); }
.nav a:hover { color: var(--gold-deep); }
.nav svg, .mobile-nav svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; opacity: .7; }
.nav a:hover svg, .mobile-nav a:hover svg { opacity: 1; }
.menu-btn { display: none; width: 38px; height: 38px; border: 1px solid var(--line); background: transparent; }
.mobile-nav { display: none; }
.mobile-nav a { display: inline-flex; align-items: center; gap: 8px; }

/* 通用标题与按钮 */
.section { padding: 72px 0; }
.section-sm { padding: 46px 0; }
.section-tint { background: var(--paper-2); }
.section-surface { background: var(--surface); }
.section-head { margin-bottom: 26px; }
.kicker { display: inline-block; font-size: 12px; letter-spacing: .18em; color: var(--gold-deep); margin-bottom: 10px; }
.section-title { font: 700 clamp(28px, 4vw, 44px)/1.25 var(--serif); letter-spacing: -.02em; }
.section-desc { margin-top: 10px; max-width: 48em; color: var(--muted); text-wrap: balance; }
.section-desc.wide { max-width: none; text-wrap: auto; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border: 1px solid var(--ink); background: var(--ink); color: var(--surface); border-radius: 2px; font-weight: 650; transition: background-color .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease); }
.btn:hover { background: var(--gold-deep); border-color: var(--gold-deep); transform: translateY(-1px); }
.btn.soft { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.soft:hover { border-color: var(--gold); color: var(--gold-deep); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Hero */
.hero { position: relative; overflow: hidden; padding: 68px 0 76px; }
.hero::before { content: ''; position: absolute; width: 460px; height: 460px; right: -160px; top: -170px; border: 1px solid rgba(178,138,69,.28); border-radius: 50%; }
.hero::after { content: ''; position: absolute; width: 260px; height: 260px; left: -110px; bottom: -130px; border: 1px solid rgba(154,74,59,.18); border-radius: 50%; }
.hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.hero h1 { font: 700 clamp(72px, 13vw, 150px)/.86 var(--serif); letter-spacing: -.08em; }
.hero h1 .seal-char { color: var(--seal); }
.hero-sub { margin-top: 22px; font: 700 clamp(24px, 3vw, 38px)/1.3 var(--serif); }
.hero-copy { margin-top: 14px; max-width: 38em; color: var(--ink-2); }
.hero-actions { margin-top: 28px; }
.hero-art { position: relative; aspect-ratio: 1; display: grid; place-items: center; }
.hero-ring { position: absolute; inset: 5%; border: 1px solid var(--line); border-radius: 50%; }
.hero-ring::before, .hero-ring::after { content: ''; position: absolute; inset: 12%; border: 1px solid rgba(178,138,69,.45); border-radius: 50%; }
.hero-ring::after { inset: 27%; border-color: rgba(154,74,59,.35); }
.hero-glyph { position: relative; z-index: 1; font: 700 clamp(120px, 20vw, 230px)/1 var(--serif); color: var(--ink); text-shadow: 3px 3px 0 rgba(178,138,69,.18); }
.daily-chip { position: absolute; right: 0; bottom: 4%; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(36,35,29,.08); font-size: 13px; }

/* 主题入口 */
.topic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.topic { position: relative; display: flex; flex-direction: column; min-height: 190px; padding: 22px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; transition: transform .18s var(--ease), border-color .18s var(--ease); }
.topic:hover { transform: translateY(-3px); border-color: var(--gold); }
.topic::after { content: attr(data-glyph); position: absolute; right: -6px; bottom: -28px; font: 700 110px/1 var(--serif); color: rgba(178,138,69,.12); }
.topic-id { font-size: 12px; color: var(--gold-deep); letter-spacing: .12em; }
.topic h3 { margin-top: 16px; font: 700 24px/1.2 var(--serif); }
.topic p { margin-top: 10px; color: var(--muted); font-size: 14px; }
.topic-arrow { margin-top: auto; color: var(--gold-deep); font-size: 13px; }

/* 卡片与网格 */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.card { background: var(--surface); border: 1px solid var(--line); padding: 22px; }
.card h3 { font: 700 20px/1.4 var(--serif); }
.card p { margin-top: 8px; color: var(--muted); font-size: 14px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; }
.tag { display: inline-flex; padding: 3px 9px; border: 1px solid var(--line); color: var(--ink-2); font-size: 12px; background: var(--paper); }

/* 交互面板 */
.panel { background: var(--surface); border: 1px solid var(--line); padding: 24px; }
.search-panel { padding: 16px; }
.search-panel input { width: 100%; min-height: 46px; padding: 10px 14px 10px 42px; background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%237B7565' stroke-width='1.5' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='4.5'/%3E%3Cpath d='m10.5 10.5 3 3'/%3E%3C/svg%3E") no-repeat 14px center / 16px 16px; border: 1px solid var(--line); border-radius: 2px; outline: none; font-size: 14px; }
.search-panel input::placeholder { color: var(--muted); }
.search-panel input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(178,138,69,.14); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 13px; color: var(--ink-2); }
.field input, .field select, .field textarea { width: 100%; min-height: 44px; padding: 10px 12px; background: var(--paper); border: 1px solid var(--line); outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); }
.full { grid-column: 1 / -1; }
.result { margin-top: 20px; padding: 22px; background: var(--paper-2); border-left: 3px solid var(--gold); }
.result h3 { font: 700 22px/1.4 var(--serif); }
.result p { margin-top: 8px; }
.result-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0; }
.pillar { padding: 14px 10px; border: 1px solid var(--line); background: var(--surface); text-align: center; }
.pillar b { display: block; font: 700 20px/1.3 var(--serif); }
.pillar span { font-size: 12px; color: var(--muted); }
.notice { margin-top: 16px; padding: 14px 16px; background: rgba(178,138,69,.1); color: var(--ink-2); font-size: 13px; }

/* 塔罗牌 */
.tarot-stage { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 22px; }
.tarot-card { position: relative; min-height: 270px; padding: 18px; border: 1px solid var(--gold); background: linear-gradient(160deg, var(--surface), var(--paper-2)); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.tarot-card::before { content: ''; position: absolute; inset: 8px; border: 1px solid rgba(178,138,69,.35); }
.tarot-card .roman { font: 700 12px/1 var(--serif); letter-spacing: .2em; color: var(--gold-deep); }
.tarot-card .glyph { margin: 16px 0; font: 700 52px/1 var(--serif); color: var(--seal); }
.tarot-card .name { font: 700 20px/1.3 var(--serif); }
.tarot-card .pos { position: absolute; top: 18px; left: 18px; font-size: 12px; color: var(--muted); }
.tarot-card .orientation { margin-top: 8px; font-size: 13px; color: var(--gold-deep); }
.tarot-card.reversed { transform: rotate(180deg); }
.tarot-card.reversed > * { transform: rotate(180deg); }

/* 卦象 */
.hex-lines { display: grid; gap: 8px; margin: 16px 0; }
.hex-line { display: flex; gap: 6px; height: 12px; }
.hex-line i { flex: 1; background: var(--ink); }
.hex-line.yin i:first-child { background: transparent; }
.hex-line.yin i:last-child { background: transparent; }
.hex-line.moving::after { content: '动'; margin-left: 8px; font-size: 12px; color: var(--seal); }

/* 知识库 */
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 24px; }
.chip { min-height: 34px; padding: 0 14px; border: 1px solid var(--line); background: transparent; font-size: 13px; }
.chip.active { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.article { padding: 20px 0; border-bottom: 1px solid var(--line); }
.article h3 { font: 700 21px/1.4 var(--serif); }
.article p { margin-top: 8px; color: var(--muted); }
.source-note { margin-top: 10px; font-size: 12px; color: var(--gold-deep); }

/* 每日卜课、印章与小测 */
.daily-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.daily-card { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.daily-card > .tag { align-self: flex-start; }
.daily-card .btn { align-self: flex-start; margin-top: 4px; }
.fortune-stage { width: 100%; }
[data-badge-progress] { width: 100%; }
.fortune-card { width: 100%; padding: 14px; background: var(--paper-2); border: 1px solid var(--line); }
.fortune-card .level { display: inline-block; padding: 2px 8px; background: var(--seal); color: #fff; font-size: 12px; letter-spacing: .1em; }
.fortune-card h3 { margin: 10px 0 6px; font: 700 20px/1.3 var(--serif); }
.fortune-card p { margin-top: 6px; font-size: 14px; }
.fortune-card .tag { margin-top: 10px; }
.reveal, .tarot-stage .tarot-card, .hex-lines .hex-line { animation: bu-reveal .45s var(--ease) both; }
.tarot-stage .tarot-card:nth-child(2), .hex-lines .hex-line:nth-child(2) { animation-delay: .06s; }
.tarot-stage .tarot-card:nth-child(3), .hex-lines .hex-line:nth-child(3) { animation-delay: .12s; }
.tarot-stage .tarot-card:nth-child(4), .hex-lines .hex-line:nth-child(4) { animation-delay: .18s; }
.hex-lines .hex-line:nth-child(5) { animation-delay: .24s; }
.hex-lines .hex-line:nth-child(6) { animation-delay: .3s; }
@keyframes bu-reveal { from { opacity: 0; transform: translateY(10px) rotateX(-6deg); } to { opacity: 1; transform: none; } }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 10px; }
.badge { display: grid; place-items: center; gap: 4px; padding: 10px 4px; border: 1px dashed var(--line); color: var(--muted); text-align: center; }
.badge span { font: 700 22px/1 var(--serif); }
.badge small { font-size: 11px; }
.badge.owned { border-style: solid; border-color: var(--seal); color: var(--seal); background: rgba(154,74,59,.06); }
.quiz-option { display: block; width: 100%; text-align: left; padding: 10px 14px; margin-top: 8px; border: 1px solid var(--line); background: var(--paper); }
.quiz-option:hover { border-color: var(--gold); }
.quiz-option.correct { border-color: var(--jade); background: rgba(78,106,94,.12); color: var(--jade); }
.quiz-option.wrong { border-color: var(--seal); background: rgba(154,74,59,.1); color: var(--seal); }
.quiz-option.quiet { opacity: .45; }
.quiz-feedback { margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.quiz-feedback .btn { margin-top: 10px; }

/* 页脚 */
.site-footer { margin-top: 40px; padding: 54px 0 24px; background: var(--ink); color: #EDE3D0; }
.footer-inner { display: grid; grid-template-columns: minmax(0, 2fr) minmax(140px, .7fr) minmax(260px, 1.3fr); gap: 36px; align-items: start; }
.footer-brand-block { display: flex; align-items: flex-start; gap: 14px; }
.footer-col h3 { margin-bottom: 10px; font-size: 14px; color: #EDE3D0; }
.footer-note { color: #BDB3A0; font-size: 13px; }
.footer-col-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.footer-col-head h3 { margin-bottom: 0; }
.site-footer .btn.soft { color: #EDE3D0; border-color: rgba(237,227,208,.45); }
.site-footer .btn.soft:hover { color: #fff; border-color: var(--gold); background: rgba(255,255,255,.06); }
.footer-bottom { margin-top: 34px; padding-top: 16px; border-top: 1px solid rgba(237,227,208,.18); font-size: 12px; color: #BDB3A0; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* 通用工具 */
.center { text-align: center; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--line); margin: 24px 0; }
.kv { display: grid; grid-template-columns: 100px 1fr; gap: 10px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 10px 18px; font-size: 13px; z-index: 100; opacity: 0; pointer-events: none; transition: opacity .18s var(--ease); }
.toast.show { opacity: 1; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { width: min(100%, 360px); margin: 0 auto; }
  .topic-grid, .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .daily-grid { grid-template-columns: 1fr 1fr; }
  .daily-grid > :last-child { grid-column: 1 / -1; }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer-brand-block { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .container, .narrow { width: min(100% - 28px, var(--max)); }
  .nav { display: none; }
  .menu-btn { display: block; }
  .mobile-nav { display: none; position: absolute; left: 0; right: 0; top: 68px; padding: 12px 18px 18px; background: var(--paper); border-bottom: 1px solid var(--line); }
  .mobile-nav.open { display: grid; gap: 10px; }
  .section { padding: 54px 0; }
  .topic-grid, .grid-2, .grid-3, .grid-4, .form-grid, .result-grid, .tarot-stage, .daily-grid { grid-template-columns: 1fr; }
  .daily-grid > :last-child { grid-column: auto; }
  .hero { padding: 46px 0 56px; }
  .hero h1 { font-size: clamp(76px, 26vw, 120px); }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .footer-brand-block { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
