/* === 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);
  --serif: 'Noto Serif SC', 'Georgia', serif;
  --sans: 'Inter', -apple-system, 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; }

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

/* Hero image background */
.hero-img-wrap {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(10,10,10,0.65) 0%,
    rgba(10,10,10,0.55) 50%,
    rgba(10,10,10,0.85) 100%
  );
}

.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;
}

.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; }
}

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

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