/* --- 0. 麵包屑導航 (符合 Google SEO 規範) --- */
.tool-breadcrumb {
  margin: 10px 0 20px;
  font-size: 0.88rem;
  color: var(--muted, #64748b);
}

.tool-breadcrumb .breadcrumb-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.tool-breadcrumb .breadcrumb-item {
  display: inline-flex;
  align-items: center;
}

.tool-breadcrumb .breadcrumb-item a {
  color: var(--muted, #64748b);
  text-decoration: none;
  transition: color 0.2s;
}

.tool-breadcrumb .breadcrumb-item a:hover {
  color: #c23531;
}

.tool-breadcrumb .breadcrumb-separator {
  color: #cbd5e1;
  user-select: none;
}

.tool-breadcrumb .breadcrumb-item.active {
  color: var(--main, #1e293b);
  font-weight: 600;
}

/* 兩欄黃金平衡佈局保障 */
.tools-bazi-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 15px;
}

@media (min-width: 900px) {
  .tools-bazi-section {
    flex-direction: row;
    align-items: flex-start;
  }
}

.bazi-left-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 320px;
  box-sizing: border-box;
}

.bazi-result-area {
  flex: 1.35;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  box-sizing: border-box;
}

/* 表單控件輸入框 100% 寬度保障 */
.bazi-form .form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
}

.bazi-form .form-group label {
  display: block;
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--main, #1e293b);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

.bz-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 12px 16px;
  background: var(--classD, #fafafa);
  border: 1px solid var(--classC, #cbd5e1);
  border-radius: 8px;
  color: var(--main, #1e293b);
  font-size: 0.98rem;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.bz-input:focus {
  border-color: #c23531;
  box-shadow: 0 0 0 3px rgba(194, 53, 49, 0.15);
}

/* ==========================================================================
 * 車牌選號吉凶對比專用工具樣式表 (License Plate Numerology Styles)
 * 前哨特種兵專精工具：多號批次對比排行榜 + 擬物車牌視覺 + 單號深度精測
 * ========================================================================== */

/* --- 1. Spoke ➔ Hub 大本營導流飾帶 --- */
.hub-return-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.95) 0%, rgba(224, 242, 254, 0.75) 100%);
  border: 1px solid #bfdbfe;
  border-left: 4px solid #0284c7;
  border-radius: 8px;
  text-decoration: none;
  color: #0369a1;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.25s ease;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.08);
}

.hub-return-banner:hover {
  background: linear-gradient(135deg, rgba(224, 242, 254, 1) 0%, rgba(186, 230, 253, 0.9) 100%);
  border-color: #38bdf8;
  color: #075985;
  transform: translateY(-1px);
}

.hub-banner-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hub-banner-icon {
  font-size: 1.2rem;
}

.hub-banner-arrow {
  font-weight: bold;
  font-size: 1rem;
}

/* --- 2. 測算模式雙模切換 Tab --- */
.plate-mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  background: var(--classD, #f1f5f9);
  padding: 5px;
  border-radius: 10px;
  border: 1px solid var(--classC, #e2e8f0);
}

.plate-mode-btn {
  flex: 1;
  padding: 10px 14px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--muted, #64748b);
  cursor: pointer;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.plate-mode-btn.active {
  background: var(--main-bg, #fff);
  color: #c23531;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* --- 3. 擬物實體車牌外觀模擬視覺 (License Plate Mockup) --- */
.plate-mockup-wrapper {
  margin: 15px 0 20px;
  display: flex;
  justify-content: center;
}

.plate-mockup {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 240px;
  max-width: 320px;
  height: 72px;
  padding: 0 24px;
  background: #fafafa;
  border: 4px solid #1e293b;
  border-radius: 8px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.12);
  font-family: "Impact", "Arial Black", -apple-system, sans-serif;
  letter-spacing: 4px;
  color: #0f172a;
  font-size: 1.85rem;
  text-transform: uppercase;
  font-weight: 900;
  user-select: none;
}

/* 車牌上方固定螺絲孔飾點 */
.plate-screw {
  position: absolute;
  top: 6px;
  width: 7px;
  height: 7px;
  background: #64748b;
  border-radius: 50%;
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.5);
}
.plate-screw.screw-left { left: 16px; }
.plate-screw.screw-right { right: 16px; }

/* 香港自訂車牌金黃反光牌樣式 */
.plate-mockup.plate-hk {
  background: linear-gradient(180deg, #fef08a 0%, #facc15 100%);
  border-color: #854d0e;
  color: #1c1917;
}

/* --- 4. 多號批次對比表單 --- */
.plate-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px 14px;
  border: 1px solid var(--classC, #cbd5e1);
  border-radius: 8px;
  background: var(--main-bg, #fff);
  color: var(--main, #1e293b);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.plate-textarea:focus {
  border-color: #c23531;
  box-shadow: 0 0 0 3px rgba(194, 53, 49, 0.12);
}

.plate-batch-hint {
  font-size: 0.8rem;
  color: var(--muted, #64748b);
  margin-top: 6px;
  line-height: 1.45;
}

.plate-quick-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.quick-chip-label {
  font-size: 0.8rem;
  color: var(--muted, #64748b);
  font-weight: 600;
}

.quick-chip {
  font-size: 0.78rem;
  padding: 3px 8px;
  background: var(--classD, #f1f5f9);
  border: 1px solid var(--classC, #e2e8f0);
  border-radius: 4px;
  color: var(--main, #334155);
  cursor: pointer;
  transition: all 0.2s;
}

.quick-chip:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

/* --- 5. 對比天梯排行榜 (Plate Leaderboard) --- */
.plate-leaderboard {
  margin-top: 15px;
}

/* 冠軍裁決首選卡 (Winner Banner Card) */
.winner-banner-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(254, 243, 199, 0.95) 0%, rgba(253, 230, 138, 0.45) 100%);
  border: 2px solid #f59e0b;
  border-radius: 10px;
  margin-bottom: 20px;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.2);
}

.winner-trophy-icon {
  font-size: 2.4rem;
  line-height: 1;
  flex-shrink: 0;
}

.winner-banner-text {
  flex: 1;
}

.winner-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #92400e;
  margin: 0 0 4px 0;
}

.winner-summary {
  font-size: 0.88rem;
  color: #78350f;
  line-height: 1.5;
  margin: 0;
}

/* 對比卡片列表 */
.rank-list-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.plate-rank-item {
  background: var(--main-bg, #fff);
  border: 1px solid var(--classC, #e2e8f0);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.plate-rank-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

/* 前三名冠亞季軍特別飾邊 */
.plate-rank-item.rank-top-1 {
  border: 2px solid #f59e0b;
  background: linear-gradient(180deg, rgba(254, 243, 199, 0.15) 0%, var(--main-bg, #fff) 100%);
}

.plate-rank-item.rank-top-2 {
  border: 1.5px solid #94a3b8;
}

.plate-rank-item.rank-top-3 {
  border: 1.5px solid #d97706;
}

/* 卡片主體行 */
.rank-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.rank-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.rank-gold {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
}

.rank-silver {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #94a3b8;
}

.rank-bronze {
  background: #ffedd5;
  color: #9a3412;
  border: 1px solid #fdba74;
}

.rank-normal-ji {
  background: rgba(34, 197, 94, 0.1);
  color: #166534;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.rank-normal-xiong {
  background: rgba(239, 68, 68, 0.08);
  color: #991b1b;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* 擬物微型車牌卡 */
.mini-plate-badge {
  font-family: "Impact", "Arial Black", sans-serif;
  font-size: 1.15rem;
  letter-spacing: 2px;
  padding: 3px 12px;
  border: 2px solid #334155;
  border-radius: 4px;
  background: #f8fafc;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.rank-item-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rank-fortune-pill {
  font-size: 0.84rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

.rank-score-wrap {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.rank-score-val {
  font-size: 1.4rem;
  font-weight: 900;
  color: #c23531;
  font-family: Georgia, serif;
}

.rank-score-unit {
  font-size: 0.75rem;
  color: var(--muted, #64748b);
}

/* 指標與星級網格 */
.rank-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: var(--classD, #f8fafc);
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 0.84rem;
}

.rank-meta-col {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--main, #334155);
}

.rank-meta-label {
  color: var(--muted, #64748b);
}

.rank-stars-text {
  color: #f59e0b;
  letter-spacing: 1px;
}

/* 一句話斷語 */
.rank-summary-quote {
  font-size: 0.9rem;
  line-height: 1.55;
  color: #475569;
  margin: 0 0 12px 0;
  padding-left: 10px;
  border-left: 3px solid #cbd5e1;
}

/* 展開詳解按鈕與折疊面板 */
.rank-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--classC, #e2e8f0);
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted, #64748b);
  cursor: pointer;
  transition: all 0.2s ease;
}

.rank-toggle-btn:hover {
  background: var(--classD, #f1f5f9);
  color: var(--main, #1e293b);
}

.rank-detail-drawer {
  display: none;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--classC, #e2e8f0);
}

.rank-detail-drawer.is-open {
  display: block;
}

.drawer-poem {
  font-family: "KaiTi", "BiauKai", serif;
  font-size: 1.15rem;
  color: #78350f;
  margin: 0 0 8px 0;
  font-weight: 600;
}

.drawer-analysis {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--main, #334155);
  margin: 0 0 10px 0;
}

.drawer-advice {
  font-size: 0.84rem;
  line-height: 1.55;
  color: #92400e;
  background: #fef3c7;
  padding: 10px 14px;
  border-radius: 6px;
  margin: 0;
}

/* --- 6. 八字車色配對推薦卡 (Metaphysical Car Color Matrix) --- */
.car-color-matrix-card {
  margin-top: 25px;
  background: var(--main-bg, #fff);
  border: 1px solid var(--classC, #e2e8f0);
  border-radius: 10px;
  padding: 20px;
}

.car-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.color-card {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--classC, #e2e8f0);
  background: var(--classD, #f8fafc);
}

.color-title {
  font-size: 0.92rem;
  font-weight: 700;
  margin: 0 0 6px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
  border: 1px solid rgba(0,0,0,0.15);
}

.color-desc {
  font-size: 0.8rem;
  color: var(--muted, #64748b);
  line-height: 1.45;
  margin: 0;
}

/* 手機響應式優化 */
@media (max-width: 680px) {
  .hub-return-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .rank-item-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .rank-item-right {
    width: 100%;
    justify-content: space-between;
  }
  .rank-meta-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

/* 查看單號完整深度詳解聯動按鈕 (解耦對比與單號) */
.rank-action-row {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.rank-view-detail-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: rgba(194, 53, 49, 0.06);
  border: 1px solid rgba(194, 53, 49, 0.25);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #c23531;
  cursor: pointer;
  transition: all 0.25s ease;
}

.rank-view-detail-btn:hover {
  background: #c23531;
  color: #fff;
  border-color: #c23531;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(194, 53, 49, 0.2);
}

/* --- 15. 左側表單輕量捷徑 (Spoke ➔ Hub Form Sub Portal) --- */
.form-sub-portal {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 15px;
  padding: 10px 14px;
  background: var(--classD, #f8fafc);
  border: 1px dashed var(--classC, #cbd5e1);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--muted, #64748b);
  line-height: 1.5;
}

.form-sub-portal .sub-portal-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.form-sub-portal a {
  color: #0284c7;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.form-sub-portal a:hover {
  color: #c23531;
  text-decoration: underline;
}

/* --- 16. 批次天梯專屬：順流導向 81 數理號碼大本營 (Plate To Hub Card) --- */
.plate-to-hub-card {
  margin-top: 24px;
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.9) 0%, rgba(240, 249, 255, 0.7) 100%);
  border: 1px solid #bfdbfe;
  border-left: 4px solid #0284c7;
  border-radius: 12px;
  padding: 18px 22px;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.08);
  transition: all 0.3s ease;
}

.plate-to-hub-card:hover {
  border-color: #38bdf8;
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.14);
  transform: translateY(-2px);
}

.plate-hub-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.plate-hub-left {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex: 1;
}

.plate-hub-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
  padding: 8px;
  background: rgba(2, 132, 199, 0.1);
  border-radius: 10px;
}

.plate-hub-content {
  flex: 1;
}

.plate-hub-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.plate-hub-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0369a1;
  letter-spacing: 0.3px;
}

.plate-hub-badge {
  display: inline-block;
  padding: 2px 8px;
  background: #0284c7;
  color: #ffffff;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.plate-hub-desc {
  margin: 0;
  font-size: 0.88rem;
  color: #475569;
  line-height: 1.55;
}

.plate-hub-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff !important;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
  transition: all 0.25s ease;
}

.plate-hub-btn:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.35);
}

@media (max-width: 768px) {
  .plate-hub-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .plate-hub-btn {
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
  }
}

/* 暗黑模式適配 */
html[data-night="true"] .plate-to-hub-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.85) 0%, rgba(30, 41, 59, 0.75) 100%);
  border-color: #1e3a8a;
  border-left-color: #38bdf8;
}

html[data-night="true"] .plate-hub-title {
  color: #7dd3fc;
}

html[data-night="true"] .plate-hub-desc {
  color: #94a3b8;
}

html[data-night="true"] .form-sub-portal {
  background: rgba(30, 41, 59, 0.5);
  border-color: #334155;
  color: #94a3b8;
}
