.tool-page { --gold: #8a6232; display: grid; gap: 16px; max-width: 100%; min-width: 0; overflow-x: clip; }
html[data-theme="muc"] .tool-page,
html[data-theme="go"] .tool-page,
html[data-theme="thuy"] .tool-page { --gold: #e4b15a; }
.tool-hero, .wheel-card, .result-card, .input-card, .day-pick, .empty-card, .summary-card {
  background:
    radial-gradient(420px 180px at 100% 0%, color-mix(in srgb, var(--seal) 8%, transparent), transparent 60%),
    var(--card);
  border: 1px solid color-mix(in srgb, var(--seal) 42%, var(--line));
  border-radius: 22px;
  box-shadow: inset 0 0 0 6px color-mix(in srgb, var(--card) 88%, transparent), inset 0 0 0 7px color-mix(in srgb, var(--seal) 28%, var(--line));
  padding: 16px;
}
.tool-hero { display: flex; gap: 14px; align-items: center; }
.tool-hero h1 { font-family: "Source Serif 4", serif; font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0; }
.tool-hero p { margin: 6px 0 0; color: var(--muted); }
/* DX9 /ho-so: single composition — no nested card frame */
.profiles-hero { margin: 0 0 4px; }
.profiles-hero h1 { font-family: "Source Serif 4", serif; font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0; }
.profiles-hero p { margin: 6px 0 0; color: var(--muted); }
.tool-mark {
  width: 64px; height: 64px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 32% 28%, #b14a42, #8c2f2a 56%, #5c1c18);
  color: #f8f1e6;
  box-shadow: 0 0 0 3px #c6a15a, 0 0 0 5px #6e241f;
}
.tool-mark .mark-icon, .tile .mark-icon, .summary-card .mark-icon { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.mark-icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.input-card h2, .summary-card h2, .empty-card h2, .tool-extra h2 { font-family: "Source Serif 4", serif; margin: 0 0 8px; }
.ymd {
  display: grid; grid-template-columns: 4.5rem 4.5rem 6.5rem; gap: 8px;
  border: 0; margin: 0; padding: 0; width: max-content; max-width: 100%;
}
.ymd input::placeholder { color: color-mix(in srgb, var(--muted) 65%, transparent); }
.ymd legend { grid-column: 1 / -1; font-weight: 700; padding: 0; }
.ymd input, .side-form input, .side-form textarea, .tool-form input[type="text"], .tool-form input[type="number"], .tool-form select, .tool-form textarea {
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  padding: 0 10px;
}
.switch { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 650; }
.switch input { position: absolute; opacity: 0; }
.switch span {
  width: 44px; height: 26px; border-radius: 999px; background: var(--line); position: relative;
}
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--card);
}
.switch input:checked + span { background: var(--seal); }
.switch input:checked + span::after { left: 21px; }
.switch input:focus-visible + span { outline: 2px solid var(--seal); }
.choice-row, .hour-row, .tile-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-row label, .hour-row label {
  min-height: 40px; display: inline-flex; align-items: center; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.choice-row input, .hour-row input { position: absolute; opacity: 0; }
.choice-row input:checked + span, .hour-row input:checked + span,
.choice-row label:has(input:checked), .hour-row label:has(input:checked) {
  background: var(--seal); color: var(--seal-ink); border-color: var(--seal);
}
.tile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 720px) { .tile-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  min-height: 84px; padding: 10px;
  border-radius: 16px; border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  text-decoration: none; font-weight: 650;
}
.tile[aria-current="page"] { background: var(--seal); color: var(--seal-ink); border-color: var(--seal); box-shadow: none; }
.group-label { margin: 12px 0 6px; color: var(--seal); font-weight: 700; }
.seal-mini { width: 72px; height: 72px; flex: none; box-shadow: 0 0 0 2px #c6a15a, 0 0 0 4px #6e241f; }
.seal-mini b { font-size: 26px; }
.gauge-sm { width: 72px; height: 72px; }
.gauge-sm text { font-size: 20px; }
.hour-chips { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.hour-chips li { border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; background: var(--bg); }
.hour-chips small { color: var(--muted); }
.open-day, .tool-form button, .converter-form button, .side-form button, .empty-card a, .hub-search button {
  display: inline-flex; min-height: 44px; align-items: center; justify-content: center;
  padding: 0 16px; border-radius: 999px; border: 0;
  background: var(--seal); color: var(--seal-ink); font: inherit; font-weight: 700; text-decoration: none;
}
.result-top { display: flex; gap: 12px; align-items: center; }
.result-top h2 { margin: 0; font-family: "Source Serif 4", serif; font-size: 1.25rem; }
.summary-card .who { display: flex; gap: 12px; align-items: center; }
.status-row { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 8px 0 0; }
.status-row li { border-radius: 999px; padding: 4px 10px; font-weight: 700; background: color-mix(in srgb, var(--good) 16%, var(--card)); color: var(--good); }
.status-row li.is-bad { background: color-mix(in srgb, var(--poor) 14%, var(--card)); color: var(--poor); }
.sort-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.sort-bar a { min-height: 40px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); text-decoration: none; background: var(--card); }
.sort-bar a[aria-current="true"] { background: var(--seal); color: var(--seal-ink); border-color: var(--seal); }
.day-list { display: grid; gap: 12px; }
.day-pick.is-top { border-color: var(--gold); }
.top-flag { grid-column: 1 / -1; margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #6e4e1e; }
html[data-theme="muc"] .top-flag,
html[data-theme="go"] .top-flag,
html[data-theme="thuy"] .top-flag { color: var(--gold); }
.pick-date { display: flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; }
.pick-date strong { display: block; font-family: "Source Serif 4", serif; font-size: 1.25rem; }
.pick-date span { display: block; color: var(--muted); }
.pick-verdict { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.badge-verdict {
  flex: none;
  white-space: nowrap;
  min-width: max-content;
  padding-inline: 12px;
}
.badge.is-best, .badge.is-good { background: color-mix(in srgb, var(--good) 16%, var(--card)); color: var(--good); }
.badge.is-fair { background: color-mix(in srgb, var(--gold) 22%, var(--card)); color: #6e4e1e; }
.badge.is-mid, .badge.is-fact { background: var(--chip); color: var(--ink); }
.tie-note { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 13px; }
html[data-theme="muc"] .badge.is-fair,
html[data-theme="go"] .badge.is-fair,
html[data-theme="thuy"] .badge.is-fair { color: var(--gold); }
.pick-why { display: grid; gap: 6px; }
.fit-list, .note-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.fit-list li, .note-list li { border-radius: 999px; padding: 4px 10px; background: var(--bg); border: 1px solid var(--line); }
.fit-list li::before { content: "✓ "; color: var(--good); font-weight: 700; }
.fit-list li.more { background: transparent; border: 0; padding: 0; }
.fit-list li.more::before { content: none; }
.fit-list li.more ul { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 6px 0 0; margin: 0; }
.fit-list li.more li { border-radius: 999px; padding: 4px 10px; background: var(--bg); border: 1px solid var(--line); }
.fit-gauge { display: grid; justify-items: center; }
.fit-gauge small { color: var(--muted); font-size: 12px; }
.rank-factors { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; color: var(--muted); font-size: 12px; }
.rank-factors span { border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; background: var(--bg); }
.rank-breakdown { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.rank-breakdown summary { cursor: pointer; color: var(--seal); font-weight: 650; min-height: 32px; display: inline-flex; align-items: center; }
.rank-breakdown p { margin: 4px 0 0; }
.term-ref { color: var(--seal); text-decoration: underline; text-underline-offset: 2px; }
.term-i { display: inline-flex; align-items: center; justify-content: center; width: 1.25rem; height: 1.25rem; margin-left: 2px; border-radius: 999px; border: 1px solid var(--line); color: var(--seal); font-size: 11px; text-decoration: none; vertical-align: middle; }
.term-page .badge { display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.sources-panel { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 8px; }
.sources-panel summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 650; color: var(--seal); }
.sources-panel p { color: var(--muted); margin: 0 0 8px; }
.source-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
/* Distinguish source links by underline + weight, not color alone (LH link-in-text-block). */
.sources-panel a,
.source-list a,
a.source-link {
  color: var(--seal);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 650;
}
.big-num { margin: 0; font-family: "Source Serif 4", serif; font-size: 3rem; line-height: 1; color: var(--seal); }
.note-list li::before { content: "⚠ "; }
.day-pick details summary { min-height: 40px; display: inline-flex; align-items: center; cursor: pointer; color: var(--seal); font-weight: 700; }
@media (min-width: 800px) {
  .day-pick { display: grid; grid-template-columns: minmax(200px, 1.2fr) auto minmax(160px, .8fr); column-gap: 12px; align-items: center; }
  .pick-why { grid-column: 1 / -1; }
}
.heat { margin-top: 8px; }
.heat summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; cursor: pointer; }
.heat-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.heat-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.heat-legend .heat-cell { min-height: 32px; padding: 4px 8px; font-size: 13px; }
.heat-cell, .heat-grid span { min-height: 44px; display: grid; place-items: center; border-radius: 10px; text-decoration: none; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.05; }
.heat-cell b { font-weight: 700; }
.heat-cell small { font-size: 11px; color: var(--muted); }
.heat-head span { color: var(--muted); font-size: 12px; min-height: 24px; font-weight: 700; }
.heat-cell.is-best { background: color-mix(in srgb, var(--good) 55%, var(--card)); }
.heat-cell.is-good { background: color-mix(in srgb, var(--good) 28%, var(--card)); }
.heat-cell.is-fair { background: color-mix(in srgb, var(--gold) 40%, var(--card)); }
.heat-cell.is-mid, .heat-cell.is-fact { background: var(--chip); }
.heat-cell.is-off, .heat-cell.is-pad { background: transparent; color: var(--muted); }
.heat-cell.is-weekend { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--muted) 45%, transparent); }
.heat-cell.is-today { outline: 2px solid var(--seal); outline-offset: 1px; }
.empty-card { display: grid; gap: 10px; }
.empty-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.empty-card a.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.tool-extra { display: grid; gap: 8px; }
.faq { border-bottom: 1px solid var(--line); padding: 4px 0; }
.faq summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 650; }
.related { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
@media (min-width: 720px) { .related { grid-template-columns: 1fr 1fr; } }
.ring { position: relative; height: 340px; margin: 8px auto; max-width: 360px; }
.ring-node {
  position: absolute; left: 50%; top: 50%;
  width: 64px; min-height: 36px; margin: -18px 0 0 -32px;
  display: grid; place-items: center;
  border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); text-decoration: none; font-weight: 700;
  transform: rotate(calc(var(--i) * 30deg)) translateY(-132px) rotate(calc(var(--i) * -30deg));
}
.ring-node.is-self { background: var(--seal); color: var(--seal-ink); border-color: var(--seal); }
.ring-node.is-tam, .ring-key .is-tam { background: color-mix(in srgb, var(--good) 28%, var(--card)); }
.ring-node.is-luc { background: color-mix(in srgb, var(--good) 12%, var(--card)); }
.ring-node.is-xung, .ring-key .is-xung { background: color-mix(in srgb, var(--poor) 22%, var(--card)); }
.ring-node.is-tu, .ring-key .is-tu { background: color-mix(in srgb, var(--poor) 10%, var(--card)); }
.ring-core, .compass-core {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 92px; height: 92px; border-radius: 50%;
  display: grid; place-items: center; text-align: center;
  background: var(--card); border: 1px solid var(--line);
}
.ring-key { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.ring-key li { border-radius: 12px; padding: 8px 10px; }
.pair { display: grid; gap: 8px; align-items: center; }
@media (min-width: 720px) { .pair { grid-template-columns: 1fr auto 1fr; } }
.pair > div { border: 1px solid var(--line); border-radius: 16px; padding: 12px; background: var(--bg); }
.pair strong, .pair span, .pair small { display: block; }
.pair span, .pair small { color: var(--muted); }
.pair-mid { text-align: center; font-weight: 700; background: var(--card); }
.tool-page .compass {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(72px, auto));
  gap: 6px;
  width: min(480px, 100%);
  height: auto;
  margin: 0 auto;
}
.compass-cell { min-height: 72px; border-radius: 14px; padding: 8px; display: grid; align-content: center; }
.compass-cell strong, .compass-cell span { display: block; }
.compass-cell span { color: var(--muted); font-size: 13px; }
.compass-cell.is-good { background: color-mix(in srgb, var(--good) 18%, var(--card)); }
.compass-cell.is-poor { background: color-mix(in srgb, var(--poor) 12%, var(--card)); }
.compass-orient {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 8px;
}
.star-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 16px;
  font-size: 0.92rem;
  color: var(--ink);
}
.star-table caption {
  caption-side: top;
  text-align: left;
  font-weight: 700;
  padding: 0 0 8px;
  color: var(--ink);
}
.star-table th, .star-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  background: var(--card);
  vertical-align: top;
}
.star-table th { background: color-mix(in srgb, var(--ink) 6%, var(--card)); }
.color-swatch-groups { display: grid; gap: 14px; margin: 12px 0 16px; }
.color-swatch-group h3 { margin: 0 0 6px; font-size: 1rem; }
.color-swatches {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.color-swatches li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px 10px;
  background: var(--card);
  color: var(--ink);
}
.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--ink) 25%, var(--line));
  background: var(--swatch, #888);
  flex: 0 0 auto;
}
.tool-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 4px;
}
.tool-link-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--seal) 12%, var(--card));
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}
.tool-link-btn:hover, .tool-link-btn:focus-visible {
  border-color: var(--seal);
  outline: 2px solid color-mix(in srgb, var(--seal) 40%, transparent);
  outline-offset: 2px;
}
.section-prose { margin: 8px 0 12px; color: var(--ink); }
/* M02 Huyền Không phi tinh — south-up grid; ink from theme tokens. */
.phi-tinh { margin: 8px 0 16px; color: var(--ink); }
.phi-tinh-meta { margin: 0 0 10px; color: var(--muted); }
.phi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  max-width: 420px;
  margin: 0 auto 12px;
}
.phi-cell {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  padding: 10px 8px;
  min-height: 88px;
  display: grid;
  gap: 2px;
  align-content: center;
  text-align: center;
}
.phi-cell.is-center {
  background: color-mix(in srgb, var(--seal) 14%, var(--card));
  border-color: var(--seal);
}
.phi-dir { font-size: 12px; color: var(--muted); }
.phi-num { font-size: 1.45rem; font-weight: 800; color: var(--ink); }
.phi-name { font-weight: 700; }
.phi-el { font-size: 12px; color: var(--muted); }
.phi-alt {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  color: var(--ink);
}
.phi-alt th, .phi-alt td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  background: var(--card);
}
.phi-alt caption { caption-side: bottom; color: var(--muted); padding-top: 6px; }
.compass-cell:nth-child(1) { grid-column: 1; grid-row: 1; }
.compass-cell:nth-child(2) { grid-column: 2; grid-row: 1; }
.compass-cell:nth-child(3) { grid-column: 3; grid-row: 1; }
.compass-cell:nth-child(4) { grid-column: 1; grid-row: 2; }
.compass-cell:nth-child(5) { grid-column: 3; grid-row: 2; }
.compass-cell:nth-child(6) { grid-column: 1; grid-row: 3; }
.compass-cell:nth-child(7) { grid-column: 2; grid-row: 3; }
.compass-cell:nth-child(8) { grid-column: 3; grid-row: 3; }
.compass-core { position: relative; left: auto; top: auto; transform: none; grid-column: 2; grid-row: 2; width: auto; height: auto; }
.huong-rose { display: grid; gap: 16px; margin: 12px 0 20px; }
@media (min-width: 900px) {
  .huong-rose { grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); align-items: start; }
}
.huong-rose-svg { width: min(360px, 100%); height: auto; justify-self: center; }
.huong-ring { fill: none; stroke: color-mix(in srgb, var(--ink) 28%, var(--line)); stroke-width: 1.2; }
.huong-wedge { stroke: color-mix(in srgb, var(--ink) 20%, var(--line)); stroke-width: 0.6; opacity: 0.92; }
.huong-wedge.is-good { fill: color-mix(in srgb, var(--good) 34%, transparent); }
.huong-wedge.is-poor { fill: color-mix(in srgb, var(--poor) 28%, transparent); }
.huong-dir-label { font-size: 14px; font-weight: 800; fill: var(--ink); letter-spacing: 0.02em; }
.huong-tick { stroke: var(--ink); stroke-width: 1.4; }
.huong-tick.is-current { stroke: var(--seal); stroke-width: 2.4; }
.huong-son { font-size: 9.5px; font-weight: 700; fill: color-mix(in srgb, var(--ink) 72%, var(--muted)); }
.huong-son.is-current { fill: var(--seal); font-weight: 800; font-size: 11px; }
.huong-needle { stroke: var(--seal); stroke-width: 2.6; stroke-linecap: round; }
.huong-needle-tip { fill: var(--seal); }
.huong-toa-needle { stroke: color-mix(in srgb, var(--ink) 55%, var(--line)); stroke-width: 1.8; stroke-dasharray: 4 3; }
.huong-toa-dot { fill: color-mix(in srgb, var(--ink) 55%, var(--line)); }
.huong-hub { fill: var(--ink); }
.huong-core { font-size: 13px; font-weight: 800; fill: var(--ink); }
.compass-core .huong-facing, .compass-core .huong-toa { display: block; font-size: 12px; color: var(--muted); font-weight: 550; margin-top: 2px; }
.huong-chips .choice-row { flex-wrap: wrap; }
.huong-son-table-wrap { grid-column: 1 / -1; }
.huong-son-table-wrap h3 { margin: 4px 0 8px; font-size: 1rem; }
.huong-son-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.huong-son-table th, .huong-son-table td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.huong-son-table tr.is-current { background: color-mix(in srgb, var(--seal) 16%, var(--card)); font-weight: 700; }

.luban-board { display: grid; gap: 10px; margin: 12px 0 18px; }
.luban-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: baseline; }
.luban-meta span { color: var(--muted); font-size: 0.92rem; }
.luban-measured { color: var(--ink) !important; font-weight: 650; }
.luban-track {
  position: relative; height: 88px; overflow: hidden; border-radius: 14px;
  border: 1px solid var(--line); background: color-mix(in srgb, var(--card) 88%, var(--bg));
  touch-action: none; cursor: grab;
}
.luban-track.is-dragging { cursor: grabbing; }
.luban-strip { display: flex; height: 64px; width: 300%; will-change: transform; transition: transform 40ms linear; }
.luban-seat {
  display: flex; align-items: center; justify-content: center; min-width: 0;
  border-right: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
  font-size: 11px; font-weight: 700; padding: 0 6px; text-align: center;
}
.luban-seat.is-good { background: color-mix(in srgb, var(--good) 34%, transparent); color: var(--ink); }
.luban-seat.is-poor { background: color-mix(in srgb, var(--poor) 26%, transparent); color: var(--ink); }
.luban-seat.is-current { outline: 2px solid var(--seal); outline-offset: -2px; }
.luban-seat-name {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden; white-space: normal; line-height: 1.15; max-width: 100%;
  word-break: keep-all;
}
.luban-ticks {
  position: absolute; left: 0; right: 0; bottom: 0; height: 24px;
  pointer-events: none; width: 300%; will-change: transform;
}
.luban-tick { position: absolute; bottom: 0; transform: translateX(-50%); text-align: center; }
.luban-tick i {
  display: block; width: 1px; height: 8px; margin: 0 auto 2px;
  background: color-mix(in srgb, var(--ink) 45%, transparent);
}
.luban-tick em {
  font-style: normal; font-size: 9px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.luban-needle {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px;
  background: var(--seal); box-shadow: 0 0 0 1px color-mix(in srgb, var(--seal) 35%, transparent);
  pointer-events: none;
}
.luban-needle::before {
  content: ""; position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 8px solid var(--seal);
}
.luban-legend {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px;
}
@media (min-width: 720px) {
  .luban-legend { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.luban-legend li {
  display: grid; grid-template-columns: 10px 1fr auto; gap: 6px; align-items: center;
  font-size: 12px; padding: 4px 6px; border-radius: 8px;
  border: 1px solid transparent;
}
.luban-legend li.is-current { border-color: var(--seal); background: color-mix(in srgb, var(--seal) 10%, transparent); }
.luban-swatch { width: 10px; height: 10px; border-radius: 2px; }
.luban-legend li.is-good .luban-swatch { background: var(--good); }
.luban-legend li.is-poor .luban-swatch { background: var(--poor); }
.luban-legend-name { font-weight: 650; min-width: 0; }
.luban-legend-cm { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.luban-readout { margin: 0; font-weight: 650; }
.luban-items .choice-row, .luban-unit .choice-row { flex-wrap: wrap; }
.stepper[data-luban-length] > span[data-luban-unit-label] {
  white-space: nowrap; flex: 0 0 auto; min-width: 4.5rem;
}

.sign-card h2 { font-family: "Source Serif 4", serif; margin: 0; }
.hub-search { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.hub-search input[type="search"] { flex: 1; min-width: 180px; min-height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 0 14px; }
.filter-row, .hub-picks { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.filter-row a, .hub-card {
  flex: none; min-height: 40px; display: inline-flex; align-items: center; gap: 6px;
  padding: 0 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); text-decoration: none; font-weight: 650;
}
.filter-row a[aria-current="true"] { background: var(--seal); color: var(--seal-ink); border-color: var(--seal); }
.hub-grid { display: grid; gap: 8px; }
@media (min-width: 720px) { .hub-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .hub-grid { grid-template-columns: 1fr 1fr 1fr; } }
.hub-card { flex: unset; border-radius: 16px; padding: 12px; align-items: flex-start; min-height: 96px; flex-direction: column; }
.hub-card span { color: var(--muted); font-weight: 450; }
.hub-card .badge { align-self: flex-start; }
.recent-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.recent-list a { min-height: 40px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.tool-page > .note { overflow-wrap: anywhere; }
.tool-page > .note a { color: var(--ink); }
.tool-page .facts div { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 14px; background: var(--bg); min-width: 0; }
.tool-page .facts dd { margin: 0; overflow-wrap: anywhere; }
.tool-page .countdown li { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; }
.related a { display: block; font-weight: 400; color: var(--ink); }
.related a strong { font-weight: 600; }
.related span { display: block; color: var(--muted); font-weight: 400; }
.facts-card, .bars { margin-top: 8px; }
.table-search { display: block; margin: 8px 0 12px; }
.table-search input[type="search"] {
  width: 100%;
  max-width: 28rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--outline);
  border-radius: var(--radius-sm, 8px);
  background: var(--surface);
  color: var(--on-surface);
  font: inherit;
}
.star-table tr.is-highlight td {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
}
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
.range-custom, .range-month { display: none; }
.tool-form:has(input[name="span"][value="custom"]:checked) .range-custom,
.tool-form:has(input[name="span"][value=""]:checked) .range-month { display: grid; gap: 8px; }
.tool-form:not(:has(input[name="span"])) .range-month { display: grid; gap: 8px; }

.accent-hoa { --accent: #8c2f2a; }
.accent-thuy { --accent: #1d4e6f; }
.accent-tho { --accent: #6d4a22; }
.accent-moc { --accent: #1b5c38; }
.accent-kim { --accent: #5c5346; }
.el-hoa { --accent: #8c2f2a; }
.el-thuy { --accent: #1d4e6f; }
.el-tho { --accent: #6d4a22; }
.el-moc { --accent: #1b5c38; }
.el-kim { --accent: #5c5346; }
.seal-medallion {
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  color: #f8f1e6;
  background: radial-gradient(circle at 32% 28%, color-mix(in srgb, var(--accent, #8c2f2a) 72%, white), var(--accent, #8c2f2a) 58%, color-mix(in srgb, var(--accent, #8c2f2a) 70%, black));
  box-shadow: 0 0 0 3px #c6a15a, 0 0 0 5px color-mix(in srgb, var(--accent, #6e241f) 80%, black);
}
.seal-medallion .mark-icon { width: 28px; height: 28px; stroke: currentColor; fill: none; }
.hub-card { border-top: 4px solid var(--accent, var(--line)); gap: 8px; }
.hub-card .seal-medallion { color: #f8f1e6; }
.tool-page > section,
.tool-page > form,
.tool-page > header,
.giap-block,
.year-table { min-width: 0; max-width: 100%; }
.feature-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding-bottom: 0;
  overflow: visible;
}
.feature-strip .hub-card {
  flex: unset;
  width: auto;
  min-width: 0;
  max-width: none;
}
.hub-figures {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}
.hub-figures .hub-table-wrap {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.hub-figures .hub-table-wrap table {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border-collapse: collapse;
}
.hub-figures .hub-table-wrap th,
.hub-figures .hub-table-wrap td {
  text-align: left;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.count { color: var(--muted); font-size: 0.85em; font-weight: 650; }
.date-wheel { margin: 4px 0 8px; }
.date-wheel .wheel-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.date-wheel .snap-col { min-width: 0; }
.date-wheel .snap {
  position: relative;
  width: 100%; height: 196px; overflow-y: auto;
  scroll-snap-type: y mandatory; scrollbar-width: none;
  border-radius: 16px; background: var(--bg); border: 1px solid var(--line);
  mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
}
.date-wheel .snap::-webkit-scrollbar { display: none; }
.date-wheel .snap-pad { height: 76px; }
.date-wheel .snap-item {
  display: grid; place-items: center; width: 100%; height: 44px;
  scroll-snap-align: center; border: 0; background: transparent;
  color: var(--muted); font-family: "Source Serif 4", serif;
  font-size: 1.15rem; font-variant-numeric: tabular-nums;
}
.date-wheel .snap-item.is-on { color: var(--ink); font-size: 1.7rem; }
@media (prefers-reduced-motion: reduce) {
  .date-wheel .snap, .snap { scroll-snap-type: none; }
}
.giap-block { display: grid; gap: 16px; }
.giap-grid { display: grid; gap: 12px; }
@media (min-width: 720px) { .giap-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .giap-grid { grid-template-columns: 1fr 1fr 1fr; } }
.giap-card {
  display: grid; grid-template-columns: 72px 1fr; gap: 10px; align-items: center;
  padding: 12px; border-radius: 18px; text-decoration: none; color: var(--ink);
  background: var(--card); border: 1px solid var(--line);
  border-left: 6px solid var(--accent, var(--line));
}
.giap-card.is-on { box-shadow: 0 0 0 2px var(--accent, var(--seal)); }
.giap-copy { display: grid; gap: 2px; min-width: 0; }
.giap-copy strong { font-family: "Source Serif 4", serif; font-size: 1.25rem; }
.giap-copy em { font-style: normal; color: var(--accent, var(--ink)); font-weight: 700; }
.giap-copy span, .tag-row { color: var(--muted); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 8px 0 0; grid-column: 1 / -1; }
.tag-row li { border-radius: 999px; padding: 2px 8px; background: color-mix(in srgb, var(--accent, var(--seal)) 16%, var(--bg)); color: var(--ink); font-size: 13px; }
.tag-xung, .tag-tai, .band-khong em { color: var(--poor, #8c2f2a); }
.creature { display: block; width: 72px; height: 72px; color: var(--accent, var(--seal)); }
.creature-lg { width: 120px; height: 120px; }
.creature-svg { width: 100%; height: 100%; }
.creature-svg .seal-ring, .creature-svg path, .creature-svg circle, .creature-svg ellipse {
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.profile-hero {
  display: grid; gap: 12px; align-items: center;
  padding: 16px; border-radius: 20px; background: var(--card);
  border: 1px solid var(--line); border-top: 6px solid var(--accent, var(--seal));
  color: inherit; text-decoration: none;
}
@media (min-width: 720px) { .profile-hero { grid-template-columns: 120px 1fr; } }
.profile-hero h1, .profile-hero h2 { font-family: "Source Serif 4", serif; margin: 0; font-size: 2.4rem; }
.fact-pills, .link-row { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 8px 0; }
.fact-pills li, .link-row a {
  min-height: 36px; display: inline-flex; align-items: center; padding: 0 12px;
  border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--ink); text-decoration: none;
}
.fact-pills li.fact-el {
  background: color-mix(in srgb, var(--accent, var(--ink)) 18%, var(--bg));
  color: var(--accent, var(--ink));
  font-weight: 750;
  border-color: color-mix(in srgb, var(--accent, var(--line)) 55%, var(--line));
}
.wheel-wrap { display: grid; justify-items: center; gap: 8px; }
.rel-wheel { width: min(480px, 100%); height: auto; }
.rel-wheel .wire { fill: color-mix(in srgb, currentColor 8%, transparent); stroke-width: 1.6; }
.rel-wheel .wire-tri { stroke: #8c2f2a; fill: color-mix(in srgb, #8c2f2a 12%, transparent); opacity: 0.35; }
.rel-wheel .wire-sq { stroke: #1d4e6f; fill: color-mix(in srgb, #1d4e6f 10%, transparent); opacity: 0; }
.rel-wheel[data-hot] .wire { opacity: 0.12; }
.rel-wheel[data-hot="0"] .wire[data-m~="0"],
.rel-wheel[data-hot="1"] .wire[data-m~="1"],
.rel-wheel[data-hot="2"] .wire[data-m~="2"],
.rel-wheel[data-hot="3"] .wire[data-m~="3"],
.rel-wheel[data-hot="4"] .wire[data-m~="4"],
.rel-wheel[data-hot="5"] .wire[data-m~="5"],
.rel-wheel[data-hot="6"] .wire[data-m~="6"],
.rel-wheel[data-hot="7"] .wire[data-m~="7"],
.rel-wheel[data-hot="8"] .wire[data-m~="8"],
.rel-wheel[data-hot="9"] .wire[data-m~="9"],
.rel-wheel[data-hot="10"] .wire[data-m~="10"],
.rel-wheel[data-hot="11"] .wire[data-m~="11"] { opacity: 1; stroke-width: 2.4; }
.rel-wheel a circle { fill: var(--card); stroke: var(--accent, var(--ink)); stroke-width: 1.4; }
.rel-wheel a.is-self circle { fill: var(--seal); }
.rel-wheel text { font-size: 11px; fill: var(--ink); pointer-events: none; }
.rel-wheel a.is-self text { fill: var(--seal-ink, #f8f1e6); }
.rel-cards { display: grid; gap: 10px; }
@media (min-width: 720px) { .rel-cards { grid-template-columns: 1fr 1fr; } }
.rel-cards article { padding: 12px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.rel-cards h3 { margin: 0 0 4px; font-family: "Source Serif 4", serif; }
.year-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.year-table table { width: 100%; min-width: 880px; border-collapse: collapse; }
.year-table caption { text-align: left; padding: 12px; font-family: "Source Serif 4", serif; font-size: 1.3rem; }
.year-table th, .year-table td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--line); white-space: nowrap; }
.year-table th { color: var(--muted); font-weight: 650; }
.verdict { padding: 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.verdict h2 { margin: 0; font-family: "Source Serif 4", serif; font-size: 2rem; }
.verdict-count { margin: 6px 0 0; font-size: 1.15rem; }
.verdict-band { display: flex; gap: 6px; margin-top: 8px; font-size: 1.3rem; }
.mark-thuan { color: #1b5c38; }
.mark-ky { color: #8c2f2a; }
.shortlist-grid { display: grid; gap: 12px; margin-top: 12px; }
@media (min-width: 800px) { .shortlist-grid { grid-template-columns: 1fr 1fr; } }
.shortlist-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; align-items: center; }
.shortlist-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.shortlist-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface, #fffdf8); font-size: 0.95rem;
}
.shortlist-chip button { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 2px; }
.shortlist-dmy { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.shortlist-dmy-field { display: grid; gap: 4px; font-weight: 600; min-width: 0; }
.shortlist-dmy-field input {
  font: inherit; font-weight: 500; min-height: 40px; width: 4.2rem; padding: 6px 8px;
  border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  border-radius: 10px; background: var(--surface, #fffdf8); color: inherit;
}
.shortlist-dmy-field:last-of-type input { width: 5.2rem; }
.hour-chips li.is-ky { color: #8a2f1d; font-weight: 600; }
.factor.is-best { border-top: 4px solid #6d4a22; box-shadow: inset 0 0 0 1px color-mix(in srgb, #6d4a22 35%, transparent); }
.best-fit { font-weight: 600; margin: 8px 0; }
.reason-list, .age-check-list { margin: 6px 0; padding-left: 1.1rem; }
.reason-list li, .age-check-list li { margin: 2px 0; }
#shortlist-ics-download { min-height: 44px; }
.pair-roster { display: grid; gap: 10px; margin-bottom: 12px; min-width: 0; }
@media (min-width: 800px) { .pair-roster { grid-template-columns: 1fr 1fr; } }
.pair-pick { display: grid; gap: 6px; font-weight: 600; min-width: 0; }
.pair-pick select {
  font: inherit; font-weight: 500; padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  border-radius: 10px; background: var(--surface, #fffdf8); color: inherit;
  width: 100%; max-width: 100%; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pair-pick .note, .person-card .note, .pair-form .note {
  overflow-wrap: anywhere; word-break: break-word; max-width: 100%;
}
.person-card, .pair-form { min-width: 0; overflow: hidden; }
.pair-form { display: grid; gap: 12px; }
@media (min-width: 800px) { .pair-form { grid-template-columns: 1fr 1fr; } }
.person-card, .factor, .pair-people article {
  padding: 12px; border-radius: 16px; background: var(--card); border: 1px solid var(--line);
}
.person-card h2, .factor h3, .pair-people h3 { font-family: "Source Serif 4", serif; margin: 0 0 8px; }
.person-card[data-cal="year"] .snap-col[data-col="d"],
.person-card[data-cal="year"] .snap-col[data-col="m"] { display: none; }
.person-card:not([data-cal="lunar"]) .lunar-only { display: none; }
.pair-people { display: grid; gap: 12px; }
@media (min-width: 720px) { .pair-people { grid-template-columns: 1fr 1fr; } }
.factor-grid { display: grid; gap: 10px; }
@media (min-width: 800px) { .factor-grid { grid-template-columns: 1fr 1fr; } }
.factor.is-thuan { border-top: 4px solid #1b5c38; }
.factor.is-ky { border-top: 4px solid #8c2f2a; }
.factor.is-neutral { border-top: 4px solid #6d4a22; }
.pair-tabs a {
  min-height: 40px; display: inline-flex; align-items: center; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--ink);
}
.pair-tabs a[aria-current="page"] { background: var(--seal); color: var(--seal-ink); border-color: var(--seal); }
.stepper { display: flex; gap: 8px; align-items: center; }
.stepper input { width: 8rem; min-height: 44px; }
.share-row button { min-height: 44px; }
.verdict.is-rat, .verdict.is-hop { border-top: 6px solid #1b5c38; }
.verdict.is-binh { border-top: 6px solid #6d4a22; }
.verdict.is-lech, .verdict.is-xung { border-top: 6px solid #8c2f2a; }
.band-nen { border-left-color: #1b5c38; }
.band-khong { border-left-color: #8c2f2a; }
.band-binh { border-left-color: #6d4a22; }
.status-panel h2 { font-family: "Source Serif 4", serif; margin: 0 0 8px; }

/* DX8R profiles roster */
.profile-card { margin-bottom: 10px; }
.profile-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.profile-card-name { font-family: "Source Serif 4", serif; font-size: 1.15rem; }
.profile-active-badge {
  display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px;
  border-radius: 999px; font-size: 0.85rem; font-weight: 650;
  background: color-mix(in srgb, var(--seal) 18%, var(--card));
  color: var(--seal); border: 1px solid color-mix(in srgb, var(--seal) 40%, var(--line));
}
.profile-card.is-active { border-color: color-mix(in srgb, var(--seal) 55%, var(--line)); }
.profile-card-meta { margin: 0 0 10px; }
.profile-card-actions { gap: 8px; }
button.is-ghost {
  background: transparent; color: var(--ink);
  border: 1px solid var(--line);
}
button.is-danger, button.is-ghost.is-danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
  background: transparent;
}
button.is-danger.is-confirm {
  background: color-mix(in srgb, var(--danger) 12%, var(--card));
  font-weight: 700;
}
