@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700;900&display=swap');

/* ===== CSS Variables (Light Professional Theme) ===== */
:root {
  --bg-gradient: linear-gradient(135deg, hsl(210, 20%, 98%) 0%, #ffffff 50%, hsl(35, 100%, 95%) 100%);
  --primary: hsl(220, 90%, 56%);
  --primary-hover: hsl(220, 90%, 50%);
  --secondary: hsl(200, 95%, 45%);
  --accent: hsl(280, 100%, 70%);
  --gold: #b8982c;
  
  --card-bg: rgba(255, 255, 255, 0.9);
  --card-border: rgba(0, 0, 0, 0.08);
  --card-hover: rgba(255, 255, 255, 1);
  
  --text-primary: hsl(220, 15%, 15%);
  --text-secondary: hsl(220, 8%, 45%);
  --text-muted: hsl(220, 8%, 65%);
  
  --danger: hsl(0, 84%, 60%);
  --success: hsl(142, 71%, 45%);
  --warning: hsl(38, 92%, 50%);
  
  --input-bg: #ffffff;
  --input-border: hsl(220, 13%, 91%);
  
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --transition: all 0.2s ease-out;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'Noto Sans SC', -apple-system, sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== Navigation ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--card-border);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.nav-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: white;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
}

.nav-logo-text {
  font-weight: 700;
  font-size: 1.1rem;
}

.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
}

.nav-links a:hover, .nav-links a.active {
  color: var(--primary);
}

/* ===== Container & Layout ===== */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Hero Section ===== */
.hero {
  padding: 100px 0 60px;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 24px;
  animation: fadeInDown 0.6s ease;
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 20px;
  color: var(--text-primary);
  animation: fadeInUp 0.8s ease;
}

.hero-desc {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 32px;
  animation: fadeInUp 1s ease;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
  background: white;
  color: var(--text-primary);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: var(--input-border);
}

.btn-blue {
  background: var(--secondary);
  color: white;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-group {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Cards (Shadows & Borders) ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  backdrop-filter: blur(8px);
}

.card:hover {
  box-shadow: var(--shadow);
  border-color: rgba(0, 0, 0, 0.12);
}

/* ===== Stats ===== */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-top: 60px;
  animation: fadeInUp 1.2s ease;
}

.stat-item {
  text-align: center;
  padding: 24px 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ===== Progress Bar ===== */
.progress-wrap {
  position: sticky;
  top: 70px;
  z-index: 90;
  padding: 16px 0;
  background: var(--bg-gradient);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: 500;
}

.progress-pct {
  color: var(--primary);
  font-weight: 700;
}

.progress-bar {
  height: 8px;
  background: var(--input-border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Quiz Sections ===== */
.quiz-section {
  padding: 40px 0 80px;
}

.quiz-step {
  display: none;
  animation: fadeIn 0.4s ease;
}

.quiz-step.active {
  display: block;
}

.step-title {
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.step-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

/* ===== Form Elements ===== */
.form-group {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-label .required {
  color: var(--danger);
  margin-left: 4px;
}

.form-input, .form-select {
  width: 100%;
  padding: 12px 16px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition);
  appearance: none;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

/* 确保下拉菜单字体颜色可见 (黑色文本) */
.form-select option {
  color: #000000;
  background: #ffffff;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236a6a82' viewBox='0 0 16 16'%3E%3Cpath d='M8 11.5l-5-5h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.birth-card {
  max-width: 760px;
  margin: 0 auto;
}

.form-help {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.readonly-box {
  width: 100%;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(184, 152, 44, 0.08), rgba(184, 152, 44, 0.03));
  border: 1px solid rgba(184, 152, 44, 0.22);
  border-radius: var(--radius-sm);
  color: #7c6220;
  font-size: 0.95rem;
  font-weight: 600;
  min-height: 50px;
  display: flex;
  align-items: center;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.choice-row-inline {
  align-items: center;
}

.choice-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.choice-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-chip span {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--input-border);
  background: #fff;
  color: var(--text-secondary);
  font-weight: 600;
  transition: var(--transition);
}

.choice-chip input:checked + span {
  color: #7c6220;
  border-color: rgba(184, 152, 44, 0.45);
  background: rgba(184, 152, 44, 0.12);
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.toggle-card {
  position: relative;
  display: block;
  cursor: pointer;
}

.toggle-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-card-body {
  display: block;
  height: 100%;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.toggle-card-title {
  display: block;
  color: var(--text-primary);
  font-weight: 700;
  margin-bottom: 4px;
}

.toggle-card-desc {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.toggle-card input:checked + .toggle-card-body {
  border-color: rgba(184, 152, 44, 0.45);
  background: linear-gradient(180deg, rgba(184, 152, 44, 0.10), rgba(184, 152, 44, 0.04));
  box-shadow: 0 4px 14px rgba(184, 152, 44, 0.12);
}

.search-suggest {
  position: relative;
  margin-top: 8px;
  border: 1px solid var(--card-border);
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  max-height: 280px;
  overflow-y: auto;
}

.search-suggest-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px 14px;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
}

.search-suggest-item:last-child {
  border-bottom: none;
}

.search-suggest-item:hover {
  background: #f8fafc;
}

.search-suggest-main {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.45;
}

.search-suggest-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.search-suggest-empty {
  padding: 14px;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.birth-preview {
  margin-top: 20px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(250,247,240,0.92));
  border: 1px solid rgba(184, 152, 44, 0.18);
  border-radius: 18px;
}

.birth-preview-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #7c6220;
  margin-bottom: 12px;
}

.birth-preview-empty {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.birth-meta-grid,
.summary-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.summary-meta-grid {
  margin-top: 16px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.birth-meta-card {
  padding: 14px 15px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.birth-meta-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.birth-meta-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.45;
}

.birth-meta-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.birth-meta-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
}

.birth-meta-status-on {
  color: #1f7a2e;
  background: rgba(46, 204, 113, 0.12);
}

.birth-meta-status-off {
  color: #9b6b00;
  background: rgba(243, 156, 18, 0.14);
}

.birth-meta-status-unknown {
  color: #6b7280;
  background: rgba(107, 114, 128, 0.12);
}

/* ===== Question Card ===== */
.question-card {
  background: white;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.question-card.answered {
  border-left: 4px solid var(--success);
}

.question-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.question-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  flex-shrink: 0;
}

.question-text {
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-primary);
  flex: 1;
}

/* ===== Likert Scale ===== */
.likert {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.likert-option {
  width: 100%;
}

.likert-option input {
  display: none;
}

.likert-option label {
  display: block;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 500;
  background: #f8fafc;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
}

.likert-option label:hover {
  background: #f1f5f9;
  border-color: rgba(59, 130, 246, 0.3);
}

.likert-option input:checked + label {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--primary);
  color: var(--primary);
}

/* ===== Professional Bazi Table (pcbz style) ===== */
.bazi-display {
  margin: 24px 0;
}

.bz-table {
  background: white;
  border: 1px solid #ebeef5;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.bz-header-bar {
  /* 柔和米金质感渐变 */
  background: linear-gradient(135deg, #fefdfa 0%, #f5f0e6 100%);
  border-bottom: 1px solid #e8e2d2;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: #333;
}

.bz-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bz-circle-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #b8982c;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b8982c;
}

.bz-circle-logo svg {
  width: 18px;
  height: 18px;
}

.bz-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: #5c4d24; /* 深褐金 */
  letter-spacing: 1px;
}

.bz-times {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: #666;
}

.bz-time-row {
  display: flex;
  align-items: center;
}

.bz-time-label {
  display: inline-block;
  width: 48px;
  color: #999;
}

.bz-gender {
  color: #b8982c;
  margin-left: 6px;
}

.bz-info-btn {
  padding: 6px 16px;
  border: 1px solid rgba(184, 152, 44, 0.4);
  border-radius: 100px;
  font-size: 0.8rem;
  color: #8c7322;
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(255,255,255,0.5);
}

.bz-info-btn:hover {
  background: rgba(184, 152, 44, 0.1);
}

.bz-grid {
  width: 100%;
  border-collapse: collapse;
}

.bz-grid th,
.bz-grid td {
  border: 1px solid #f0f0f0;
}

.bz-row-header th {
  background: #fafafa;
  padding: 12px 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #666;
  text-align: center;
}

.bz-label {
  background: #fafafa;
  padding: 10px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #888;
  text-align: right;
  white-space: nowrap;
  width: 60px;
  min-width: 60px;
}

.bz-cell {
  padding: 10px 12px;
  text-align: center;
  font-size: 0.85rem;
  color: #333;
  vertical-align: middle;
}

.bz-cell-header {
  background: #fafafa;
}

.bz-cell-shishen {
  color: var(--primary); 
  font-size: 0.85rem;
}

/* 天干 + 地支 — 大号 */
.bz-cell-gan,
.bz-cell-zhi {
  font-size: 0;
  padding: 16px 8px;
  position: relative;
}

.bz-char-big {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  display: inline-block;
}

.bz-wx-icon {
  font-size: 0.85rem;
  vertical-align: top;
  margin-left: 4px;
}

.bz-cell-hide {
  font-size: 0.8rem;
  line-height: 1.8;
}

.bz-cell-shishen-sub {
  font-size: 0.8rem;
  line-height: 1.8;
  color: #666;
}

.bz-cell-small {
  font-size: 0.8rem;
  color: #888;
}

.bz-cell-nayin {
  font-weight: 600;
  color: #997130;
  font-size: 0.8rem;
}

.bz-cell-shensha {
  font-size: 0.75rem;
  color: #8a7b66; /* 神煞颜色偏温和 */
  line-height: 1.6;
}

.bz-row-shensha td {
  vertical-align: top;
  padding: 10px 6px;
}

/* Base Mobile Overrides */
@media (max-width: 768px) {
  .bz-header-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .bz-char-big { font-size: 1.5rem; }
  .bz-cell-gan, .bz-cell-zhi { padding: 10px 4px; }
  .bz-label { padding: 8px 6px; font-size: 0.75rem; width: 44px; min-width: 44px; }
  .bz-cell { padding: 8px 4px; font-size: 0.75rem; }
  .bz-wx-icon { font-size: 0.7rem; margin-left: 2px; }
}

/* ===== Smart Diagram (智能四柱图示) ===== */
.bz-smart-diagram {
  background: white;
  border: 1px solid #ebeef5;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.04);
  margin: 24px 0;
  padding-bottom: 24px;
}

.bz-sd-header {
  background: #fafafa;
  border-bottom: 1px solid #ebeef5;
  padding: 12px 24px;
  font-weight: 700;
  color: #555;
  text-align: center;
  font-size: 1rem;
}

.bz-sd-grid {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 24px 16px 0;
  position: relative;
}

.bz-sd-labels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 16px;
}

.bz-sd-col-title {
  text-align: center;
  color: #999;
  font-size: 0.85rem;
  font-weight: 500;
}

.bz-sd-chars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 12px;
}

.bz-sd-char {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 800;
}

.bz-sd-empty {
  text-align: center;
  font-size: 0.8rem;
  color: #ccc;
  padding: 8px 0;
}

/* 连线轨道区 */
.bz-sd-tracks-gan,
.bz-sd-tracks-zhi {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
  min-height: 20px;
}

.bz-smart-track {
  height: 24px;
  position: relative;
  width: 100%;
}

.bz-smart-line-wrap {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
}

.bz-smart-line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  z-index: 1;
}

.bz-smart-node {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: #666;
  z-index: 2;
}

.bz-smart-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 2px 8px;
  font-size: 0.75rem;
  border-radius: 100px;
  z-index: 3;
}

/* 连线颜色主题 */
.rel-neutral {
  border-top: 1px dashed #bbb;
}
.bz-smart-label.rel-neutral {
  border: 1px solid #bbb;
  color: #666;
}

.rel-good {
  border-top: 1px solid #4caf50;
}
.bz-smart-label.rel-good {
  border: 1px solid #4caf50;
  color: #2e7d32;
}

.rel-bad {
  border-top: 1px solid #f44336;
}
.bz-smart-label.rel-bad {
  border: 1px solid #f44336;
  color: #c62828;
}

/* ===== Result Page ===== */
.result-section {
  padding: 60px 0;
}

.result-header {
  text-align: center;
  margin-bottom: 40px;
}

.result-score {
  font-size: 4.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 8px;
}

.result-score-label {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.radar-wrap {
  display: flex;
  justify-content: center;
  margin: 40px 0;
  background: white;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

.radar-wrap canvas {
  max-width: 420px;
  width: 100%;
}

/* ===== Dimension Cards ===== */
.dimension-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

.dimension-card {
  background: white;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.dimension-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.dimension-name {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.dimension-score {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary);
}

.dimension-bar {
  height: 6px;
  background: var(--input-border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
}

.dimension-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s ease;
}

.dimension-formulas {
  list-style: none;
}

.dimension-formulas li {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 8px 0;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  display: flex;
  align-items: center;
  gap: 12px;
}

.dimension-formulas li:last-child {
  border-bottom: none;
}

/* ===== Footer ===== */
.footer {
  padding: 40px 0;
  text-align: center;
  border-top: 1px solid var(--card-border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ===== Quiz Nav ===== */
.quiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0;
  margin-top: 16px;
}

.quiz-nav-info {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

/* ===== Responsive ===== */
@media (min-width: 640px) {
  .likert { flex-direction: row; }
  .likert-option label { text-align: center; }
}

@media (max-width: 768px) {
  .hero-title { font-size: 2.2rem; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .bazi-display { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .toggle-grid,
  .birth-meta-grid,
  .summary-meta-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .dimension-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .hero-title { font-size: 1.8rem; }
  .hero-desc { font-size: 1rem; }
  .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .card, .question-card { padding: 20px; }
  .choice-row { gap: 8px; }
  .choice-chip span { padding: 9px 14px; }
}

/* ===== Community Banner ===== */
.community-banner {
  display: flex;
  justify-content: center;
  margin-bottom: 32px;
  animation: fadeInDown 0.4s ease;
}

.community-banner-inner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: 100px;
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: 500;
}

.community-icon {
  font-size: 1.1rem;
}

.community-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(59, 130, 246, 0.08);
  color: var(--primary);
  white-space: nowrap;
}

/* ===== Hit Rate Bar ===== */
.hit-rate-bar-wrap {
  height: 6px;
  background: var(--input-border);
  border-radius: 3px;
  overflow: hidden;
  flex: 1;
}

.hit-rate-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease;
}

/* ===== Formula Hit Summary (Result Page) ===== */
.formula-hit-grid {
  width: 100%;
}

.hit-summary-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

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

.hit-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
}

.hit-item-text {
  flex: 1;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hit-rate-value {
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 38px;
  text-align: right;
}

/* ===== Compare Panel (Same Bazi) ===== */
.compare-panel {
  border-left: 4px solid var(--primary);
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.compare-dim-card {
  padding: 12px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
}

.compare-bar-wrap {
  position: relative;
  height: 8px;
  background: var(--input-border);
  border-radius: 4px;
  overflow: visible;
}

.compare-bar-bg {
  position: absolute;
  left: 0; top: 0; right: 0; bottom: 0;
  border-radius: 4px;
}

.compare-bar-range {
  position: absolute;
  top: 0; bottom: 0;
  border-radius: 4px;
}

.compare-bar-avg {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 14px;
  background: var(--text-muted);
  border-radius: 1px;
  transform: translateX(-1px);
}

.compare-bar-me {
  position: absolute;
  top: -4px;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  transform: translateX(-5px);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* ===== Stats Dashboard — Page Header ===== */
.stats-section {
  padding: 40px 0 80px;
}

.stats-page-header {
  text-align: center;
  margin-bottom: 40px;
}

.stats-page-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.stats-page-desc {
  font-size: 1rem;
  color: var(--text-secondary);
}

/* ===== Stats Loading ===== */
.stats-loading {
  text-align: center;
  padding: 80px 0;
  color: var(--text-muted);
}

.stats-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--input-border);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Stats Overview Cards ===== */
.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stats-ov-card {
  text-align: center;
  padding: 24px 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.stats-ov-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.stats-ov-icon {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.stats-ov-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}

.stats-ov-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ===== Search Box ===== */
.search-box {
  display: flex;
  gap: 12px;
}

.search-box .form-input {
  flex: 1;
}

.stats-inline-status {
  padding: 18px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ===== Tabs ===== */
.stats-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #f1f5f9;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
}

.stats-tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.stats-tab:hover {
  color: var(--text-primary);
}

.stats-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.stats-tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.stats-tab-content.active {
  display: block;
}

/* ===== Formula Table (Ranking) ===== */
.formula-table {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.ft-header, .ft-row {
  display: grid;
  grid-template-columns: 48px 1fr 120px 160px 60px;
  gap: 12px;
  padding: 12px 16px;
  align-items: center;
}

.ft-header {
  background: #f8fafc;
  border-bottom: 1px solid var(--card-border);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ft-row {
  border-bottom: 1px solid rgba(0,0,0,0.03);
  transition: var(--transition);
}

.ft-row:hover {
  background: #f8fafc;
}

.ft-row:last-child {
  border-bottom: none;
}

.ft-rank {
  text-align: center;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.ft-formula {
  min-width: 0;
}

.ft-formula-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.ft-question-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ft-dim-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.ft-rate {
  text-align: right;
  font-size: 0.9rem;
}

/* ===== Bazi Group Cards ===== */
.bazi-group-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition);
}

.bazi-group-card:hover {
  box-shadow: var(--shadow);
}

.bgc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  transition: var(--transition);
}

.bgc-header:hover {
  background: #f8fafc;
}

.bgc-bazi {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bgc-pillars {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  font-family: 'Noto Sans SC', sans-serif;
  letter-spacing: 1px;
}

.bgc-count {
  font-size: 0.8rem;
  padding: 2px 10px;
  background: rgba(59, 130, 246, 0.08);
  color: var(--primary);
  border-radius: 100px;
  font-weight: 600;
}

.bgc-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.bgc-match {
  font-weight: 700;
  font-size: 0.85rem;
}

.bgc-expand-icon {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 0.3s ease;
}

.bazi-group-card.expanded .bgc-expand-icon {
  transform: rotate(180deg);
}

.bgc-detail {
  display: none;
  padding: 0 20px 20px;
  border-top: 1px solid var(--card-border);
}

.bazi-group-card.expanded .bgc-detail {
  display: block;
}

.stats-list-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.stats-list-note {
  line-height: 1.6;
}

.stats-list-count {
  white-space: nowrap;
  font-weight: 600;
}

.bgc-dim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.bgc-dim-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.bgc-dim-name {
  min-width: 80px;
  color: var(--text-secondary);
}

.bgc-dim-bar {
  flex: 1;
  height: 6px;
  background: var(--input-border);
  border-radius: 3px;
  overflow: hidden;
}

.bgc-dim-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease;
}

.bgc-dim-val {
  font-weight: 700;
  min-width: 36px;
  text-align: right;
  color: var(--text-primary);
}

.bgc-formulas {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--input-border);
}

.bgc-formula-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.8rem;
  border-bottom: 1px solid rgba(0,0,0,0.02);
}

.bgc-formula-text {
  color: var(--text-secondary);
  flex: 1;
  margin-right: 12px;
}

.bgc-formula-rate {
  font-weight: 700;
  flex-shrink: 0;
}

.bgc-detail-hint,
.bgc-detail-loading,
.bgc-detail-empty,
.bgc-detail-summary {
  margin-top: 16px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.stats-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding: 16px 18px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.stats-pager-info {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.stats-pager-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stats-pager-btn {
  min-width: 96px;
  padding: 10px 18px;
  font-size: 0.9rem;
}

/* ===== Dimension Analysis Tab ===== */
.dim-analysis-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.da-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.da-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #f8fafc;
}

.da-card-title {
  font-weight: 700;
  font-size: 1rem;
}

.da-card-avg {
  font-weight: 800;
  font-size: 1.1rem;
}

.da-card-questions {
  padding: 8px 20px;
}

.da-q-row {
  padding: 12px 0;
  border-bottom: 1px solid rgba(0,0,0,0.03);
}

.da-q-row:last-child {
  border-bottom: none;
}

.da-q-text {
  font-size: 0.85rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.da-q-formula {
  font-size: 0.75rem;
  margin-bottom: 6px;
}

.da-q-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== Loading Dot Animation ===== */
.loading-dot {
  animation: pulse 1.5s ease infinite;
}

/* ===== Stats Responsive ===== */
@media (max-width: 768px) {
  .stats-overview { grid-template-columns: repeat(2, 1fr); }
  .hit-summary-row { grid-template-columns: 1fr; }
  .ft-header, .ft-row {
    grid-template-columns: 36px 1fr 60px;
  }
  .ft-dim, .ft-bar { display: none; }
  .stats-tabs { flex-wrap: wrap; }
  .compare-grid { grid-template-columns: 1fr; }
  .stats-list-meta,
  .stats-pager {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .stats-overview { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stats-ov-value { font-size: 1.5rem; }
  .search-box { flex-direction: column; }
  .bgc-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .stats-pager-actions {
    width: 100%;
  }
  .stats-pager-btn {
    flex: 1;
  }
}
