/* ============================================================
   命理学数字实验室 — Global Styles
   Design: Apple-inspired · Dark Black-Gold Theme
   ============================================================ */

/* ── CSS Variables ────────────────────────────────────────── */
:root {
  --bg-primary:      #080808;
  --bg-secondary:    #111111;
  --bg-card:         #161616;
  --bg-card-hover:   #1e1e1e;
  --bg-glass:        rgba(255, 255, 255, 0.04);
  --bg-glass-hover:  rgba(255, 255, 255, 0.07);

  --gold:            #C9A84C;
  --gold-light:      #E8C97A;
  --gold-dim:        rgba(201, 168, 76, 0.18);
  --gold-border:     rgba(201, 168, 76, 0.25);

  --text-primary:    #F5F5F7;
  --text-secondary:  #A1A1A6;
  --text-tertiary:   #6E6E73;
  --text-gold:       #C9A84C;

  --border:          rgba(255, 255, 255, 0.07);
  --border-gold:     rgba(201, 168, 76, 0.2);

  --radius-sm:   8px;
  --radius-md:   14px;
  --radius-lg:   20px;
  --radius-xl:   28px;
  --radius-pill: 999px;

  --shadow-card:  0 4px 24px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-gold:  0 0 30px rgba(201, 168, 76, 0.12);
  --shadow-glow:  0 0 60px rgba(201, 168, 76, 0.08);

  --ease:         cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration:     0.28s;

  --nav-h:        64px;
  --content-w:    1100px;
  --section-gap:  96px;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, 'SF Pro Text', 'PingFang SC', 'Helvetica Neue', sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
a  { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }

/* ── Typography ───────────────────────────────────────────── */
.display-xl {
  font-size: clamp(3rem, 7vw, 6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-family: -apple-system, 'SF Pro Display', 'PingFang SC', sans-serif;
}
.display-lg {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  font-family: -apple-system, 'SF Pro Display', 'PingFang SC', sans-serif;
}
.display-md {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.headline {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.body-lg  { font-size: 1.125rem; line-height: 1.7; }
.body-md  { font-size: 1rem;     line-height: 1.65; }
.body-sm  { font-size: 0.875rem; line-height: 1.6; }
.caption  { font-size: 0.75rem;  letter-spacing: 0.04em; text-transform: uppercase; }

.text-gold      { color: var(--gold); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary  { color: var(--text-tertiary); }
.text-center    { text-align: center; }

/* ── Layout ───────────────────────────────────────────────── */
.container {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 0 24px;
}
.section { padding: var(--section-gap) 0; }

/* ── Navigation ───────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  padding: 0 32px;
  background: rgba(8, 8, 8, 0.8);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  transition: border-color var(--duration) var(--ease);
}
.nav__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.nav__logo-icon {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--gold), #8B6914);
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
}
.nav__links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 auto;
  list-style: none;
}
.nav__links a {
  display: block;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: color var(--duration) var(--ease), background var(--duration) var(--ease);
}
.nav__links a:hover,
.nav__links a.active {
  color: var(--text-primary);
  background: var(--bg-glass);
}
.nav__links a.active { color: var(--gold); }

/* ── Hero Section ─────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: calc(var(--nav-h) + 40px) 24px 80px;
  position: relative;
  overflow: hidden;
}
.hero__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(201,168,76,0.08) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(201,168,76,0.04) 0%, transparent 60%);
  pointer-events: none;
}
.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  color: var(--gold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 28px;
  animation: fadeUp 0.6s var(--ease) both;
}
.hero__eyebrow::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--gold);
  border-radius: 50%;
  animation: pulse 2s ease infinite;
}
.hero__title {
  margin-bottom: 24px;
  animation: fadeUp 0.6s 0.1s var(--ease) both;
}
.hero__title em {
  font-style: normal;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero__subtitle {
  max-width: 560px;
  margin: 0 auto 48px;
  color: var(--text-secondary);
  font-size: 1.125rem;
  line-height: 1.7;
  animation: fadeUp 0.6s 0.2s var(--ease) both;
}
.hero__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  animation: fadeUp 0.6s 0.3s var(--ease) both;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 500;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
}
.btn-primary {
  background: var(--gold);
  color: #000;
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(201, 168, 76, 0.35);
}
.btn-secondary {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-primary);
  backdrop-filter: blur(10px);
}
.btn-secondary:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-gold);
  transform: translateY(-1px);
}
.btn-ghost {
  color: var(--gold);
  border: 1px solid var(--border-gold);
}
.btn-ghost:hover {
  background: var(--gold-dim);
  transform: translateY(-1px);
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: all var(--duration) var(--ease);
  box-shadow: var(--shadow-card);
}
.card:hover {
  border-color: var(--border-gold);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card), var(--shadow-gold);
}
.card-glass {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

/* ── Feature Grid ─────────────────────────────────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  transition: all var(--duration) var(--ease);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.feature-card:hover {
  border-color: var(--border-gold);
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-card), var(--shadow-gold);
}
.feature-card__icon {
  width: 48px; height: 48px;
  background: var(--gold-dim);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  font-size: 1.4rem;
}
.feature-card__title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}
.feature-card__desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.feature-card__arrow {
  margin-top: auto;
  color: var(--gold);
  font-size: 1.1rem;
  transition: transform var(--duration) var(--ease-spring);
}
.feature-card:hover .feature-card__arrow { transform: translateX(4px); }

/* ── Page Header ──────────────────────────────────────────── */
.page-header {
  padding: calc(var(--nav-h) + 60px) 0 60px;
  text-align: center;
  position: relative;
}
.page-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 300px;
  background: radial-gradient(ellipse 80% 100% at 50% 0%, rgba(201,168,76,0.07) 0%, transparent 70%);
  pointer-events: none;
}
.page-header__label {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  color: var(--gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

/* ── Divider ──────────────────────────────────────────────── */
.divider {
  width: 48px; height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent);
  margin: 0 auto 32px;
}

/* ── Form Elements ────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.form-label {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.form-input,
.form-select {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 1rem;
  color: var(--text-primary);
  width: 100%;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.12);
}
.form-input::placeholder { color: var(--text-tertiary); }
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

/* ── Result Panel ─────────────────────────────────────────── */
.result-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-gold);
  animation: fadeUp 0.4s var(--ease) both;
}

/* ── Pillars Grid (八字) ──────────────────────────────────── */
.pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 32px 0;
}
.pillar {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
  transition: border-color var(--duration) var(--ease);
}
.pillar:hover { border-color: var(--border-gold); }
.pillar__label {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.pillar__stem {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 4px;
}
.pillar__branch {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 12px;
}
.pillar__element {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Element Colors ───────────────────────────────────────── */
.el-wood  { color: #4ade80; }
.el-fire  { color: #f87171; }
.el-earth { color: #fbbf24; }
.el-metal { color: #e2e8f0; }
.el-water { color: #60a5fa; }

/* ── Tags / Badges ────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.tag-gold {
  background: var(--gold-dim);
  border-color: var(--border-gold);
  color: var(--gold);
}

/* ── Stats Row ────────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 32px 0;
}
.stat {
  background: var(--bg-card);
  padding: 24px 20px;
  text-align: center;
}
.stat__num {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 6px;
}
.stat__label {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

/* ── Table ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th {
  text-align: left;
  padding: 10px 16px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
}
tr:last-child td { border-bottom: none; }
tr:hover td {
  background: var(--bg-glass);
  color: var(--text-primary);
}

/* ── Search ───────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  max-width: 680px;
  margin: 0 auto;
}
.search-icon {
  position: absolute;
  left: 18px;
  top: 50%; transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 1rem;
  pointer-events: none;
}
.search-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 14px 20px 14px 48px;
  font-size: 1rem;
  color: var(--text-primary);
  width: 100%;
  transition: all var(--duration) var(--ease);
}
.search-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.12);
}
.search-input::placeholder { color: var(--text-tertiary); }

/* ── Footer ───────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}
.footer__logo {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.footer em {
  font-style: normal;
  color: var(--gold);
}

/* ── Loader / Skeleton ────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin: 40px auto;
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

/* ── Animations ───────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}
@keyframes goldPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(201,168,76,0.15); }
  50%       { box-shadow: 0 0 40px rgba(201,168,76,0.3); }
}

/* ── Utility ──────────────────────────────────────────────── */
.hidden   { display: none !important; }
.sr-only  { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.mt-4  { margin-top: 1rem; }
.mt-8  { margin-top: 2rem; }
.mt-12 { margin-top: 3rem; }
.mb-4  { margin-bottom: 1rem; }
.mb-8  { margin-bottom: 2rem; }
.gap-8 { gap: 2rem; }
.flex  { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --section-gap: 64px;
    --nav-h: 56px;
  }
  .nav { padding: 0 20px; }
  .nav__links { display: none; }
  .container { padding: 0 16px; }
  .pillars { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .result-panel { padding: 24px; }
  .hero__actions { flex-direction: column; align-items: center; }

  /* Mobile Nav Toggle */
  .nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-left: auto;
    cursor: pointer;
    padding: 4px;
  }
  .nav-toggle span {
    width: 22px; height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: all var(--duration) var(--ease);
  }
}
@media (min-width: 769px) { .nav-toggle { display: none; } }
