/* Lịch dịch lý (/lich-dich-ly) – nhận diện Trần Khương: xanh cổ vịt, điểm nhấn vàng đồng */
.ld {
    --ld-teal: #0d5b61;
    --ld-teal-deep: #0a3f44;
    --ld-teal-soft: #e2efed;
    --ld-teal-wash: #f2f8f7;
    --ld-ink: #17363a;
    --ld-muted: #587477;
    --ld-line: #cfe0de;
    --ld-gold: #c7a14a;
    --ld-gold-soft: #f6ecd0;
    --ld-gold-ink: #6d5418;
    --ld-sun: #b4482a;
    --ld-radius: 14px;
    max-width: 1200px;
    margin: 24px auto 48px;
    padding: 0 16px;
    color: var(--ld-ink);
    background: #fff;
    font-family: "Nunito Sans", "Roboto", sans-serif;
    font-size: 16px;
    line-height: 1.55;
}
.ld *, .ld *::before, .ld *::after { box-sizing: border-box; }
.ld h2, .ld h3 { font-family: "Lexend", sans-serif; color: var(--ld-teal-deep); margin: 0; }
.ld p { margin: 0; }
.ld a { color: var(--ld-teal); }
.ld :focus-visible { outline: 3px solid var(--ld-gold); outline-offset: 2px; }
.ld-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Nút ---------- */
.ld-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 42px; padding: 0 20px; border-radius: 999px; border: 1.5px solid transparent;
    font-family: "Lexend", sans-serif; font-size: 15px; font-weight: 500; line-height: 1;
    text-decoration: none; cursor: pointer; white-space: nowrap; list-style: none;
}
.ld-btn::-webkit-details-marker { display: none; }
.ld .ld-btn.is-primary { background: var(--ld-gold); color: var(--ld-teal-deep); border-color: var(--ld-gold); }
.ld .ld-btn.is-primary:hover { background: #d6b462; }
.ld .ld-btn.is-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .55); }
.ld .ld-btn.is-ghost:hover { background: rgba(255, 255, 255, .12); }
.ld-block .ld-btn.is-ghost { color: var(--ld-teal); border-color: var(--ld-line); }
.ld-block .ld-btn.is-ghost:hover { background: var(--ld-teal-wash); }

/* ---------- Đầu trang: điều hướng | tiêu đề | điều hướng ---------- */
.ld-top {
    position: relative;
    display: grid; grid-template-columns: 1fr minmax(0, 2.2fr) 1fr; align-items: center; gap: 16px;
    padding: 28px 24px 26px;
    background: linear-gradient(160deg, var(--ld-teal) 0%, var(--ld-teal-deep) 100%);
    color: #fff;
    border-radius: var(--ld-radius) var(--ld-radius) 0 0;
}
.ld--month .ld-top { border-radius: var(--ld-radius); }
.ld-top::after { /* viền vàng đồng mảnh ở chân */
    content: ""; position: absolute; left: 24px; right: 24px; bottom: 0; height: 3px;
    background: linear-gradient(90deg, transparent, var(--ld-gold), transparent);
}
.ld--month .ld-top::after { display: none; }
.ld-nav { display: flex; align-items: center; gap: 10px; }
.ld-nav--prev { justify-content: flex-end; }
.ld-nav--next { justify-content: flex-start; }
.ld-nav-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; border-radius: 50%;
    font-size: 26px; line-height: 1; font-weight: 600; text-decoration: none;
    border: 1.5px solid rgba(255, 255, 255, .5);
}
.ld .ld-nav-btn { color: #fff; }
.ld-nav-btn.is-month { width: 58px; height: 58px; font-size: 34px; border-color: var(--ld-gold); color: var(--ld-gold-soft); }
.ld a.ld-nav-btn:hover { background: rgba(255, 255, 255, .12); }
.ld-nav-btn.is-off { opacity: .3; }

.ld-title { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.ld-brand { font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: var(--ld-gold-soft); font-weight: 700; }
.ld-picks { display: flex; flex-direction: column; align-items: center; }
.ld-pick { position: relative; }
.ld-pick summary { list-style: none; cursor: pointer; font-family: "Lexend", sans-serif; line-height: 1.05; border-radius: 10px; padding: 2px 10px; }
.ld-pick summary::-webkit-details-marker { display: none; }
.ld-pick summary:hover { background: rgba(255, 255, 255, .08); }
.ld-pick-year { font-size: 30px; font-weight: 500; color: var(--ld-gold-soft); }
.ld-pick-month { font-size: 46px; font-weight: 700; text-transform: uppercase; letter-spacing: .01em; }
.ld-pick summary::after { content: "▾"; font-size: .4em; vertical-align: middle; margin-left: 8px; opacity: .7; }
.ld-pop {
    position: absolute; z-index: 20; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
    width: 300px; padding: 14px; background: #fff; color: var(--ld-ink);
    border-radius: 12px; box-shadow: 0 14px 40px rgba(10, 63, 68, .28); border-top: 3px solid var(--ld-gold);
}
.ld-pop-grid { display: grid; gap: 6px; }
.ld-pop-grid.is-years { grid-template-columns: repeat(3, 1fr); }
.ld-pop-grid.is-months { grid-template-columns: repeat(4, 1fr); }
.ld-pop-grid a, .ld-pop-grid span { display: flex; align-items: center; justify-content: center; height: 40px; border-radius: 8px; text-decoration: none; font-weight: 600; background: var(--ld-teal-wash); }
.ld-pop-grid span { color: #a7b8b9; }
.ld-pop-grid a:hover { background: var(--ld-teal-soft); }
.ld-pop-grid a[aria-current] { background: var(--ld-teal); color: #fff; }
.ld-pop-form { display: flex; gap: 8px; margin-top: 12px; }
.ld-pop-form label { flex: 1; margin: 0; }
.ld-pop-form input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--ld-line); border-radius: 8px; font: inherit; }
.ld-pop-form button { height: 40px; padding: 0 18px; border: 0; border-radius: 8px; background: var(--ld-teal); color: #fff; font-weight: 700; cursor: pointer; }

.ld-canchi { font-family: "Lexend", sans-serif; font-size: 18px; font-weight: 500; margin-top: 4px; }
.ld-convert { font-size: 15px; color: #cfe5e2; }
.ld-convert strong { color: var(--ld-gold-soft); font-weight: 700; }
.ld-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 12px; }

.ld-lookup { position: relative; }
.ld-lookup-form {
    position: absolute; z-index: 20; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
    width: min(360px, calc(100vw - 32px)); padding: 16px; text-align: left;
    display: flex; flex-direction: column; gap: 12px;
    background: #fff; color: var(--ld-ink); border-radius: 12px; border-top: 3px solid var(--ld-gold);
    box-shadow: 0 14px 40px rgba(10, 63, 68, .28);
}
.ld-kind { display: flex; gap: 4px; margin: 0; padding: 3px; border: 0; background: var(--ld-teal-wash); border-radius: 999px; }
.ld-kind label { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; height: 36px; margin: 0; border-radius: 999px; font-size: 14px; font-weight: 600; cursor: pointer; }
.ld-kind label:has(input:checked) { background: var(--ld-teal); color: #fff; }
.ld-kind input, .ld-leap input { accent-color: var(--ld-gold); margin: 0; }
.ld-lookup-fields { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 8px; }
.ld-lookup-fields label { display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: 13px; font-weight: 700; color: var(--ld-muted); }
.ld-lookup-fields select { height: 42px; padding: 0 8px; border: 1px solid var(--ld-line); border-radius: 8px; background: #fff; font: inherit; color: var(--ld-ink); }
.ld-leap { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; }
.ld-leap[hidden] { display: none; }
.ld-lookup-form .ld-btn { width: 100%; }

.ld-alert { margin-top: 16px; padding: 14px 16px; border-left: 4px solid var(--ld-sun); background: #fbefe9; color: #6b2c14; border-radius: 0 8px 8px 0; }
.ld-note { margin-top: 10px; font-size: 14px; color: var(--ld-muted); }
.ld-empty { margin-top: 24px; padding: 20px; border: 1px dashed var(--ld-line); border-radius: 12px; color: var(--ld-muted); text-align: center; }

/* ---------- Lưới lịch tháng (xem ngày) ---------- */
.ld-cal { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; border: 1px solid var(--ld-line); border-top: 0; border-radius: 0 0 var(--ld-radius) var(--ld-radius); overflow: hidden; }
.ld-cal th { padding: 10px 4px; background: var(--ld-teal-wash); font-family: "Lexend", sans-serif; font-weight: 600; font-size: 15px; color: var(--ld-teal-deep); text-align: center; border-bottom: 1px solid var(--ld-line); }
.ld-cal th.is-sun { color: var(--ld-sun); }
.ld-cal td { height: 76px; padding: 0; vertical-align: top; border-right: 1px solid var(--ld-line); border-bottom: 1px solid var(--ld-line); background: #fff; }
.ld-cal td:last-child { border-right: 0; }
.ld-cal tr:last-child td { border-bottom: 0; }
.ld-cal td.is-blank { background: #fafcfc; }
.ld-cal a { position: relative; display: flex; flex-direction: column; justify-content: space-between; height: 100%; min-height: 76px; padding: 8px 10px; text-decoration: none; color: var(--ld-ink); }
.ld-cal a:hover { background: var(--ld-teal-wash); }
.ld-cal-solar { align-self: flex-end; font-family: "Lexend", sans-serif; font-size: 22px; font-weight: 500; line-height: 1; }
.ld-cal-solar.is-out { display: block; padding: 8px 10px; color: #b6c6c7; text-align: right; }
.ld-cal-lunar { align-self: flex-start; font-size: 13px; color: var(--ld-teal); font-weight: 600; }
.ld-cal td.is-sun .ld-cal-solar { color: var(--ld-sun); }
.ld-cal td.is-sat .ld-cal-solar { color: var(--ld-teal); }
.ld-cal td.is-today { background: var(--ld-gold-soft); }
.ld-cal td.is-tet .ld-cal-lunar { color: var(--ld-sun); }
.ld-cal td.is-selected a { background: var(--ld-teal-soft); box-shadow: inset 0 0 0 2px var(--ld-teal); }
.ld-cal td.is-selected .ld-cal-solar { font-weight: 700; color: var(--ld-teal-deep); }

/* ---------- Khối nội dung ---------- */
.ld-block { margin-top: 28px; }
.ld-block-title { font-size: 21px; font-weight: 600; margin-bottom: 12px; }
.ld-block-title span { font-weight: 400; color: var(--ld-muted); font-size: .8em; }

/* ---------- Bảng 12 giờ (xem ngày) ---------- */
.ld-scroll { overflow-x: auto; border: 1px solid var(--ld-line); border-radius: 12px; -webkit-overflow-scrolling: touch; }
.ld-hours { width: 100%; min-width: 980px; border-collapse: collapse; table-layout: fixed; font-size: 14px; }
.ld-hours th, .ld-hours td { padding: 8px 4px; text-align: center; border-right: 1px solid var(--ld-line); border-bottom: 1px solid var(--ld-line); line-height: 1.3; }
.ld-hours tr:last-child th, .ld-hours tr:last-child td { border-bottom: 0; }
.ld-hours th:last-child, .ld-hours td:last-child { border-right: 0; }
.ld-hours .ld-rowhead { position: sticky; left: 0; z-index: 1; width: 88px; background: var(--ld-teal-wash); color: var(--ld-muted); font-weight: 700; font-size: 13px; text-align: left; padding-left: 12px; }
.ld-hours thead th { background: #fff; font-family: "Lexend", sans-serif; font-weight: 600; }
.ld-hours thead th a { display: block; padding: 4px 0; text-decoration: none; color: var(--ld-teal-deep); }
.ld-hours td { cursor: pointer; }
.ld-hours td:hover { background: var(--ld-teal-wash); }
.ld-hours tr.is-range td { font-size: 12.5px; color: var(--ld-muted); }
.ld-hours tr.is-primary td, .ld-hours tr.is-changed td { font-weight: 700; color: var(--ld-teal-deep); }
.ld-hours tr.is-nuclear td { color: var(--ld-ink); }
.ld-hours tr.is-moving td { font-size: 12.5px; color: var(--ld-muted); }
.ld-hours tr.is-beast td { font-size: 13px; color: var(--ld-muted); }
.ld-hours td.is-tl, .ld-mtable em.is-tl, .ld-facts dd.is-tl { color: var(--ld-gold-ink); font-weight: 700; }
.ld-hours thead th.is-now a::after { content: "bây giờ"; display: block; font-family: "Nunito Sans", sans-serif; font-size: 11px; font-weight: 700; color: var(--ld-gold-ink); }
.ld-hours th.is-active { background: var(--ld-teal); box-shadow: inset 0 3px 0 var(--ld-gold); }
.ld-hours th.is-active a { color: #fff; }
.ld-hours th.is-active.is-now a::after { color: var(--ld-gold-soft); }
.ld-hours td.is-active { background: var(--ld-teal-soft); }

/* ---------- Ba quẻ CHÁNH / HỘ / BIẾN ---------- */
.ld-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.ld-fig { margin: 0; border: 1px solid var(--ld-line); border-radius: var(--ld-radius); overflow: hidden; background: #fff; }
.ld-fig figcaption { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 10px; background: var(--ld-teal-wash); border-bottom: 1px solid var(--ld-line); text-align: center; }
.ld-fig.is-primary figcaption { background: var(--ld-teal); color: #fff; border-bottom-color: var(--ld-teal); }
.ld-fig-label { font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--ld-gold-ink); }
.ld-fig.is-primary .ld-fig-label { color: var(--ld-gold-soft); }
.ld-fig-name { font-family: "Lexend", sans-serif; font-size: 24px; font-weight: 600; line-height: 1.2; color: var(--ld-teal-deep); }
.ld-fig.is-primary .ld-fig-name { color: #fff; }
.ld-fig-full { font-size: 13px; color: var(--ld-muted); }
.ld-fig.is-primary .ld-fig-full { color: #cfe5e2; }
.ld-hex { list-style: none; margin: 0; padding: 20px 18px 22px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.ld-line { display: grid; grid-template-columns: 14px 140px 22px 84px; align-items: center; gap: 8px; }
.ld-fig:not(.is-primary) .ld-line { grid-template-columns: 14px 140px 22px; }
.ld-line-no { font-size: 11px; color: var(--ld-muted); text-align: right; }
.ld-bar { display: flex; height: 16px; }
.ld-bar i { display: block; height: 100%; background: var(--ld-teal-deep); border-radius: 2px; flex: 1; }
.ld-line.is-yin .ld-bar { gap: 24%; }
.ld-line.is-yang .ld-bar i + i { display: none; }
.ld-line.is-moving .ld-bar i, .ld-line.is-changed .ld-bar i { background: var(--ld-gold); }
.ld-mark { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 13px; font-weight: 700; color: var(--ld-gold-ink); }
.ld-line.is-moving .ld-mark { background: var(--ld-gold-soft); border: 1px solid var(--ld-gold); }
.ld-beast { font-size: 12.5px; color: var(--ld-muted); white-space: nowrap; }
.ld-line.is-moving .ld-beast { color: var(--ld-gold-ink); font-weight: 700; }

.ld-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 16px 0 0; border: 1px solid var(--ld-line); border-radius: 12px; overflow: hidden; }
.ld-facts > div { padding: 12px 16px; border-right: 1px solid var(--ld-line); border-bottom: 1px solid var(--ld-line); }
.ld-facts > div:nth-child(3) { border-right: 0; }
.ld-facts > div.is-wide { grid-column: 1 / -1; border-right: 0; border-bottom: 0; background: var(--ld-teal-wash); }
.ld-facts dt { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ld-muted); }
.ld-facts dd { margin: 2px 0 0; font-family: "Lexend", sans-serif; font-weight: 500; color: var(--ld-teal-deep); }
.ld-facts .is-wide dd { font-family: inherit; font-weight: 400; color: var(--ld-ink); font-size: 15px; }

.ld-fig { display: flex; flex-direction: column; }
.ld-fig-detail { flex: 1 1 auto; padding: 14px 16px 16px; border-top: 1px solid var(--ld-line); background: var(--ld-teal-wash); font-size: 15px; line-height: 1.65; }

/* ---------- Bảng tháng ---------- */
.ld-search { display: grid; grid-template-columns: 1fr auto auto; align-items: end; gap: 8px 10px; max-width: 760px; margin: 0 auto 16px; }
.ld-search label { grid-column: 1 / -1; margin: 0; font-weight: 700; font-size: 14px; color: var(--ld-teal-deep); }
.ld-search-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 46px; padding: 5px 8px; border: 1.5px solid var(--ld-line); border-radius: 12px; background: #fff; }
.ld-search-box:focus-within { border-color: var(--ld-teal); }
.ld-search-box input { flex: 1; min-width: 160px; height: 34px; border: 0; outline: 0; font: inherit; background: transparent; }
.ld-chips { display: contents; list-style: none; margin: 0; padding: 0; }
.ld-chips button { height: 30px; padding: 0 10px; border: 0; border-radius: 999px; background: var(--ld-teal); color: #fff; font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.ld-search-status { grid-column: 1 / -1; min-height: 1em; font-size: 14px; color: var(--ld-gold-ink); font-weight: 700; }

.ld-mwrap { max-height: min(78vh, 980px); overflow: auto; border: 1px solid var(--ld-line); border-radius: 12px; -webkit-overflow-scrolling: touch; }
.ld-mtable { width: 100%; min-width: 1100px; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 13.5px; }
.ld-mtable th, .ld-mtable td { border-right: 1px solid var(--ld-line); border-bottom: 1px solid var(--ld-line); text-align: center; vertical-align: middle; }
.ld-mtable thead th, .ld-mtable tfoot th { position: sticky; z-index: 2; padding: 8px 4px; background: var(--ld-teal); color: #fff; font-family: "Lexend", sans-serif; font-weight: 600; font-size: 14px; line-height: 1.25; }
.ld-mtable thead th { top: 0; }
.ld-mtable tfoot th { bottom: 0; border-bottom: 0; }
.ld-mtable thead th small, .ld-mtable tfoot th small { display: block; font-family: "Nunito Sans", sans-serif; font-weight: 400; font-size: 11.5px; color: #cfe5e2; }
.ld-mtable thead th.is-daytime, .ld-mtable tfoot th.is-daytime { background: #11686e; }
.ld-mtable thead th.is-now, .ld-mtable tfoot th.is-now { background: var(--ld-gold); color: var(--ld-teal-deep); }
.ld-mtable thead th.is-now small, .ld-mtable tfoot th.is-now small { color: var(--ld-teal-deep); }
.ld-mtable .ld-mdate { position: sticky; left: 0; z-index: 1; width: 122px; background: #fff; text-align: left; }
.ld-mtable thead .ld-mdate, .ld-mtable tfoot .ld-mdate { z-index: 3; background: var(--ld-teal-deep); text-align: center; }
.ld-mtable tbody .ld-mdate a { display: flex; flex-direction: column; padding: 8px 10px; text-decoration: none; color: var(--ld-ink); line-height: 1.25; }
.ld-mtable tbody .ld-mdate strong { font-family: "Lexend", sans-serif; font-size: 17px; color: var(--ld-teal-deep); }
.ld-mtable tbody .ld-mdate span { font-size: 13px; }
.ld-mtable tbody .ld-mdate em { font-style: normal; font-size: 12px; color: var(--ld-teal); font-weight: 700; }
.ld-mtable td { padding: 0; background: #fff; }
.ld-mtable td a { display: flex; flex-direction: column; gap: 1px; padding: 7px 4px; text-decoration: none; color: var(--ld-ink); line-height: 1.25; }
.ld-mtable td b { font-weight: 700; color: var(--ld-teal-deep); }
.ld-mtable td span { color: var(--ld-ink); }
.ld-mtable td em { font-style: normal; font-size: 12px; color: var(--ld-muted); margin-top: 3px; }
.ld-mtable td small { font-size: 11px; color: #8aa0a2; }
.ld-mtable td.is-daytime { background: #fdf9ee; }
.ld-mtable tr.is-weekend td, .ld-mtable tr.is-weekend .ld-mdate { background: var(--ld-teal-wash); }
.ld-mtable tr.is-weekend td.is-daytime { background: #f4f3e6; }
.ld-mtable tr.is-today .ld-mdate { box-shadow: inset 4px 0 0 var(--ld-gold); background: var(--ld-gold-soft); }
.ld-mtable tr.is-newmoon .ld-mdate em::after { content: " · mùng 1"; color: var(--ld-sun); }
.ld-mtable td a:hover { background: var(--ld-teal-soft); }
.ld-mtable td.is-hit { background: var(--ld-gold-soft) !important; box-shadow: inset 0 0 0 2px var(--ld-gold); }
.ld-mtable td.is-hit2 { background: #ead08a !important; box-shadow: inset 0 0 0 3px var(--ld-gold-ink); }

.ld-foot { margin-top: 32px; padding-top: 14px; border-top: 1px solid var(--ld-line); font-size: 13px; color: var(--ld-muted); }

/* ---------- Máy tính bảng ---------- */
@media (max-width: 960px) {
    .ld-trio { gap: 10px; }
    .ld-fig-detail { padding: 12px 12px 14px; font-size: 14.5px; }
    .ld-line { grid-template-columns: 12px 96px 20px 74px; gap: 6px; }
    .ld-fig:not(.is-primary) .ld-line { grid-template-columns: 12px 96px 20px; }
    .ld-hex { padding: 16px 8px 18px; }
}

/* ---------- Điện thoại ---------- */
@media (max-width: 720px) {
    .ld { margin-top: 12px; }
    .ld-top { grid-template-columns: 1fr 1fr; grid-template-areas: "title title" "prev next"; padding: 20px 14px 18px; gap: 14px; }
    .ld-title { grid-area: title; }
    .ld-nav--prev { grid-area: prev; justify-content: flex-start; }
    .ld-nav--next { grid-area: next; justify-content: flex-end; }
    .ld-nav-btn { width: 42px; height: 42px; font-size: 22px; }
    .ld-nav-btn.is-month { width: 46px; height: 46px; font-size: 28px; }
    .ld-pick-year { font-size: 24px; }
    .ld-pick-month { font-size: 34px; }
    .ld-canchi { font-size: 15.5px; }
    .ld-convert { font-size: 14px; }
    .ld-btn { min-height: 40px; padding: 0 16px; font-size: 14px; }

    .ld-cal th { padding: 8px 2px; font-size: 13px; }
    .ld-cal td, .ld-cal a { height: 54px; min-height: 54px; }
    .ld-cal a { padding: 5px 5px; }
    .ld-cal-solar { font-size: 17px; }
    .ld-cal-lunar { font-size: 11px; }

    .ld-block-title { font-size: 18px; }
    .ld-hours { min-width: 900px; font-size: 13px; }
    .ld-hours .ld-rowhead { width: 76px; padding-left: 8px; font-size: 12px; }

    .ld-trio { grid-template-columns: 1fr; }
    .ld-line, .ld-fig:not(.is-primary) .ld-line { grid-template-columns: 14px 150px 22px 90px; }
    .ld-fig:not(.is-primary) .ld-line { grid-template-columns: 14px 150px 22px; }
    .ld-facts { grid-template-columns: 1fr; }
    .ld-facts > div { border-right: 0; }

    .ld-search { grid-template-columns: 1fr 1fr; }
    .ld-search-box { grid-column: 1 / -1; }
    .ld-search .ld-btn { width: 100%; }
    .ld-mwrap { max-height: 72vh; }
    .ld-mtable { min-width: 980px; font-size: 12.5px; }
    .ld-mtable .ld-mdate { width: 76px; }
    .ld-mtable tbody .ld-mdate a { padding: 6px 6px; }
    .ld-mtable tbody .ld-mdate strong { font-size: 15px; }
    .ld-mtable tbody .ld-mdate span, .ld-mtable tbody .ld-mdate em { font-size: 11px; }

    /* Xem ngày: bảng giờ và ba quẻ vừa chiều rộng màn hình. */
    .ld--day { padding-inline: 8px; }
    .ld--day .ld-top {
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas: "prev title next";
        gap: 4px;
        padding: 12px 6px;
    }
    .ld--day .ld-nav { gap: 3px; }
    .ld--day .ld-nav-btn { width: 26px; height: 26px; font-size: 17px; }
    .ld--day .ld-nav-btn.is-month { width: 30px; height: 30px; font-size: 20px; }
    .ld--day .ld-title { gap: 3px; }
    .ld--day .ld-brand { font-size: 9px; }
    .ld--day .ld-pick-year { font-size: 18px; }
    .ld--day .ld-pick-month { font-size: 23px; }
    .ld--day .ld-canchi, .ld--day .ld-convert { font-size: 11px; }
    .ld--day .ld-actions { gap: 4px; margin-top: 5px; }
    .ld--day .ld-actions > .ld-btn, .ld--day .ld-lookup > .ld-btn { min-height: 28px; padding-inline: 8px; font-size: 10px; }
    .ld--day .ld-lookup { position: static; }
    .ld--day .ld-cal th { padding: 4px 2px; font-size: 11px; }
    .ld--day .ld-cal td, .ld--day .ld-cal a { height: 32px; min-height: 32px; }
    .ld--day .ld-cal a { padding: 3px 4px; }
    .ld--day .ld-cal-solar { font-size: 13px; }
    .ld--day .ld-cal-lunar { font-size: 9px; }

    .ld--day .ld-block { margin-top: 14px; }
    .ld--day #ld-gio, .ld--day #ld-que { scroll-margin-top: 72px; }
    .ld--day .ld-block-title { font-size: 14px; margin-bottom: 6px; }
    .ld--day .ld-hours { min-width: 0; font-size: 8px; }
    .ld--day .ld-hours th, .ld--day .ld-hours td { padding: 3px 1px; line-height: 1.2; overflow-wrap: anywhere; }
    .ld--day .ld-hours .ld-rowhead { position: static; width: 36px; padding-left: 3px; font-size: 8px; }
    .ld--day .ld-hours thead th a { padding-block: 2px; }
    .ld--day .ld-hours thead th.is-now a::after { font-size: 7px; }
    .ld--day .ld-hours tr.is-range td,
    .ld--day .ld-hours tr.is-moving td,
    .ld--day .ld-hours tr.is-beast td { font-size: inherit; }

    .ld--day .ld-trio { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
    .ld--day .ld-fig { border-radius: 6px; }
    .ld--day .ld-fig figcaption { min-height: 57px; padding: 5px 2px; }
    .ld--day .ld-fig-label { font-size: 8px; letter-spacing: .05em; }
    .ld--day .ld-fig-name { font-size: 12px; }
    .ld--day .ld-fig-full { font-size: 9px; line-height: 1.2; }
    .ld--day .ld-hex { gap: 5px; padding: 8px 4px; }
    .ld--day .ld-line { width: 100%; grid-template-columns: 8px minmax(0, 1fr) 12px 32px; gap: 2px; }
    .ld--day .ld-fig:not(.is-primary) .ld-line { grid-template-columns: 8px minmax(0, 1fr) 12px 32px; }
    .ld--day .ld-line-no, .ld--day .ld-beast { font-size: 7px; }
    .ld--day .ld-beast { white-space: normal; line-height: 1; }
    .ld--day .ld-bar { height: 6px; }
    .ld--day .ld-mark { width: 12px; height: 12px; font-size: 8px; }
    .ld--day .ld-fig-detail { padding: 6px; font-size: 10px; line-height: 1.4; overflow-wrap: anywhere; }
}
