/* ==========================================================================
   Phong Thủy — giao diện mới
   Bố cục biên tập, không quảng cáo. Thuần CSS, không phụ thuộc thư viện.
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --font-sans: ui-sans-serif, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", "Noto Serif", serif;

  --bg: #faf7f2;
  --bg-alt: #f2ebdf;
  --surface: #fffdfa;
  --surface-2: #f7f1e6;
  --ink: #17211f;
  --ink-2: #3b4a46;
  --muted: #6f7f7a;
  --brand: #0f4c46;
  --brand-2: #1a7f6f;
  --accent: #b8863b;
  --line: #e7ded0;
  --line-soft: #efe7dc;
  --shadow-sm: 0 1px 2px rgba(23, 33, 31, .05);
  --shadow: 0 2px 4px rgba(23, 33, 31, .04), 0 12px 32px -18px rgba(23, 33, 31, .35);
  --radius: 18px;
  --radius-sm: 12px;
  --wrap: 1180px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

[data-theme="dark"] {
  --bg: #0c1312;
  --bg-alt: #101a18;
  --surface: #121d1b;
  --surface-2: #16211f;
  --ink: #e9f0ed;
  --ink-2: #c3d0cb;
  --muted: #8a9c96;
  --brand: #5cb6a3;
  --brand-2: #7fcdbb;
  --accent: #d9ae62;
  --line: #22302d;
  --line-soft: #1b2725;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 2px 4px rgba(0, 0, 0, .3), 0 18px 40px -22px rgba(0, 0, 0, .8);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 600; line-height: 1.18; letter-spacing: -.012em; margin: 0; }
p { margin: 0 0 1em; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

.wrap { width: min(100% - 2.6rem, var(--wrap)); margin-inline: auto; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--brand); color: #fff; padding: .7rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; top: 1rem; border-radius: 8px; }
.progress { position: fixed; inset: 0 auto auto 0; height: 3px; width: 0; background: linear-gradient(90deg, var(--brand-2), var(--accent)); z-index: 60; transition: width .1s linear; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.header-inner { display: flex; align-items: center; gap: 1.5rem; height: 76px; }
.brand { display: flex; align-items: center; gap: .7rem; flex-shrink: 0; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 32% 28%, #1d6f64, var(--brand));
  color: #ecd9a8; font-size: 1.35rem; line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--font-serif); font-size: 1.22rem; letter-spacing: -.01em; }
.brand-text small { font-size: .72rem; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }

.main-nav { display: flex; gap: .15rem; margin-left: auto; }
.main-nav a {
  padding: .5rem .78rem; border-radius: 999px;
  font-size: .93rem; font-weight: 500; color: var(--ink-2);
  transition: background .18s var(--ease), color .18s var(--ease);
}
.main-nav a:hover { background: var(--surface-2); color: var(--ink); }
.main-nav a.on { background: var(--brand); color: #fff; }

.header-actions { display: flex; gap: .35rem; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; border-radius: 999px;
  cursor: pointer; color: var(--ink-2); transition: .18s var(--ease);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.nav-toggle { display: none; }
[data-theme="dark"] #themeToggle svg { transform: rotate(180deg); }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 1.55fr 1fr; gap: 1.6rem; padding: 2.4rem 0 .5rem; }
.hero-card {
  display: grid; grid-template-rows: auto 1fr;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  height: 100%;
}
.hero-media { display: block; height: 336px; overflow: hidden; background: var(--surface-2); }
.hero-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.hero-card:hover .hero-media img { transform: scale(1.03); }
.hero-body { padding: 1.4rem 1.6rem 1.5rem; }
.hero-body h2 { font-size: clamp(1.45rem, 2.4vw, 2.05rem); margin: .55rem 0 .6rem; }
.hero-body h2 a:hover { color: var(--brand); }
.hero-body p { color: var(--ink-2); font-size: .97rem; margin-bottom: .9rem; }

.hero-side { display: grid; gap: .85rem; align-content: start; }
.hero-mini {
  display: grid; grid-template-columns: 118px 1fr; gap: .95rem;
  padding: .8rem; background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.hero-mini:hover { border-color: var(--line); transform: translateY(-2px); }
.hero-mini-media { border-radius: 9px; overflow: hidden; aspect-ratio: 1; background: var(--surface-2); }
.hero-mini-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-mini h3 { font-size: 1rem; margin-top: .4rem; }
.hero-mini h3 a:hover { color: var(--brand); }

/* ---------- chips & meta ---------- */
.chip {
  display: inline-block; align-self: flex-start; width: fit-content;
  font-size: .72rem; font-weight: 650; letter-spacing: .06em;
  text-transform: uppercase; color: var(--brand); background: color-mix(in srgb, var(--brand) 9%, transparent);
  padding: .28rem .6rem; border-radius: 999px; transition: .18s var(--ease);
}
.chip:hover { background: color-mix(in srgb, var(--brand) 16%, transparent); }
[data-theme="dark"] .chip { color: var(--brand-2); }
.card-meta { display: flex; align-items: center; gap: .5rem; font-size: .79rem; color: var(--muted); margin-top: .55rem; flex-wrap: wrap; }
.dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .5; }

/* ---------- stats strip ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  margin: 2.6rem auto 1rem; background: var(--line-soft);
  border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden;
}
.stats > div { background: var(--surface); padding: 1.15rem 1.2rem; display: flex; flex-direction: column; gap: .1rem; }
.stats strong { font-family: var(--font-serif); font-size: 1.7rem; color: var(--brand); line-height: 1; }
.stats span { font-size: .8rem; color: var(--muted); letter-spacing: .03em; }

/* ---------- blocks ---------- */
.block { padding: 2.6rem 0 0; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.3rem; }
.block-head h2 { font-size: clamp(1.35rem, 2.2vw, 1.75rem); }
.more { display: inline-flex; align-items: center; gap: .35rem; font-size: .87rem; font-weight: 600; color: var(--brand); white-space: nowrap; }
.more svg { width: 16px; height: 16px; transition: transform .2s var(--ease); }
.more:hover svg { transform: translateX(3px); }

/* ---------- grid & cards ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
.grid-wide { grid-template-columns: repeat(3, 1fr); }
.card {
  display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line); }
.card-media { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-2); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.card:hover .card-media img { transform: scale(1.04); }
.card-ph {
  display: grid; place-items: center; height: 100%; font-family: var(--font-serif);
  font-size: 1.1rem; color: var(--muted); background: linear-gradient(135deg, var(--surface-2), var(--bg-alt));
}
.card-body { padding: 1.05rem 1.2rem 1.15rem; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { font-size: 1.08rem; margin: .5rem 0 .35rem; }
.card-body h3 a:hover { color: var(--brand); }
.card-ex { font-size: .88rem; color: var(--muted); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { margin-top: auto; padding-top: .7rem; }

/* ---------- popular list ---------- */
.popular { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--line-soft); }
.popular li { display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 1rem; padding: .95rem .2rem; border-bottom: 1px solid var(--line-soft); }
.popular li:hover { background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--brand) 4%, transparent)); }
.rank { font-family: var(--font-serif); font-size: 1.15rem; color: var(--accent); }
.popular a { font-weight: 520; font-size: 1rem; }
.popular a:hover { color: var(--brand); }
.chip-mini { font-size: .7rem; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }

/* ---------- page head ---------- */
.page-head { padding: 2.2rem 0 1.6rem; }
.page-head h1 { font-size: clamp(1.9rem, 3.6vw, 2.9rem); margin: .5rem 0 .45rem; }
.page-head.center { text-align: center; padding: 5rem 0; }
.lede { color: var(--muted); font-size: 1rem; }
.crumbs { display: flex; flex-wrap: wrap; gap: .45rem; font-size: .78rem; color: var(--muted); align-items: center; }
.crumbs a:hover { color: var(--brand); }
.crumbs span:last-child { color: var(--ink-2); }
.subchips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.1rem; }
.subchips .chip { text-transform: none; letter-spacing: 0; font-size: .82rem; font-weight: 550; padding: .4rem .8rem; border: 1px solid var(--line); background: var(--surface); }
.subchips .chip b { color: var(--muted); font-weight: 500; margin-left: .25rem; }
.subchips .chip.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); }

/* ---------- pagination ---------- */
.pagination { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; padding: 2.6rem 0 1rem; }
.page {
  min-width: 40px; height: 40px; padding: 0 .7rem; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  font-size: .9rem; font-weight: 550; color: var(--ink-2); transition: .18s var(--ease);
}
.page:hover { border-color: var(--brand); color: var(--brand); }
.page.current { background: var(--brand); border-color: var(--brand); color: #fff; }
.page.gap { border: none; background: none; color: var(--muted); }

/* ---------- article ---------- */
.article { padding-top: .6rem; }
.article-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 262px; gap: 3rem; align-items: start; }
.article-main { min-width: 0; }
.article-main h1 { font-size: clamp(1.85rem, 3.4vw, 2.7rem); margin: .55rem 0 .8rem; }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; font-size: .82rem; color: var(--muted); margin-bottom: 1.6rem; }
.article-meta svg { width: 15px; height: 15px; vertical-align: -2px; }
.article-hero { margin: 0 0 2rem; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.article-hero img { width: 100%; max-height: 520px; object-fit: cover; }

.article-aside { position: sticky; top: 100px; display: grid; gap: 1.4rem; }
.toc, .aside-cat, .aside-list { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 1rem 1.1rem; }
.toc h4, .aside-cat h4, .aside-list h4 { font-family: var(--font-sans); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: .7rem; }
.aside-list { display: grid; gap: .55rem; }
.aside-list a { font-size: .87rem; line-height: 1.4; color: var(--ink-2); padding-left: .8rem; position: relative; }
.aside-list a::before { content: ""; position: absolute; left: 0; top: .55em; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.aside-list a:hover { color: var(--brand); }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; counter-reset: toc; }
.toc li { font-size: .87rem; line-height: 1.4; }
.toc li.lvl-3 { padding-left: .9rem; font-size: .83rem; }
.toc a { color: var(--ink-2); }
.toc a:hover { color: var(--brand); }
.aside-cat-link { font-size: .92rem; font-weight: 550; color: var(--brand); }

.article-tags { display: flex; flex-wrap: wrap; gap: .45rem; margin: 2.2rem 0 0; padding-top: 1.4rem; border-top: 1px solid var(--line-soft); }
.tag {
  font-size: .8rem; color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--line); padding: .32rem .7rem; border-radius: 999px; transition: .18s var(--ease);
}
.tag:hover { border-color: var(--brand); color: var(--brand); }

.article-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2.4rem; }
.an { display: flex; flex-direction: column; gap: .25rem; padding: 1rem 1.1rem; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--surface); }
.an small { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.an span { font-weight: 550; font-size: .95rem; }
.an:hover { border-color: var(--brand); }
.an.next { text-align: right; }

/* ---------- prose ---------- */
.prose { font-size: 1.075rem; line-height: 1.78; color: var(--ink-2); max-width: 72ch; }
.prose > p:first-of-type { font-size: 1.16rem; color: var(--ink); }
.prose p { margin: 0 0 1.15em; }
.prose strong { color: var(--ink); font-weight: 650; }
.prose h2 { font-size: 1.55rem; margin: 2.2rem 0 .8rem; color: var(--ink); scroll-margin-top: 100px; }
.prose h3 { font-size: 1.25rem; margin: 1.9rem 0 .6rem; color: var(--ink); scroll-margin-top: 100px; }
.prose img { border-radius: var(--radius-sm); margin: 1.6rem auto; box-shadow: var(--shadow-sm); }
.prose ul, .prose ol { margin: 0 0 1.2em; padding-left: 1.35em; }
.prose li { margin-bottom: .45em; }
.prose blockquote {
  margin: 1.6rem 0; padding: .9rem 1.3rem; border-left: 3px solid var(--accent);
  background: var(--surface-2); border-radius: 0 10px 10px 0; color: var(--ink-2); font-style: italic;
}
.prose table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: .92rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: .55rem .7rem; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); font-family: var(--font-sans); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 2rem 0; }
.prose a { color: var(--brand); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* ---------- search ---------- */
.search-inline { display: flex; gap: .6rem; margin-top: 1.2rem; max-width: 620px; }
.search-inline input {
  flex: 1; padding: .8rem 1rem; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 1rem;
}
.search-inline input:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand); }
.search-inline button {
  padding: .8rem 1.4rem; border-radius: 12px; border: none; background: var(--brand); color: #fff;
  font-weight: 600; cursor: pointer; transition: .18s var(--ease);
}
.search-inline button:hover { background: var(--brand-2); }

.results { display: grid; gap: 1.1rem; }
.result { display: grid; grid-template-columns: 168px 1fr; gap: 1.3rem; padding: 1rem; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.result-media { border-radius: 10px; overflow: hidden; aspect-ratio: 4/3; background: var(--surface-2); }
.result-media img { width: 100%; height: 100%; object-fit: cover; }
.result h3 { font-size: 1.15rem; margin: .4rem 0 .3rem; }
.result h3 a:hover { color: var(--brand); }
.result p { font-size: .9rem; color: var(--muted); margin: 0; }

/* search modal */
.search-modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: start center; padding-top: 10vh; }
.search-modal[hidden] { display: none; }
.search-backdrop { position: absolute; inset: 0; background: rgba(10, 18, 16, .48); backdrop-filter: blur(3px); }
.search-panel {
  position: relative; width: min(680px, calc(100% - 2rem)); background: var(--surface);
  border-radius: var(--radius); border: 1px solid var(--line); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .5);
  overflow: hidden; animation: pop .18s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.99); } }
.search-form { display: flex; align-items: center; gap: .6rem; padding: .9rem 1rem; border-bottom: 1px solid var(--line-soft); }
.search-icon { color: var(--muted); display: grid; place-items: center; }
.search-icon svg { width: 20px; height: 20px; }
.search-form input { flex: 1; border: none; background: none; font-size: 1.05rem; color: var(--ink); outline: none; }
.search-close { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 1rem; padding: .3rem; }
.search-results { max-height: 60vh; overflow-y: auto; }
.sr-item { display: grid; grid-template-columns: 52px 1fr; gap: .9rem; padding: .7rem 1rem; align-items: center; }
.sr-item + .sr-item { border-top: 1px solid var(--line-soft); }
.sr-item:hover { background: var(--surface-2); }
.sr-item img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; }
.sr-item strong { display: block; font-size: .93rem; font-weight: 550; line-height: 1.35; }
.sr-item small { color: var(--muted); font-size: .76rem; }
.sr-empty { padding: 1.6rem 1rem; color: var(--muted); font-size: .92rem; }

/* ---------- tag cloud ---------- */
.tagcloud { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 2rem; }

/* ---------- footer ---------- */
.site-footer { margin-top: 4.5rem; border-top: 1px solid var(--line-soft); background: var(--bg-alt); }
.footer-inner { display: grid; grid-template-columns: 1.3fr 1fr; gap: 3rem; padding: 3rem 0 2rem; }
.footer-brand { display: flex; gap: .9rem; align-items: flex-start; }
.footer-brand strong { font-family: var(--font-serif); font-size: 1.1rem; }
.footer-brand p { color: var(--muted); font-size: .86rem; margin: .35rem 0 0; max-width: 34ch; }
.footer-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.footer-cols h4 { font-family: var(--font-sans); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: .7rem; }
.footer-cols a { display: block; font-size: .88rem; color: var(--ink-2); padding: .18rem 0; }
.footer-cols a:hover { color: var(--brand); }
.footer-base { padding: 1.1rem 0 2.2rem; border-top: 1px solid var(--line-soft); }
.footer-base p { margin: 0; font-size: .78rem; color: var(--muted); }

.btn { display: inline-block; padding: .7rem 1.3rem; background: var(--brand); color: #fff; border-radius: 12px; font-weight: 600; }
.empty { padding: 3rem 0; color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  .article-wrap { grid-template-columns: 1fr; gap: 2rem; }
  .article-aside { position: static; grid-row: 2; }
  .hero { grid-template-columns: 1fr; }
  .grid, .grid-wide { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr; gap: 2rem; }
}
@media (max-width: 860px) {
  .main-nav {
    position: absolute; top: 76px; left: 0; right: 0; flex-direction: column;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: .8rem 1.3rem 1.2rem; gap: .1rem; display: none; box-shadow: var(--shadow);
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: .65rem .8rem; border-radius: 10px; }
  .header-inner { gap: .6rem; }
  .nav-toggle { display: grid; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  body { font-size: 16px; }
  .wrap { width: calc(100% - 2rem); }
  .grid, .grid-wide { grid-template-columns: 1fr; gap: 1.1rem; }
  .hero-mini { grid-template-columns: 84px 1fr; }
  .result { grid-template-columns: 1fr; }
  .result-media { aspect-ratio: 16/9; }
  .article-nav { grid-template-columns: 1fr; }
  .brand-text small { display: none; }
  .popular li { grid-template-columns: 34px 1fr; }
  .chip-mini { display: none; }
  .footer-cols { grid-template-columns: 1fr; }
}

/* ====================== Công cụ tính toán ====================== */
.toolgrid { display:grid; grid-template-columns: repeat(3, 1fr); gap:1.1rem; margin-top:.5rem; }
.toolcard {
  display:flex; flex-direction:column; gap:.35rem; padding:1.3rem 1.25rem;
  background:var(--surface); border:1px solid var(--line-soft); border-radius:var(--radius);
  box-shadow:var(--shadow-sm); transition:.22s var(--ease);
}
.toolcard:hover { transform:translateY(-3px); box-shadow:var(--shadow); border-color:var(--line); }
.toolicon { font-size:1.5rem; line-height:1; margin-bottom:.35rem; }
.toolcard strong { font-family:var(--font-serif); font-size:1.12rem; font-weight:600; }
.toolcard small { color:var(--muted); font-size:.85rem; line-height:1.5; }

.calc-wrap { display:grid; grid-template-columns: 330px minmax(0,1fr); gap:2rem; align-items:start; margin-top:.5rem; }
.calc-form {
  background:var(--surface); border:1px solid var(--line-soft); border-radius:var(--radius);
  padding:1.25rem; box-shadow:var(--shadow-sm); position:sticky; top:96px;
}
.fields { display:grid; gap:.9rem; }
.field { display:flex; flex-direction:column; gap:.35rem; }
.field > span { font-size:.78rem; font-weight:600; letter-spacing:.05em; text-transform:uppercase; color:var(--muted); }
.field em { font-style:normal; font-size:.75rem; color:var(--muted); }
.field input, .field select {
  width:100%; padding:.62rem .8rem; border-radius:10px; border:1px solid var(--line);
  background:var(--bg); color:var(--ink); font-size:.98rem; font-family:inherit;
}
.field input:focus, .field select:focus { outline:2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color:var(--brand); }
.btn-calc {
  width:100%; margin-top:1.1rem; padding:.8rem 1rem; border:none; border-radius:12px;
  background:var(--brand); color:#fff; font-weight:650; font-size:.98rem; cursor:pointer;
  transition:.18s var(--ease);
}
.btn-calc:hover { background:var(--brand-2); }

.calc-result { display:grid; gap:1rem; grid-template-columns:1fr 1fr; align-content:start; }
.calc-empty { color:var(--muted); padding:2.5rem 0; }
.rcard {
  background:var(--surface); border:1px solid var(--line-soft); border-radius:var(--radius);
  padding:1.1rem 1.2rem; box-shadow:var(--shadow-sm);
}
.rcard.wide { grid-column:1 / -1; }
.rcard.ok { border-color:color-mix(in srgb, var(--brand) 35%, var(--line-soft)); background:color-mix(in srgb, var(--brand) 5%, var(--surface)); }
.rcard.warn { border-color:color-mix(in srgb, #c0632f 35%, var(--line-soft)); background:color-mix(in srgb, #c0632f 5%, var(--surface)); }
.rcard h3 { font-family:var(--font-sans); font-size:.75rem; letter-spacing:.09em; text-transform:uppercase; color:var(--muted); margin-bottom:.75rem; font-weight:700; }
.rcard dl { margin:0; display:grid; gap:.45rem; }
.rcard dl > div { display:grid; grid-template-columns: 42% 1fr; gap:.6rem; align-items:baseline; }
.rcard dt { color:var(--muted); font-size:.86rem; }
.rcard dd { margin:0; font-size:.92rem; line-height:1.45; }
.badge {
  display:inline-block; font-size:.72rem; font-weight:700; letter-spacing:.03em;
  padding:.2rem .55rem; border-radius:999px; white-space:nowrap;
}
.badge.good { background:color-mix(in srgb, var(--brand) 14%, transparent); color:var(--brand); }
.badge.bad { background:color-mix(in srgb, #c0632f 14%, transparent); color:#a8511f; }
[data-theme="dark"] .badge.good { color:var(--brand-2); }
[data-theme="dark"] .badge.bad { color:#e3925f; }
.muted { color:var(--muted); }
.verdict { font-family:var(--font-serif); font-size:1.15rem; margin:.2rem 0 .5rem; }
.verdict.big { font-size:1.9rem; }
.score { display:grid; grid-template-columns:auto 1fr; gap:1.4rem; align-items:center; }
.score h3 { grid-column:1 / -1; }
.scorering {
  width:104px; height:104px; border-radius:50%; display:grid; place-items:center;
  background: conic-gradient(var(--brand) calc(var(--v) * 1%), var(--line) 0);
  position:relative;
}
.scorering::before { content:""; position:absolute; inset:9px; border-radius:50%; background:var(--surface); }
.scorering span { position:relative; font-family:var(--font-serif); font-size:1.5rem; color:var(--brand); }
.scorering small { font-size:.7rem; color:var(--muted); }

@media (max-width: 980px) {
  .calc-wrap { grid-template-columns:1fr; }
  .calc-form { position:static; }
  .calc-result { grid-template-columns:1fr; }
  .toolgrid { grid-template-columns:repeat(2,1fr); }
}
@media (max-width: 620px) {
  .toolgrid { grid-template-columns:1fr; }
  .rcard dl > div { grid-template-columns:1fr; gap:.1rem; }
  .score { grid-template-columns:1fr; justify-items:start; }
}

/* ==================== Lịch vạn niên & điểm số ==================== */
.cal-head { display:grid; grid-template-columns:repeat(7,1fr); gap:6px; margin-bottom:8px; }
.cal-head span { text-align:center; font-size:.72rem; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); }
.cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:6px; }
.cal-cell {
  min-height:82px; border:1px solid var(--line-soft); border-radius:10px;
  padding:.35rem .4rem; display:flex; flex-direction:column; gap:1px; background:var(--surface);
}
.cal-cell.empty { visibility:hidden; }
.cal-cell.good { background:color-mix(in srgb, var(--brand) 7%, var(--surface)); }
.cal-cell.bad  { background:color-mix(in srgb, #c0632f 7%, var(--surface)); }
.cal-cell.today { outline:2px solid var(--brand); outline-offset:-2px; }
.cal-day { font-family:var(--font-serif); font-size:1.12rem; line-height:1; }
.cal-lunar { font-size:.7rem; color:var(--muted); }
.cal-cc { font-size:.62rem; color:var(--muted); }
.cal-tr { font-size:.64rem; font-weight:650; color:var(--ink-2); }
.cal-tk { font-size:.58rem; color:var(--accent); }

.scorebig { display:flex; align-items:baseline; gap:.25rem; font-family:var(--font-serif); color:var(--brand); margin:.2rem 0 .4rem; }
.scorebig span { font-size:2.6rem; line-height:1; }
.scorebig small { font-size:.9rem; color:var(--muted); }
.calc-note { color:var(--muted); font-size:.9rem; margin:0; }
.small { font-size:.82rem; }

@media (max-width: 720px) {
  .cal-cell { min-height:64px; padding:.25rem; }
  .cal-day { font-size:.95rem; }
  .cal-cc, .cal-tk { display:none; }
}

/* Lịch Việt và công cụ phong thủy */
:root { --pt-seal: #963a2b; --pt-seal-ink: #fff6e6; }
[data-theme="dark"] { color-scheme: dark; --pt-seal: #f19b83; --pt-seal-ink: #261310; }
.pt-home { padding-top: clamp(1.35rem, 4vw, 3.5rem); }
.pt-hero {
  display: grid; grid-template-columns: minmax(0, .84fr) minmax(0, 1fr);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
}
.pt-intro { padding: clamp(1.35rem, 4vw, 3.25rem); align-self: center; }
.pt-eyebrow { color: var(--brand); font-weight: 650; font-size: .84rem; margin: 0 0 .65rem; }
.pt-intro h1 { font-size: clamp(2.25rem, 4.2vw, 3.65rem); line-height: 1; letter-spacing: -.035em; margin: 0 0 .75rem; }
.pt-intro > p:not(.pt-eyebrow) { color: var(--ink-2); max-width: 36ch; margin: 0 0 1.15rem; }
.pt-date { display: flex; gap: .75rem; align-items: center; margin-bottom: 1.2rem; }
.pt-date strong, .pt-date div > span { display: block; }
.pt-date div > span { color: var(--ink-2); font-size: .82rem; }
.pt-stamp {
  min-width: 2.65rem; min-height: 2.65rem; display: grid; place-items: center;
  border-radius: 5px; background: var(--pt-seal); color: var(--pt-seal-ink);
  font: 700 1.35rem var(--font-serif); box-shadow: inset 0 0 0 3px var(--pt-seal), inset 0 0 0 4px currentColor;
}
.pt-primary {
  display: inline-flex; align-items: center; gap: .8rem; min-height: 44px;
  padding: .55rem 1rem; border: 1px solid transparent; border-radius: 8px;
  color: #fffdfa; background: #0f4c46; font-weight: 650;
}
.pt-primary:hover { color: #fffdfa; background: #166558; }
.pt-art { position: relative; min-height: 100%; overflow: hidden; background: #123f3a; }
.pt-landscape { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pt-jumps { display: flex; flex-wrap: wrap; gap: .5rem; padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.pt-jumps a, .pt-calendar-top nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: .35rem .7rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--brand); font-size: .86rem; font-weight: 650;
}
.pt-jumps a:hover, .pt-calendar-top nav a:hover { border-color: var(--brand); }
.pt-group { margin-top: 1.55rem; }
.pt-group h2 { display: flex; align-items: center; gap: .65rem; margin-bottom: .65rem; scroll-margin-top: 6rem; }
.pt-group-icon, .pt-home .toolicon {
  display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 9%, var(--surface));
  color: var(--brand); border: 1px solid color-mix(in srgb, var(--brand) 25%, var(--line));
  width: 2.7rem; height: 2.7rem; border-radius: 10px; flex: none;
}
.pt-group-icon svg { width: 1.4rem; height: 1.4rem; }
.pt-home .toolgrid { list-style: none; padding: 0; gap: .65rem; }
.pt-home .toolcard {
  display: flex; flex-direction: row; align-items: center; gap: .7rem; min-height: 94px;
  height: 100%; padding: .65rem .8rem; border-radius: 12px;
}
.pt-home .toolcard:hover { border-color: var(--brand); }
.pt-tool-text { display: grid; min-width: 0; }
.pt-tool-text small { color: var(--ink-2); }
.pt-tool-arrow { margin-left: auto; color: var(--brand); }
.pt-home a:focus-visible, .pt-calendar a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; position: relative; z-index: 1; }
.pt-calendar { scroll-margin-top: 6rem; }
@media (min-width: 981px) {
  .calc-wrap.pt-calendar-layout { grid-template-columns: minmax(0, 1fr) 260px; }
}
.pt-calendar-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .9rem; }
.pt-calendar-top h3 { margin: 0; }
.pt-calendar-top nav { display: flex; flex-wrap: wrap; gap: .3rem; }
.pt-calendar .cal-grid, .pt-calendar .cal-head { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.pt-calendar a.cal-cell:hover { border-color: var(--brand); }
.pt-calendar .cal-cell.today { outline-color: var(--pt-seal); }
.pt-calendar .cal-cell.today .cal-day { color: var(--pt-seal); font-weight: 700; }
.pt-calendar .cal-cell.today:focus-visible { outline-offset: 2px; outline-color: var(--brand); }
.pt-compass svg { display: block; width: min(100%, 340px); height: auto; margin: auto; font: 650 14px var(--font-sans); }
.pt-compass text { fill: var(--ink); }
.pt-compass-ring { fill: none; stroke: var(--line); stroke-width: 1.6; }
.pt-direction-good { color: var(--brand); }
.pt-direction-bad { color: var(--pt-seal); }
.pt-spoke { fill: currentColor; fill-opacity: .24; stroke: currentColor; }
.pt-direction-selected .pt-spoke { fill-opacity: .73; stroke-width: 2; }
.pt-direction-selected text { fill: currentColor; font-weight: 800; text-decoration: underline; }
.pt-compass-center { fill: var(--surface-2); stroke: var(--brand); }

@media (max-width: 700px) {
  .pt-hero { grid-template-columns: minmax(0, 1fr); }
  .pt-art { min-height: clamp(9.5rem, 36vw, 14rem); }
  .pt-home .toolcard { min-height: 76px; }
  .pt-calendar .cal-grid, .pt-calendar .cal-head { gap: 3px; }
  .pt-calendar .cal-cell { min-height: 58px; padding: .28rem .15rem; text-align: center; }
  .pt-calendar .cal-tr { overflow-wrap: anywhere; }
}
