/* ==========================================================================
   HOA SƠN BÁT TỰ - CSS STYLESHEET
   Module: luchao.io.vn/bat-tu
   Thiết kế giao diện Tứ Trụ chuẩn Ảnh 1 (nguhanh.net) trên nền giấy kem Á Đông
   Tự chứa hoàn toàn (Self-contained), tích hợp Portal Navigation 5 Môn
   ========================================================================== */

/* --- Biến CSS Bát Tự --- */
:root {
  /* Nền & Viền Lá Số Chuẩn Tứ Trụ Mệnh Bàn (Màu kem hoàng gia nguhanh.net) */
  --bazi-bg-paper: #FEF6E8;
  --bazi-bg-paper-alt: #FDE68A;
  --bazi-border-outer: #3B82F6;
  --bazi-border-inner: #93C5FD;
  --bazi-header-bg: #FEF6E8;
  --bazi-header-text: #0F172A;
  --bazi-active-cell: #FDE68A;
  --bazi-active-border: #F59E0B;

  /* Màu Ngũ Hành Chuẩn Phong Thủy Đậm Sắc Nét (nguhanh.net) */
  --elem-kim: #52525B;
  --elem-moc: #008000;
  --elem-thuy: #08078D;
  --elem-hoa: #E60000;
  --elem-tho: #8C4817;

  /* Màu Text Hệ Thống */
  --text-dark: #0F172A;
  --text-body: #1E293B;
  --text-gray: #475569;
  --text-muted: #64748B;
  --text-light: #94A3B8;

  /* Safe Area Tokens */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

/* --- Reset cơ bản & Nền Trang Sáng Hiện Đại --- */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #F8FAFC;
  background-image: 
    radial-gradient(circle at 15% 20%, rgba(37, 99, 235, 0.03) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(217, 119, 6, 0.03) 0%, transparent 45%);
  color: var(--text-body);
  margin: 0;
  padding: 0;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   PORTAL NAVIGATION & MOBILE DRAWER (ĐỒNG BỘ 5 MÔN)
   ========================================================================== */
.portal-nav {
  position: sticky !important;
  top: 0 !important;
  z-index: 10000 !important;
  background: linear-gradient(180deg, #18223c 0%, #0d1527 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(245, 158, 11, 0.28);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  padding: 8px 16px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.portal-desktop-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 1200px;
  margin: 0 auto;
}

.portal-tabs-track {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(10, 16, 30, 0.65);
  padding: 5px 8px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.35);
}

.portal-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 18px;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none !important;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
}

.portal-tab-btn:hover {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.22) 0%, rgba(180, 83, 9, 0.12) 100%);
  border-color: rgba(245, 158, 11, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.2);
}

.portal-tab-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  border: 1px solid #ef4444;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  font-weight: 700;
}

.portal-tab-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.portal-tab-text {
  letter-spacing: 0.2px;
}

/* Mobile Bar (< 769px) */
.portal-mobile-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.portal-mobile-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none !important;
  color: #f8fafc;
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: 0.3px;
  min-height: 38px;
}

.mobile-brand-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.mobile-brand-title {
  background: linear-gradient(135deg, #fef3c7 0%, #fbbf24 60%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
  letter-spacing: 0.4px;
  font-size: 1.02rem;
}

.portal-hamburger-btn {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4.5px;
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.portal-hamburger-btn:active {
  background: rgba(255, 255, 255, 0.16);
  transform: scale(0.95);
}

.hamburger-bar {
  display: block;
  width: 19px;
  height: 2px;
  background: #f8fafc;
  border-radius: 2px;
  transition: all 0.25s ease;
}

.portal-hamburger-btn.open .hamburger-bar:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}

.portal-hamburger-btn.open .hamburger-bar:nth-child(2) {
  opacity: 0;
}

.portal-hamburger-btn.open .hamburger-bar:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* Mobile Off-Canvas Drawer */
.portal-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 100000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.portal-drawer-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.portal-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 86vw);
  background: linear-gradient(180deg, #141c2f 0%, #0c1220 100%);
  border-left: 1px solid rgba(245, 158, 11, 0.3);
  box-shadow: -8px 0 35px rgba(0, 0, 0, 0.75);
  z-index: 100001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.portal-drawer.open {
  transform: translateX(0);
}

.portal-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(20, 28, 48, 0.95);
}

.drawer-header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fbbf24;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
}

.drawer-header-icon {
  font-size: 1.25rem;
}

.drawer-close-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
}

.drawer-close-btn:hover,
.drawer-close-btn:active {
  color: #ffffff;
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
}

.portal-drawer-body {
  padding: 16px 14px;
  flex: 1;
}

.drawer-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  text-decoration: none !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: #e2e8f0;
}

.drawer-item:hover,
.drawer-item:active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(245, 158, 11, 0.35);
  transform: translateX(2px);
}

.drawer-item.active {
  background: linear-gradient(135deg, rgba(185, 28, 28, 0.35) 0%, rgba(153, 27, 27, 0.18) 100%);
  border: 1.5px solid #ef4444;
  box-shadow: 0 4px 14px rgba(185, 28, 28, 0.35);
}

.drawer-item-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.drawer-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-item-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f8fafc;
}

.drawer-item.active .drawer-item-title {
  color: #ffffff;
}

.drawer-item-desc {
  font-size: 0.76rem;
  color: #94a3b8;
  line-height: 1.3;
}

.drawer-item-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
  flex-shrink: 0;
}

.drawer-item-arrow {
  color: #64748b;
  font-size: 1.2rem;
  font-weight: 700;
}

.portal-drawer-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 16, 30, 0.9);
}

.drawer-contact-card {
  font-size: 0.82rem;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-contact-card a {
  color: #fbbf24;
  text-decoration: none;
  font-weight: 600;
}

/* ==========================================================================
   BÁT TỰ MAIN CONTENT & FORM
   ========================================================================== */
.bazi-page-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* Header Banner - Phong thái học thuật sang trọng */
.bazi-header-banner {
  background: #FFFFFF;
  border: 1px solid #E2D8C3;
  border-left: 5px solid #D97706;
  border-radius: 14px;
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 18px rgba(60, 40, 20, 0.05);
  flex-wrap: wrap;
  gap: 16px;
}

.bazi-header-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.bazi-header-title .icon {
  font-size: 2.4rem;
  line-height: 1;
}

.bazi-header-title h1 {
  font-size: 1.45rem;
  font-weight: 800;
  color: #0F172A;
  margin: 0;
  letter-spacing: 0.5px;
}

.bazi-header-title p {
  font-size: 0.88rem;
  color: #64748B;
  margin: 4px 0 0 0;
}

.bazi-badge {
  background: #FEF3C7;
  border: 1px solid #F59E0B;
  color: #B45309;
  padding: 7px 16px;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* Form Card - Nền Trắng / Kem Tinh Tế */
.bazi-form-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  padding: 24px 28px;
  margin-bottom: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.bazi-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px 20px;
  margin-bottom: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.form-group label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #334155;
  letter-spacing: 0.2px;
}

.form-input, .form-select {
  background: #F8FAFC;
  border: 1.5px solid #CBD5E1;
  border-radius: 8px;
  padding: 10px 14px;
  color: #0F172A;
  font-size: 16px; /* 16px chống tự động zoom trên iOS Safari */
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.form-input:focus, .form-select:focus {
  background: #FFFFFF;
  border-color: #D97706;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

/* Đảm bảo ô Giờ sinh đồng bộ 100% với các ô nhập liệu khác, không biến dạng trên mobile */
input[type="time"].form-input,
.bazi-time-input {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  text-align: left;
  background-color: #F8FAFC;
}

.bazi-date-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.3fr;
  gap: 8px;
}

.bazi-time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Nơi sinh Autocomplete */
.province-search-container {
  position: relative;
}

.province-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #FFFFFF;
  border: 1.5px solid #CBD5E1;
  border-radius: 8px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  display: none;
  margin-top: 4px;
}

.province-dropdown.show {
  display: block;
}

.province-item {
  padding: 9px 14px;
  font-size: 0.9rem;
  color: #1E293B;
  cursor: pointer;
  transition: background 0.15s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #F1F5F9;
}

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

.province-item:hover, .province-item.active {
  background: #FEF3C7;
  color: #92400E;
}

.province-item .sub {
  font-size: 0.78rem;
  color: #64748B;
}

/* Nút Submit Hoàng Gia */
.btn-submit-bazi {
  background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
  color: #FFFFFF;
  border: none;
  border-radius: 9px;
  padding: 14px 28px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.35);
  transition: all 0.22s ease;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.btn-submit-bazi:hover {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.45);
}

.btn-submit-bazi:active {
  transform: translateY(0);
}

/* ==========================================================================
   BẢNG LÁ SỐ BÁT TỰ (CHUẨN ẢNH 1 - NGUHANH.NET)
   ========================================================================== */
.bazi-result-container {
  display: none;
  margin-top: 24px;
}

.bazi-result-container.show {
  display: block !important;
  animation: fadeIn 0.3s ease forwards;
}

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

/* Container Render Ngầm (Target để html2canvas chụp ảnh chuẩn 1280px) */
.bazi-capture-container {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 1280px;
  min-width: 1280px;
  max-width: 1280px;
  opacity: 0.01;
  pointer-events: none;
  z-index: -9999;
  -webkit-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
}

/* Container hiển thị kết quả chính */
.bazi-rendered-card-container {
  max-width: 1280px;
  margin: 0 auto 30px auto;
}

/* Thanh chọn Đại Vận nhanh trên UI */
.bazi-daivan-switcher-box {
  background: #FFFFFF;
  border: 1px solid var(--bazi-border-outer);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.switcher-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.bazi-daivan-switcher-box .switcher-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1E3A8A;
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.switcher-quick-year {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1E3A8A;
}

.form-select-sm {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #CBD5E1;
  background: #FFFFFF;
  font-size: 0.84rem;
  font-family: inherit;
  font-weight: 700;
  color: #0F172A;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-select-sm:focus {
  border-color: #2563EB;
}

.bazi-daivan-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.bazi-dv-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #CBD5E1;
  background: #F8FAFC;
  font-size: 0.84rem;
  color: #1E293B;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  font-family: inherit;
}

.bazi-dv-pill:hover {
  border-color: #F59E0B;
  background: #FEF3C7;
}

.bazi-dv-pill.active {
  background: #FEF3C7;
  border-color: #F59E0B;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
  font-weight: 700;
  color: #78350F;
}

.bazi-dv-pill .pill-tt {
  font-size: 0.74rem;
  color: #64748B;
  font-weight: 600;
}

.bazi-dv-pill .pill-cc {
  font-weight: 800;
}

.bazi-dv-pill .pill-age {
  font-size: 0.76rem;
  color: #B45309;
  font-weight: 700;
}

/* Khung hiển thị Ảnh Lá Số */
.bazi-image-display-frame {
  position: relative;
  background: #FEF6E8;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  border: 1px solid #E2D8C3;
  overflow: hidden;
  min-height: 220px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.bazi-rendered-img {
  display: block;
  width: 100%;
  max-width: 1280px;
  height: auto;
  object-fit: contain;
  cursor: pointer;
  -webkit-touch-callout: default !important;
  user-select: auto !important;
}

.bazi-img-loading {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 5;
  color: #1E3A8A;
  font-weight: 700;
  font-size: 0.95rem;
}

.bazi-spinner {
  width: 38px;
  height: 38px;
  border: 3.5px solid #E2E8F0;
  border-top-color: #2563EB;
  border-radius: 50%;
  animation: baziSpin 0.8s linear infinite;
}

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

/* Gợi ý lưu ảnh */
.bazi-save-hints {
  margin-top: 12px;
  text-align: center;
  font-size: 0.85rem;
  color: #64748B;
  background: #FFFFFF;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px dashed var(--bazi-border-outer);
}

.bazi-save-hints strong {
  color: #B45309;
}

.hint-mobile {
  display: none;
}

@media (max-width: 768px) {
  .hint-desktop {
    display: none;
  }
  .hint-mobile {
    display: inline;
  }
}

/* ==========================================================================
   SHEET TỨ TRỤ MỆNH BÀN (CHUẨN ẢNH THỰC TẾ)
   ========================================================================== */
.bazi-chart-card {
  width: 1280px;
  min-width: 1280px;
  max-width: 1280px;
  box-sizing: border-box;
  background: #FEF6E8; /* Màu nền giấy kem hoàng gia chuẩn nguhanh.net */
  border: 2.5px solid #000000; /* Viền đen sắc nét bao quanh toàn bộ lá số */
  border-radius: 4px;
  padding: 26px 30px;
  box-shadow: 0 4px 24px rgba(30, 58, 138, 0.12);
  position: relative;
  overflow: hidden;
  font-family: 'Roboto', Arial, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
}

/* Watermark Thái Cực chìm - Ẩn hoàn toàn để nền lá số sạch tinh khiết */
.bazi-watermark {
  display: none !important;
}

/* Sheet Header (Bố cục 2 cột dồn về 1 phía bên trái chuẩn Lục Hào Ảnh 2) */
.bazi-sheet-header {
  position: relative;
  z-index: 1;
  width: 100%;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(59, 130, 246, 0.22);
  background: transparent;
}

.header-meta-box {
  display: grid;
  grid-template-columns: minmax(350px, max-content) auto;
  justify-content: start;
  column-gap: 50px;
  row-gap: 13px;
  width: fit-content;
  background: transparent;
  box-sizing: border-box;
}

.meta-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 18.5px;
  color: #1F2937;
  white-space: nowrap;
  line-height: 1.4;
}

.meta-label {
  font-weight: 700 !important; /* In đậm tiêu đề theo yêu cầu */
  color: #0F172A;
  font-size: 18.5px;
  letter-spacing: 0.15px;
}

.meta-val {
  font-weight: 400;
  color: #1E293B;
  font-size: 18.5px;
}

#res-name {
  font-weight: 700;
  color: #0F172A;
  font-size: 18.5px; /* Bằng kích thước các chữ khác theo yêu cầu */
  letter-spacing: 0.2px;
}

.meta-highlight {
  color: #B45309 !important;
  font-weight: 700 !important;
  font-size: 18.5px;
}

/* BẢNG TỨ TRỤ CHÍNH */
.bazi-table-responsive {
  position: relative;
  z-index: 1;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.bazi-main-table,
.dai-van-table,
.luu-nien-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  background: #FEF6E8;
  border: 1.5px solid #3B82F6; /* Viền bảng màu xanh lam chuẩn nét Ảnh 4 */
  table-layout: fixed;
}

.bazi-main-table {
  margin-bottom: 14px;
}

.bazi-main-table td,
.dai-van-table td,
.luu-nien-table td {
  border: 1px solid #93C5FD; /* Viền ô màu xanh lam thanh thoát chuẩn Ảnh 4 */
  vertical-align: middle;
  background: #FEF6E8;
}

.bazi-main-table td {
  padding: 14px 4px;
}

/* Cột Tiêu Đề Bên Trái In Đậm Rõ Nét Màu Đen Chuẩn */
.bazi-main-table .col-title,
.col-title-vertical {
  width: 5.6%;
  min-width: 66px;
  max-width: 72px;
  font-weight: 700 !important;
  color: #0F172A !important; /* Màu đen mực sắc nét, dễ nhìn */
  background: #FEF6E8 !important;
  font-size: 15px;
  letter-spacing: 0.4px;
  text-align: center;
  vertical-align: middle;
  padding: 8px 2px;
}

/* Kiểu xếp chữ trên dưới 1 chữ */
.title-split {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1.18;
}

.title-split span {
  display: block;
  font-weight: 700 !important;
  color: #0F172A !important;
  font-size: 14.5px;
}

.bazi-main-table .col-cell {
  width: 23.6%;
  font-size: 19.5px;
  color: #0F172A; /* Màu đen mực sắc nét chuẩn yêu cầu */
  font-weight: 600;
  background: #FEF6E8;
}

.bazi-main-table .num-bold {
  font-weight: 600;
  font-size: 20px;
  color: #0F172A;
  letter-spacing: 0.2px;
}

.cell-nhat-chu {
  vertical-align: middle;
}

/* Kiểu chữ NHẬT CHỦ xếp 2 dòng vuông vắn chuẩn Ảnh 2 */
.nhat-chu-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.25;
  gap: 2px;
  font-weight: 800;
  color: #0F172A;
  font-size: 18.5px;
  letter-spacing: 0.5px;
}

.nhat-chu-stack span {
  display: block;
}

.can-chi-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 0;
}

.can-chi-stack .char-can,
.can-chi-stack .char-chi {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.18;
  display: block;
  text-transform: uppercase; /* In hoa toàn bộ chữ Bát Tự */
}

/* Hàng Tinh Sát (Chu Thần Bân) trong Bảng Tứ Trụ - Xếp trên dưới, đồng nhất kích cỡ & khoảng cách */
.bazi-main-table .cell-tinhsat {
  padding: 14px 4px;
  vertical-align: middle;
  height: auto;
  box-sizing: border-box;
}

.tinhsat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  line-height: 1.25;
  padding: 0;
  width: 100%;
}

.tinhsat-tag {
  display: block;
  font-size: 19.5px;
  font-weight: 600;
  color: #0F172A;
  letter-spacing: 0.1px;
  white-space: nowrap;
  word-break: keep-all;
}

.tinhsat-empty {
  font-size: 19.5px;
  font-weight: 600;
  color: #0F172A;
  display: block;
  line-height: 1.25;
}

/* BẢNG ĐẠI VẬN 10 CỘT */
.table-daivan-box {
  margin-bottom: 14px;
}

/* Khung thông tin tính Đại Vận */
.daivan-info-cell {
  padding: 8px 16px !important;
  text-align: left !important;
  background: #FEF6E8 !important;
  border-bottom: 1px solid #93C5FD !important;
  vertical-align: middle;
}

.daivan-info-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
}

.daivan-info-line {
  font-size: 16.5px;
  color: #1E293B;
  line-height: 1.45;
  letter-spacing: 0.1px;
}

.daivan-info-line strong {
  font-weight: 700;
  color: #0F172A;
}

.daivan-info-line .val-blue {
  color: #034687;
  font-weight: 700;
  font-size: 16.5px;
}

.daivan-info-line .val-sub {
  color: #64748B;
  font-size: 15.5px;
  font-weight: 500;
}

/* ==========================================================================
   BẢNG ĐẠI VẬN & LƯU NIÊN (CHUẨN TỶ LỆ VÀNG, PHÂN BẬC ĐẠI VẬN > LƯU NIÊN)
   ========================================================================== */

.dai-van-table td.dv-col,
.luu-nien-table td.ln-cell {
  width: 9.44%;
  vertical-align: middle;
  background: #FEF6E8;
  transition: background 0.15s ease;
}

.dai-van-table td.dv-col {
  cursor: pointer;
  padding: 3px 1px;
}

.dai-van-table td.dv-col:hover {
  background: #FDE68A;
}

.dai-van-table td.dv-col.target-dv,
.dai-van-table td.dv-col.active {
  background: #FDE68A !important;
}

.table-luunien-box {
  margin-bottom: 18px;
}

.luu-nien-table td.ln-cell {
  padding: 2px 1px;
}

.luu-nien-table td.ln-cell:hover {
  background: #FDE68A;
}

/* Năm Chuyển Vận (Đổi Đại Vận 10 năm) - Màu Xanh lam pastel dịu mát */
.luu-nien-table td.ln-cell.transition-year {
  background: #E0F2FE !important;
}

/* Năm Đang Xét (Xem Hạn) - Màu Vàng hổ phách */
.luu-nien-table td.ln-cell.target-year {
  background: #FDE68A !important;
}

/* Năm Chuyển Vận mà ĐỒNG THỜI là Năm Đang Xét (Xem Hạn) - Gradient Vàng hổ phách chuyển Xanh lam */
.luu-nien-table td.ln-cell.target-year.transition-year {
  background: linear-gradient(135deg, #FDE68A 45%, #BAE6FD 100%) !important;
}

/* Base stack layout */
.cell-pair-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.cell-pair-line {
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  width: 100%;
}

.cell-meta-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.25;
  width: 100%;
}

.cell-meta-stack .meta-age,
.cell-meta-stack .meta-year {
  white-space: nowrap;
  display: block;
}

/* ---------------------------------------------------------
   1. ĐẠI VẬN (10 Năm - Bỏ dấu gạch, Can Chi in đậm màu ngũ hành, Thập Thần nét thường)
   --------------------------------------------------------- */
.dai-van-table .cell-pair-stack {
  gap: 4px;
  padding: 8px 1px;
}

.dai-van-table .cell-pair-line {
  gap: 8px; /* Tăng từ 4px lên 8px để Can Chi và Thập Thần tách bạch rõ ràng, thoáng mắt */
  line-height: 1.32;
}

.dai-van-table .cell-pair-line .char-name {
  font-size: 17px; /* To hơn Lưu Niên 1 chút (17px so với 15.5px) */
  font-weight: 700; /* Can Chi in đậm nổi bật */
}

.dai-van-table .cell-pair-line .char-tt {
  font-size: 15.5px; /* To hơn Lưu Niên 1 chút */
  font-weight: 400; /* Thập Thần nét thường, không in đậm */
  color: #1E293B; /* Màu mực dễ đọc, sắc sảo */
}

.dai-van-table .cell-meta-stack {
  gap: 3px;
  padding: 7px 1px;
}

.dai-van-table .cell-meta-stack .meta-age {
  font-size: 15px;
  font-weight: 400;
  color: #475569;
}

.dai-van-table .cell-meta-stack .meta-year {
  font-size: 15.5px;
  font-weight: 500;
  color: #1E293B;
}

/* ---------------------------------------------------------
   2. LƯU NIÊN (Từng năm - Bỏ dấu gạch, thanh thoát)
   --------------------------------------------------------- */
.luu-nien-table .cell-pair-stack {
  gap: 3px;
  padding: 6px 1px;
}

.luu-nien-table .cell-pair-line {
  gap: 6px; /* Tăng từ 3px lên 6px để khoảng cách 2 chữ tự nhiên, dễ đọc */
  line-height: 1.28;
}

.luu-nien-table .cell-pair-line .char-name {
  font-size: 15.5px; /* Nhỏ hơn Đại Vận ~1.5px, gọn gàng, thanh thoát */
  font-weight: 700; /* Can Chi in đậm nổi bật */
}

.luu-nien-table .cell-pair-line .char-tt {
  font-size: 15px; /* Nhỏ hơn Đại Vận */
  font-weight: 400;
  color: #334155;
}

.luu-nien-table .cell-meta-stack {
  gap: 2px;
  padding: 5px 1px;
}

.luu-nien-table .cell-meta-stack .meta-year {
  font-size: 15px;
  font-weight: 500;
  color: #1E293B;
}

.luu-nien-table .cell-meta-stack .meta-age {
  font-size: 14px;
  font-weight: 400;
  color: #64748B;
}

/* ---------------------------------------------------------
   3. TIỂU VẬN (Can 1 Thập thần ↓ Can 2 Thập thần - Chiều dọc, Chuẩn Hoa Sơn)
   --------------------------------------------------------- */
.luu-nien-table .cell-tv-line {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  white-space: nowrap;
  padding: 5px 1px;
  line-height: 1.25;
}

.luu-nien-table .cell-tv-line .tv-item {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.luu-nien-table .cell-tv-line .tv-can {
  font-size: 15.5px; /* Bằng 100% kích thước Can Lưu Niên (15.5px) */
  font-weight: 700;
}

.luu-nien-table .cell-tv-line .tv-tt {
  font-size: 15px; /* Bằng 100% kích thước Thập Thần Lưu Niên (15px) */
  font-weight: 400;
  color: #334155;
}

.luu-nien-table .cell-tv-line .tv-arrow {
  font-size: 11px;
  color: #94A3B8;
  line-height: 1;
  margin: 1px 0;
}

.col-title-vertical .title-dash {
  font-size: 13px;
  font-weight: 700;
  color: #64748B;
  line-height: 1;
  margin: 1px 0;
}

.col-title-vertical .title-bday {
  font-size: 13.5px;
  font-weight: 700;
  color: #1D4ED8;
  margin-top: 2px;
  letter-spacing: -0.3px;
  white-space: nowrap;
}

/* ---------------------------------------------------------
   4. HÀNG PHÂN CÁCH 2 KHỐI 10 NĂM LƯU NIÊN - TIỂU VẬN
   --------------------------------------------------------- */
.luu-nien-table .ln-decade-divider-row {
  height: 10px;
  line-height: 10px;
}

.luu-nien-table .ln-decade-divider-cell {
  height: 10px;
  background: #FEF6E8; /* Màu nền giấy kem hoàng gia chuẩn nguhanh.net */
  border-top: 1.5px solid #3B82F6 !important; /* Đường viền xanh chốt khối 1 */
  border-bottom: 1.5px solid #3B82F6 !important; /* Đường viền xanh khởi đầu khối 2 */
  border-left: 1px solid #93C5FD !important;
  border-right: 1.5px solid #3B82F6 !important;
  padding: 0 !important;
}

/* ==========================================================================
   3. BẢNG 10 THIÊN CAN (VƯỢNG SUY)
   ========================================================================== */
.table-thiencan-box {
  margin-bottom: 14px;
}

.thien-can-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  background: #FEF6E8;
  border: 1.5px solid #3B82F6;
  table-layout: fixed;
}

.thien-can-table td {
  border: 1px solid #93C5FD;
  vertical-align: middle;
  background: #FEF6E8;
  padding: 6px 1px;
}

.thien-can-table td.tc-cell {
  width: 9.44%;
  vertical-align: middle;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  box-sizing: border-box;
}

.thien-can-table .tc-can {
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.25;
  padding: 6px 1px;
}

.thien-can-table .tc-vs {
  font-size: 15px;
  font-weight: 400;
  color: #1E293B;
  line-height: 1.25;
  padding: 5px 1px;
}

/* ==========================================================================
   4. BẢNG 20 TINH SÁT TOÀN CỤC (CHU THẦN BÂN)
   ========================================================================== */
.table-tinhsat-box {
  margin-bottom: 14px;
}

.tinh-sat-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  background: #FEF6E8;
  border: 1.5px solid #3B82F6;
  table-layout: fixed;
}

.tinh-sat-table td {
  border: 1px solid #93C5FD;
  vertical-align: middle;
  background: #FEF6E8;
  padding: 5px 2px;
  height: 62px; /* Đồng nhất cân đối chiều cao 2 hàng chuẩn thẩm mỹ hoàng gia */
  box-sizing: border-box;
}

.tinh-sat-table td.col-title-vertical {
  width: 5.6%;
  background: #FEF6E8;
  font-weight: 700;
  color: #1E293B;
  text-align: center;
  vertical-align: middle;
  padding: 5px 1px;
  font-size: 15px;
  line-height: 1.25;
}

.tinh-sat-table td.ts-cell {
  width: 9.44%;
  vertical-align: middle;
  text-align: center;
  box-sizing: border-box;
  padding: 5px 2px;
  background: #FEF6E8;
  transition: all 0.2s ease;
}

.tinh-sat-table .ts-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  color: #0F172A;
  display: block;
  text-align: center;
  word-break: keep-all;
}

.tinh-sat-table .ts-val {
  font-size: 15px; /* Đồng nhất kích cỡ chuẩn 15px với Thập Thần */
  font-weight: 400;
  line-height: 1.2;
  color: #1E293B; /* Đồng nhất màu mực sắc nét chuẩn với Thập Thần (#1E293B) */
  display: block;
  text-align: center;
  margin-top: 3px;
  word-break: keep-all;
}

/* PHƯƠNG ÁN A: Tinh Sát có mặt trong Bát Tự (Active Pastel Amber Tint) */
.tinh-sat-table td.ts-cell.is-active {
  background-color: #FEF3C7 !important; /* Vàng hổ phách pastel nhã nhặn */
}

.tinh-sat-table td.ts-cell.is-active .ts-name {
  color: #92400E !important; /* Nâu hổ phách đậm quý tộc */
  font-weight: 800;
}

.tinh-sat-table td.ts-cell.is-active .ts-val {
  color: #B45309 !important; /* Hổ phách ấm */
  font-weight: 600;
}

/* Chân bảng Lá Số / Footer Sheet */
.bazi-card-footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 4px 2px 4px;
  margin-top: 4px;
  font-size: 14.5px;
  color: #4B5563;
  border-top: 1.5px solid #3B82F6;
  text-align: center;
  background: #FEF6E8;
}

.footer-center-link span {
  font-size: 14.5px;
  color: #4B5563;
}

.footer-center-link strong {
  color: #034687;
  font-weight: 700;
  font-size: 15px;
}

.footer-center-link a {
  color: #034687;
  text-decoration: none;
}

.footer-center-link a:hover {
  text-decoration: underline;
}

.footer-legend {
  display: flex;
  align-items: center;
  gap: 14px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: #0F172A;
}

.legend-box {
  display: inline-block;
  width: 14px;
  height: 12px;
  border-radius: 2px;
}

.legend-box.legend-kim { background: #52525B; }
.legend-box.legend-moc { background: #008000; }
.legend-box.legend-thuy { background: #08078D; }
.legend-box.legend-hoa { background: #E60000; }
.legend-box.legend-tho { background: #8C4817; }

/* Nút Action Footer */
.bazi-actions-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

.btn-bazi-action {
  padding: 12px 24px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 0.98rem;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.btn-bazi-download {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #FFFFFF;
}

.btn-bazi-download:hover {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.35);
}

.btn-bazi-reset {
  background: #FFFFFF;
  color: #334155;
  border: 1.5px solid #CBD5E1;
}

.btn-bazi-reset:hover {
  background: #F1F5F9;
  border-color: #94A3B8;
}

/* Toast Thông Báo Nhẹ */
.bazi-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 23, 42, 0.92);
  color: #FFFFFF;
  padding: 11px 22px;
  border-radius: 9999px;
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  z-index: 999999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.bazi-toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   BÁT TỰ SEO GUIDE SECTION & FOOTER
   ========================================================================== */
.bazi-seo-guide-section {
  background: #FFFFFF;
  border: 1px solid #E2D8C3;
  border-radius: 14px;
  padding: 32px 28px;
  margin-top: 36px;
  box-shadow: 0 4px 18px rgba(60, 40, 20, 0.04);
}

.bazi-seo-guide-section h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0F172A;
  margin: 0 0 14px 0;
  border-bottom: 2px solid #E2D8C3;
  padding-bottom: 12px;
}

.bazi-seo-guide-section h3 {
  font-size: 1.12rem;
  font-weight: 700;
  color: #92400E;
  margin: 24px 0 12px 0;
}

.bazi-seo-guide-section p {
  font-size: 0.94rem;
  line-height: 1.7;
  color: #334155;
  margin-bottom: 14px;
}

.bazi-seo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 16px 0 24px;
}

.bazi-seo-card {
  background: #FFFDF9;
  border: 1px solid #EADCC8;
  border-left: 4px solid #D97706;
  border-radius: 10px;
  padding: 16px 18px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bazi-seo-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(217, 119, 6, 0.1);
}

.bazi-seo-card h4 {
  font-size: 0.98rem;
  font-weight: 700;
  color: #0F172A;
  margin: 0 0 8px 0;
}

.bazi-seo-card p {
  font-size: 0.88rem;
  line-height: 1.6;
  color: #475569;
  margin: 0;
}

.bazi-footer {
  margin-top: 36px;
  padding: 24px 16px;
  text-align: center;
  font-size: 0.88rem;
  color: #64748B;
  border-top: 1px solid #E2D8C3;
}

.bazi-footer p {
  margin: 4px 0;
}

.bazi-footer a {
  color: #B45309;
  text-decoration: none;
  font-weight: 600;
}

.bazi-footer a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   RESPONSIVE DESIGN (MOBILE & TABLET)
   ========================================================================== */
@media (max-width: 768px) {
  .portal-desktop-nav {
    display: none !important;
  }

  .portal-mobile-bar {
    display: flex !important;
  }

  .bazi-page-wrapper {
    padding: 12px 10px 32px;
  }

  .bazi-header-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 16px;
    gap: 10px;
  }

  .bazi-header-title .icon {
    font-size: 2rem;
  }

  .bazi-header-title h1 {
    font-size: 1.22rem;
  }

  .bazi-form-card {
    padding: 16px 14px;
    overflow: hidden;
  }

  .bazi-form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .btn-bazi-action {
    width: 100%;
    justify-content: center;
  }
}


/* ==========================================================================
   KHUNG NHẬP NHANH AI (TEXT & ẢNH LÁ SỐ) - ĐỒNG BỘ HOA SƠN BÁT TỰ
   ========================================================================== */
.bazi-ai-parse-box {
  background: linear-gradient(135deg, #FFFDF9 0%, #FEF6E8 100%);
  border: 1.5px dashed #D97706;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 16px;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.bazi-ai-parse-box.drag-over {
  border-color: #B45309;
  background: #FEF3C7;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18);
}

.bazi-ai-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.bazi-ai-badge {
  font-size: 0.9rem;
  font-weight: 700;
  color: #B45309;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bazi-ai-model-tag {
  font-size: 0.74rem;
  color: #78350F;
  background: #FDE68A;
  border: 1px solid rgba(245, 158, 11, 0.45);
  padding: 2px 9px;
  border-radius: 9999px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.bazi-ai-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bazi-ai-textarea {
  width: 100%;
  border: 1.5px solid #E2D8C3;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.92rem;
  line-height: 1.45;
  resize: vertical;
  min-height: 58px;
  background: #FFFFFF;
  color: #0F172A;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bazi-ai-textarea:focus {
  border-color: #D97706;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

.bazi-ai-img-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #FFFFFF;
  border: 1px solid #F59E0B;
  border-radius: 8px;
  padding: 8px 12px;
}

.bazi-ai-thumb-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.bazi-ai-thumb-wrap img {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #E2E8F0;
  flex-shrink: 0;
  background: #F8FAFC;
}

.bazi-ai-thumb-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.bazi-ai-thumb-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: #0F172A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bazi-ai-thumb-sub {
  font-size: 0.75rem;
  color: #059669;
  font-weight: 600;
}

.bazi-ai-remove-img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid #FECACA;
  background: #FEF2F2;
  color: #DC2626;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.1s ease;
}

.bazi-ai-remove-img:hover {
  background: #FEE2E2;
}

.bazi-ai-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.bazi-ai-upload-btn {
  background: #FFFFFF;
  color: #92400E;
  border: 1.5px solid #F59E0B;
  border-radius: 8px;
  padding: 8px 14px;
  min-height: 40px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.18s ease;
}

.bazi-ai-upload-btn:hover {
  background: #FEF3C7;
  border-color: #D97706;
}

.bazi-ai-parse-btn {
  background: linear-gradient(135deg, #D97706 0%, #B45309 100%);
  color: #FFFFFF;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  min-height: 40px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.25);
  transition: all 0.18s ease;
  margin-left: auto;
}

.bazi-ai-parse-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #B45309 0%, #92400E 100%);
  transform: translateY(-1px);
}

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

.bazi-ai-error {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: #DC2626;
  font-weight: 600;
}

.bazi-form-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 4px 0 18px;
}

.bazi-form-divider::before,
.bazi-form-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px dashed #CBD5E1;
}

.bazi-form-divider span {
  padding: 0 12px;
  font-size: 0.74rem;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}

@media (max-width: 768px) {
  .bazi-ai-parse-box {
    padding: 12px 12px;
  }
  .bazi-ai-textarea {
    font-size: 16px;
  }
  .bazi-ai-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .bazi-ai-upload-btn,
  .bazi-ai-parse-btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
    margin-left: 0;
  }
}
