@charset "UTF-8";
/* === Design Tokens === */
:root {
  --bg: #0a0a0a;
  --bg-elevated: #111111;
  --bg-card: #161616;
  --fg: #e8e0d0;
  --fg-muted: #8a8274;
  --fg-dim: #5a5548;
  --gold: #c9a84c;
  --gold-dim: #8a7535;
  --gold-glow: rgba(201, 168, 76, 0.15);
  --red: #b22222;
  --red-bright: #c0392b;
  --red-glow: rgba(178, 34, 34, 0.18);
  --silver: #a8a8b0;
  --silver-glow: rgba(168, 168, 176, 0.15);
  /* WHY long fallback chain: Google Fonts (fonts.googleapis.com) is blocked
     in China and on some restricted networks. Without CJK system fonts in the
     fallback, Chinese characters render as invisible zero-width boxes —
     exactly the "garbled" symptom seen in 13 rounds of debugging. */
  --serif: 'Noto Serif SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'STSong', 'SimSun', 'Songti SC', serif;
  --sans: 'Inter', -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', 'Hiragino Sans GB', sans-serif;
  --max-w: 960px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.2;
}

/* === NAV === */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(201, 168, 76, 0.1);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 28px;
  align-items: center;
}

.nav-links a {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.15s;
}

.nav-links a:hover { color: var(--fg); }

.nav-cta {
  background: var(--gold) !important;
  color: var(--bg) !important;
  padding: 8px 18px;
  border-radius: 5px;
  font-weight: 600;
  font-size: 0.85rem !important;
}

.nav-cta:hover { background: #d4b45a !important; }

/* Nav auth state — populated by nav-auth.js */
.nav-auth {
  display: inline-flex;
  gap: 10px;
  align-items: center;
}

.nav-user-name {
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 600;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-link-subtle {
  color: var(--fg-muted) !important;
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
}

.nav-link-subtle:hover { color: var(--fg) !important; }

.nav-link-auth {
  color: var(--gold) !important;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.nav-link-auth:hover { color: #d4b45a !important; }

/* === HERO === */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  overflow: hidden;
  background: var(--bg);
  padding-top: 56px;
}

/* Hero hexagram background — 地风升卦 (Hexagram #46) */
.hero-hexagram-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8vh;
  pointer-events: none;
}

.hero-hexagram {
  width: 550px;
  height: auto;
  opacity: 0.35;
  filter: drop-shadow(0 0 32px rgba(184, 134, 11, 0.5));
}

@media (max-width: 768px) {
  .hero-hexagram { width: 350px; }
}
@media (max-width: 480px) {
  .hero-hexagram { width: 260px; }
}

.hero-bg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.07;
  pointer-events: none;
}

.hexagram-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  transform: scale(3);
}

.hex-line {
  height: 6px;
  border-radius: 2px;
}

.hex-line.solid {
  width: 80px;
  background: var(--gold);
}

.hex-line.broken {
  width: 80px;
  background: transparent;
  position: relative;
}

.hex-line.broken::before,
.hex-line.broken::after {
  content: '';
  position: absolute;
  top: 0;
  height: 6px;
  width: 32px;
  background: var(--gold);
  border-radius: 2px;
}

.hex-line.broken::before { left: 0; }
.hex-line.broken::after { right: 0; }

.hero-content {
  position: relative;
  z-index: 1;
  padding: 40px 24px 0;
  margin-bottom: auto;
  margin-top: 12vh;
}

.hero-kicker {
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 24px;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  color: var(--fg);
  margin-bottom: 16px;
}

.hero h1 .gold { color: var(--gold); }

.hero-tagline {
  font-family: var(--serif);
  font-size: 1.3rem;
  color: var(--fg);
  margin-bottom: 10px;
}

.hero-sub {
  font-size: 1rem;
  color: var(--fg-muted);
  max-width: 540px;
  margin: 0 auto 36px;
  letter-spacing: 0.03em;
}

/* === CTA Buttons === */
.cta-btn {
  display: inline-block;
  padding: 14px 32px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  margin: 6px 8px;
}

.cta-primary {
  background: var(--gold);
  color: var(--bg);
}

.cta-primary:hover {
  background: #d4b45a;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--gold-glow);
}

.cta-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid rgba(201, 168, 76, 0.35);
}

.cta-ghost:hover {
  border-color: var(--gold);
  color: var(--gold);
  transform: translateY(-1px);
}

/* === TRUST BAR === */
.trust-bar {
  background: var(--bg-elevated);
  border-top: 1px solid rgba(201, 168, 76, 0.08);
  border-bottom: 1px solid rgba(201, 168, 76, 0.08);
  padding: 14px 24px;
  overflow-x: auto;
}

.trust-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  max-width: var(--max-w);
  margin: 0 auto;
}

.trust-item {
  font-size: 0.8rem;
  color: var(--fg-muted);
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.trust-dot {
  width: 5px;
  height: 5px;
  background: var(--gold);
  border-radius: 50%;
  flex-shrink: 0;
}

.trust-sep {
  color: var(--fg-dim);
  font-size: 0.9rem;
}

/* === SECTION HEADER === */
.section-header {
  text-align: center;
  margin-bottom: 48px;
}

.section-kicker {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.red-kicker { color: var(--red-bright); }

/* === FEATURES === */
.features-section {
  padding: 80px 0;
  background: var(--bg);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 32px 24px;
  text-align: center;
  transition: border-color 0.2s, transform 0.2s;
}

.feature-card:hover {
  border-color: rgba(201, 168, 76, 0.3);
  transform: translateY(-3px);
}

.feature-icon-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.red-glow { background: var(--red-glow); border: 1px solid rgba(178,34,34,0.3); }
.gold-glow { background: var(--gold-glow); border: 1px solid rgba(201,168,76,0.3); }
.silver-glow { background: var(--silver-glow); border: 1px solid rgba(168,168,176,0.3); }

.feature-icon {
  font-family: var(--serif);
  font-size: 2rem;
  color: var(--fg);
}

.feature-card h3 {
  font-size: 1.15rem;
  color: var(--fg);
  margin-bottom: 12px;
}

.feature-desc {
  font-size: 0.875rem;
  color: var(--fg-muted);
  line-height: 1.65;
  margin-bottom: 16px;
}

.feature-tag {
  display: inline-block;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--fg-dim);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}

/* === RITUAL === */
.ritual-section {
  padding: 80px 0;
  background: var(--bg-elevated);
  border-top: 1px solid rgba(201,168,76,0.07);
  border-bottom: 1px solid rgba(201,168,76,0.07);
}

.ritual-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 680px;
  margin: 0 auto;
  position: relative;
}

.ritual-steps::before {
  content: '';
  position: absolute;
  left: 31px;
  top: 24px;
  bottom: 24px;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--gold-dim) 10%, var(--gold-dim) 90%, transparent);
}

.ritual-step {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 18px 24px;
  border-radius: 10px;
  transition: background 0.15s;
}

.ritual-step:hover { background: rgba(201, 168, 76, 0.04); }

.active-step {
  background: rgba(178, 34, 34, 0.06) !important;
  border: 1px solid rgba(178, 34, 34, 0.2);
}

.step-number {
  font-family: var(--serif);
  font-size: 0.75rem;
  color: var(--gold);
  background: var(--bg-card);
  border: 1px solid var(--gold-dim);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  margin-top: 2px;
}

.active-step .step-number {
  background: var(--red);
  border-color: var(--red-bright);
  color: #fff;
}

.step-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
  margin-top: 1px;
}

.step-body h4 {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--fg);
  margin-bottom: 4px;
}

.step-body p {
  font-size: 0.85rem;
  color: var(--fg-muted);
  line-height: 1.6;
}

.step-badge {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.7rem;
  background: var(--red);
  color: #fff;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.05em;
}

/* === CASTING METHODS === */
.methods-section {
  padding: 80px 0;
  background: var(--bg);
}

.methods-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.method-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 28px 20px;
  text-align: center;
  transition: border-color 0.2s;
}

.method-card:hover { border-color: rgba(201, 168, 76, 0.25); }

.method-glyph {
  font-family: var(--serif);
  font-size: 2.5rem;
  margin-bottom: 12px;
  color: var(--gold);
}

.method-card h4 {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--fg);
  margin-bottom: 10px;
}

.method-card p {
  font-size: 0.85rem;
  color: var(--fg-muted);
  line-height: 1.55;
  margin-bottom: 14px;
}

.method-tag {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--fg-dim);
  text-transform: uppercase;
  border: 1px solid rgba(255,255,255,0.07);
  padding: 2px 10px;
  border-radius: 20px;
}

/* === USERS === */
.users-section {
  padding: 80px 0;
  background: var(--bg-elevated);
}

.users-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.user-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 28px 20px;
  text-align: center;
  transition: border-color 0.2s;
}

.user-card:hover { border-color: rgba(201, 168, 76, 0.2); }

.user-icon { font-size: 2rem; margin-bottom: 12px; }

.user-card h4 {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--fg);
  margin-bottom: 8px;
}

.user-card p {
  font-size: 0.85rem;
  color: var(--fg-muted);
  line-height: 1.55;
}

/* === COMPARISON TABLE === */
.compare-section {
  padding: 80px 0;
  background: var(--bg);
}

.compare-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.06);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.compare-table th {
  font-family: var(--serif);
  font-weight: 700;
  padding: 16px 20px;
  text-align: center;
  background: var(--bg-card);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: var(--fg-muted);
  font-size: 0.8rem;
}

.compare-table th:first-child { text-align: left; }

.compare-table td {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--fg-muted);
  text-align: center;
}

.compare-table td:first-child { text-align: left; color: var(--fg); }

.compare-table tr:last-child td { border-bottom: none; }
.compare-table tr:hover td { background: rgba(255,255,255,0.015); }

.col-yao {
  background: rgba(201, 168, 76, 0.05) !important;
  color: var(--gold) !important;
  font-family: var(--serif);
  font-weight: 700;
}

.compare-table th.col-yao {
  color: var(--gold) !important;
  border-bottom-color: rgba(201,168,76,0.2) !important;
}

.check { color: var(--gold) !important; font-weight: 700; }
.cross { color: var(--red-bright); }
.neutral { color: var(--fg-dim); }

/* === FAQ === */
.faq-section {
  padding: 80px 0;
  background: var(--bg-elevated);
}

.faq-list {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.faq-item[open] {
  border-color: rgba(201, 168, 76, 0.2);
}

.faq-item summary {
  padding: 18px 20px;
  cursor: pointer;
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--fg);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: '+';
  color: var(--gold);
  font-size: 1.2rem;
  font-weight: 300;
  transition: transform 0.2s;
  flex-shrink: 0;
  margin-left: 12px;
}

.faq-item[open] summary::after {
  content: '−';
}

.faq-body {
  padding: 0 20px 18px;
  font-size: 0.875rem;
  color: var(--fg-muted);
  line-height: 1.7;
  border-top: 1px solid rgba(255,255,255,0.04);
  padding-top: 14px;
}

/* === SITE FOOTER === */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid rgba(201, 168, 76, 0.1);
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 56px 24px 40px;
  display: flex;
  gap: 48px;
  justify-content: space-between;
  flex-wrap: wrap;
}

.footer-brand { max-width: 320px; }

.footer-logo {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 10px;
}

.footer-tagline {
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-bottom: 6px;
}

.footer-privacy {
  font-size: 0.8rem;
  color: var(--fg-dim);
}

.footer-links {
  display: flex;
  gap: 48px;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-col h5 {
  font-family: var(--serif);
  font-size: 0.8rem;
  color: var(--fg-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.footer-col a {
  font-size: 0.875rem;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-col a:hover { color: var(--gold); }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.04);
  padding: 16px 24px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--fg-dim);
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
}

/* === APP SECTION === */
.app-section {
  padding: 80px 0;
}

.section-title {
  text-align: center;
  font-size: 1.8rem;
  margin-bottom: 12px;
  color: var(--fg);
}

.section-sub {
  text-align: center;
  color: var(--fg-muted);
  margin-bottom: 48px;
}

/* === Hexagram Selector === */
.hex-selector {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin-bottom: 40px;
}

.palace-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.palace-label {
  font-family: var(--serif);
  font-size: 0.8rem;
  color: var(--gold);
  text-align: center;
  padding: 4px 0;
  border-bottom: 1px solid var(--gold-dim);
  margin-bottom: 4px;
}

.hex-btn {
  background: var(--bg-card);
  border: 1px solid transparent;
  color: var(--fg-muted);
  font-family: var(--serif);
  font-size: 0.7rem;
  padding: 6px 2px;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.15s;
  text-align: center;
  line-height: 1.3;
}

.hex-btn:hover {
  border-color: var(--gold-dim);
  color: var(--fg);
}

.hex-btn.active {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-glow);
}

/* === Line Input === */
.line-input-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 40px;
}

.line-input-label {
  font-family: var(--serif);
  color: var(--fg-muted);
  font-size: 0.9rem;
}

.line-toggles {
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  align-items: center;
}

.line-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
}

.line-pos {
  font-family: var(--serif);
  font-size: 0.8rem;
  color: var(--fg-dim);
  width: 24px;
  text-align: right;
}

.line-bar {
  width: 120px;
  height: 12px;
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
}

.line-bar.yang {
  background: var(--gold);
  border-radius: 3px;
}

.line-bar.yin {
  background: transparent;
}

.line-bar.yin::before,
.line-bar.yin::after {
  content: '';
  position: absolute;
  top: 0;
  height: 12px;
  width: 50px;
  background: var(--gold-dim);
  border-radius: 3px;
}

.line-bar.yin::before { left: 0; }
.line-bar.yin::after { right: 0; }

.line-bar:hover { opacity: 0.8; }

.line-element {
  font-size: 0.75rem;
  color: var(--fg-dim);
  width: 20px;
}

.build-btn {
  margin-top: 8px;
}

/* === Paipan Display === */
.paipan-container {
  max-width: 640px;
  margin: 0 auto;
}

.paipan-card {
  background: var(--bg-card);
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: 12px;
  overflow: hidden;
}

.paipan-header {
  padding: 24px 28px;
  text-align: center;
  border-bottom: 1px solid rgba(201, 168, 76, 0.1);
  background: linear-gradient(180deg, rgba(201, 168, 76, 0.06) 0%, transparent 100%);
}

.paipan-hex-name {
  font-family: var(--serif);
  font-size: 2rem;
  color: var(--gold);
  margin-bottom: 8px;
}

.paipan-meta {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.paipan-meta-item { font-size: 0.85rem; }
.paipan-meta-label { color: var(--fg-dim); }
.paipan-meta-value { color: var(--fg); font-family: var(--serif); }
.paipan-lines { padding: 8px 0; }

.paipan-line {
  display: grid;
  grid-template-columns: 48px 50px 1fr 48px 48px 56px;
  align-items: center;
  padding: 14px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: background 0.1s;
}

.paipan-line:last-child { border-bottom: none; }
.paipan-line:hover { background: rgba(201, 168, 76, 0.03); }

.paipan-line-pos { font-family: var(--serif); font-size: 0.8rem; color: var(--fg-dim); }
.paipan-line-vis { display: flex; justify-content: center; }
.mini-line { width: 36px; height: 6px; position: relative; }
.mini-line.yang { background: var(--gold); border-radius: 2px; }
.mini-line.yin { background: transparent; }

.mini-line.yin::before,
.mini-line.yin::after {
  content: '';
  position: absolute;
  top: 0;
  height: 6px;
  width: 14px;
  background: var(--gold-dim);
  border-radius: 2px;
}

.mini-line.yin::before { left: 0; }
.mini-line.yin::after { right: 0; }

.paipan-line-branch {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--fg);
}

.paipan-line-element {
  font-family: var(--serif);
  font-size: 0.85rem;
  text-align: center;
}

.paipan-line-element.e-金 { color: #c0c0c0; }
.paipan-line-element.e-水 { color: #5b9bd5; }
.paipan-line-element.e-木 { color: #70ad47; }
.paipan-line-element.e-火 { color: #e06040; }
.paipan-line-element.e-土 { color: #c9a84c; }

.paipan-line-yinyang {
  font-size: 0.8rem;
  text-align: center;
  color: var(--fg-dim);
}

.paipan-line-relative {
  font-family: var(--serif);
  font-size: 0.9rem;
  text-align: right;
  color: var(--fg);
}

/* Trigram divider */
.trigram-divider {
  grid-column: 1 / -1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
  margin: 2px 0;
}

/* === Footer === */
.app-footer {
  text-align: center;
  padding: 40px 24px;
  color: var(--fg-dim);
  font-size: 0.8rem;
  border-top: 1px solid rgba(255,255,255,0.05);
}

/* === How It Works === */
.how-section {
  padding: 60px 0 40px;
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 32px;
}

.how-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 28px 20px;
  text-align: center;
}

.how-icon { font-size: 2rem; margin-bottom: 12px; }
.how-card h3 { font-size: 1rem; color: var(--gold); margin-bottom: 8px; }
.how-card p { font-size: 0.85rem; color: var(--fg-muted); line-height: 1.5; }

/* === Responsive === */
@media (max-width: 768px) {
  .nav-links a:not(.nav-cta) { display: none; }

  .hex-selector {
    grid-template-columns: repeat(4, 1fr);
  }
  .how-grid,
  .features-grid,
  .methods-grid,
  .users-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .paipan-line {
    grid-template-columns: 40px 40px 1fr 36px 36px 48px;
    padding: 10px 16px;
    font-size: 0.9rem;
  }
  .footer-inner {
    flex-direction: column;
    gap: 32px;
  }
  .footer-links { gap: 32px; }
  .ritual-steps::before { display: none; }
}

@media (max-width: 480px) {
  .hex-selector {
    grid-template-columns: repeat(2, 1fr);
  }
  .paipan-line {
    grid-template-columns: 32px 32px 1fr 32px 32px 44px;
    padding: 8px 12px;
  }
  .cta-btn { display: block; margin: 8px 0; width: 100%; text-align: center; }
  .hero-cta-group { flex-direction: column; align-items: stretch; }
}

/* === CTA Hint === */
.cta-hint {
  font-size: 0.8rem;
  color: var(--fg-dim);
  margin-top: 16px;
  letter-spacing: 0.05em;
}

/* === Hero CTA Group === */
.hero-cta-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.cta-icon {
  font-size: 1.1em;
  vertical-align: -0.05em;
  margin-right: 2px;
}

/* Primary CTA glow pulse — draws the eye */
.cta-glow {
  position: relative;
  box-shadow: 0 0 20px rgba(201, 168, 76, 0.3);
  animation: ctaPulse 2.8s ease-in-out infinite;
}

@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 0 16px rgba(201, 168, 76, 0.25); }
  50%      { box-shadow: 0 0 28px rgba(201, 168, 76, 0.45); }
}

.cta-glow:hover {
  animation: none;
  box-shadow: 0 4px 28px rgba(201, 168, 76, 0.5);
}

/* === Hero Proof Line === */
.hero-proof {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  font-size: 0.78rem;
  color: var(--fg-dim);
  letter-spacing: 0.04em;
}

.proof-dot {
  width: 6px;
  height: 6px;
  background: var(--gold);
  border-radius: 50%;
  flex-shrink: 0;
  animation: proofPulse 2s ease-in-out infinite;
}

@keyframes proofPulse {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

/* === Footer Disclaimer === */
.footer-disclaimer {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 24px 24px 0;
  border-top: 1px solid rgba(255,255,255,0.04);
}

.footer-disclaimer p {
  font-size: 0.75rem;
  color: var(--fg-dim);
  line-height: 1.7;
  margin-bottom: 8px;
}

/* === About Page === */
.about-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 100px 24px 80px;
}

.about-page h1 {
  font-family: var(--serif);
  font-size: 2rem;
  color: var(--fg);
  margin-bottom: 24px;
}

.about-page .about-intro {
  font-size: 1.1rem;
  color: var(--fg);
  font-family: var(--serif);
  margin-bottom: 12px;
}

.about-page .about-desc {
  font-size: 0.95rem;
  color: var(--fg-muted);
  line-height: 1.8;
  margin-bottom: 48px;
}

.about-page h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  color: var(--fg);
  margin-bottom: 28px;
}

.about-page h3 {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--gold);
  margin-bottom: 8px;
  margin-top: 28px;
}

.about-page p {
  font-size: 0.9rem;
  color: var(--fg-muted);
  line-height: 1.8;
  margin-bottom: 16px;
}

.about-section {
  margin-bottom: 48px;
}

.about-page .about-source {
  background: var(--bg-card);
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: 10px;
  padding: 28px;
  margin-bottom: 48px;
}

.about-page .about-source h2 {
  margin-bottom: 16px;
}

.about-page .about-source ul {
  list-style: none;
  padding: 0;
}

.about-page .about-source li {
  font-size: 0.9rem;
  color: var(--fg-muted);
  line-height: 1.8;
  padding-left: 16px;
  position: relative;
  margin-bottom: 8px;
}

.about-page .about-source li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--gold);
}

.about-page .about-notice {
  background: var(--bg-elevated);
  border: 1px solid rgba(178, 34, 34, 0.2);
  border-radius: 10px;
  padding: 28px;
  margin-bottom: 48px;
}

.about-page .about-notice h2 {
  margin-bottom: 16px;
  color: var(--red-bright);
}

.about-page .about-notice ol {
  padding-left: 20px;
}

.about-page .about-notice li {
  font-size: 0.9rem;
  color: var(--fg-muted);
  line-height: 1.8;
  margin-bottom: 8px;
}

/* Scroll anchor offset */
#app { scroll-margin-top: 20px; }

/* Hidden state */
.hidden { display: none !important; }

/* ============================================================ */
/* === RITUAL PAGE (/ritual) ================================== */
/* ============================================================ */

.ritual-body {
  background: var(--bg);
  min-height: 100vh;
}

/* Layout: sidebar + content */
.ritual-main {
  display: flex;
  min-height: 100vh;
  padding-top: 56px; /* nav height */
}

/* ── Sidebar (desktop) ── */
.ritual-sidebar {
  width: 220px;
  flex-shrink: 0;
  padding: 40px 24px 40px 32px;
  border-right: 1px solid rgba(201, 168, 76, 0.1);
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}

.progress-title {
  font-family: var(--serif);
  font-size: 0.75rem;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 24px;
}

.step-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: default;
  transition: background 0.2s;
}

.step-indicator {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--fg-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  transition: all 0.2s;
}

.step-num {
  font-size: 0.78rem;
  color: var(--fg-dim);
  font-weight: 600;
}

.step-check {
  display: none;
  font-size: 0.75rem;
  color: var(--gold);
}

.step-label {
  font-family: var(--serif);
  font-size: 0.85rem;
  color: var(--fg-dim);
  transition: color 0.2s;
  white-space: nowrap;
}

/* Active step */
.step-item.active .step-indicator {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.12);
}
.step-item.active .step-num { color: var(--gold); }
.step-item.active .step-label { color: var(--fg); }

/* Completed step */
.step-item.completed .step-indicator {
  border-color: var(--gold-dim);
  background: rgba(201, 168, 76, 0.06);
}
.step-item.completed .step-num { display: none; }
.step-item.completed .step-check { display: block; }
.step-item.completed .step-label { color: var(--fg-muted); }

/* Step 5 (六爻起卦) highlight in sidebar */
.ritual-highlight-step.active .step-indicator {
  border-color: var(--red);
  background: var(--red-glow);
}
.ritual-highlight-step.active .step-num { color: var(--red-bright); }

/* ── Mobile horizontal progress ── */
.ritual-mobile-progress {
  display: none;
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  z-index: 90;
  background: var(--bg-elevated);
  border-bottom: 1px solid rgba(201, 168, 76, 0.1);
  padding: 10px 20px 12px;
}

.mobile-step-track {
  height: 3px;
  background: rgba(201, 168, 76, 0.15);
  border-radius: 2px;
  margin-bottom: 8px;
  overflow: hidden;
}

.mobile-step-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 2px;
  transition: width 0.4s ease;
  width: 0%;
}

.mobile-step-label {
  font-family: var(--serif);
  font-size: 0.8rem;
  color: var(--fg-muted);
}

/* ── Main content area ── */
.ritual-content {
  flex: 1;
  padding: 48px 60px;
  max-width: 680px;
}

/* ── Step panel ── */
.step-panel {
  animation: fadeSlideIn 0.35s ease;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.step-icon {
  margin-bottom: 28px;
  opacity: 0.9;
}

.step-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.step-badge {
  font-size: 0.75rem;
  color: var(--fg-dim);
  letter-spacing: 0.06em;
  font-family: var(--sans);
}

/* Inline Yi badge (shown on step 5) */
.yao-badge-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(201,168,76,0.15), rgba(201,168,76,0.08));
  border: 1px solid rgba(201, 168, 76, 0.4);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 0.75rem;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.step-title {
  font-family: var(--serif);
  font-size: 2.4rem;
  color: var(--fg);
  margin-bottom: 8px;
}

.step-subtitle {
  font-size: 1rem;
  color: var(--fg-muted);
  margin-bottom: 28px;
  font-style: italic;
}

.step-guidance {
  font-size: 0.95rem;
  color: var(--fg-muted);
  line-height: 1.85;
  max-width: 560px;
  margin-bottom: 32px;
}

/* ── Input / textarea ── */
.step-input-wrap {
  margin-bottom: 28px;
}

.step-textarea {
  width: 100%;
  max-width: 540px;
  background: var(--bg-elevated);
  border: 1px solid rgba(201, 168, 76, 0.25);
  border-radius: 8px;
  padding: 16px 20px;
  color: var(--fg);
  font-family: var(--serif);
  font-size: 0.95rem;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.step-textarea:focus {
  border-color: rgba(201, 168, 76, 0.6);
}

.step-textarea::placeholder {
  color: var(--fg-dim);
  font-style: italic;
}

.step-input-hint {
  font-size: 0.75rem;
  color: var(--fg-dim);
  margin-top: 8px;
}

/* ── Timer ── */
.step-timer {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding: 14px 20px;
  background: var(--bg-elevated);
  border: 1px solid rgba(201, 168, 76, 0.1);
  border-radius: 8px;
  max-width: 380px;
}

.timer-label {
  font-size: 0.85rem;
  color: var(--fg-muted);
  white-space: nowrap;
}

.timer-display {
  font-family: var(--serif);
  font-size: 1.25rem;
  color: var(--gold);
  min-width: 60px;
}

.timer-skip {
  background: none;
  border: none;
  color: var(--fg-dim);
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0;
  transition: color 0.15s;
}

.timer-skip:hover { color: var(--fg-muted); }

/* ── Actions ── */
.step-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.step-confirm {
  background: var(--gold);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 14px 32px;
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.step-confirm:hover {
  background: #d4b45a;
  transform: translateY(-1px);
}

.step-confirm:active { transform: translateY(0); }

/* ── Step 5 divine panel ── */
.step-panel--divine {
  border: 1.5px solid rgba(178, 34, 34, 0.45);
  border-radius: 14px;
  padding: 40px;
  background: linear-gradient(135deg, rgba(178,34,34,0.05), rgba(10,10,10,0));
  position: relative;
  overflow: hidden;
}

.step-panel--divine::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  box-shadow: inset 0 0 40px rgba(178,34,34,0.08);
  pointer-events: none;
}

.step-divine-cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

/* Ritual badge on divine step */
.ritual-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(201,168,76,0.18), rgba(201,168,76,0.08));
  border: 1px solid rgba(201, 168, 76, 0.5);
  border-radius: 24px;
  padding: 6px 18px;
  margin-bottom: 6px;
}

.badge-icon {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--gold);
  font-weight: 700;
}

.badge-text {
  font-size: 0.8rem;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.06em;
}

.cta-divine {
  font-size: 1.05rem \!important;
  padding: 16px 40px \!important;
  background: linear-gradient(135deg, var(--gold), #d4b45a) \!important;
  box-shadow: 0 4px 24px rgba(201,168,76,0.25);
}

.cta-divine:hover {
  box-shadow: 0 6px 32px rgba(201,168,76,0.4) \!important;
  transform: translateY(-2px);
}

.cta-sub {
  font-size: 0.8rem;
  color: var(--fg-dim);
}

/* ── Skip link ── */
.ritual-skip-wrap {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
}

.ritual-skip-link {
  color: var(--fg-dim);
  font-size: 0.78rem;
  text-decoration: none;
  transition: color 0.15s;
  padding: 8px 16px;
  background: rgba(10,10,10,0.8);
  border-radius: 20px;
  backdrop-filter: blur(8px);
}

.ritual-skip-link:hover { color: var(--fg-muted); }

/* ── Responsive: mobile ── */
@media (max-width: 768px) {
  .ritual-sidebar { display: none; }

  .ritual-mobile-progress { display: block; }

  .ritual-main {
    flex-direction: column;
    padding-top: calc(56px + 50px); /* nav + mobile progress */
  }

  .ritual-content {
    padding: 32px 20px 80px;
    max-width: 100%;
  }

  .step-title { font-size: 1.8rem; }

  .step-timer {
    flex-wrap: wrap;
    gap: 10px;
  }

  .step-panel--divine {
    padding: 28px 20px;
  }

  .step-confirm {
    width: 100%;
    text-align: center;
  }

  .cta-divine { width: 100%; text-align: center; }
}

/* === AI Interpretation Section === */
.interpret-section {
  max-width: 700px;
  margin: 32px auto 0;
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: 12px;
}

.interpret-label {
  display: block;
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--gold);
  margin-bottom: 8px;
}

.interpret-textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: 8px;
  color: var(--fg);
  font-family: var(--sans);
  font-size: 0.9rem;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.6;
}
.interpret-textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-glow);
}
.interpret-textarea::placeholder { color: var(--fg-dim); }

.interpret-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 16px;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--red) 0%, #8b1a1a 100%);
  color: #fff;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 700;
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.interpret-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--red-glow);
}
.interpret-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.interpret-btn-icon { font-size: 1.1rem; }

.interpret-result {
  margin-top: 20px;
  padding: 20px 24px;
  background: var(--bg-elevated);
  border: 1px solid rgba(201, 168, 76, 0.12);
  border-radius: 8px;
  font-family: var(--serif);
  font-size: 0.92rem;
  line-height: 1.85;
  color: var(--fg);
  word-break: break-word;
  min-height: 60px;
}
.interpret-result.hidden { display: none; }

.interpret-result h1,
.interpret-result h2,
.interpret-result h3,
.interpret-result h4 {
  color: var(--gold);
  font-weight: 700;
  margin: 18px 0 8px;
}
.interpret-result h1 { font-size: 1.15rem; }
.interpret-result h2 { font-size: 1.05rem; }
.interpret-result h3 { font-size: 0.98rem; }
.interpret-result h4 { font-size: 0.94rem; }
.interpret-result h1:first-child,
.interpret-result h2:first-child,
.interpret-result h3:first-child,
.interpret-result h4:first-child { margin-top: 0; }

.interpret-result strong { color: var(--gold); }
.interpret-result em { font-style: italic; }

.interpret-result p { margin: 8px 0; }

/* Tables */
.interpret-result table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.88rem;
}
.interpret-result th,
.interpret-result td {
  border: 1px solid rgba(201, 168, 76, 0.2);
  padding: 8px 12px;
  text-align: left;
}
.interpret-result th {
  background: rgba(201, 168, 76, 0.1);
  color: var(--gold);
  font-weight: 700;
}
.interpret-result tr:nth-child(even) td {
  background: rgba(201, 168, 76, 0.04);
}

/* Lists */
.interpret-result ul,
.interpret-result ol {
  margin: 8px 0;
  padding-left: 24px;
}
.interpret-result li { margin: 4px 0; }

/* Code */
.interpret-result code {
  background: rgba(201, 168, 76, 0.1);
  color: var(--gold);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 0.85em;
}
.interpret-result pre {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: 6px;
  padding: 12px 16px;
  overflow-x: auto;
  margin: 12px 0;
}
.interpret-result pre code {
  background: none;
  padding: 0;
  color: var(--fg);
}

/* Blockquotes */
.interpret-result blockquote {
  border-left: 3px solid var(--gold);
  margin: 12px 0;
  padding: 8px 16px;
  color: var(--fg-dim);
  background: rgba(201, 168, 76, 0.05);
  border-radius: 0 6px 6px 0;
}

/* Horizontal rules */
.interpret-result hr {
  border: none;
  border-top: 1px solid rgba(201, 168, 76, 0.2);
  margin: 16px 0;
}

.interpret-disclaimer {
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--fg-dim);
  text-align: center;
}

/* Checkboxes in GFM task lists */
.interpret-result input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--gold-dim);
  border-radius: 3px;
  background: var(--bg-card);
  vertical-align: middle;
  margin-right: 6px;
  position: relative;
  cursor: default;
}
.interpret-result input[type="checkbox"]:checked {
  background: var(--gold);
  border-color: var(--gold);
}
.interpret-result input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: -1px;
  left: 2px;
  font-size: 12px;
  color: var(--bg);
  font-weight: 700;
}
/* Task list items — remove bullet when checkbox present */
.interpret-result li:has(> input[type="checkbox"]) {
  list-style: none;
  margin-left: -24px;
}

/* Mobile table overflow prevention */
.interpret-result table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.interpret-loading {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--gold);
  border-radius: 50%;
  animation: interpretPulse 1s ease-in-out infinite;
  margin-left: 4px;
  vertical-align: middle;
}
@keyframes interpretPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════════════
   HEXAGRAM LIBRARY
   ═══════════════════════════════════════════════════════════════════ */
.library-body { padding-top: 60px; }
.library-main { min-height: 100vh; }

.library-header {
  padding: 60px 0 32px;
  text-align: center;
  border-bottom: 1px solid rgba(201, 168, 76, 0.1);
}
.library-title {
  font-size: 2.4rem;
  color: var(--gold);
  margin: 8px 0;
}
.library-sub {
  color: var(--fg-muted);
  font-size: 0.95rem;
  letter-spacing: 2px;
}

/* Two-column layout */
.library-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
  max-width: 1200px;
  min-height: calc(100vh - 240px);
}
@media (max-width: 860px) {
  .library-layout { grid-template-columns: 1fr; }
  .library-sidebar {
    position: static !important;
    max-height: none !important;
    border-right: none !important;
    border-bottom: 1px solid rgba(201, 168, 76, 0.1);
    padding-bottom: 16px;
  }
}

/* Sidebar */
.library-sidebar {
  position: sticky;
  top: 60px;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  border-right: 1px solid rgba(201, 168, 76, 0.08);
  padding: 16px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dim) transparent;
}

/* Palace tabs */
.library-palace-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}
.lib-palace-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  background: var(--bg-card);
  border: 1px solid rgba(201, 168, 76, 0.08);
  border-radius: 8px;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  font-size: 0.75rem;
}
.lib-palace-tab:hover {
  border-color: var(--gold-dim);
  color: var(--fg);
}
.lib-palace-tab.active {
  background: rgba(201, 168, 76, 0.1);
  border-color: var(--gold);
  color: var(--gold);
}
.lib-tab-symbol { font-size: 1.2rem; line-height: 1; }
.lib-tab-name { font-weight: 600; }
.lib-tab-element { font-size: 0.65rem; opacity: 0.7; }

/* Hex grid */
.library-hex-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lib-hex-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--fg);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  width: 100%;
  font-family: inherit;
  font-size: inherit;
}
.lib-hex-card:hover {
  background: var(--bg-card);
  border-color: rgba(201, 168, 76, 0.15);
}
.lib-hex-card.active {
  background: rgba(201, 168, 76, 0.08);
  border-color: var(--gold);
}

/* Mini hexagram lines in grid cards */
.lib-hex-visual {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
}
.lib-mini-line {
  width: 24px;
  height: 2px;
  border-radius: 1px;
}
.lib-mini-line.yang {
  background: var(--gold);
}
.lib-mini-line.yin {
  background: linear-gradient(to right, var(--gold) 38%, transparent 38%, transparent 62%, var(--gold) 62%);
}

.lib-hex-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.lib-hex-name {
  font-family: var(--serif);
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lib-hex-gen {
  font-size: 0.7rem;
  color: var(--fg-dim);
}

/* ── Reader Panel ──────────────────────────────────────────────── */
.library-reader {
  padding: 32px 24px;
  min-height: 400px;
}
@media (max-width: 860px) {
  .library-reader { padding: 24px 12px; }
}

.reader-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  color: var(--fg-dim);
  text-align: center;
}
.reader-placeholder-icon {
  font-size: 4rem;
  color: var(--gold-dim);
  margin-bottom: 16px;
  font-family: var(--serif);
}
.reader-placeholder-hint {
  font-size: 0.85rem;
  margin-top: 4px;
  opacity: 0.6;
}

/* Reader header */
.reader-header {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(201, 168, 76, 0.1);
}
.reader-hex-visual {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  padding: 16px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid rgba(201, 168, 76, 0.1);
}
.reader-line {
  width: 48px;
  height: 4px;
  border-radius: 2px;
}
.reader-line.yang {
  background: var(--gold);
}
.reader-line.yin {
  background: linear-gradient(to right, var(--gold) 35%, transparent 35%, transparent 65%, var(--gold) 65%);
}

.reader-hex-name {
  font-size: 1.8rem;
  color: var(--gold);
  margin: 0 0 8px;
}
.reader-hex-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.reader-badge {
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid rgba(201, 168, 76, 0.15);
  color: var(--fg-muted);
}
.reader-trigrams {
  display: flex;
  gap: 16px;
  font-size: 0.9rem;
  color: var(--fg-muted);
}

/* Paipan table */
.reader-paipan {
  margin-bottom: 32px;
}
.reader-section-title {
  font-size: 1.1rem;
  color: var(--gold);
  margin-bottom: 12px;
  font-family: var(--serif);
}
.reader-paipan-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.reader-paipan-table th {
  padding: 8px 12px;
  background: var(--bg-card);
  color: var(--fg-dim);
  font-weight: 600;
  font-size: 0.75rem;
  text-align: center;
  border-bottom: 1px solid rgba(201, 168, 76, 0.1);
}
.reader-paipan-table td {
  padding: 8px 12px;
  text-align: center;
  border-bottom: 1px solid rgba(201, 168, 76, 0.05);
}
.reader-paipan-table tr:hover td {
  background: rgba(201, 168, 76, 0.03);
}

/* Interpretation markdown */
.reader-interpretation {
  margin-bottom: 32px;
  line-height: 1.8;
}
.reader-interpretation h1, .reader-interpretation h2 {
  color: var(--gold);
  font-size: 1.2rem;
  margin-top: 24px;
  margin-bottom: 8px;
}
.reader-interpretation h3 {
  color: var(--gold);
  font-size: 1rem;
  margin-top: 16px;
  margin-bottom: 6px;
}
.reader-interpretation p {
  margin-bottom: 12px;
  color: var(--fg);
}
.reader-interpretation strong {
  color: var(--gold);
}
.reader-interpretation table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.85rem;
}
.reader-interpretation th, .reader-interpretation td {
  padding: 6px 10px;
  border: 1px solid rgba(201, 168, 76, 0.1);
  text-align: left;
}
.reader-interpretation th {
  background: var(--bg-card);
  color: var(--fg-dim);
  font-weight: 600;
}
.reader-interpretation blockquote {
  border-left: 3px solid var(--gold);
  padding-left: 16px;
  margin: 12px 0;
  color: var(--fg-muted);
  font-style: italic;
}
.reader-interpretation hr {
  border: none;
  border-top: 1px solid rgba(201, 168, 76, 0.1);
  margin: 20px 0;
}
.reader-interpretation em {
  color: var(--fg-muted);
}

/* Reader navigation */
.reader-nav {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  padding-top: 24px;
  border-top: 1px solid rgba(201, 168, 76, 0.1);
}
.reader-nav-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  background: var(--bg-card);
  border: 1px solid rgba(201, 168, 76, 0.15);
  color: var(--fg-muted);
  text-decoration: none;
}
.reader-nav-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.reader-nav-cta {
  background: rgba(201, 168, 76, 0.1);
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 600;
}
.reader-nav-cta:hover {
  background: rgba(201, 168, 76, 0.2);
}
