/* ===== PHONG THUY TRACH CAT - TU VI PLUGIN ===== */

:root {
  --tuvi-red:         #8B0000;
  --tuvi-red-dark:    #5c0000;
  --tuvi-red-mid:     #a01010;
  --tuvi-gold:        #c9a227;
  --tuvi-gold-light:  #f0d060;
  --tuvi-bg-form:     #1e0000;
  --tuvi-bg-row:      #2a0505;
  --tuvi-border-form: #5c1010;
  --tuvi-text-light:  #f5e6c8;
  --tuvi-text-dim:    #c8a090;
  --tuvi-chart-bg:    #ffffff;
  --tuvi-chart-border:#8B0000;
  --tuvi-cell-border: #c06060;
  /* Chiều rộng lá số (căn giữa, bảng full trong khung — đồng bộ với chart_width trong JS) */
  --tuvi-chart-width: 850px;
}

/* ===== WRAPPER ===== */
.tuvi-wrap {
	padding-top: 30px !important;
	padding-bottom: 30px !important;
	margin: 0 auto;
  max-width: 1200px;
  font-size: 13px;
  line-height: 1.4;
}
td.tuvi-label, td.tuvi-cam-ket {
    padding-left: 28px !important;
}
/* ===== TABS ===== */
.tuvi-tabs {
  display: flex;
  background: var(--tuvi-red-dark);
  border-bottom: 3px solid var(--tuvi-gold);
}
.tuvi-tab {
  padding: 14px 32px;
  background: transparent;
  border: none;
  color: var(--tuvi-text-dim);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all .2s;
  letter-spacing: .3px;
  margin-bottom: -3px;
}
.tuvi-tab:hover  { color: var(--tuvi-gold-light); }
.tuvi-tab.active {
  color: var(--tuvi-gold);
  border-bottom-color: var(--tuvi-gold);
  background: rgba(255,255,255,.05);
}
.tuvi-tab-content        { display: none; }
.tuvi-tab-content.active { display: block; }

/* ===== FORM ===== */
.tuvi-tab-content#tab-thongtin {
  background: var(--tuvi-bg-form);
  padding: 0;
}
.tuvi-form-table {
  width: 100%;
  border-collapse: collapse;
}
.tuvi-form-table tr {
  border-bottom: 1px solid var(--tuvi-border-form);
}
.tuvi-form-table tr:last-child { border-bottom: none; }

.tuvi-label {
  padding: 13px 24px 13px 28px;
  color: var(--tuvi-gold-light);
  font-weight: 600;
  white-space: nowrap;
  background: var(--tuvi-bg-row);
  border-right: 1px solid var(--tuvi-border-form);
  vertical-align: middle;
  font-size: 14px;
  width: 160px;
}
.tuvi-field {
  padding: 10px 20px;
  vertical-align: middle;
}

.tuvi-input {
  background: #2f0808;
  border: 1px solid #8a3030;
  color: #f5e6c8;
  padding: 8px 12px;
  border-radius: 3px;
  font-size: 13px;
  outline: none;
  transition: border-color .2s;
}
.tuvi-input:focus { border-color: var(--tuvi-gold); }
.tuvi-input-wide  { width: 100%; max-width: 520px; box-sizing: border-box; }

.tuvi-select {
  background: #2f0808;
  border: 1px solid #8a3030;
  color: #f5e6c8;
  padding: 7px 10px;
  border-radius: 3px;
  font-size: 13px;
  outline: none;
  min-width: 85px;
  cursor: pointer;
}
.tuvi-select:focus { border-color: var(--tuvi-gold); }
.tuvi-select-wide { min-width: 220px; max-width: 100%; }

/* Múi giờ — combobox có tìm kiếm */
.tuvi-tz-picker { position: relative; max-width: 100%; width: 100%; }
.tuvi-tz-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  max-width: 560px;
  box-sizing: border-box;
  background: #2f0808;
  border: 1px solid #8a3030;
  color: #f5e6c8;
  padding: 8px 12px;
  border-radius: 3px;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  line-height: 1.35;
}
.tuvi-tz-trigger:hover,
.tuvi-tz-picker.is-open .tuvi-tz-trigger { border-color: var(--tuvi-gold); }
.tuvi-tz-trigger-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tuvi-tz-caret {
  flex-shrink: 0;
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--tuvi-gold);
  opacity: .85;
}
.tuvi-tz-dropdown {
  position: absolute;
  z-index: 1200;
  left: 0;
  right: 0;
  max-width: 560px;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #c8b8a0;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
  overflow: hidden;
}
.tuvi-tz-search {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: 0;
  border-bottom: 1px solid #e8dfd0;
  padding: 10px 12px;
  font-size: 13px;
  color: #333;
  outline: none;
}
.tuvi-tz-search:focus { background: #fffef8; }
.tuvi-tz-search::placeholder { color: #999; }
.tuvi-tz-list {
  max-height: 280px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.tuvi-tz-group-label {
  padding: 6px 12px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #8B0000;
  background: #faf6f0;
  border-bottom: 1px solid #eee4d6;
  position: sticky;
  top: 0;
  z-index: 1;
}
.tuvi-tz-option {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: 0;
  background: #fff;
  text-align: left;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.35;
  cursor: pointer;
  color: #222;
}
.tuvi-tz-option:hover,
.tuvi-tz-option.is-active { background: #f0ebe3; }
.tuvi-tz-option.is-selected { background: #e8dfd0; font-weight: 600; }
.tuvi-tz-off { color: #888; margin-right: 6px; }
.tuvi-tz-name { color: #1a1a1a; }
.tuvi-tz-empty {
  padding: 14px 12px;
  color: #666;
  font-size: 13px;
  text-align: center;
}

.tuvi-radio-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--tuvi-text-light);
  cursor: pointer;
  font-size: 13px;
}
.tuvi-radio-label input[type="radio"] {
  accent-color: var(--tuvi-gold);
  width: 16px; height: 16px;
  cursor: pointer;
}
.tuvi-radio-cell { white-space: nowrap; }

.tuvi-cam-ket {
  padding: 12px 20px;
  color: #f5e6c8;
  font-size: 13px;
}
.tuvi-cam-ket span { color: #f5e6c8; }
.tuvi-cam-ket input[type="checkbox"] { accent-color: var(--tuvi-gold); }

/* ===== BUTTONS ===== */
.tuvi-btn-group {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 22px;
  background: var(--tuvi-bg-form);
  border-top: 1px solid var(--tuvi-border-form);
}
.tuvi-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .2s;
  letter-spacing: .3px;
}
.tuvi-btn-primary {
  background: var(--tuvi-red);
  color: var(--tuvi-gold-light);
  border-color: var(--tuvi-gold);
}
.tuvi-btn-primary:hover {
  background: var(--tuvi-red-mid);
  box-shadow: 0 0 14px rgba(201,162,39,.5);
}
.tuvi-btn-danger {
  background: #1e0000;
  color: #f5c0c0;
  border-color: #8a3030;
}
.tuvi-btn-danger:hover { background: #330000; border-color: #bb4040; }
.tuvi-btn-print {
  background: var(--tuvi-red);
  color: var(--tuvi-gold-light);
  border-color: var(--tuvi-gold);
  font-size: 14px;
  padding: 9px 24px;
}

/* ===== TÙY CHỌN / HƯỚNG DẪN ===== */
.tuvi-tuychon, .tuvi-huongdan {
  background: var(--tuvi-bg-form);
  color: var(--tuvi-text-light);
  padding: 22px 26px;
}
.tuvi-tuychon h4, .tuvi-huongdan h4 {
  color: var(--tuvi-gold);
  margin: 0 0 14px 0;
  font-size: 15px;
  border-bottom: 1px solid var(--tuvi-border-form);
  padding-bottom: 8px;
}
.tuvi-tuychon-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tuvi-tuychon-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--tuvi-text-light);
}
.tuvi-huongdan ol { padding-left: 20px; line-height: 2.2; }
.tuvi-huongdan p  { color: var(--tuvi-text-dim); margin: 8px 0; }

/* ===== LOADING ===== */
.tuvi-loading {
  text-align: center;
  padding: 30px;
  color: var(--tuvi-red);
  font-size: 15px;
  font-weight: 600;
}

/* ===== KẾT QUẢ ===== */
.tuvi-result {
  margin-top: 24px;
  max-width: 1200px;
}
.tuvi-result.tuvi-result-pro {
  max-width: none;
}

/* Header lá số */
.tuvi-result-header {
  background: linear-gradient(135deg, #3c0000 0%, #7a0000 50%, #3c0000 100%);
  color: #ffffff;
  text-align: center;
  padding: 16px 20px 12px;
  border: 2px solid var(--tuvi-gold);
  border-bottom: none;
}
.tuvi-result-header h3 {
  display: inline;
  margin: 0;
  font-size: 26px;
  letter-spacing: 2px;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.tuvi-sun-icon { font-size: 22px; margin-right: 8px; color: var(--tuvi-gold-light); }
.tuvi-result-meta {
  color: #e8d8b0;
  font-size: 14px;
  margin-top: 6px;
}
.tuvi-result-meta strong { color: var(--tuvi-gold-light); }

/* ===== BẢNG LÁ SỐ ===== */
.tuvi-grid-wrap {
  border: 2px solid var(--tuvi-chart-border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tuvi-grid {
  width: 100%;
  border-collapse: collapse;
  background: var(--tuvi-chart-bg);
  table-layout: fixed;
}

/* ===== Ô CUNG ===== */
.tuvi-cung {
  width: 25%;
  vertical-align: top;
  border: 1px solid var(--tuvi-cell-border);
  padding: 0;
}
.cung-inner {
  display: flex;
  flex-direction: column;
  min-height: 350px;
  height: 100%;
  position: relative;
}

/* Triệt / Tuần overlay */
.cung-triet, .cung-tuan {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) rotate(-90deg);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 2px;
  padding: 2px 4px;
  border-radius: 3px;
  z-index: 3;
  opacity: .9;
}
.cung-triet {
  right: -10px;
  color: #fff;
  background: #1a4a9b;
}
.cung-tuan {
  left: -10px;
  color: #fff;
  background: #888;
}

/* ĐẦU Ô */
.cung-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 3px;
  border-bottom: 2px solid #d08080;
  background: linear-gradient(to bottom, #fff0f0, #ffe8e8);
  gap: 3px;
}
.cung-abbr {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 40px;
  font-style: italic;
}
.cung-ten {
  font-size: 15px;
  font-weight: 900;
  color: var(--tuvi-red);
  text-align: center;
  flex: 1;
  text-transform: uppercase;
  letter-spacing: .2px;
  line-height: 1.2;
}
.cung-daihan-num {
  font-size: 13px;
  color: #444;
  flex-shrink: 0;
  min-width: 22px;
  text-align: right;
  font-weight: 700;
}

/* Badge Mệnh / Thân */
.badge-menh, .badge-than {
  display: inline-block;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 2px;
  padding: 1px 3px;
  margin-left: 2px;
  vertical-align: middle;
  letter-spacing: 0;
}
.badge-menh { background: #8B0000; }
.badge-than { background: #1a5c1a; }

/* Cung Mệnh */
.tuvi-cung.cung-menh .cung-head {
  background: linear-gradient(to bottom, #ffe8d0, #ffd8b8);
  border-bottom-color: #8B0000;
}
.tuvi-cung.cung-menh .cung-ten { color: #5c0000; }

/* Cung Thân */
.tuvi-cung.cung-than .cung-head {
  background: linear-gradient(to bottom, #d8f0e0, #c8e8d0);
  border-bottom-color: #1a7a1a;
}
.tuvi-cung.cung-than .cung-ten { color: #1a5c1a; }

/* THÂN CUNG (giữa) */
.cung-body {
  flex: 1;
  padding: 4px 6px 3px;
  overflow: hidden;
}
.cung-chinh { margin-bottom: 5px; text-align: center; }

.star-chinh {
  display: inline-block;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.5;
  margin: 0 3px;
}
.star-chinh.main-star { font-size: 20px; }

/* ===== MÀU NGŨ HÀNH CHO SAO ===== */
.h-kim  { color: #b8860b !important; }   /* Kim - vàng đậm */
.h-moc  { color: #1a7a1a !important; }   /* Mộc - xanh lá */
.h-thuy { color: #1a4a9b !important; }   /* Thủy - xanh dương */
.h-hoa  { color: #c00000 !important; }   /* Hỏa - đỏ */
.h-tho  { color: #8a6d00 !important; }   /* Thổ - nâu vàng */

/* Độ sáng (superscript) */
.bright {
  font-size: 11px;
  font-weight: 700;
  margin-left: 1px;
  vertical-align: super;
}
.b-mieu  { color: #c00000; }   /* Miếu */
.b-vuong { color: #d2691e; }   /* Vượng */
.b-dac   { color: #1a7a1a; }   /* Đắc */
.b-binh  { color: #777; }      /* Bình */
.b-ham   { color: #999; }      /* Hãm */

/* Hóa tinh badges */
.star-hoa {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  border-radius: 3px;
  padding: 1px 4px;
  margin: 2px 1px;
}
.star-hoa.hoa-loc   { background: #1a7a1a; color: #fff; }
.star-hoa.hoa-quyen { background: #cc5500; color: #fff; }
.star-hoa.hoa-khoa  { background: #1a4a9b; color: #fff; }
.star-hoa.hoa-ki    { background: #7a1a8a; color: #fff; }
.star-hoa.hoa-luu {
  border: 1px dashed rgba(107, 45, 138, 0.85);
  font-weight: 700;
}
.star-hoa.hoa-luu.hoa-loc   { background: #2d6b3a; }
.star-hoa.hoa-luu.hoa-quyen { background: #8b4513; }
.star-hoa.hoa-luu.hoa-khoa  { background: #2a5088; }
.star-hoa.hoa-luu.hoa-ki    { background: #5a2d6b; }

/* Phụ tinh */
.cung-phu { display: flex; gap: 3px; }
.phu-col  { flex: 1; min-width: 0; }
.star-phu {
  display: block;
  font-size: 15px;
  line-height: 1.5;
  white-space: normal;
  color: #333;
}
.star-phu.loc     { font-weight: 700; }
.star-phu.nam-xem { font-style: italic; opacity: .85; }
.star-phu .bright { font-size: 12px; }

/* CHÂN Ô */
.cung-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 6px;
  border-top: 2px solid #d08080;
  background: linear-gradient(to top, #fff0f0, #ffe8e8);
  font-size: 12px;
  color: #555;
  flex-shrink: 0;
}
.cung-chi-name { font-weight: 800; color: #222; font-size: 13px; }
.cung-ts       { color: #8B0000; text-align: center; font-size: 12px; font-style: italic; }
.cung-thang    { text-align: right; color: #666; font-size: 12px; }
.badge-tieu-han {
  display: inline-block;
  background: var(--tuvi-red);
  color: #fff;
  font-size: 9px;
  border-radius: 2px;
  padding: 1px 3px;
  margin-left: 2px;
  font-weight: 700;
}
.tuvi-cung.cung-tieu-han .cung-foot {
  background: linear-gradient(to top, #ffd0d0, #ffbbbb);
  border-top-color: var(--tuvi-red);
}

/* ===== Ô TÂM ===== */
.tuvi-center {
  background: #fffdf5;
  vertical-align: middle;
  position: relative;
}
.tuvi-center-inner {
  position: relative;
  padding: 12px 16px;
  text-align: center;
  min-height: 100%;
}
.bat-quai-bg {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 88%;
  max-width: 320px;
  aspect-ratio: 1/1;
  z-index: 0;
  pointer-events: none;
}
.tuvi-center-content { position: relative; z-index: 1; }

.tuvi-site-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--tuvi-red);
  text-transform: uppercase;
  letter-spacing: .6px;
}
.tuvi-site-url { font-size: 12px; color: #bbb; margin-bottom: 10px; }
.tuvi-center-name {
  font-size: 20px;
  font-weight: 900;
  color: #5c0000;
  letter-spacing: .5px;
  margin-top: 5px;
}
.tuvi-center-gioi {
  font-size: 14px;
  color: #b8860b;
  font-weight: 700;
  margin-bottom: 5px;
}
.tuvi-center-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, var(--tuvi-gold), transparent);
  margin: 10px auto;
  width: 80%;
}
.tuvi-info-table {
  margin: 0 auto;
  border-collapse: collapse;
  text-align: left;
  display: inline-block;
}
.tuvi-info-table td { border: none !important; padding: 2px 4px; font-size: 13px; }
.ti-lbl  { color: #999; white-space: nowrap; text-align: right; }
.ti-val  { color: #222; font-weight: 600; }
.ti-can  { color: #8B0000; font-weight: 700; }
.ti-val.highlight { color: #8B0000; font-weight: 700; }
.ti-val.chu-star  { color: #1a4a9b; font-weight: 700; }
.tuvi-center-title {
  font-size: 16px;
  font-weight: 900;
  color: var(--tuvi-red-dark);
  letter-spacing: 3px;
  margin-top: 10px;
  padding-top: 6px;
  border-top: 2px solid var(--tuvi-gold);
}

/* ===== CHÚ THÍCH ===== */
.tuvi-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fff9f0;
  border: 2px solid var(--tuvi-chart-border);
  border-top: none;
  font-size: 13px;
  color: #555;
}
.tuvi-legend .lg-item b { color: #c00000; font-size: 14px; }
.tuvi-legend .lg-sep {
  width: 1px; height: 16px; background: #ccc; margin: 0 4px;
}
.tuvi-legend .lg-hanh { font-weight: 700; }
.tuvi-legend .lg-hanh.h-kim  { color: #b8860b; }
.tuvi-legend .lg-hanh.h-moc  { color: #1a7a1a; }
.tuvi-legend .lg-hanh.h-thuy { color: #1a4a9b; }
.tuvi-legend .lg-hanh.h-hoa  { color: #c00000; }
.tuvi-legend .lg-hanh.h-tho  { color: #8a6d00; }

/* ===== PRINT BAR ===== */
.tuvi-print-bar {
  text-align: center;
  padding: 14px;
  background: #fff5f5;
  border: 2px solid var(--tuvi-chart-border);
  border-top: 1px solid #ddd;
}

/* ===== PRINT ===== */
@media print {
  .tuvi-tabs, .tuvi-btn-group, .tuvi-print-bar { display: none !important; }
  .tuvi-result { margin: 0; }
  .tuvi-grid   { font-size: 9px; }
  .star-chinh  { font-size: 9px; }
  .star-phu    { font-size: 8px; }
  .cung-inner  { min-height: 130px; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 767px) {
  .tuvi-tab   { padding: 10px 14px; font-size: 12px; }
  .tuvi-label { display: block; border-right: none; border-bottom: 1px solid var(--tuvi-border-form); }
  .tuvi-field { display: block; }
  .tuvi-btn-group { flex-direction: column; align-items: center; }
  .cung-inner { min-height: 180px; }
  .star-chinh { font-size: 14px; }
  .star-phu   { font-size: 12px; }
}

/* Thanh nút kết quả — luôn nằm trên vùng ảnh/HTML */
.tuvi-result-toolbar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
  padding: 12px 10px;
  background: #fff8f0;
  border: 1px solid var(--tuvi-gold, #c9a227);
  border-radius: 6px;
}
.tuvi-chart-hidden {
  position: absolute;
  left: -99999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.tuvi-capture-fail {
  background: #fff3f3;
  border: 1px solid #e0a0a0;
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 12px;
  color: #8b0000;
  font-size: 14px;
}
.tuvi-loading-snap {
  text-align: center;
  padding: 28px;
  color: var(--tuvi-red, #8b0000);
  font-weight: 600;
}

/* ===== KẾT QUẢ DẠNG HÌNH ẢNH ===== */
.tuvi-image-result {
  margin-top: 24px;
  text-align: center;
}
#tuvi-laso-img {
  width: 100%;
  max-width: min(100%, var(--tuvi-chart-width));
  height: auto;
  display: block;
  margin: 0 auto;
  border: 2px solid var(--tuvi-gold);
  border-radius: 4px;
  box-shadow: 0 4px 18px rgba(0,0,0,.18);
  box-sizing: border-box;
}
.tuvi-image-hint {
  font-size: 13px;
  color: #888;
  font-style: italic;
  margin: 12px 0 8px;
}
.tuvi-image-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.tuvi-image-actions .tuvi-btn {
  text-decoration: none;
}
.tuvi-image-actions a.tuvi-btn-print:hover {
  background: var(--tuvi-red-mid);
  box-shadow: 0 0 14px rgba(201,162,39,.5);
}
.tuvi-image-actions-fallback {
  margin-top: 16px;
}

/* Stage tạm để chụp ảnh - đảm bảo render đầy đủ kích thước desktop */
#tuvi-capture-stage .tuvi-grid {
  min-width: 850px;
}
#tuvi-capture-stage .tuvi-result {
  max-width: none;
}

/* Vùng xem lá số — cuộn ngang nếu màn hình hẹp, không cắt nội dung */
.tuvi-chart-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0 12px;
}
.tuvi-chart-scroll .tuvi-result-pro {
  margin-left: auto;
  margin-right: auto;
}

/* ===== LÁ SỐ CHUYÊN NGHIỆP — khung vừa, căn giữa, bảng full trong khung ===== */
.tuvi-result-pro {
  margin-top: 0;
  width: 100%;
  max-width: var(--tuvi-chart-width);
  box-sizing: border-box;
  margin-left: auto;
  margin-right: auto;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  color: #222;
  background: #fff;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.07);
  font-size: 10.5px;
  overflow: visible;
}
.tuvi-result-pro .tuvi-grid-wrap {
  border: 1px solid #b0b0b0;
  overflow: visible;
  width: 100%;
  box-sizing: border-box;
}
.tuvi-result-pro .tuvi-grid-pro {
  width: 100%;
  max-width: 100%;
  background: #fff;
  table-layout: fixed;
  border-collapse: collapse;
}
.tuvi-result-pro .tuvi-cung {
  border: 1px solid #c5c5c5;
  background: #fff;
  width: 25%;
  min-width: 0;
  vertical-align: top;
}
.tuvi-result-pro .tuvi-center {
  width: auto;
  min-width: 0;
}
.tuvi-result-pro .tuvi-grid-pro td,
.tuvi-result-pro .tuvi-cung,
.tuvi-result-pro .tuvi-center {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  vertical-align: top;
}
.tuvi-result-pro .tuvi-center-inner {
  min-height: auto !important;
  height: auto !important;
  overflow: visible;
  padding: 12px 14px 16px;
}
.tuvi-result-pro .cung-inner {
  display: flex;
  flex-direction: column;
  min-height: auto !important;
  height: auto !important;
  position: relative;
  overflow: visible !important;
  box-sizing: border-box;
  padding-bottom: 6px;
}
.tuvi-result-pro .cung-head {
  display: grid;
  grid-template-columns: 32px 1fr 24px;
  align-items: center;
  gap: 2px;
  background: #fafafa;
  border-bottom: 1px solid #d0d0d0;
  padding: 4px 5px 3px;
  flex-shrink: 0;
}
.tuvi-result-pro .cung-ten {
  color: #111;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
  text-align: center;
  line-height: 1.25;
  overflow: visible;
  white-space: normal;
  word-break: break-word;
  min-width: 0;
}
.tuvi-result-pro .cung-abbr {
  color: #666;
  font-size: 12px;
  font-style: normal;
  white-space: normal;
  word-break: break-all;
  line-height: 1.2;
}
.tuvi-result-pro .cung-daihan-num {
  color: #333;
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}
.tuvi-result-pro .tuvi-cung.cung-menh {
  background: #fffef3;
}
.tuvi-result-pro .tuvi-cung.cung-menh .cung-head {
  background: #fff9e6;
  border-bottom-color: #c9a227;
}
.tuvi-result-pro .tuvi-cung.cung-than .cung-head {
  background: #f4faf4;
}
.tuvi-result-pro .tuvi-cung.cung-tieu-han .cung-foot {
  background: #fff5f5;
  border-top-color: #c00000;
}
/* Dải TRIỆT / TUẦN — nằm trong luồng layout, không đè chữ */
.tuvi-result-pro .cung-band {
  flex-shrink: 0;
  min-height: 14px;
  height: auto;
  line-height: 1.35;
  padding: 2px 4px;
  text-align: center;
  font-size: 7.5px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #fff;
}
.tuvi-result-pro .cung-band-triet {
  background: #1a3d7a;
}
.tuvi-result-pro .cung-band-tuan {
  background: #6b8f1a;
}
.tuvi-result-pro .cung-band-luu-triet {
  background: #4a2d7a;
  font-size: 7px;
  letter-spacing: 1px;
}
.tuvi-result-pro .cung-band-luu-tuan {
  background: #2d6b4a;
  font-size: 7px;
  letter-spacing: 1px;
}
.tuvi-center-logo {
  margin: 0 auto 6px;
  text-align: center;
}
.tuvi-center-logo img {
  max-width: 72px;
  max-height: 72px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
}
.tuvi-result-pro .cung-body {
  flex: 1 1 auto !important;
  padding: 5px 4px 10px;
  overflow: visible !important;
  min-height: min-content;
}
.tuvi-result-pro .cung-stars-3col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas: 
    "mid mid"
    "left right";
  gap: 6px 4px;
  align-items: start;
  width: 100%;
}
.tuvi-result-pro .phu-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.tuvi-result-pro .phu-col-left { grid-area: left; }
.tuvi-result-pro .phu-col-right { grid-area: right; }
.tuvi-result-pro .cung-mid {
  grid-area: mid;
  min-width: 0;
  text-align: center;
  padding: 0 1px 4px;
}
.tuvi-result-pro .cung-chinh {
  line-height: 1.35;
}
.tuvi-result-pro .star-chinh {
  font-size: 16px;
  font-weight: 800;
  display: block;
  margin: 0 0 3px;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
}
.tuvi-result-pro .star-bright-tag {
  font-size: 11px;
  font-weight: 700;
  margin-left: 1px;
}
.tuvi-result-pro .cung-hoa-row {
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.tuvi-result-pro .star-hoa {
  font-size: 10px;
  padding: 0 2px;
  line-height: 1.3;
  display: inline-block;
}
.tuvi-result-pro .cung-phu .star-phu,
.tuvi-result-pro .phu-col .star-phu {
  font-size: 15px;
  line-height: 1.25;
  color: #333;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: unset !important;
  word-break: break-word;
  display: block;
  margin: 0 0 2px;
  position: static !important;
  max-height: none !important;
}
.tuvi-result-pro .phu-col-left .star-phu {
  text-align: left;
}
.tuvi-result-pro .phu-col-right .star-phu {
  text-align: right;
}
.tuvi-result-pro .cung-foot {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 2px;
  background: #fafafa;
  border-top: 1px solid #d0d0d0;
  padding: 3px 5px;
  font-size: 12px;
  flex-shrink: 0;
  min-height: 22px;
}
.tuvi-result-pro .cung-chi-name {
  text-align: left;
  font-size: 13px;
}
.tuvi-result-pro .cung-ts {
  color: #333;
  font-style: normal;
  font-weight: 600;
  text-align: center;
  font-size: 12px;
  white-space: normal;
  word-break: break-word;
}
.tuvi-result-pro .cung-foot-right {
  text-align: right;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
}
.tuvi-result-pro .cung-thang,
.tuvi-result-pro .cung-dv-ln {
  display: block;
  font-size: 12px;
  color: #777;
  font-weight: 600;
}
/* Ẩn style cũ absolute (nếu còn sót) */
.tuvi-result-pro .cung-triet,
.tuvi-result-pro .cung-tuan {
  display: none !important;
}

/* Ngũ hành — đúng mẫu: Kim xám, Mộc xanh, Thủy đen, Hỏa đỏ, Thổ vàng */
.tuvi-result-pro .h-kim { color: #5a5a5a !important; }
.tuvi-result-pro .h-moc { color: #1a7a1a !important; }
.tuvi-result-pro .h-thuy { color: #111 !important; }
.tuvi-result-pro .h-hoa { color: #c00000 !important; }
.tuvi-result-pro .h-tho { color: #a07800 !important; }
.tuvi-result-pro .star-bright-tag.b-mieu { color: #c00000; }
.tuvi-result-pro .star-bright-tag.b-vuong { color: #b35c00; }
.tuvi-result-pro .star-bright-tag.b-dac { color: #1a7a1a; }
.tuvi-result-pro .star-bright-tag.b-binh { color: #666; }
.tuvi-result-pro .star-bright-tag.b-ham { color: #999; }

/* Thiên bàn */
.tuvi-result-pro .tuvi-center {
  background: #fffdf8;
  border: 1px solid #c8c8c8;
}
.tuvi-result-pro .tuvi-center-inner {
  padding: 10px 12px 8px;
}
.tuvi-result-pro .tuvi-brand {
  font-size: 14px;
  font-weight: 800;
  color: #111;
  text-decoration: underline;
  text-underline-offset: 3px;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.tuvi-result-pro .tuvi-center-name {
  font-size: 18px;
  font-weight: 900;
  color: #111;
  text-decoration: underline;
  margin: 4px 0 8px;
}
.tuvi-result-pro .tuvi-center-line {
  font-size: 15px;
  font-weight: 700;
  margin: 2px 0;
}
.tuvi-result-pro .tuvi-line-red { color: #c00000; }
.tuvi-result-pro .tuvi-line-blue { color: #1a4a9b; font-weight: 600; }
.tuvi-result-pro .tuvi-center-meta {
  font-size: 13px;
  color: #333;
  margin: 8px auto 6px;
  line-height: 1.5;
  text-align: left;
  max-width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 10px;
}
.tuvi-result-pro .tuvi-center-meta span {
  display: block;
  white-space: normal;
  overflow: visible;
}
.tuvi-result-pro .tuvi-center-meta strong {
  color: #111;
}
.tuvi-result-pro .tuvi-center-extra {
  font-size: 13px;
  color: #333;
  line-height: 1.45;
  margin: 4px auto 6px;
  max-width: 100%;
  text-align: center;
}
.tuvi-result-pro .tuvi-center-extra-line {
  margin: 1px 0;
}
.tuvi-result-pro .tuvi-center-warn {
  font-size: 13px;
  color: #b45309;
  font-weight: 700;
  margin: 4px 0;
}
.tuvi-result-pro .tuvi-center-dv {
  font-size: 13px;
  color: #555;
  margin-top: 4px;
}
.tuvi-result-pro .cung-band-triet-tuan,
.tuvi-result-pro .cung-band-luu-triet-tuan {
  background: linear-gradient(90deg, #2d6a4f 0%, #2d6a4f 50%, #1e3a5f 50%, #1e3a5f 100%);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  padding: 2px 4px;
  letter-spacing: 0.02em;
}
.tuvi-result-pro .chu-star {
  color: #1a4a9b !important;
}
.tuvi-result-pro .tuvi-birth-grid {
  width: 100%;
  max-width: 400px;
  margin: 6px auto 8px;
  border-collapse: collapse;
  font-size: 13px;
}
.tuvi-result-pro .tuvi-birth-grid th,
.tuvi-result-pro .tuvi-birth-grid td {
  border: 1px solid #d8d8d8;
  padding: 4px 8px;
  text-align: center;
}
.tuvi-result-pro .tuvi-birth-grid th {
  background: #f5f5f5;
  font-weight: 700;
  color: #444;
}
.tuvi-result-pro .tuvi-birth-grid .birth-lbl {
  font-weight: 800;
  background: #fafafa;
  color: #666;
}
.tuvi-result-pro .tuvi-tru-wrap {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #e0e0e0;
}
.tuvi-result-pro .tuvi-tru-title {
  font-size: 14px;
  font-weight: 800;
  color: #444;
  margin-bottom: 6px;
  letter-spacing: 1px;
}
.tuvi-result-pro .tuvi-tru-cols {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tuvi-result-pro .tru-col {
  min-width: 68px;
  flex: 1;
  border: 1px solid #d0d0d0;
  background: #fff;
  padding: 4px 6px 6px;
  text-align: center;
}
.tuvi-result-pro .tru-col-nhat {
  border-color: #c9a227;
  background: #fffef5;
}
.tuvi-result-pro .tru-lbl {
  font-size: 12px;
  font-weight: 700;
  color: #888;
  margin-bottom: 3px;
}
.tuvi-result-pro .tru-can {
  font-size: 15px;
  font-weight: 700;
}
.tuvi-result-pro .tru-chi {
  font-size: 17px;
  font-weight: 900;
  margin-top: 2px;
}
.tuvi-result-pro .tuvi-center-foot {
  margin-top: 12px;
  font-size: 13px;
  color: #999;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tuvi-result-pro .tuvi-foot-url {
  color: #1a4a9b;
  word-break: break-all;
}

/* Chú thích */
.tuvi-result-pro .tuvi-legend-pro {
  background: #fafafa;
  border: 1px solid #bbb;
  border-top: none;
  padding: 10px 16px;
  font-size: 11.5px;
  gap: 8px 14px;
}
.tuvi-result-pro .lg-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 4px;
  vertical-align: middle;
  border: 1px solid #ccc;
  border-radius: 1px;
}
.tuvi-result-pro .lg-swatch.h-kim { background: #707070; }
.tuvi-result-pro .lg-swatch.h-moc { background: #1a7a1a; }
.tuvi-result-pro .lg-swatch.h-thuy { background: #222; }
.tuvi-result-pro .lg-swatch.h-hoa { background: #c00000; }
.tuvi-result-pro .lg-swatch.h-tho { background: #c9a227; }

/* Chụp ảnh / iframe — cùng chiều rộng với màn hình */
#tuvi-capture-root {
  width: var(--tuvi-chart-width);
  max-width: var(--tuvi-chart-width);
  box-sizing: border-box;
  margin: 0;
}
#tuvi-capture-root .tuvi-result-pro,
#tuvi-capture-root .tuvi-grid-wrap,
#tuvi-capture-root .tuvi-grid-pro,
#tuvi-chart-hidden .tuvi-result-pro {
  margin-top: 0;
  overflow: visible !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}
.tuvi-image-result {
  width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  text-align: center;
  padding: 8px 0;
}
.tuvi-image-result #tuvi-laso-img {
  width: auto;
  max-width: min(100%, var(--tuvi-chart-width));
  height: auto;
  display: block;
  margin-left: auto;
  margin-right: auto;
}
@media (max-width: 1024px) {
  .tuvi-result-pro {
    max-width: 100%;
  }
}
.tuvi-result-pro .bat-quai-bg {
  max-width: 240px;
}
.tuvi-result-pro .star-phu.nam-xem,
.tuvi-result-pro .star-phu.luu-nien {
  font-weight: 700;
  font-style: italic;
  color: #6b2d8a;
}
.tuvi-result-pro .star-bright-tag.b-luu {
  color: #6b2d8a;
  font-weight: 700;
  font-style: normal;
}
