/**
 * Lá số tử vi (trang /lap-la-so-tu-vi): khung 800px chép cách trình bày của plugin tuvitailoc
 * (tuvithienco). Lá số luôn nền giấy sáng, kể cả khi trang ở chế độ tối, như một tờ lá số in.
 * Màu chữ theo ngũ hành: Kim xám, Mộc xanh lá, Thủy đen, Hỏa đỏ, Thổ vàng.
 */
.ls-laso { display: grid; gap: 20px; align-items: start; margin-top: 4px; }
@media (min-width: 1200px) { .ls-laso { grid-template-columns: 272px minmax(0, 1fr); } .ls-ben { position: sticky; top: 84px; } }
@media (max-width: 1199.98px) { .ls-khung { order: -1; } }

/* ── Cột tùy chỉnh ── */
.ls-ben { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ls-the { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 16px; padding: 16px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 12px; }
.ls-khoi { color-scheme: light; border: 1px solid #eadccb; border-radius: 10px; background: #fffcf5; font-size: 14px; margin: 0; color: #1b2a3b; }
.ls-khoi-tieu { margin: 0; padding: 9px 12px; font-family: "Times New Roman", Times, serif; font-weight: 600; font-size: 15px; border-bottom: 1px solid #eadccb; }
details.ls-khoi > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; min-height: 40px; }
details.ls-khoi > summary::-webkit-details-marker { display: none; }
details.ls-khoi > summary::before { content: ""; border: 5px solid transparent; border-top-color: #9ca3af; border-bottom: 0; transform: rotate(-90deg); transition: transform .15s; }
details.ls-khoi[open] > summary::before { transform: none; }
details.ls-khoi:not([open]) > summary { border-bottom: 0; }
.ls-khoi summary:focus-visible { outline: 3px solid var(--c-gold); outline-offset: 2px; border-radius: 8px; }
.ls-khoi-than { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.ls-hang { display: flex; gap: 8px; }
.ls-hang .form-control { min-width: 0; flex: 1; height: 38px; background: #fff; color: #1b2a3b; border-color: #eadccb; }
.ls-hang .btn { flex: 0 0 auto; min-width: 64px; }
.ls-goi-y { margin: 0; font-size: 12px; color: #6b6257; }
.ls-chon { display: flex; align-items: flex-start; gap: 8px; margin: 0; cursor: pointer; line-height: 1.4; min-height: 24px; }
.ls-chon input { margin-top: 3px; width: 16px; height: 16px; accent-color: #c4552b; flex: 0 0 auto; }
.ls-chon-phai { margin: 4px 0 0; }
.ls-tuychinh select { font-size: 14px; padding-left: 8px; background: #fff; color: #1b2a3b; border-color: #eadccb; height: 38px; }
.ls-nut { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.ls-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; border-radius: 10px; font-size: 14px; font-weight: 500; border: 1px solid transparent; cursor: pointer; transition: background-color .15s, color .15s, box-shadow .15s; }
.ls-btn:focus-visible { outline: 3px solid var(--c-gold); outline-offset: 2px; }
.ls-btn:disabled { opacity: .6; cursor: wait; }
.ls-btn-vien { border-color: #c4552b; color: #c4552b; background: transparent; }
.ls-btn-vien:hover { background: rgba(196, 85, 43, .08); }
.ls-btn-chinh { background: #c4552b; color: #fff; font-weight: 600; box-shadow: 0 12px 24px -14px rgba(196, 85, 43, .9); margin-top: 6px; }
.ls-btn-chinh:hover { background: #a9441f; }
.ls-btn-nhat { background: rgba(240, 228, 212, .7); color: #1b2a3b; }
.ls-btn-nhat:hover { background: #f0e4d4; }
.ls-bao { margin: 0; min-height: 1.2em; font-size: 12px; text-align: center; color: var(--c-muted); }
.ls-bao:empty { display: none; }
.ls-panel { border: 1px solid #eadccb; border-radius: 10px; background: #fff; font-size: 14px; color: #1b2a3b; box-shadow: var(--shadow-sm); }
.ls-panel-dau { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid #f3ebe0; }
.ls-panel-tieu { color: #a9441f; font-family: "Times New Roman", Times, serif; font-size: 16px; }
.ls-panel-dong { border: 0; background: none; font-size: 22px; line-height: 1; color: #6b7280; cursor: pointer; width: 36px; height: 36px; border-radius: 50%; }
.ls-panel-dong:hover { background: #f5efe6; }
.ls-panel-than { padding: 10px 12px; }
.ls-panel-than p { margin: 0 0 5px; line-height: 1.5; }
.ls-panel-than b { font-weight: 600; color: #374151; }
.ls-panel-than a { font-weight: 600; }

/* ── Khung lá số (800px, thu nhỏ bằng transform khi hẹp: js trong trang) ── */
.ls-khung { min-width: 0; overflow: hidden; }
.ls-chart { width: 800px; transform-origin: left top; background: #fffcf5; color: #111827; font-family: "Be Vietnam Pro", system-ui, sans-serif; font-size: 12px; line-height: 1.35; }
.ls-luoi { position: relative; display: grid; grid-template-columns: repeat(4, 200px); grid-template-rows: repeat(4, auto); border: .5px solid #e6d5c1;
	background: linear-gradient(rgba(255, 252, 245, .5), rgba(255, 252, 245, .5)), url('../images/trong-dong.webp') center / contain no-repeat; }
.ls-chart p { margin: 0; }
.ls-cung { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border: .5px solid #e6d5c1; cursor: pointer; transition: background-color .2s; min-width: 0; }
.ls-cung:hover { background-color: rgba(247, 228, 214, .35); }
.ls-cung:focus-visible { outline: 2px solid #c4552b; outline-offset: -2px; }
.ls-dau, .ls-chan { display: grid; grid-template-columns: 1fr 3fr 1fr; padding: 0 4px; align-items: start; }
.ls-canchi { font-weight: 600; }
.ls-ten { text-align: center; font-weight: 700; color: #000; }
.ls-dv { text-align: right; font-weight: 600; }
.ls-giua { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.ls-chinh { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 32px; text-align: center; }
.ls-chinh p { font-weight: 600; font-size: 14px; line-height: 18px; }
.ls-than { padding: 1px 6px; background: #dc2626; color: #fff; font-weight: 700; line-height: 1.25; }
.ls-phu { display: flex; justify-content: space-between; gap: 8px; padding: 0 4px; flex: 1; }
.ls-cot { display: flex; flex-direction: column; align-items: flex-start; min-height: 160px; min-width: 0; }
.ls-s { font-weight: 400; }
.ls-vua { font-weight: 600; }
.ls-dam { font-weight: 700; }
.ls-nghieng { font-style: italic; }
.ls-mo { opacity: .8; }
.ls-tt { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.ls-tt span { padding: 1px 6px; background: #000; color: #fff; font-weight: 700; line-height: 1.25; }
.ls-chan-trai { line-height: 1.25; }
.ls-chan-phai { text-align: right; font-weight: 600; }
.ls-ts { text-align: center; font-size: 14px; line-height: 20px; font-weight: 600; }
.ls-th { color: #dc2626; }
.ls-nho { font-size: 10px; text-transform: uppercase; color: #6b7280; font-weight: 400; line-height: 1.25; }
.ls-thp { margin-top: 4px; line-height: 1.25; color: #7e22ce; }
.ls-kim { color: #4b5563; } .ls-moc { color: #16a34a; } .ls-thuy { color: #111827; } .ls-hoa { color: #ef4444; } .ls-tho { color: #eab308; }

/* Thiên bàn */
.ls-thienban { grid-row: 2 / 4; grid-column: 2 / 4; position: relative; z-index: 1; display: flex; flex-direction: column; gap: 4px; padding: 8px 48px 32px; border: .5px solid #e6d5c1;
	background: linear-gradient(rgba(255, 252, 245, .5), rgba(255, 252, 245, .5)), url('../images/trong-dong.webp') center / contain no-repeat; }
.ls-host { margin-top: 18px; text-align: center; font-size: 18px; color: #2563eb; text-decoration: underline !important; }
.ls-thienban hr { width: 50%; margin: 8px auto; border: 0; border-top: 1px solid #1f2937; }
.ls-tieu { text-align: center; text-transform: uppercase; font-family: "Times New Roman", Times, serif; font-size: 19px; font-weight: 700; color: #1b2a3b; margin-bottom: 4px !important; }
.ls-tt-bang { display: grid; grid-template-columns: 1fr 1fr 1fr; column-gap: 24px; row-gap: 10px; margin: 0 0 10px; font-size: 14px; }
.ls-tt-bang dt { font-weight: 400; color: #1f2937; }
.ls-tt-bang dd { margin: 0; font-weight: 600; color: #111827; }
.ls-tt-bang dd span { color: #6b7280; font-weight: 400; }
.ls-tt-bang dd.ls-dam { font-weight: 700; }
.ls-tt-bang .ls-c2 { grid-column: span 2; display: flex; flex-direction: column; }
.ls-tt-bang .ls-c2 b { font-weight: 700; }
.ls-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.ls-overlay polygon { fill: none; stroke: #d1d5db; stroke-width: 1.5; stroke-linejoin: round; }
.ls-overlay line { stroke: #ef4444; stroke-width: 1.5; stroke-dasharray: 5 4; }

/* Chú thích */
.ls-chu-thich { display: flex; justify-content: space-between; gap: 8px; border: 1px solid #e6d5c1; border-top: 0; padding: 12px 16px; font-size: 14px; }
.ls-ct-sang, .ls-ct-hanh { display: flex; align-items: center; gap: 8px; }
.ls-ct-sang b { color: #ef4444; font-weight: 400; }
.ls-ct-hanh span { display: flex; align-items: center; gap: 4px; }
.ls-ct-hanh i { width: 14px; height: 14px; display: inline-block; }
.ls-o-kim { background: #9ca3af; } .ls-o-moc { background: #16a34a; } .ls-o-thuy { background: #111827; } .ls-o-hoa { background: #ef4444; } .ls-o-tho { background: #eab308; }

/* Tùy chỉnh: lớp thông tin phụ luôn có trong DOM, ẩn đến khi người xem bật */
.ls-opt { display: none !important; }
.ls-laso.ls-on-dv .ls-dv.ls-opt, .ls-laso.ls-on-tuduc .ls-tuduc, .ls-laso.ls-on-thp .ls-thp { display: block !important; }
.ls-cung.ls-chieu-goc { background-color: rgba(220, 38, 38, .10); }
.ls-cung.ls-chieu-tam { background-color: rgba(22, 163, 74, .10); }
.ls-cung.ls-chieu-xung { background-color: rgba(37, 99, 235, .10); }
@media (prefers-reduced-motion: reduce) { .ls-cung, .ls-btn, details.ls-khoi > summary::before { transition: none; } }

/* In / lưu PDF: chỉ in lá số */
@media print {
	body.ls-in * { visibility: hidden !important; }
	body.ls-in .ls-chart, body.ls-in .ls-chart * { visibility: visible !important; }
	body.ls-in .ls-chart { position: absolute; left: 0; top: 0; transform: none !important; zoom: .88; }
	body.ls-in .ls-khung { height: auto !important; }
	@page { size: A4 portrait; margin: 10mm; }
}

/* Khối nền giấy giữ màu sáng cả khi trang ở chế độ tối */
.ls-laso .ls-khoi, .ls-laso .ls-khoi label, .ls-laso .ls-khoi-tieu { color: #1b2a3b; }
.ls-laso .ls-khoi .form-control { background-color: #fff !important; color: #1b2a3b !important; border-color: #eadccb !important; }
.ls-laso .ls-hang .btn { width: auto !important; flex: 0 0 72px; }
.ls-laso .ls-btn-nhat { background: #f3e9dc; color: #1b2a3b; }
.ls-laso .ls-btn-nhat:hover { background: #ecdcc7; }
.ls-laso .ls-panel a { color: #a9441f; }
