/* ===== TỨ TRỤ PLUGIN – Phong Thủy Trạch Cát ===== */

:root {
  --tt-red:        #8B0000;
  --tt-red-dark:   #5c0000;
  --tt-red-mid:    #a01010;
  --tt-gold:       #c9a227;
  --tt-gold-light: #f0d060;
  --tt-bg-form:    #1e0000;
  --tt-bg-row:     #2a0505;
  --tt-border:     #5c1010;
  --tt-text-light: #f5e6c8;
  --tt-text-dim:   #c8a090;
}

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

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

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

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

.tutu-select {
  background: #2f0808;
  border: 1px solid #8a3030;
  color: #f5e6c8;
  padding: 7px 8px;
  border-radius: 3px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  min-width: 70px;
}
.tutu-select:focus { border-color: var(--tt-gold); }

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

.tutu-cam-ket {
  padding: 12px 28px;
  color: #f5e6c8;
  font-size: 13px;
  background: var(--tt-bg-form);
  border-top: 1px solid var(--tt-border);
}
.tutu-cam-ket span { color: #f5e6c8; }
.tutu-cam-ket input[type="checkbox"] { accent-color: var(--tt-gold); }

.tutu-btn-group {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 22px;
  background: var(--tt-bg-form);
  border-top: 1px solid var(--tt-border);
}
.tutu-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;
}
.tutu-btn-primary {
  background: var(--tt-red);
  color: var(--tt-gold-light);
  border-color: var(--tt-gold);
}
.tutu-btn-primary:hover {
  background: var(--tt-red-mid);
  box-shadow: 0 0 14px rgba(201,162,39,.5);
}
.tutu-btn-danger {
  background: #1e0000;
  color: #f5c0c0;
  border-color: #8a3030;
}
.tutu-btn-danger:hover { background: #330000; }
.tutu-btn-print {
  background: var(--tt-red);
  color: var(--tt-gold-light);
  border-color: var(--tt-gold);
  font-size: 14px;
  padding: 9px 24px;
}

/* Hướng dẫn */
.tutu-huongdan {
  background: var(--tt-bg-form);
  color: var(--tt-text-light);
  padding: 24px 28px;
}
.tutu-huongdan h4 {
  color: var(--tt-gold);
  margin: 0 0 14px;
  font-size: 15px;
  border-bottom: 1px solid var(--tt-border);
  padding-bottom: 8px;
}
.tutu-huongdan ol { padding-left: 20px; line-height: 2.2; }
.tutu-huongdan p  { color: var(--tt-text-dim); margin: 10px 0; }

/* Loading */
.tutu-loading {
  text-align: center;
  padding: 28px;
  color: var(--tt-red);
  font-size: 15px;
  font-weight: 600;
}

/* Thanh nút kết quả (giống lá số Tử Vi) */
.tutu-result-toolbar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
  padding: 12px 10px;
  background: #fff8f0;
  border: 1px solid var(--tt-gold);
  border-radius: 6px;
}
.tutu-chart-hidden {
  position: absolute;
  left: -99999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.tutu-capture-fail {
  background: #fff3f3;
  border: 1px solid #e0a0a0;
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 12px;
  color: #8b0000;
  font-size: 14px;
}
.tutu-loading-snap {
  text-align: center;
  padding: 28px;
  color: var(--tt-red);
  font-weight: 600;
}
.tutu-chart-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0 12px;
}
.tutu-error {
  color: #c00;
  padding: 20px;
  text-align: center;
}

/* ===== KẾT QUẢ ===== */
.tutu-result {
  margin-top: 24px;
  max-width: 1200px;
}
.tutu-result-pro {
  width: max-content;
  max-width: none;
  margin-left: auto;
  margin-right: auto;
  overflow: visible;
}

/* Header */
.tutu-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(--tt-gold);
  border-bottom: none;
}
.tutu-result-header h3 {
  display: inline;
  margin: 0;
  font-size: 26px;
  letter-spacing: 2px;
  color: #ffffff;
}
.tutu-sun-icon { font-size: 22px; margin-right: 8px; color: var(--tt-gold-light); }
.tutu-result-meta {
  color: #e8d8b0;
  font-size: 14px;
  margin-top: 6px;
}
.tutu-result-meta strong { color: var(--tt-gold-light); }

/* ===== GRID TỨ TRỤ ===== */
.tutu-grid-wrap {
  border: 2px solid var(--tt-red);
  overflow-x: auto;
}
.tutu-grid {
  width: 100%;
  min-width: 500px;
  border-collapse: collapse;
  background: #fff;
  table-layout: fixed;
}

/* Header row */
.tutu-th {
  background: linear-gradient(to bottom, #7a0000, #5c0000);
  color: var(--tt-gold-light);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  padding: 10px 6px;
  border: 1px solid #9a3030;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Shared cell */
.tutu-cell {
  text-align: center;
  vertical-align: middle;
  padding: 10px 8px;
  border: 1px solid #d0a0a0;
}
.cell-nhatchu { background: #fff8e8; }

/* Can (Thiên Can) */
.cell-can {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 4px;
}
.cell-nh-can {
  font-size: 12px;
  color: #777;
  font-style: italic;
}
/* Màu ngũ hành Can */
.nh-can-moc  { color: #1a6b1a; }
.nh-can-hoa  { color: #cc2200; }
.nh-can-tho  { color: #b8860b; }
.nh-can-kim  { color: #888800; }
.nh-can-thuy { color: #1a5b9b; }

/* Chi (Địa Chi) */
.cell-chi {
  font-size: 28px;
  font-weight: 900;
  color: #5c0000;
  line-height: 1;
  margin-bottom: 4px;
}
.cell-nh-chi {
  font-size: 12px;
  color: #777;
  font-style: italic;
}

/* Row title */
.tutu-row-title {
  background: linear-gradient(to right, #fff0e8, #ffe0d0, #fff0e8);
  color: var(--tt-red);
  font-weight: 700;
  font-size: 12px;
  text-align: center;
  padding: 5px;
  border: 1px solid #d0a0a0;
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* Nạp Âm */
.cell-napam {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 3px;
}
.cell-napam-nh { font-size: 11px; color: #777; }
/* Màu nạp âm */
.nh-kim  { color: #888800; }
.nh-moc  { color: #1a6b1a; }
.nh-hoa  { color: #cc2200; }
.nh-tho  { color: #b8860b; }
.nh-thuy { color: #1a5b9b; }

/* Tàng Can */
.cell-tangcan {
  font-size: 12px;
  color: #444;
  line-height: 1.8;
}

/* Thập Thần */
.cell-thapthan {
  font-size: 13px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 3px;
  display: inline-block;
}
.tt-nhatchu   { background: #8B0000; color: #fff; }
.tt-tykien    { background: #1a3d8b; color: #fff; }
.tt-kieptai   { background: #2a5ab0; color: #fff; }
.tt-thucthan  { background: #1a7a1a; color: #fff; }
.tt-thuongquan{ background: #2a9a2a; color: #fff; }
.tt-thientai  { background: #b85000; color: #fff; }
.tt-chinhtai  { background: #cc6600; color: #fff; }
.tt-thatsat   { background: #6b1a6b; color: #fff; }
.tt-chinhquan { background: #8a2a8a; color: #fff; }
.tt-thianan   { background: #888800; color: #fff; }
.tt-chinhan   { background: #aaaa00; color: #fff; }

/* Trường Sinh */
.cell-truongsinh {
  font-size: 12px;
  color: #555;
  font-style: italic;
}

/* ===== TỔNG HỢP ===== */
.tutu-summary {
  border: 2px solid var(--tt-red);
  border-top: none;
  background: #fffcf5;
  padding: 16px;
}
.tutu-summary-inner {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.tutu-info-box {
  flex: 1;
  min-width: 200px;
  border: 1px solid #e0c0b0;
  border-radius: 4px;
  overflow: hidden;
}
.tutu-box-title {
  background: linear-gradient(to right, #7a0000, #5c0000);
  color: var(--tt-gold-light);
  font-size: 13px;
  font-weight: 700;
  padding: 7px 12px;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.tutu-info-tbl { width: 100%; border-collapse: collapse; padding: 8px; }
.tutu-info-tbl td { border: none !important; padding: 4px 10px; font-size: 12px; }
.ti-lbl       { color: #999; white-space: nowrap; width: 90px; }
.ti-val       { color: #222; font-weight: 600; }
.ti-name      { color: #5c0000; font-size: 14px; font-weight: 900; }
.ti-highlight { color: #8B0000; font-weight: 700; }
.ti-star      { color: #1a4a9b; font-weight: 600; }

/* Ngũ Hành bars */
.tutu-nhanh-bars { padding: 10px 12px; }
.nh-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}
.nh-bar-label {
  width: 42px;
  font-size: 12px;
  font-weight: 600;
  color: #444;
}
.nh-bar-track {
  flex: 1;
  height: 14px;
  background: #f0e0e0;
  border-radius: 7px;
  overflow: hidden;
}
.nh-bar-fill {
  height: 100%;
  border-radius: 7px;
  transition: width .4s;
  min-width: 4px;
}
.nh-bar-count {
  width: 20px;
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  color: #555;
}

/* ===== ĐẠI VẬN ===== */
.tutu-daivan-wrap {
  border: 2px solid var(--tt-red);
  border-top: none;
  background: #fff;
}
.tutu-daivan-title {
  background: linear-gradient(to right, #5c0000, #8B0000, #5c0000);
  color: var(--tt-gold-light);
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  padding: 10px;
  letter-spacing: 1px;
}
.tutu-daivan-scroll { overflow-x: auto; }
.tutu-daivan-tbl {
  min-width: 700px;
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.tutu-daivan-tbl td { border: 1px solid #d0a0a0; text-align: center; padding: 8px 4px; }

.dv-row-age td { background: linear-gradient(to bottom, #fff0f0, #ffe4e4); }
.dv-age { font-size: 12px; font-weight: 800; color: #8B0000; }

.dv-row-can td { background: #fff; }
.dv-can { font-size: 18px; font-weight: 900; color: #333; margin-bottom: 3px; }
.dv-thapthan {
  font-size: 10px;
  font-weight: 700;
  border-radius: 2px;
  padding: 1px 5px;
  display: inline-block;
}

.dv-row-chi td { background: #fffcf0; }
.dv-chi { font-size: 18px; font-weight: 900; color: #5c0000; }

.dv-row-nap td { background: #f8f4e8; }
.dv-napam { font-size: 11px; font-weight: 600; }

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

/* ===== PRINT ===== */
@media print {
  .tutu-tabs, .tutu-btn-group, .tutu-print-bar { display: none !important; }
  .tutu-result { margin: 0; }
  .cell-can, .cell-chi { font-size: 18px; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 767px) {
  .tutu-tab  { padding: 10px 14px; font-size: 12px; }
  .tutu-label { display: block; border-right: none; border-bottom: 1px solid var(--tt-border); }
  .tutu-field { display: block; }
  .tutu-btn-group { flex-direction: column; align-items: center; }
  .tutu-summary-inner { flex-direction: column; }
  .cell-can, .cell-chi { font-size: 20px; }
}

/* ═══ KẾT QUẢ DẠNG HÌNH ẢNH ═══ */
#tutu-result-wrap .tutu-image-result,
.tutu-image-result { text-align:center; margin-top:18px; }
#tutu-laso-img {
  max-width:100%; height:auto; display:block; margin:0 auto;
  border:2px solid #c9a227; border-radius:6px;
  box-shadow:0 4px 18px rgba(0,0,0,.18);
}
.tutu-image-hint { font-size:13px; color:#888; font-style:italic; margin:12px 0 8px; }
.tutu-image-actions { display:flex; justify-content:center; gap:14px; flex-wrap:wrap; margin-bottom:20px; }
.tutu-image-actions .tutu-btn { text-decoration: none; }
.tutu-image-actions-fallback { margin-top: 16px; }
.tutu-img-btn {
  display:inline-flex; align-items:center; gap:6px;
  background:#8b0000; color:#fff; border:none;
  padding:10px 24px; border-radius:20px; font-size:.92rem;
  cursor:pointer; transition:background .2s; text-decoration:none;
}
.tutu-img-btn:hover { background:#5a0000; color:#fff; }
.tutu-img-dl { background:#1a56c4; }
.tutu-img-dl:hover { background:#0d3d8a; }

/* ═══ Tàng Can + Thập Thần (v1.1) ═══ */
.cell-tangcan-row {
  display:flex; justify-content:space-between; align-items:center;
  gap:6px; padding:1px 4px; font-size:.78rem; line-height:1.5;
}
.cell-tangcan-row .tc-can { font-weight:700; color:#333; }
.cell-tangcan-row .tc-than { font-size:.72rem; color:#666; }
/* Lưu niên: highlight năm hiện tại */
.tutu-daivan-tbl .dv-cell.ln-cur { background:#fff0d8; }
.tutu-daivan-tbl .dv-cell.ln-cur .dv-age { color:#8b0000; font-weight:800; }

/* ===== TỨ TRỤ MỆNH BÀN — phong cách bảng chuyên nghiệp ===== */
.tutu-board-hcv {
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 18px;
  color: #222;
  background: #fff;
  border: 1px solid #bbb;
  padding: 15px 20px 12px;
  width: max-content;
  max-width: none;
  margin: 0 auto;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.08);
}
.tutu-board-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  border-bottom: 2px solid #333;
  padding-bottom: 15px;
  margin-bottom: 15px;
}
.tutu-board-brand { text-align: center; min-width: 250px; }
.tutu-board-logo { max-height: 80px; width: auto; margin-bottom: 6px; }
.tutu-board-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #111;
}
.tutu-board-site { font-size: 16px; color: #666; margin-top: 4px; }
.tutu-info-mini {
  border-collapse: collapse;
  font-size: 16px;
  min-width: 520px;
}
.tutu-info-mini th {
  text-align: left;
  padding: 4px 12px 4px 0;
  font-weight: 600;
  color: #444;
  white-space: nowrap;
}
.tutu-info-mini td { padding: 4px 10px; }
.tutu-name-cell { font-weight: 800; font-size: 18px; }
.tutu-board-main { margin-bottom: 15px; }
.tutu-board-grid {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #888;
}
.tutu-board-grid th,
.tutu-board-grid td {
  border: 1px solid #bbb;
  padding: 8px 12px;
  text-align: center;
  vertical-align: middle;
}
.tutu-board-grid .tutu-row-hd,
.tutu-board-grid tbody th {
  background: #f0f0f0;
  font-weight: 700;
  font-size: 14px;
  text-align: left;
  white-space: nowrap;
  width: 110px;
}
.tutu-board-grid thead th {
  background: #e8e8e8;
  font-weight: 800;
  font-size: 18px;
}
.tutu-row-bat .bat-cell { padding: 12px 10px; }
.bat-can, .bat-chi {
  display: block;
  font-size: 40px;
  font-weight: 900;
  line-height: 1.15;
}
.bat-can { margin-bottom: 4px; }
.tutu-row-chu .is-nhat-chu,
.tutu-row-bat .is-nhat-chu {
  background: #fff8e8;
  font-weight: 800;
}
.tang-line { line-height: 1.45; font-size: 16px; }
.tang-can { font-weight: 700; }
.tang-tt { color: #555; font-size: 14px; }
.tutu-row-ts td { font-size: 16px; font-weight: 600; }
.tutu-row-nap td { font-size: 16px; font-weight: 600; }
.nh-kim, .bat-can.nh-kim, .bat-chi.nh-kim { color: #5a5a5a; }
.nh-moc, .bat-can.nh-moc, .bat-chi.nh-moc { color: #1a7a1a; }
.nh-thuy, .bat-can.nh-thuy, .bat-chi.nh-thuy { color: #1a3d7a; }
.nh-hoa, .bat-can.nh-hoa, .bat-chi.nh-hoa { color: #c41e1e; }
.nh-tho, .bat-can.nh-tho, .bat-chi.nh-tho { color: #9a7b0a; }
.tutu-board-section { margin: 15px 0; }
.tutu-section-title {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 1px;
  margin-bottom: 8px;
  color: #333;
}
.tutu-flow-scroll { overflow-x: auto; padding-bottom: 6px; }
.tutu-flow-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: min-content;
}
.tutu-flow-cell {
  flex: 0 0 auto;
  min-width: 86px;
  border: 1px solid #bbb;
  background: #fafafa;
  text-align: center;
  padding: 6px 4px;
  font-size: 13px;
}
.tutu-flow-cell.is-cur {
  background: #ffe8c8;
  border-color: #c9a227;
  font-weight: 700;
}
.fc-pillar { font-weight: 800; font-size: 16px; margin-bottom: 2px; }
.fc-age { color: #555; font-size: 13px; }
.fc-year { font-weight: 700; color: #8b0000; font-size: 13px; }
.tutu-board-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  border-top: 1px solid #ccc;
  padding-top: 15px;
  margin-top: 12px;
  font-size: 16px;
}
.tutu-foot-left { flex: 1 1 220px; line-height: 1.6; }
.tutu-foot-sub { color: #777; font-size: 14px; }
.tutu-foot-right { flex: 1 1 280px; }
.tutu-than-title {
  font-weight: 800;
  margin-bottom: 6px;
  font-size: 18px;
}
.tutu-than-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.tutu-than-grid th,
.tutu-than-grid td {
  border: 1px solid #ccc;
  padding: 4px 8px;
  text-align: center;
}
.tutu-than-grid th:first-child { text-align: left; font-weight: 600; }
.tutu-board-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 15px;
  color: #777;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px dashed #ddd;
}
.tutu-legend-hcv {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
  font-size: 15px;
}
.tutu-legend-hcv .lg-item { display: inline-flex; align-items: center; gap: 6px; }
.tutu-legend-hcv .lg-swatch {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 2px;
  border: 1px solid #999;
}
.tutu-legend-hcv .lg-swatch.nh-kim { background: #9a9a9a; }
.tutu-legend-hcv .lg-swatch.nh-moc { background: #2d8a2d; }
.tutu-legend-hcv .lg-swatch.nh-thuy { background: #2a5088; }
.tutu-legend-hcv .lg-swatch.nh-hoa { background: #c41e1e; }
.tutu-legend-hcv .lg-swatch.nh-tho { background: #c9a227; }
