* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: clip; max-width: 100%; }
body {
  font-family: "Be Vietnam Pro", "Noto Serif CJK TC", "Noto Sans SC", "Noto Sans Symbols", system-ui, "Segoe UI", sans-serif;
  background: var(--surface);
  color: var(--on-surface);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--seal); }
.wrap { width: min(1080px, calc(100% - 32px)); margin: 0 auto; }
.narrow { width: min(440px, calc(100% - 32px)); padding-top: 48px; }
.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--surface-container);
  padding: 8px 12px;
}
.skip:focus { top: 12px; }
.site-header {
  background: var(--card);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.site-header a, .site-header button { color: var(--ink); }
.header-row {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  flex-wrap: wrap;
}
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--ink); }
.brand strong { display: block; }
.brand small { display: block; color: var(--muted); font-weight: 500; }
.mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 8px, #F4F5F8 9px 11px, transparent 12px),
    var(--primary-soft);
  box-shadow: inset 0 0 0 2px var(--brand-dark);
}
.nav { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.nav a { text-decoration: none; font-weight: 600; }
.nav button, button, .stack button {
  background: var(--seal);
  color: var(--seal-ink);
  border: 0;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.nav button { background: transparent; border: 1px solid rgba(255,255,255,.45); }
main { padding: 28px 0 48px; }
h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.25; margin: 0 0 12px; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }
.kicker { margin: 0 0 8px; color: var(--seal); font-weight: 700; letter-spacing: .02em; }
.day-card, .panel, .stack, .picker {
  background: var(--surface-container);
  border: 1px solid var(--outline);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 16px 0;
}
.eyebrow { margin: 0; color: var(--stone); font-weight: 600; }
.facts, .facts-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 16px 0; padding: 0; }
.facts div { margin: 0; }
.facts dt { color: var(--stone); font-size: .85rem; }
.facts dd { margin: 2px 0 0; font-weight: 600; }
.muted, .note { color: var(--stone); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; }
.chips li, .countdown span {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface-container));
  border-radius: 999px;
  padding: 6px 10px;
}
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.picker, .stack { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.stack { flex-direction: column; align-items: stretch; }
label { display: grid; gap: 4px; font-weight: 600; }
input, select, textarea {
  font: inherit;
  color: var(--on-surface);
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.dow { text-align: center; color: var(--stone); font-size: .8rem; font-weight: 700; }
.cell {
  min-height: 84px;
  border: 1px solid var(--outline);
  border-radius: var(--radius-sm);
  background: var(--surface-container);
  color: var(--on-surface);
  text-decoration: none;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cell strong { font-size: 1.05rem; }
.cell small, .cell em { font-style: normal; color: var(--stone); font-size: .75rem; }
.cell.mute { background: transparent; }
.cell.is-today { outline: 2px solid var(--primary); }
.cell.is-hoang { box-shadow: inset 0 -3px 0 var(--primary-soft); }
.year-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.month-card {
  display: grid;
  gap: 6px;
  text-decoration: none;
  background: var(--surface-container);
  border: 1px solid var(--outline);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--on-surface);
}
.countdown { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.countdown li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.countdown li .note { flex: 1 0 100%; margin: 4px 0 0; }
.pager { display: flex; justify-content: space-between; gap: 12px; }
.crumbs { display: flex; gap: 8px; flex-wrap: wrap; color: var(--stone); }
.error { color: var(--danger); font-weight: 700; }
.site-footer { border-top: 1px solid var(--outline); padding: 24px 0 40px; color: var(--stone); }
.admin-shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.admin-side {
  background: var(--brand-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
}
.admin-side a { color: #fff; text-decoration: none; font-weight: 600; }
.admin-main { padding: 24px; }
.post-list { list-style: none; padding: 0; display: grid; gap: 12px; }
.check { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.tool-grid .month-card span { color: var(--stone); font-weight: 500; }
.bars { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.bars li { display: grid; grid-template-columns: minmax(140px, 1.4fr) 1fr auto; gap: 8px; align-items: center; }
.bar { display: block; height: 10px; background: var(--outline); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--primary); }
.score { font-size: 1.8rem; font-weight: 700; margin: 0; color: var(--on-surface); }
.la-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.la-cell, .la-center {
  border: 1px solid var(--outline);
  background: var(--surface);
  color: var(--on-surface);
  border-radius: var(--radius-sm);
  padding: 6px;
  font-size: clamp(.68rem, 1.4vw, .85rem);
  min-width: 0;
}
.la-center { background: var(--surface-container); }
.la-cell header,
.la-cell-head { display: flex; justify-content: space-between; gap: 4px; }
.la-cell ul { margin: 4px 0; padding-left: 1em; }
.la-meta { margin: 0; color: var(--on-surface); }
.la-tieu { white-space: nowrap; }
/* M01S: Tuần/Triệt + Kỵ use theme --poor (≥4.5:1 on surface across all 10 themes). */
.la-meta.la-warn,
.la-meta.la-warn a { color: var(--poor); font-weight: 700; }
.la-hoa {
  display: inline-block;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--chip);
  color: var(--seal);
  border: 1px solid color-mix(in srgb, var(--seal) 55%, transparent);
  font-weight: 700;
}
.la-hoa.is-ky {
  color: var(--poor);
  border-color: color-mix(in srgb, var(--poor) 55%, transparent);
}
.la-cell.is-now { outline: 2px solid var(--primary-deep); }
.la-sat { font-weight: 700; }
.la-center-phone-summary { display: none; }
@media (max-width: 720px) {
  .la-cell, .la-center { padding: 4px; }
  .bars li { grid-template-columns: 1fr; }
}
/* M02 leftover from M01S: phone lá số — no mid-label wrap; center shows Tứ hóa. */
@media (max-width: 480px) {
  .la-cell-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }
  .la-cung-name,
  .la-canchi {
    display: block;
    white-space: nowrap;
  }
  .la-tieu { white-space: nowrap; }
  .la-center-core { display: none; }
  .la-center-phone-summary {
    display: block;
  }
  .la-center-sum-title {
    margin: 0 0 4px;
    font-weight: 800;
  }
  .la-center-tuhoa {
    margin: 0;
    padding-left: 1.1em;
    font-size: 0.85rem;
  }
}
.chip-hoang-dao { box-shadow: inset 0 0 0 2px var(--primary); }
.chip-hac-dao { box-shadow: inset 0 0 0 2px var(--stone); }
fieldset { border: 1px solid var(--outline); border-radius: var(--radius); padding: 12px; margin: 0; }
fieldset legend { font-weight: 700; padding: 0 6px; }
@media print {
  .site-header, .site-footer, .no-print, .crumbs, .picker, .tree-card.is-omit, .family-tools { display: none !important; }
  body { background: #fff; color: #142019; }
  .cell { break-inside: avoid; }
}
.print-sheet .site-header, .print-sheet .site-footer, .print-sheet .no-print { display: none; }
.reading { font-size: 1.125rem; line-height: 1.7; max-width: 40rem; }
.reading[data-size='sm'] { font-size: 1.05rem; }
.reading[data-size='md'] { font-size: 1.35rem; }
.reading[data-size='lg'] { font-size: 1.7rem; }
.reading p { margin: 0 0 1rem; }
/* DX6R: article body is regular sans; headings use display serif and outrank body. */
.article-page {
  max-width: 42rem;
  margin: 0 auto;
}
/* Article typography tokens — keep in sync with Flutter ArticleType. */
:root {
  --article-font-body: "Be Vietnam Pro", "Noto Sans SC", system-ui, sans-serif;
  --article-font-display: "Source Serif 4", "Noto Serif", serif;
  --article-body-size: 1.125rem; /* 18px */
  --article-body-weight: 400;
  --article-body-lh: 1.75; /* Vietnamese diacritics — UI2 */
  --article-measure: 70ch; /* 65–75ch reading measure */
  --article-h1-size: clamp(1.85rem, 4vw, 2.4rem);
  --article-h2-size: 1.6rem; /* ~26px */
  --article-h3-size: 1.28rem; /* ~20.5px */
  --article-heading-weight: 600;
  --article-heading-lh: 1.35;
  --article-scroll-margin: 5rem;
}
.article-page .article-header h1 {
  font-family: var(--article-font-display);
  font-weight: var(--article-heading-weight);
  font-size: var(--article-h1-size);
  line-height: 1.25;
  margin: 0 0 0.5rem;
}
.article-page .article-meta { margin: 0 0 1rem; }
.article-page .article-cover,
.article-body .article-figure {
  margin: 0 0 1.25rem;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.article-page .article-cover img,
.article-body .article-figure img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border-radius: 8px;
  /* Paper plate so light-ink diagrams stay visible on dark themes (muc/go/thủy). */
  background: #f4efe6;
}
.article-body .article-figure--diagram,
.hub-figures .article-figure--diagram {
  padding: 8px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f4efe6, #e7dcc8);
  border: 1px solid #c9b79a;
}
.article-body .article-figure--diagram img,
.hub-figures .article-figure--diagram img {
  background: #fffdf8;
  width: 100%;
  height: auto;
  /* IMG02R: keep wheel labels ≥ ~11px on phone; figure fills the column. */
  min-width: min(100%, 360px);
}
.article-page .article-cover figcaption,
.article-page .article-cover-cap,
.article-body .article-figure figcaption {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}
.article-figure-zoom { display: block; color: inherit; text-decoration: none; }
/*
 * HTML diagrams keep a fixed light paper palette.
 * Never bind diagram ink to theme --ink/--muted: those flip to light on muc/go/thủy
 * and wipe out text on the light gradient (IMG01).
 */
.article-cover-html .diagram {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 14px;
  font-family: "Be Vietnam Pro", system-ui, sans-serif;
  color: #1c1712;
  background: linear-gradient(135deg, #f4efe6, #e7dcc8);
  border: 1px solid #c9b79a;
  border-radius: 8px;
}
.article-cover-html .diagram h2 {
  margin: 0 0 6px;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.25;
  color: #1c1712;
}
.article-cover-html .diagram .note,
.article-cover-html .diagram .foot {
  margin: 0 0 12px;
  font-size: 1rem;
  color: #5c5348;
  line-height: 1.35;
}
.article-cover-html .diagram .foot { margin: 10px 0 0; }
.article-cover-html .diagram table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  line-height: 1.35;
  font-weight: 400;
  color: #1c1712;
}
.article-cover-html .diagram th,
.article-cover-html .diagram td {
  border: 1px solid #c9b79a;
  background: #fffdf8;
  color: #1c1712;
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}
.article-cover-html .diagram th { font-weight: 600; background: rgba(28,23,18,0.04); color: #1c1712; }
.article-cover-html .diagram td.num {
  width: 2.75rem;
  min-width: 2.75rem;
  color: #5c5348;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.article-cover-html .diagram tr.is-hoang td { background: #f0e2c8; color: #1c1712; }
.article-cover-html .diagram .grid-4 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.article-cover-html .diagram .cell {
  border: 1px solid #c9b79a;
  background: #fffdf8;
  color: #1c1712;
  border-radius: 8px;
  padding: 10px;
  font-size: 1rem;
}
.article-cover-html .diagram .cell strong { display: block; font-size: 1.15rem; margin-bottom: 4px; color: #1c1712; }
.article-cover-html .diagram .tag {
  display: inline-block;
  margin-left: 6px;
  color: #5c5348;
  white-space: nowrap;
}
.article-page .reading-time { font-variant-numeric: tabular-nums; }
.article-body.reading {
  font-family: var(--article-font-body);
  font-weight: var(--article-body-weight);
  font-size: var(--article-body-size);
  line-height: var(--article-body-lh);
  max-width: var(--article-measure);
}
.article-body h2,
.article-body h3 {
  font-family: var(--article-font-display);
  font-weight: var(--article-heading-weight);
  color: var(--ink);
  scroll-margin-top: var(--article-scroll-margin);
  line-height: var(--article-heading-lh);
}
.article-body h2 {
  font-size: var(--article-h2-size);
  margin: 1.75rem 0 0.65rem;
}
.article-body h3 {
  font-size: var(--article-h3-size);
  margin: 1.4rem 0 0.55rem;
}
.article-body ul, .article-body ol { margin: 0 0 1rem; padding-left: 1.25rem; }
.article-body .article-toc a { text-decoration: none; text-underline-offset: 0.2em; }
.article-body img { max-width: 100%; height: auto; margin: 0.75rem 0; }
/* DX7 term/article search */
.term-search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 1rem;
  max-width: 40rem;
}
.term-search input[type="search"] {
  flex: 1 1 12rem;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 12px);
  background: var(--card, #fff);
  color: var(--ink);
  font: inherit;
}
.term-search button {
  min-height: 44px;
  padding: 0 1rem;
  border: 0;
  border-radius: var(--radius-sm, 12px);
  background: var(--seal);
  color: var(--seal-ink);
  font-weight: 600;
  cursor: pointer;
}
.article-list .article-card { margin: 0 0 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); list-style: none; }
.article-list { list-style: none; padding: 0; margin: 0; }
.article-card-title { font-family: "Source Serif 4", serif; font-weight: 600; font-size: 1.25rem; text-decoration: none; color: var(--ink); }
.article-excerpt { margin: 0.35rem 0 0; max-width: 68ch; color: var(--ink); }
.md-table-wrap { overflow-x: auto; margin: 0 0 1rem; -webkit-overflow-scrolling: touch; }
.md-table { width: 100%; min-width: 28rem; border-collapse: collapse; font-size: 1rem; font-weight: 400; }
.md-table th, .md-table td { border: 1px solid rgba(28, 23, 18, 0.14); padding: 0.55rem 0.7rem; text-align: left; }
.md-table th { background: rgba(28, 23, 18, 0.04); font-weight: 600; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-row a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
}
.chip-row a.is-on { background: var(--seal); color: var(--seal-ink); border-color: transparent; }
.offering-list { margin: 0; padding-left: 1.2rem; }
.family-head { display: grid; gap: 8px; }
.family-head h2 { margin: 0; font-family: var(--serif); }
.tree-diagram {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  align-items: flex-start;
  padding-bottom: 8px;
}
.tree-col { display: grid; gap: 10px; list-style: none; padding: 0; margin: 0; }
.tree-card {
  min-width: 180px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
}
.tree-card.is-omit { opacity: 0.45; }
.tree-card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.tree-row { margin: 0.2rem 0; }
.fav-on { font-weight: 700; }
.soon-block h2, .prayer-hub h2, .when-card h2, .offer-card h2 { font-family: var(--serif); }
.soon-row {
  display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px;
  width: 100%; max-width: 100%; min-width: 0;
}
.soon-card {
  flex: 0 0 200px; display: grid; gap: 4px; padding: 12px 14px;
  border-radius: 16px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); text-decoration: none;
}
.soon-card em { font-style: normal; color: var(--seal); font-weight: 700; }
.prayer-cats { display: grid; gap: 12px; }
@media (min-width: 720px) { .prayer-cats { grid-template-columns: 1fr 1fr; } }
.prayer-cat {
  display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: center;
  padding: 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; min-width: 0;
}
.prayer-cat.is-on { box-shadow: inset 0 0 0 2px var(--seal); }
.prayer-cat strong { display: block; font-family: var(--serif); font-size: 1.2rem; }
.prayer-cat em { font-style: normal; color: var(--muted); }
.prayer-cat span span { display: block; color: var(--muted); }
.cat-icon {
  width: 48px; height: 48px; display: grid; place-items: center;
  border-radius: 14px; background: color-mix(in srgb, var(--seal) 16%, var(--bg)); color: var(--seal);
}
.cat-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; }
.when-card, .offer-card {
  padding: 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); margin: 12px 0;
}
.offer-tick {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  border: 0; background: transparent; color: var(--ink); min-height: 40px; font: inherit;
}
.tick-icon {
  width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--line); flex: 0 0 auto;
}
.offer-tick[aria-pressed="true"] .tick-icon { background: var(--seal); border-color: var(--seal); }
.prayer-tools {
  position: absolute; top: 0; right: 0; z-index: 2; display: flex; gap: 6px; justify-content: flex-end;
  width: fit-content; padding: 4px;
  border-radius: 999px; background: color-mix(in srgb, var(--card) 92%, transparent); border: 1px solid var(--line);
}
.prayer-tools button, .tray-tabs button, .family-toolbar .is-ghost, .zoom-overlay button, .who-card summary, .tree-tools .is-ghost {
  background: transparent; color: var(--ink); border: 1px solid var(--line);
}
.prayer-tools button { min-width: 40px; min-height: 36px; padding: 0 10px; border-radius: 999px; }
.who-card { margin: 12px 0; border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; background: var(--card); }
.who-card summary { cursor: pointer; font-weight: 700; list-style: none; border: 0; padding: 0; }
.who-card[open] summary { margin-bottom: 10px; }
.who-card .picker { margin: 0; padding: 0; border: 0; background: transparent; }
.who-card label span { display: block; font-size: 0.85rem; margin-bottom: 4px; }
.tray-tabs { display: flex; gap: 8px; margin: 0 0 10px; }
.tray-tabs button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: transparent; }
.offer-tick { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: transparent; color: var(--ink); border: 1px solid var(--line); }
.offer-icon {
  width: 18px; height: 18px; flex: none; background: var(--seal);
  -webkit-mask: var(--glyph) center / contain no-repeat;
  mask: var(--glyph) center / contain no-repeat;
}
.offer-incense { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M7.2 15h1.6V6.2H7.2zM8 1.2c.7 1.5.2 2.4 0 2.8-.2-.4-.7-1.3 0-2.8z'/%3E%3C/svg%3E"); }
.offer-flower { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle fill='%23000' cx='8' cy='8' r='1.7'/%3E%3Ccircle fill='%23000' cx='8' cy='3.6' r='1.7'/%3E%3Ccircle fill='%23000' cx='8' cy='12.4' r='1.7'/%3E%3Ccircle fill='%23000' cx='3.6' cy='8' r='1.7'/%3E%3Ccircle fill='%23000' cx='12.4' cy='8' r='1.7'/%3E%3C/svg%3E"); }
.offer-fruit { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle fill='%23000' cx='8' cy='9.2' r='4.2'/%3E%3Cpath fill='%23000' d='M8 4.6V2.2h1.4C8.6 3.2 8.2 4 8 4.6z'/%3E%3C/svg%3E"); }
.offer-tea, .offer-wine { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M3 4h8v5.2a4 4 0 0 1-8 0zM11 5.2h1.6a1.6 1.6 0 0 1 0 3.2H11zM5 14h6v1.2H5z'/%3E%3C/svg%3E"); }
.offer-wine { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M4 1.5h8l-.6 6.2a3.4 3.4 0 0 1-6.8 0zM7.2 10.2h1.6V13H11v1.4H5V13h2.2z'/%3E%3C/svg%3E"); }
.offer-paper { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M4 1.5h5.2L13 5.2V14.5H4zM9 1.8V5h3.2'/%3E%3C/svg%3E"); }
.offer-cake, .offer-rice { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M3 7h10v7H3zM4 7c0-2.4 1.8-4 4-4s4 1.6 4 4'/%3E%3C/svg%3E"); }
.offer-salt { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M5 6h6l1 8H4zM6.2 6 7 2.5h2L9.8 6'/%3E%3C/svg%3E"); }
.offer-chicken, .offer-fish { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M2 9.5c2-3 4-4 6.2-4 1.6 2.2 2.2 4 1.6 6.2-2 .2-4-.2-5.6-1.2C3.4 11.6 2.4 10.8 2 9.5zM11 6l3-1.2-1.2 3'/%3E%3C/svg%3E"); }
.offer-fish { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M1.5 8c2.4-2.6 5-3.6 8.2-3.4L14 6.2 11.2 8 14 9.8l-4.3 1.6C6.5 11.6 3.9 10.6 1.5 8z'/%3E%3C/svg%3E"); }
.offer-betel { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M8 14c-3-2.2-4-4.4-4-6.4C4 5 5.6 3 8 3s4 2 4 4.6c0 2-1 4.2-4 6.4z'/%3E%3C/svg%3E"); }
.offer-candle { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M7 15h2V6H7zM8 1.4c.8 1.2.3 2 .3 2S7.2 2.6 8 1.4z'/%3E%3C/svg%3E"); }
.offer-porridge { --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23000' d='M2.5 7h11l-1 6.5h-9zM5 7c.2-2 1.4-3.4 3-3.4S10.8 5 11 7'/%3E%3C/svg%3E"); }
.source-line { color: var(--seal); font-weight: 700; }
.reading-column { position: relative; max-width: 42rem; margin: 0 auto; padding-top: 52px; }
.reading { font-family: "Be Vietnam Pro", "Noto Sans SC", system-ui, sans-serif; font-weight: 400; }
.reading-column .reading { font-family: "Source Serif 4", "Noto Serif", serif; }
.rubric { display: inline-block; margin-left: 0.3em; font-style: italic; letter-spacing: 0.04em; color: var(--seal); font-size: 0.82em; }
.slot { background: color-mix(in srgb, var(--seal) 22%, transparent); border-radius: 4px; padding: 0 0.15em; }
.prayer-reader .picker { display: grid; grid-template-columns: 1fr 1fr; align-items: stretch; }
.prayer-reader .picker label { display: grid; gap: 4px; min-width: 0; }
.prayer-reader .picker label.date-field { grid-column: 1 / -1; }
.prayer-reader .picker input { width: 100%; max-width: 100%; box-sizing: border-box; }
@media (max-width: 720px) { .prayer-reader .picker { grid-template-columns: 1fr; } }
.tree-stage {
  position: relative; overflow: visible; height: auto; min-height: 0;
  border: 1px solid var(--line); border-radius: 18px; background: var(--bg); touch-action: none;
  min-width: 0; max-width: 100%;
}
#family-root, .family-panel, .family-tools { min-width: 0; max-width: 100%; }
#family-root { width: 100%; overflow-x: clip; }
#family-root input { max-width: 100%; width: 100%; box-sizing: border-box; }
.family-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.family-tools label {
  position: relative; display: inline-flex; align-items: center; min-height: 36px;
  padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; overflow: hidden;
}
#family-root .family-tools input[type="file"] {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; opacity: 0; cursor: pointer;
}
.tree-stage svg { width: 100%; height: auto; display: block; min-width: 0; max-width: 100%; }
.tree-stage.is-vertical { height: auto; min-height: 0; overflow: visible; touch-action: auto; }
.tree-stage.is-vertical svg { height: auto; max-height: none; }
.tree-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.gen-label { font: 700 12px "Source Serif 4", serif; fill: var(--muted, #6b5e4e); }
.child-link { fill: none; stroke: var(--ink, #142019); stroke-width: 1.5; }
.spouse-link { stroke: var(--seal, #8c2f2a); stroke-width: 2; }
.node-card { fill: var(--card, #fff); stroke: var(--line, #c8bba8); stroke-width: 1; }
.node-initial { fill: #f8f1e6; font-family: "Source Serif 4", serif; font-weight: 700; font-size: 11px; }
.node-name { fill: var(--ink, #142019); font-family: "Source Serif 4", serif; font-weight: 650; font-size: 11px; }
.node-years { fill: var(--muted, #6b5e4e); font-family: "Source Serif 4", serif; font-size: 11px; }
.node-lunar { fill: var(--muted, #6b5e4e); font-family: "Be Vietnam Pro", sans-serif; font-size: 11px; }
.family-empty { padding: 24px 16px; border: 1px dashed var(--line); border-radius: 16px; background: var(--card); display: grid; gap: 10px; max-width: 36rem; }
.tree-node { cursor: pointer; }
.tree-node.is-omit { opacity: 0.4; }
.member-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.member-row {
  display: grid; grid-template-columns: 40px 1fr auto auto; gap: 8px; align-items: center;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); min-width: 0;
}
.member-copy { display: grid; min-width: 0; }
.member-copy strong, .member-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 40px; height: 40px; border-radius: 999px; display: grid; place-items: center;
  color: #f8f1e6; font-weight: 700;
}
.avatar.g-m { background: #1d4e6f; }
.avatar.g-f { background: #8c2f2a; }
.avatar.g-u { background: #6b5e4e; }
.press-chip {
  border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink);
  min-height: 36px; padding: 0 10px;
}
.press-chip[aria-pressed="true"] { background: var(--seal); color: var(--seal-ink); border-color: transparent; }
.more-menu { position: relative; }
.more-menu summary { list-style: none; cursor: pointer; min-width: 36px; min-height: 36px; display: grid; place-items: center; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-menu[open] { display: grid; }
.more-menu button { display: block; width: 100%; text-align: left; }
.gio-list { display: grid; gap: 12px; }
.gio-row {
  padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); display: grid; gap: 4px;
}
.gio-row h3 { margin: 0; font-family: var(--serif); }
.gio-count { font-weight: 700; }
.person-sheet {
  width: min(560px, calc(100vw - 24px)); max-height: min(92vh, 880px); overflow: auto;
  border: 0; border-radius: 20px; padding: 16px; background: var(--card); color: var(--ink);
}
.person-sheet::backdrop { background: rgba(20, 16, 12, 0.45); }
.person-sheet .date-wheel .snap { height: 140px; }
.person-sheet .date-wheel .snap-pad { height: 48px; }
.person-sheet .date-wheel .snap-item { height: 36px; font-size: 1rem; }
.person-sheet .date-wheel .snap-item.is-on { font-size: 1.2rem; }
.sheet-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.choice-row button[aria-pressed="true"] { background: var(--seal); color: var(--seal-ink); border-color: transparent; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); margin: 8px 0 12px; }
.segmented button { background: transparent; color: var(--ink); border: 0; border-radius: 0; }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.family-head h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; font-family: var(--serif); margin: 0 0 8px; }
#family-root .family-name {
  width: min(100%, 28rem);
  background: color-mix(in srgb, var(--card) 88%, var(--bg));
  color: var(--ink);
  border: 1.5px dashed var(--seal);
  border-radius: 10px;
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 650;
  line-height: 1.2;
  padding: 4px 12px 6px;
}
#family-root .family-name:focus { outline: 2px solid var(--seal); outline-offset: 2px; }
.family-title { display: flex; align-items: center; gap: 8px; }
.family-title .info-tip {
  width: 28px; height: 28px; min-height: 28px; border-radius: 999px; padding: 0;
  background: transparent; color: var(--ink); border: 1px solid var(--line);
  font-family: var(--serif); font-weight: 700; font-size: 0.95rem; line-height: 1;
}
.info-pop {
  position: relative; max-width: 36rem; margin: 0 0 12px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--ink);
}
.info-pop p { margin: 0 0 6px; }
.info-pop p:last-child { margin: 0; }
.family-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.zoom-overlay { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.zoom-overlay button { width: 36px; height: 36px; padding: 0; border-radius: 999px; background: var(--card); color: var(--ink); }
#family-root .sr-only { position: absolute; width: 1px; height: 1px; max-width: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.gio-card { display: grid; grid-template-columns: 76px 1fr; gap: 12px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.gio-card-body { display: grid; gap: 4px; min-width: 0; }
.gio-card-body h3 { margin: 0; font-family: var(--serif); font-size: 1.1rem; }
.gio-card-body p { margin: 0; }
.gio-relation { color: var(--muted); font-size: 0.92rem; }
.gio-card-actions { margin: 8px 0 0; }
.gio-card .gio-remind-row { margin-top: 6px; }
.reminder-plan-list { display: none; }
.gio-home-panel { margin: 16px 0 8px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.gio-home-panel h2 { margin: 0 0 10px; font-family: var(--serif); font-size: 1.25rem; }
.gio-home-cards { display: grid; gap: 10px; }
.gio-home-card { padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--bg) 55%, var(--card)); }
.gio-home-card h3 { margin: 0 0 6px; font-family: var(--serif); font-size: 1.15rem; }
.gio-home-card .gio-chip { display: inline-block; margin: 0 0 8px; }
.gio-home-card .gio-lunar, .gio-home-card .gio-solar, .gio-home-card .gio-count { margin: 0 0 4px; }
.gio-home-card .gio-count { font-weight: 700; color: var(--seal); }
.gio-checklist { margin: 16px 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.gio-checklist ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.gio-checklist li label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.gio-rule-note { margin: 0 0 10px; color: var(--muted); font-size: 0.95rem; }
.gio-check-prefs { display: grid; gap: 8px; padding: 4px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.gio-remind-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.gio-remind-row .kicker { width: 100%; margin: 0; }
.gio-month-toggle { display: flex; gap: 8px; align-items: center; }
.family-more { position: relative; }
.family-more summary { list-style: none; cursor: pointer; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; display: inline-flex; align-items: center; background: var(--card); }
.family-more summary::-webkit-details-marker { display: none; }
.family-more[open] .family-more-panel {
  position: absolute; z-index: 20; top: calc(100% + 6px); left: 0;
  min-width: 220px; padding: 8px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); box-shadow: 0 8px 24px color-mix(in srgb, var(--ink) 10%, transparent);
  display: grid; gap: 4px;
}
.family-more:not([open]) .family-more-panel { display: none; }
.family-more-panel button { width: 100%; text-align: left; background: transparent; color: var(--ink); border: 0; border-radius: 8px; padding: 10px 12px; }
.gio-seal { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--seal); color: var(--seal); font-weight: 700; }
.gio-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.gio-badge, .gio-chip { border-radius: 999px; padding: 2px 10px; border: 1px solid var(--line); font-size: 0.92rem; }
.gio-chip { background: color-mix(in srgb, var(--seal) 18%, transparent); }
.prayer-index { columns: 2; padding-left: 0; }
.prayer-index li { break-inside: avoid; margin: 0 0 6px; }
@media (max-width: 720px) { .prayer-index { columns: 1; } }
@media (max-width: 720px) {
  .member-row { grid-template-columns: 40px 1fr auto; }
  .member-row .press-chip { grid-column: 2; }
  .tree-stage { height: auto; min-height: 0; overflow: visible; touch-action: auto; }
  .tree-stage svg { height: auto; }
}
@media print {
  @page { size: A4; margin: 16mm; }
  .prayer-tools, .picker, .soon-block, .prayer-cats, .site-header, .site-footer, .no-print, .crumbs { display: none !important; }
  .reading-column, .reading { max-width: none; color: #142019; font-size: 12pt; }
  .reading-column { padding-top: 0; }
  .tree-stage { height: auto; overflow: visible; border: 0; }
  .tree-stage svg { height: auto; }
  .tree-node.is-omit { display: none; }
  .family-panel[hidden] { display: none !important; }
}
@media (max-width: 720px) {
  .split, .admin-shell { grid-template-columns: 1fr; }
  .cell { min-height: 64px; padding: 6px; }
  .cell em { display: none; }
  .admin-side { flex-direction: row; flex-wrap: wrap; }
  .bars li { grid-template-columns: 1fr; }
}

/* F09R Kinh Dịch */
.iching-64-list { list-style: none; padding: 0; margin: 16px 0 40px; display: grid; gap: 8px; }
.iching-64-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 10px 0; border-bottom: 1px solid color-mix(in srgb, var(--ink) 12%, transparent); }
.han-face { font-family: "Noto Serif CJK TC", "Noto Sans SC", "Noto Sans Symbols", "Source Serif 4", serif; }
.iching-mode .choice-row { display: flex; flex-wrap: wrap; gap: 10px; }
.hex-cast { font-family: "Be Vietnam Pro", "Source Serif 4", "Noto Serif CJK TC", "Noto Sans Symbols", sans-serif; margin: 12px 0; }
.hex-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0 8px; align-items: start; }
.hex-pair.hex-pair--triple { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
@media (max-width: 360px) {
  .hex-pair.hex-pair--triple { gap: 6px; }
  .hex-pair.hex-pair--triple .hex-trigrams { font-size: 0.78rem; }
}
.hex-figure {
  display: grid;
  grid-template-rows: auto auto 1fr;
  align-content: start;
  min-width: 0;
}
.hex-figure strong {
  display: block;
  font-weight: 700;
  min-height: 1.35em;
  line-height: 1.35;
}
.hex-figure .hex-trigrams {
  min-height: 1.35em;
  margin: 2px 0 8px;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hex-figure .hex-cast { margin: 0; }
.hex-moving-legend {
  margin: 0 0 14px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #b45309;
}
.hex-moving-badge {
  /* legacy single-column badge — prefer .hex-moving-legend under the grid */
  margin: 4px 0 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #b45309;
}
.yao-list { list-style: none; padding: 0; margin: 0; }
.yao-list > li { margin: 0 0 1.1rem; padding-bottom: 0.85rem; border-bottom: 1px solid color-mix(in srgb, var(--ink) 12%, transparent); }
.yao-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 0.35rem; }
.yao-head a { font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.yao-mini {
  display: inline-flex;
  width: 36px;
  height: 10px;
  flex: 0 0 auto;
}
.yao-mini .hex-bar { height: 10px; border-radius: 2px; }
.yao-mini .hex-bar.yang { width: 100%; background: var(--seal, #8b1e1e); }
.yao-mini .hex-bar.yin { display: flex; justify-content: space-between; width: 100%; gap: 6px; }
.yao-mini .hex-bar.yin i { display: block; flex: 1; height: 10px; border-radius: 2px; background: var(--seal, #8b1e1e); }
.hex-trigrams { margin: 2px 0 8px; color: var(--muted); font-size: 0.95rem; }
.iching-tri-filter { display: flex; flex-wrap: wrap; gap: 8px 12px; margin: 10px 0 16px; }
.iching-tri-filter a { text-decoration: none; border-bottom: 1px solid transparent; color: var(--seal); }
.iching-tri-filter a[aria-current="page"] { border-bottom-color: var(--seal); font-weight: 700; }
.yao-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.yao-list li { border-top: 1px solid var(--line); padding-top: 10px; }
.hex-line { display: grid; grid-template-columns: 28px 1fr 28px; align-items: center; gap: 8px; margin: 5px 0; }
.hex-no, .hex-mark { font-weight: 700; text-align: center; }
.hex-bar { display: block; height: 14px; border-radius: 3px; background: var(--seal); }
.hex-bar.yin { display: flex; gap: 10px; background: transparent; }
.hex-bar.yin i { flex: 1; display: block; height: 14px; border-radius: 3px; background: var(--seal); }
.hex-bar.placeholder {
  background: transparent;
  border: 0;
  background-image: repeating-linear-gradient(
    to right,
    color-mix(in srgb, var(--ink) 35%, transparent) 0 6px,
    transparent 6px 10px
  );
  background-size: 100% 2px;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 0;
}
.hex-line.is-pending .hex-no { color: var(--muted); }
/* Moving mark recolors only — never fill a yin gap into a solid bar. */
.hex-line.is-changing .hex-bar.yang { background: color-mix(in srgb, #b45309 85%, var(--seal)); }
.hex-line.is-changing .hex-bar.yin { background: transparent; }
.hex-line.is-changing .hex-bar.yin i { background: color-mix(in srgb, #b45309 85%, var(--seal)); }
.hex-line.is-changing .hex-mark { color: #b45309; font-size: 1.05rem; }
.iching-coin-flow { margin: 12px 0 16px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.iching-coin-flow.is-dim .coin { opacity: 0.4; }
.coin-row { display: flex; justify-content: center; gap: 14px; margin: 10px 0; }
.coin {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--seal); background: var(--bg); color: var(--ink); font-weight: 800;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--seal) 18%, transparent);
}
.coin.is-heads { background: var(--seal); color: var(--seal-ink); }
.coin span { font-size: 1.15rem; line-height: 1; }
.coin small { display: block; font-size: 0.7rem; font-weight: 650; }
.coin-words { text-align: center; font-weight: 650; min-height: 1.4em; }
.coin-toss { min-height: 44px; width: 100%; margin-top: 8px; border-radius: 14px; border: 0; background: var(--seal); color: var(--seal-ink); font: inherit; font-weight: 700; }
.tool-page .input-card { position: relative; z-index: 0; }
.tool-page { padding-bottom: 24px; }
.han-face { font-family: "Be Vietnam Pro", "Source Serif 4", "Noto Serif CJK TC", "Noto Sans SC", "Noto Sans Symbols", sans-serif; }

/* M07R — name compare table */
.table-wrap { overflow-x: auto; margin: 0 0 1rem; -webkit-overflow-scrolling: touch; }
.table-wrap table { width: 100%; min-width: 36rem; border-collapse: collapse; font-size: 0.95rem; }
.table-wrap th, .table-wrap td { border: 1px solid var(--line); padding: 0.45rem 0.55rem; text-align: left; vertical-align: top; }
.table-wrap th { background: color-mix(in srgb, var(--chip) 80%, transparent); font-weight: 650; }

/* M08R — Sao hạn result card */
.sao-han-card {
  margin: 1rem 0 1.25rem;
  padding: 1rem 1.1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}
.sao-han-card-head { margin-bottom: 0.75rem; }
.sao-han-meta {
  display: flex; flex-wrap: wrap; gap: 0.55rem 1rem;
  margin: 0 0 0.65rem; color: var(--muted); font-size: 0.95rem;
}
.sao-han-title-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.55rem;
  margin: 0.35rem 0; font-size: 1.12rem;
}
.sao-han-label { color: var(--muted); font-size: 0.92rem; margin-right: 0.15rem; }
.sao-han-heavy { margin: 0.55rem 0 0; }
.sao-han-meanings p { margin: 0.45rem 0; line-height: 1.5; }
.sao-han-ritual h2, .sao-han-dates-block h2 { margin: 1rem 0 0.45rem; font-size: 1.05rem; }
.sao-han-ritual ul { margin: 0.25rem 0 0.5rem; padding-left: 1.15rem; }
.sao-han-diffs {
  margin: 0.85rem 0;
  padding: 0.7rem 0.85rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--chip) 55%, transparent);
}
.sao-han-diffs h3, .sao-han-diffs h4 { margin: 0 0 0.4rem; font-size: 0.98rem; }
.sao-han-diffs ul { margin: 0; padding-left: 1.1rem; }
.sao-han-diff-topic { font-weight: 650; }
.sao-han-next { margin: 0.35rem 0 0.55rem; }
.sao-han-dates { list-style: none; padding: 0; margin: 0.4rem 0 0; display: grid; gap: 0.35rem; }
.sao-han-dates li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem 0.65rem;
  padding: 0.35rem 0.55rem; border-radius: 8px; border: 1px solid transparent;
}
.sao-han-dates li.is-past { color: var(--muted); opacity: 0.78; }
.sao-han-dates li.is-next {
  border-color: color-mix(in srgb, var(--seal) 45%, var(--line));
  background: color-mix(in srgb, var(--seal) 10%, var(--card));
  font-weight: 650;
}
.sao-han-date-solar { min-width: 6.2rem; font-variant-numeric: tabular-nums; }
.sao-han-date-wd { min-width: 5.2rem; }
.sao-han-chip {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.02em;
  padding: 0.1rem 0.45rem; border-radius: 999px;
  background: color-mix(in srgb, var(--seal) 18%, var(--card)); color: var(--ink);
}
.sao-han-chip.is-past { background: var(--chip); font-weight: 550; }
.sao-han-card .badge-verdict,
.sao-han-family-card .badge-verdict {
  display: inline-block; border-radius: 999px; padding: 0.12rem 0.55rem;
  font-size: 0.82rem; font-weight: 700; border: 1px solid var(--line);
  background: var(--chip); color: var(--ink); vertical-align: middle;
}
.sao-han-card .badge-verdict.is-good {
  background: color-mix(in srgb, var(--good) 16%, var(--card)); color: var(--good);
  border-color: color-mix(in srgb, var(--good) 35%, var(--line));
}
.sao-han-card .badge-verdict.is-bad {
  background: color-mix(in srgb, var(--poor) 14%, var(--card)); color: var(--poor);
  border-color: color-mix(in srgb, var(--poor) 35%, var(--line));
}
.sao-han-card .badge-verdict.is-mixed {
  background: color-mix(in srgb, var(--gold) 18%, var(--card)); color: var(--ink);
}
.sao-han-family-list { display: grid; gap: 0.75rem; margin-top: 1rem; }

/* M08S — Sao hạn forms + family chips + source rows */
.sao-han-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px 16px;
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
  background: transparent;
  align-items: start;
}
@media (min-width: 720px) {
  .sao-han-form { grid-template-columns: 1fr 1fr; }
}
.sao-han-field {
  display: grid;
  gap: 4px;
  min-width: 0;
  font-weight: 600;
}
.sao-han-field > span { font-size: 0.92rem; }
.sao-han-field input,
.sao-han-field select,
.sao-han-field button {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 44px;
}
.sao-han-field small.note { font-weight: 400; }
.sao-han-field-action { align-content: end; }
.sao-han-field-spacer { display: block; font-size: 0.92rem; visibility: hidden; }
.sao-han-people {
  list-style: none; margin: 0 0 1rem; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.sao-han-person-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.95rem;
}
.sao-han-person-remove {
  border: 0; background: transparent; color: var(--muted);
  min-width: 32px; min-height: 32px; border-radius: 999px; cursor: pointer;
  font-size: 1rem; line-height: 1;
}
.sao-han-person-remove:hover { color: var(--ink); background: var(--chip); }
.sao-han-diff-row {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem 0.65rem;
  margin: 0.25rem 0 0.15rem;
}
.sao-han-diff-value { font-weight: 650; }
.sao-han-diff-sources { color: var(--muted); }

/* M13 — Đếm ngày & sự kiện */
.dem-ngay-head { margin: 0 0 1.25rem; }
.dem-ngay-head .lead { max-width: 40rem; color: var(--muted); }
.dem-preset-list {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.dem-preset-card {
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px;
  background: color-mix(in srgb, var(--bg) 55%, var(--card));
}
.dem-preset-card strong { display: block; font-family: var(--serif); font-size: 1.05rem; }
.dem-count { margin: 6px 0 4px; font-weight: 700; color: var(--seal); font-size: 1.1rem; }
.dem-panel { margin: 14px 0; display: grid; gap: 10px; }
.dem-field { display: grid; gap: 4px; }
.dem-field input { max-width: 16rem; }
.dem-result { margin: 0; font-weight: 650; font-size: 1.05rem; min-height: 1.4em; }
.dem-event-list { display: grid; gap: 10px; }
.dem-event-card {
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card);
}
.dem-event-card h3 { margin: 0 0 4px; font-family: var(--serif); font-size: 1.1rem; }
.events-home-panel { margin: 16px 0 8px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.events-home-panel h2 { margin: 0 0 10px; font-family: var(--serif); font-size: 1.25rem; }
.events-home-cards { display: grid; gap: 10px; }
.events-home-card { padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--bg) 55%, var(--card)); }
.events-home-card h3 { margin: 0 0 6px; font-family: var(--serif); font-size: 1.15rem; }
.events-home-card .dem-count { margin: 0 0 4px; }

.dem-date-dmy {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  max-width: 11rem;
}
.dem-date-hint { margin: 0 0 12px; }

/* M14 / M14R — Thần số học */
.than-so-head .kicker { letter-spacing: 0.04em; text-transform: uppercase; color: var(--seal); font-weight: 700; }
.than-so-form { display: grid; gap: 10px; }
.than-so-layout { display: grid; gap: 16px; }
.than-so-side { display: grid; gap: 16px; align-content: start; }
.than-so-main { display: grid; gap: 16px; }
@media (min-width: 1024px) {
  .than-so-layout {
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    align-items: start;
  }
  .than-so-side { position: sticky; top: 1rem; }
}
.than-gloss { font-size: 1.05rem; line-height: 1.55; white-space: pre-line; }
.than-steps { margin: 8px 0 0; padding-left: 1.2rem; }
.than-num-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.than-num-block { margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.than-num-block:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.than-word { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.than-letter { border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px; font-variant-numeric: tabular-nums; }
.than-letter.is-vowel { border-color: var(--seal); color: var(--seal); }
.than-chart-table { border-collapse: collapse; margin: 10px 0; }
.than-chart-table td {
  border: 1px solid var(--line); width: 4.5rem; height: 4.5rem; text-align: center; vertical-align: middle;
}
.than-chart-table td.is-missing { background: color-mix(in srgb, var(--line) 35%, transparent); }
.than-cell-n { display: block; color: var(--muted); font-size: 0.8rem; }
.than-arrows { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; }
.than-arrow-chips {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.than-arrow-chips li {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.9rem;
}
.than-pinnacle-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.than-so-disclaimer { margin-top: 18px; }
.than-cell-n { font-size: 0.85rem; }

/* M15 / M15R cung hoàng đạo */
.cung-layout { display: grid; gap: 16px; }
.cung-side, .cung-main { display: grid; gap: 16px; align-content: start; }
@media (min-width: 1024px) {
  .cung-layout {
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    align-items: start;
  }
  .cung-side { position: sticky; top: 1rem; }
}
.cung-sign-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
}
.cung-sign-grid a {
  display: grid; gap: 4px; justify-items: start; text-decoration: none; color: inherit;
  padding: 10px 8px; border: 1px solid var(--line); border-radius: 8px;
  min-height: 5.5rem;
}
.cung-sign-grid .is-active a { border-color: var(--seal); }
.cung-card-glyph.creature { width: 48px; height: 48px; color: var(--seal); }
.cung-glyph-svg.creature { color: var(--seal); margin-bottom: 6px; }
.cung-astro { margin-top: 8px; }
.cung-astro summary { cursor: pointer; color: var(--seal); }
@media (min-width: 1024px) {
  .cung-hoang-dao .cung-sign-grid { grid-template-columns: repeat(4, 1fr); }
}

/* M16 — Xin xăm Quán Âm */
.xin-layout { display: grid; gap: 16px; }
.xin-side, .xin-main { display: grid; gap: 16px; align-content: start; }
@media (min-width: 1024px) {
  .xin-layout {
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    align-items: start;
  }
  .xin-side { position: sticky; top: 1rem; }
}
.xin-ritual { display: grid; gap: 10px; }
.xin-tube {
  display: grid; place-items: center;
  min-height: 7rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--seal) 6%, transparent);
}
.xin-tube-body {
  width: 3.2rem; height: 5.2rem;
  border: 2px solid var(--seal);
  border-radius: 0.6rem 0.6rem 0.35rem 0.35rem;
  display: grid; align-content: start; gap: 4px; padding: 8px 6px;
  background: color-mix(in srgb, var(--paper, #fff) 88%, var(--seal));
}
.xin-stick {
  display: block; height: 4px; border-radius: 2px;
  background: var(--seal); opacity: 0.75;
}
.xin-tube.is-shaking .xin-tube-body {
  animation: xin-shake 0.9s ease-in-out;
}
@media (prefers-reduced-motion: reduce) {
  .xin-tube.is-shaking .xin-tube-body { animation: none; }
}
@keyframes xin-shake {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  20% { transform: rotate(-8deg) translateY(-2px); }
  40% { transform: rotate(8deg) translateY(1px); }
  60% { transform: rotate(-6deg) translateY(-1px); }
  80% { transform: rotate(5deg) translateY(0); }
}
.xin-han {
  font-family: "Noto Sans SC", "Noto Serif CJK TC", "Source Han Sans SC", serif;
  font-size: 1.15rem;
  line-height: 1.55;
  letter-spacing: 0.02em;
}
.xin-am { color: var(--muted); margin: 0.15rem 0; }
.xin-gloss { margin: 0 0 0.6rem; }
.xin-verse { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.xin-verse li { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.xin-verse li:last-child { border-bottom: 0; }
.xin-lot-grid {
  list-style: none; padding: 0; margin: 12px 0 0;
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
}
.xin-lot-grid a {
  display: grid; gap: 2px; text-decoration: none; color: inherit;
  padding: 8px; border: 1px solid var(--line); border-radius: 8px;
}
.xin-search { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 8px; }
.xin-search label { flex: 1 1 12rem; display: grid; gap: 4px; }
[data-xin-history-list] { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }

/* M16R — tube SVG, grade chips, topics */
.xin-tube {
  color: var(--seal);
}
.xin-tube-body {
  width: auto; height: auto;
  border: none; background: transparent; padding: 0;
  display: grid; place-items: center;
}
.xin-tube-svg { display: block; }
.xin-tube.is-shaking .xin-tube-body {
  animation: xin-shake 0.9s ease-in-out;
}
.xin-tube.is-shaking .xin-stick-line {
  animation: xin-stick-wiggle 0.9s ease-in-out;
}
@keyframes xin-stick-wiggle {
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(-3px); }
  50% { transform: translateY(2px); }
  75% { transform: translateY(-2px); }
}
.xin-grade-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.4;
}
.xin-grade-chip.tone-thuong {
  color: color-mix(in srgb, var(--seal) 85%, #0a7a3e);
  background: color-mix(in srgb, #0a7a3e 14%, transparent);
  border-color: color-mix(in srgb, #0a7a3e 40%, var(--line));
}
.xin-grade-chip.tone-trung {
  color: color-mix(in srgb, var(--seal) 70%, #8a6a12);
  background: color-mix(in srgb, #c9a227 16%, transparent);
  border-color: color-mix(in srgb, #c9a227 45%, var(--line));
}
.xin-grade-chip.tone-ha {
  color: color-mix(in srgb, var(--seal) 55%, #8b2e2e);
  background: color-mix(in srgb, #8b2e2e 12%, transparent);
  border-color: color-mix(in srgb, #8b2e2e 40%, var(--line));
}
.xin-result-kicker {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.xin-story { margin: 0.25rem 0 0.75rem; }
.xin-topics {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 10px;
}
.xin-topics li {
  display: grid; gap: 2px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.xin-topics li:last-child { border-bottom: 0; }
.xin-lot-grid a {
  align-items: start;
}
.xin-result-title {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin: 0 0 0.35rem;
}
.xin-grade-chip {
  width: fit-content;
  max-width: max-content;
  flex: 0 0 auto;
}
.xin-browse summary {
  cursor: pointer;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline;
  list-style: none;
}
.xin-browse summary::-webkit-details-marker { display: none; }
.xin-lot-grid-compact {
  grid-template-columns: repeat(auto-fill, minmax(4.2rem, 1fr));
  gap: 6px;
}
.xin-lot-grid-compact a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px; text-align: center;
  border: 1px solid var(--line); border-radius: 8px;
  text-decoration: none; color: inherit;
}
.xin-lot-grid-compact .xin-lot-story {
  display: none;
  font-size: 12px; color: var(--muted); line-height: 1.2;
}
.xin-lot-grid-compact a:focus .xin-lot-story,
.xin-lot-grid-compact a:hover .xin-lot-story {
  display: block;
}
.xin-dot {
  width: 0.55rem; height: 0.55rem; border-radius: 50%;
  display: inline-block;
  background: color-mix(in srgb, var(--seal) 55%, #c9a227);
}
.xin-dot.tone-thuong { background: color-mix(in srgb, #0a7a3e 70%, var(--seal)); }
.xin-dot.tone-trung { background: color-mix(in srgb, #c9a227 75%, var(--seal)); }
.xin-dot.tone-ha { background: color-mix(in srgb, #8b2e2e 65%, var(--seal)); }
.xin-triad { display: grid; gap: 2px; margin-bottom: 0.75rem; }
@media (min-width: 900px) {
  .xin-side .xin-tube-sticky { position: sticky; top: 4.5rem; }
}
