/* ==============================================================================
 * 💑 男女姓名配對 (name-match) 專屬樣式表
 * ==============================================================================
 * 設計哲學：宣紙水墨 + 緋紅金石新東方美學 · 390px 移動端防爆框 · 原生 CSS3 動效
 * ============================================================================== */

:root {
  --nm-primary: #a82e2e;
  --nm-primary-dark: #8b2020;
  --nm-gold: #c59b27;
  --nm-gold-light: #fef9e7;
  --nm-ink: #2b2d42;
  --nm-ink-light: #555770;
  --nm-bg-paper: #fcfaf7;
  --nm-card-bg: #ffffff;
  --nm-border: #ebd9c8;
  --nm-radius: 12px;
  --nm-shadow: 0 8px 24px rgba(168, 46, 46, 0.08);
}

.nm-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 0 24px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", sans-serif;
  color: var(--nm-ink);
  box-sizing: border-box;
}

/* 標題與引言 (緊湊自然過渡，修復斷聯感) */
.nm-header {
  text-align: center;
  margin-top: 4px;
  margin-bottom: 16px;
}
.nm-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--nm-primary);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.nm-header p {
  font-size: 13.5px;
  color: var(--nm-ink-light);
  line-height: 1.5;
  margin: 0;
}

/* 雙模 Tab 切換 */
.nm-tab-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}
.nm-tab-btn {
  padding: 8px 20px;
  border-radius: 20px;
  border: 1px solid var(--nm-border);
  background: var(--nm-card-bg);
  color: var(--nm-ink);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  font-weight: 500;
}
.nm-tab-btn.active {
  background: var(--nm-primary);
  color: #fff;
  border-color: var(--nm-primary);
  box-shadow: 0 4px 12px rgba(168, 46, 46, 0.25);
}

/* 乾坤雙位水墨壇場 (表單區) */
.nm-altar-card {
  background: var(--nm-card-bg);
  border: 1px solid var(--nm-border);
  border-radius: var(--nm-radius);
  padding: 24px;
  box-shadow: var(--nm-shadow);
  margin-bottom: 24px;
  background-image: radial-gradient(circle at 50% 10%, rgba(197, 155, 39, 0.05) 0%, transparent 60%);
}
.nm-inputs-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}
.nm-input-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nm-input-box label {
  font-size: 13px;
  font-weight: 600;
  color: var(--nm-primary);
}
.nm-input-box input {
  height: 46px;
  border: 1.5px solid var(--nm-border);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 16px; /* 防止 iOS 縮放 */
  color: var(--nm-ink);
  background: var(--nm-bg-paper);
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.nm-input-box input:focus {
  outline: none;
  border-color: var(--nm-primary);
  background: #fff;
}
.nm-divider-heart {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--nm-gold-light);
  border-radius: 50%;
  color: var(--nm-primary);
  font-size: 20px;
  border: 1px dashed var(--nm-gold);
  margin-top: 18px;
}
.nm-btn-submit {
  width: 100%;
  margin-top: 20px;
  height: 48px;
  background: linear-gradient(135deg, var(--nm-primary), var(--nm-primary-dark));
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(168, 46, 46, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}
.nm-btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(168, 46, 46, 0.4);
}
.nm-btn-submit:active {
  transform: translateY(1px);
}

/* 契合度聚光燈大看板 */
.nm-result-section {
  display: none; /* JS 測算後顯示 */
  margin-bottom: 30px;
  animation: nmFadeIn 0.4s ease-out;
}
@keyframes nmFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.nm-spotlight-card {
  background: var(--nm-card-bg);
  border: 1.5px solid var(--nm-border);
  border-radius: var(--nm-radius);
  padding: 24px;
  box-shadow: var(--nm-shadow);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.nm-spotlight-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--nm-gold), var(--nm-primary), var(--nm-gold));
}

.nm-seal-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--nm-primary);
  color: var(--nm-primary);
  padding: 4px 16px;
  border-radius: 4px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 3px;
  margin-bottom: 12px;
  background: rgba(168, 46, 46, 0.04);
}
.nm-score-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin-bottom: 8px;
}
.nm-score-num {
  font-size: 52px;
  font-weight: 800;
  color: var(--nm-primary);
  font-family: Georgia, serif;
  line-height: 1;
}
.nm-score-unit {
  font-size: 20px;
  font-weight: 600;
  color: var(--nm-primary);
}
.nm-stars {
  color: var(--nm-gold);
  font-size: 18px;
  margin-bottom: 12px;
  letter-spacing: 2px;
}
.nm-desc-badge {
  display: inline-block;
  font-size: 13px;
  color: var(--nm-ink-light);
  background: var(--nm-bg-paper);
  padding: 4px 12px;
  border-radius: 12px;
  margin-bottom: 20px;
}

/* 天機三言速讀膠囊 */
.nm-capsule-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}
.nm-capsule-pill {
  background: var(--nm-bg-paper);
  border: 1px solid var(--nm-border);
  padding: 10px 8px;
  border-radius: 8px;
  text-align: center;
}
.nm-capsule-label {
  font-size: 11px;
  color: var(--nm-primary);
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}
.nm-capsule-val {
  font-size: 13px;
  color: var(--nm-ink);
  font-weight: 500;
  line-height: 1.3;
}

/* 四維情愫指標能量條 */
.nm-dimensions-card {
  background: var(--nm-card-bg);
  border: 1px solid var(--nm-border);
  border-radius: var(--nm-radius);
  padding: 20px;
  margin-bottom: 20px;
}
.nm-dim-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--nm-ink);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nm-dim-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}
.nm-dim-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nm-dim-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--nm-ink);
}
.nm-dim-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--nm-primary);
}
.nm-progress-track {
  height: 8px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
}
.nm-progress-bar {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--nm-gold), var(--nm-primary));
  width: 0%;
  transition: width 0.8s ease-out;
}
.nm-dim-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--nm-primary);
  text-align: right;
}

/* 焦點雙舞台：相處甜蜜點 vs 避坑雷區 */
.nm-interaction-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.nm-block-card {
  background: var(--nm-card-bg);
  border: 1px solid var(--nm-border);
  border-radius: var(--nm-radius);
  padding: 16px;
}
.nm-block-card.sweet {
  border-left: 4px solid #48bb78;
}
.nm-block-card.minefield {
  border-left: 4px solid #ed8936;
}
.nm-block-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nm-block-card.sweet .nm-block-title { color: #2f855a; }
.nm-block-card.minefield .nm-block-title { color: #c05621; }
.nm-block-content {
  font-size: 13px;
  color: var(--nm-ink);
  line-height: 1.6;
}

/* 天機相生 · 通關錦囊 (全覆蓋) */
.nm-cure-kit {
  background: linear-gradient(135deg, #fff9f5 0%, #fff 100%);
  border: 1.5px solid var(--nm-gold);
  border-radius: var(--nm-radius);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(197, 155, 39, 0.12);
}
.nm-cure-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--nm-border);
}
.nm-cure-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--nm-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.nm-cure-tag {
  font-size: 12px;
  background: var(--nm-gold-light);
  color: #8c6d17;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}
.nm-cure-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.nm-cure-item {
  font-size: 13px;
  line-height: 1.5;
}
.nm-cure-item strong {
  color: var(--nm-ink);
}
.nm-cure-guide {
  font-size: 13px;
  color: var(--nm-ink-light);
  line-height: 1.6;
  background: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid #f0e6db;
}

/* 民間交叉相減金字塔模式 */
.nm-pyramid-wrap {
  background: var(--nm-card-bg);
  border: 1px solid var(--nm-border);
  border-radius: var(--nm-radius);
  padding: 20px;
  margin-bottom: 20px;
  text-align: center;
}
.nm-pyramid-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}
.nm-pyramid-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--nm-bg-paper);
  border: 1px solid var(--nm-border);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 600;
  color: var(--nm-ink);
  transition: transform 0.2s;
}
.nm-pyramid-cell.final {
  width: 44px;
  height: 44px;
  background: var(--nm-primary);
  color: #fff;
  border-color: var(--nm-primary);
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(168, 46, 46, 0.3);
}

/* 操作按鈕組 */
.nm-action-btns {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 24px;
}
.nm-btn-poster, .nm-btn-reset {
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.nm-btn-poster {
  background: var(--nm-primary);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(168, 46, 46, 0.2);
}
.nm-btn-poster:hover { background: var(--nm-primary-dark); }
.nm-btn-reset {
  background: #fff;
  color: var(--nm-ink);
  border: 1px solid var(--nm-border);
}
.nm-btn-reset:hover { background: var(--nm-bg-paper); }

/* 海報彈窗 Modal */
.nm-modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.nm-modal-content {
  background: #fff;
  border-radius: 12px;
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 16px;
  text-align: center;
  position: relative;
}
.nm-modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 24px;
  cursor: pointer;
  color: #999;
}
.nm-poster-img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  margin-bottom: 12px;
}

/* 響應式防爆框 (≤640px) */
@media (max-width: 640px) {
  .nm-inputs-wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .nm-divider-heart {
    margin: 0 auto;
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  .nm-capsule-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .nm-interaction-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .nm-cure-items {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .nm-score-num {
    font-size: 44px;
  }
}

/* 矩陣底部導航網格 (全寬互導) */
.nm-matrix-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 600px) {
  .nm-matrix-grid {
    grid-template-columns: 1fr;
  }
}
.nm-matrix-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #ffffff;
  border: 1px solid var(--nm-border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--nm-ink);
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}
.nm-matrix-card:hover {
  border-color: var(--nm-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(168, 46, 46, 0.1);
}
.nm-matrix-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--nm-gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.nm-matrix-info {
  flex: 1;
  min-width: 0;
}
.nm-matrix-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--nm-primary);
  margin-bottom: 2px;
}
.nm-matrix-desc {
  font-size: 13px;
  color: var(--nm-ink-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==============================================================================
 * ☯️ 乾坤五格三才深度對照卡片樣式
 * ============================================================================== */
.nm-grids-card {
  background: var(--nm-card-bg);
  border: 1px solid var(--nm-border);
  border-radius: var(--nm-radius);
  padding: 22px;
  box-shadow: var(--nm-shadow);
  margin-bottom: 24px;
}
.nm-grids-header {
  text-align: center;
  margin-bottom: 18px;
}
.nm-grids-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--nm-primary);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.nm-grids-subtitle {
  font-size: 12px;
  color: var(--nm-ink-light);
}

/* 雙人三才總括徽章列 */
.nm-grids-summary-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
  padding: 12px;
  background: #faf7f2;
  border-radius: 10px;
  border: 1px dashed var(--nm-border);
}
.nm-three-badge {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #ebd9c8;
}
.nm-three-badge.male {
  border-left: 3px solid #3b82f6;
}
.nm-three-badge.female {
  border-left: 3px solid #ec4899;
}
.nm-side-role {
  font-size: 11px;
  color: #888;
  font-weight: 500;
}
.nm-side-name {
  font-size: 15px;
  color: var(--nm-primary);
}
.nm-three-val {
  font-size: 12px;
  color: var(--nm-ink);
}
.nm-three-val em {
  font-style: normal;
  font-weight: 700;
  color: #c59b27;
  letter-spacing: 2px;
}
.nm-three-vs {
  font-size: 13px;
  font-weight: 800;
  color: #a82e2e;
  padding: 4px 10px;
  background: #fef2f2;
  border-radius: 12px;
  border: 1px solid #fecaca;
  flex-shrink: 0;
}

/* 五格逐項對照表 */
.nm-grids-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nm-gt-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #f0e6db;
  border-radius: 8px;
  transition: all 0.2s ease;
}
.nm-gt-row.header {
  background: #fcfaf7;
  font-weight: 700;
  font-size: 12px;
  color: #777;
  border-color: #ebd9c8;
  padding: 8px 14px;
}
.nm-gt-row.highlight {
  background: #fffdf5;
  border: 1.5px solid var(--nm-gold);
  box-shadow: 0 2px 10px rgba(197, 155, 39, 0.1);
}
.nm-gt-row.highlight-sub {
  background: #fff8f8;
  border: 1.5px solid #f87171;
}
.nm-gt-col.male {
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.nm-gt-col.female {
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}
.nm-gt-col.mid {
  text-align: center;
  min-width: 140px;
}
.nm-palace-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--nm-primary);
}
.nm-palace-desc {
  font-size: 11px;
  color: #888;
}

/* 劃數與數理標籤 */
.nm-cell-draw {
  font-size: 16px;
  font-weight: 800;
  color: #2b2d42;
  min-width: 32px;
  display: inline-block;
}
.nm-cell-elem {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  color: #fff;
}
.nm-elem-wood  { background: #15803d; } /* 木綠 */
.nm-elem-fire  { background: #dc2626; } /* 火紅 */
.nm-elem-earth { background: #b45309; } /* 土黃 */
.nm-elem-metal { background: #64748b; } /* 金銀灰 */
.nm-elem-water { background: #0284c7; } /* 水藍 */

.nm-cell-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}
.nm-cell-badge.ji {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}
.nm-cell-badge.xiong {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}
.nm-cell-badge.banji {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

/* 四柱親密氣數深度短評樣式 */
.nm-dim-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.nm-dim-comment {
  font-size: 12px;
  color: #666;
  line-height: 1.5;
  margin-top: 6px;
  background: #faf7f2;
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 3px solid var(--nm-gold);
}

@media (max-width: 640px) {
  .nm-grids-summary-row {
    flex-direction: column;
    gap: 8px;
  }
  .nm-three-vs {
    align-self: center;
  }
  .nm-gt-row {
    grid-template-columns: 1fr;
    gap: 6px;
    text-align: center;
  }
  .nm-gt-col.male, .nm-gt-col.female {
    justify-content: center;
  }
  .nm-gt-row.header {
    display: none;
  }
}

/* ==============================================================================
 * 輸入防呆錯誤高亮 (Input Error State)
 * ============================================================================== */
.nm-input-box input.input-error {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important;
  animation: nm-shake 0.3s ease-in-out;
}
@keyframes nm-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ==============================================================================
 * 📖 下方 SSR 深度百科卡片化樣式 (Encyclopedia Card System)
 * ============================================================================== */
.nm-wiki-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--nm-border);
}

.nm-wiki-header {
  text-align: center;
  margin-bottom: 28px;
}
.nm-wiki-badge {
  display: inline-block;
  padding: 4px 14px;
  background: var(--nm-gold-light);
  color: #8c6d17;
  font-size: 13px;
  font-weight: 600;
  border-radius: 20px;
  border: 1px solid rgba(197, 155, 39, 0.3);
  margin-bottom: 10px;
  letter-spacing: 1px;
}
.nm-wiki-main-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--nm-primary);
  margin: 0 0 8px;
  letter-spacing: 0.5px;
}
.nm-wiki-subtitle {
  font-size: 14px;
  color: var(--nm-ink-light);
  margin: 0;
}

/* 獨立章節卡片容器 */
.nm-wiki-card {
  background: var(--nm-card-bg);
  border: 1px solid var(--nm-border);
  border-radius: var(--nm-radius);
  padding: 24px 28px;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(168, 46, 46, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.nm-wiki-card:hover {
  box-shadow: 0 8px 24px rgba(168, 46, 46, 0.08);
}

/* 章節頭部 */
.nm-wiki-ch-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f2e6da;
}
.nm-ch-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--nm-primary);
  color: #fff;
  font-family: Georgia, serif;
  font-size: 16px;
  font-weight: bold;
  flex-shrink: 0;
}
.nm-ch-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--nm-primary);
  margin: 0;
  line-height: 1.4;
}

/* 導讀引言段 */
.nm-wiki-lead {
  font-size: 15px;
  color: var(--nm-ink);
  line-height: 1.8;
  margin-bottom: 16px;
  background: #fdfbf7;
  padding: 12px 16px;
  border-radius: 8px;
  border-left: 3px solid var(--nm-primary);
}

.nm-wiki-text {
  font-size: 14px;
  color: #4a4c5e;
  line-height: 1.85;
  margin: 0 0 14px;
}
.nm-wiki-text u {
  text-decoration-color: var(--nm-gold);
  text-underline-offset: 3px;
  font-weight: 500;
  color: #2b2d42;
}

/* 雙欄子卡片網格 */
.nm-wiki-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 18px 0;
}
.nm-wiki-subcard {
  background: #faf7f2;
  border: 1px solid #eee1d3;
  border-radius: 8px;
  padding: 14px 16px;
}
.nm-wsub-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--nm-primary);
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nm-wsub-text {
  font-size: 13px;
  color: #555770;
  line-height: 1.7;
  margin: 0;
}

/* 五格微卡網格列表 */
.nm-wgrid-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.nm-wgrid-item {
  background: #fcfaf7;
  border: 1px solid #eadbc8;
  border-radius: 8px;
  padding: 12px 14px;
  text-align: left;
}
.nm-wgrid-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--nm-primary);
  background: rgba(168, 46, 46, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
}
.nm-wgrid-desc {
  font-size: 12px;
  color: #666;
  line-height: 1.6;
  margin: 0;
}

/* 康熙古籍考證 Callout */
.nm-callout-box {
  background: #fff9f0;
  border: 1px dashed #d4a34b;
  border-radius: 8px;
  padding: 14px 18px;
  margin: 16px 0;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.nm-callout-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}
.nm-callout-content {
  font-size: 13px;
  color: #785210;
  line-height: 1.75;
}
.nm-callout-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
  color: #8c6014;
}

/* 四步相剋通關處方條 */
.nm-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin: 20px 0;
}
.nm-step-item {
  background: #faf7f2;
  border: 1px solid #ebd9c8;
  border-radius: 8px;
  padding: 14px 16px;
  position: relative;
  border-top: 3px solid var(--nm-primary);
}
.nm-step-num {
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--nm-primary);
  margin-bottom: 4px;
}
.nm-step-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--nm-ink);
  margin-bottom: 8px;
}
.nm-step-desc {
  font-size: 12px;
  color: #555770;
  line-height: 1.7;
  margin: 0;
}

/* 金句古韻引用框 */
.nm-quote-box {
  background: #faf5ee;
  border: 1px solid #dfcfbc;
  border-radius: 8px;
  padding: 16px 20px;
  margin: 18px 0;
  text-align: center;
  position: relative;
}
.nm-quote-box blockquote {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--nm-primary);
  line-height: 1.8;
  letter-spacing: 0.5px;
}

/* 響應式適配 */
@media (max-width: 640px) {
  .nm-wiki-card {
    padding: 18px 16px;
  }
  .nm-wiki-grid-2col {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .nm-steps-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .nm-ch-title {
    font-size: 16px;
  }
}

/* ==============================================================================
 * 💡 8 大 PAA 手風琴問答重構樣式 (Accordion with Takeaways & Micro-Cards)
 * ============================================================================== */
.nm-faq-section {
  margin-top: 48px;
  padding-top: 10px;
}
.nm-faq-header {
  text-align: center;
  margin-bottom: 24px;
}
.nm-faq-main-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--nm-primary);
  margin: 0 0 8px;
  letter-spacing: 0.5px;
}
.nm-faq-subtitle {
  font-size: 14px;
  color: var(--nm-ink-light);
  margin: 0;
}

.nm-faq-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.nm-faq-item {
  background: var(--nm-card-bg);
  border: 1px solid var(--nm-border);
  border-radius: var(--nm-radius);
  overflow: hidden;
  box-shadow: 0 3px 12px rgba(168, 46, 46, 0.03);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.nm-faq-item:hover {
  border-color: #d8c2ad;
  box-shadow: 0 6px 18px rgba(168, 46, 46, 0.06);
}
.nm-faq-item[open] {
  border-color: var(--nm-primary);
  box-shadow: 0 6px 20px rgba(168, 46, 46, 0.08);
}

.nm-faq-summary {
  list-style: none;
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  user-select: none;
  background: #ffffff;
  transition: background 0.2s ease;
}
.nm-faq-summary::-webkit-details-marker {
  display: none;
}
.nm-faq-item[open] .nm-faq-summary {
  background: #fdfaf6;
  border-bottom: 1px solid #f2e4d4;
}

.nm-faq-q-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.nm-faq-idx {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #f5efe6;
  color: var(--nm-primary);
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: bold;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.nm-faq-item[open] .nm-faq-idx {
  background: var(--nm-primary);
  color: #fff;
}
.nm-faq-q-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--nm-ink);
  line-height: 1.5;
  letter-spacing: 0.2px;
}
.nm-faq-item[open] .nm-faq-q-text {
  color: var(--nm-primary);
}

.nm-faq-arrow {
  color: #a82e2e;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(168, 46, 46, 0.06);
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s ease;
}
.nm-faq-item[open] .nm-faq-arrow {
  transform: rotate(180deg);
  background: rgba(168, 46, 46, 0.12);
}

/* 抽屜內容主體 */
.nm-faq-body {
  padding: 18px 22px 22px;
  background: #fcfaf7;
  border-left: 3px solid var(--nm-primary);
  animation: nmFaqSlide 0.25s ease-out;
}
@keyframes nmFaqSlide {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 💡 結論先行膠囊 */
.nm-faq-takeaway {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #ffffff;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid rgba(197, 155, 39, 0.35);
  box-shadow: 0 2px 8px rgba(197, 155, 39, 0.06);
  margin-bottom: 14px;
}
.nm-faq-takeaway-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #8c6d17;
  background: var(--nm-gold-light);
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}
.nm-faq-takeaway-text {
  font-size: 14px;
  font-weight: 700;
  color: #8b2020;
  line-height: 1.6;
}

/* 完整權威詳解 (全量原文保留) */
.nm-faq-full-answer {
  font-size: 14.5px;
  color: #44475b;
  line-height: 1.85;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #ebd9c8;
  padding: 12px 16px;
  letter-spacing: 0.2px;
}

/* 底部更多命理工具導航網格精修 */
.nm-matrix-nav {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--nm-border);
}
.nm-matrix-nav .nm-matrix-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--nm-ink);
  margin-bottom: 16px;
  text-align: center;
}


