/* Ngoc Tien AI · thư viện tài liệu
   Màu lấy từ bộ nhận diện Ngoc Tien AI (brand/ngoc-tien-ai-palette.html).
   Riêng web: nền navy làm nền chính (anh chốt 2026-12-03). */

:root {
  /* màu gốc (bộ nhận diện) */
  --navy: #1A2638;
  --espresso: #2B2420;
  --chocolate: #4A2F22;
  --bronze: #A9815A;
  --champagne: #E8D7BD;
  --ivory: #FAF7F1;

  /* màu suy ra cho web, cùng họ màu gốc */
  --navy-deep: #0D1420;      /* rìa tối của vũ trụ */
  --navy-lift: #22304A;      /* thẻ nổi trên nền navy */
  --bronze-soft: #C9A47C;    /* đồng sáng hơn, đủ đọc chữ nhỏ trên navy */
  --paper-line: #E7DDCB;     /* kẻ trên giấy */
  --paper-muted: #6A5546;    /* chữ phụ trên giấy (≈6.9:1 trên ivory) */

  /* vai trò */
  --bg: var(--navy);
  --on-bg: var(--ivory);
  --on-bg-muted: rgba(232, 215, 189, .78);
  --line-on-bg: rgba(232, 215, 189, .16);
  --accent: var(--bronze);
  --accent-text: var(--bronze-soft);
  --paper: var(--ivory);
  --on-paper: var(--espresso);

  --font-sans: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Playfair Display", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --wrap: 1180px;
  --gut: clamp(20px, 4vw, 40px);
  --header-h: 68px;

  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --t-fast: 160ms;
  --t-med: 260ms;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 24px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--navy-deep);
  color: var(--on-bg);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--bronze-soft); outline-offset: 3px; border-radius: 4px; }
::selection { background: rgba(169, 129, 90, .45); color: var(--ivory); }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gut); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 100;
  background: var(--ivory); color: var(--espresso);
  padding: 10px 16px; border-radius: var(--r-sm); font-weight: 600; text-decoration: none;
  transition: top var(--t-fast) var(--ease-out);
}
.skip-link:focus { top: 12px; }

/* ───────── Vũ trụ ───────── */
.space {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 0%, #22304A 0%, rgba(26, 38, 56, 0) 60%),
    radial-gradient(140% 120% at 50% 40%, var(--navy) 0%, var(--navy-deep) 78%);
}
.space canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
/* tinh vân: vài đám sáng rất mờ, trôi chậm */
.space .nebula {
  position: absolute; border-radius: 50%; filter: blur(60px); opacity: .9;
  will-change: transform;
}
.space .nebula.n1 { width: 62vmax; height: 42vmax; left: -18vmax; top: -8vmax;
  background: radial-gradient(closest-side, rgba(169, 129, 90, .24), rgba(169, 129, 90, 0)); }
.space .nebula.n2 { width: 54vmax; height: 54vmax; right: -20vmax; top: 28vh;
  background: radial-gradient(closest-side, rgba(78, 112, 160, .36), rgba(78, 112, 160, 0)); }
.space .nebula.n3 { width: 46vmax; height: 30vmax; left: 20vw; bottom: -16vmax;
  background: radial-gradient(closest-side, rgba(232, 215, 189, .09), rgba(232, 215, 189, 0)); }
@media (prefers-reduced-motion: no-preference) {
  .space .nebula.n1 { animation: drift-a 48s ease-in-out infinite alternate; }
  .space .nebula.n2 { animation: drift-b 60s ease-in-out infinite alternate; }
  .space .nebula.n3 { animation: drift-a 72s ease-in-out infinite alternate-reverse; }
}
@keyframes drift-a { to { transform: translate3d(4vw, 3vh, 0) scale(1.06); } }
@keyframes drift-b { to { transform: translate3d(-5vw, -4vh, 0) scale(1.08); } }
/* vệt sáng mờ ở rìa cho cảm giác sâu */
.space::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 50% 45%, rgba(13, 20, 32, 0) 55%, rgba(8, 12, 20, .55) 100%);
}

.page { position: relative; z-index: 1; }

/* ───────── Thanh trên ───────── */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  display: flex; align-items: center;
  transition: background var(--t-med) var(--ease-out), border-color var(--t-med) var(--ease-out);
  border-bottom: 1px solid transparent;
}
.site-header.is-scrolled {
  background: rgba(16, 24, 38, .78);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom-color: var(--line-on-bg);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: baseline; gap: 8px; text-decoration: none; min-height: 44px; align-items: center; }
.brand .name { font-family: var(--font-serif); font-weight: 600; font-size: 22px; color: var(--champagne); letter-spacing: .01em; }
.brand .ai {
  font-family: var(--font-sans); font-weight: 800; font-size: 14px; color: var(--navy-deep);
  background: var(--bronze); padding: 2px 7px 1px; border-radius: 6px; letter-spacing: .04em;
}
.site-nav { display: flex; align-items: center; gap: 8px; }
.site-nav a.nav-link {
  text-decoration: none; color: var(--on-bg-muted); font-size: 15px; font-weight: 500;
  padding: 10px 12px; border-radius: var(--r-sm); min-height: 44px; display: inline-flex; align-items: center;
  transition: color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
.site-nav a.nav-link:hover { color: var(--ivory); background: rgba(232, 215, 189, .06); }
.site-nav a.nav-link[aria-current="page"] { color: var(--ivory); }

/* ───────── Nút ───────── */
.btn {
  --bg-b: var(--champagne); --fg-b: var(--navy-deep);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; padding: 10px 18px; border-radius: 999px; border: 1px solid transparent;
  background: var(--bg-b); color: var(--fg-b); font-weight: 600; font-size: 15px; line-height: 1.2;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out), box-shadow var(--t-med) var(--ease-out);
}
.btn:hover { transform: translateY(-1px); background: var(--ivory); box-shadow: 0 8px 24px -10px rgba(232, 215, 189, .55); }
.btn:active { transform: translateY(0) scale(.98); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-ghost { --bg-b: transparent; --fg-b: var(--ivory); border-color: rgba(232, 215, 189, .32); }
.btn-ghost:hover { background: rgba(232, 215, 189, .08); box-shadow: none; border-color: rgba(232, 215, 189, .55); }
.btn-dark { --bg-b: var(--navy); --fg-b: var(--ivory); }
.btn-dark:hover { background: var(--navy-lift); box-shadow: 0 10px 24px -12px rgba(26, 38, 56, .8); }
.btn-sm { min-height: 40px; padding: 8px 14px; font-size: 14px; }

/* ───────── Chữ chung ───────── */
.overline {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text);
}
.overline::before { content: ""; width: 28px; height: 1px; background: var(--bronze); }
.display {
  font-family: var(--font-sans); font-weight: 800; letter-spacing: -.025em; line-height: 1.08;
  font-size: clamp(38px, 6.2vw, 72px); margin: 18px 0 0; color: var(--ivory); text-wrap: balance;
}
.display em, .h1 em {
  font-family: var(--font-serif); font-style: italic; font-weight: 500; letter-spacing: -.01em; color: var(--champagne);
}
.lede { color: var(--on-bg-muted); font-size: clamp(17px, 1.6vw, 19.5px); max-width: 60ch; margin: 22px 0 0; text-wrap: pretty; }

/* ───────── Thư viện ───────── */
.lib-hero { padding: clamp(56px, 10vh, 120px) 0 40px; }
.lib-hero .wrap { display: grid; gap: 0; }

.search {
  margin-top: 38px; max-width: 720px; position: relative;
}
.search label { display: block; font-size: 14px; font-weight: 600; color: var(--champagne); margin-bottom: 10px; }
.search-box {
  display: flex; align-items: center; gap: 12px;
  background: rgba(13, 20, 32, .62); border: 1px solid rgba(232, 215, 189, .26); border-radius: 16px;
  padding: 6px 8px 6px 18px; min-height: 64px;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-med) var(--ease-out);
}
.search-box:focus-within { border-color: var(--bronze-soft); box-shadow: 0 0 0 4px rgba(169, 129, 90, .18), 0 20px 50px -24px rgba(0, 0, 0, .7); }
.search-box svg { width: 22px; height: 22px; color: var(--bronze-soft); flex: none; }
.search-box input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--ivory);
  font: 500 18px/1.3 var(--font-sans); padding: 12px 0;
}
.search-box input::placeholder { color: rgba(232, 215, 189, .5); }
.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-clear {
  border: 0; background: rgba(232, 215, 189, .08); color: var(--champagne); border-radius: 10px;
  min-width: 44px; min-height: 44px; cursor: pointer; display: none; align-items: center; justify-content: center;
}
.search-clear.is-on { display: inline-flex; }
.search-clear:hover { background: rgba(232, 215, 189, .16); }
.search-hint { margin: 12px 0 0; font-size: 14px; color: var(--on-bg-muted); }
.search-hint kbd {
  font-family: var(--font-mono); font-size: 12.5px; color: var(--champagne);
  border: 1px solid rgba(232, 215, 189, .3); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px;
}

.match-banner {
  margin-top: 18px; max-width: 720px; display: none; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: 14px; border: 1px solid rgba(169, 129, 90, .55);
  background: linear-gradient(120deg, rgba(169, 129, 90, .20), rgba(169, 129, 90, .06));
}
.match-banner.is-on { display: flex; }
.match-banner p { margin: 0; flex: 1; min-width: 220px; font-size: 15.5px; }
.match-banner strong { color: var(--champagne); }

.features { list-style: none; margin: 36px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 940px; }
.features li { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--r-md); background: rgba(34, 48, 74, .6); border: 1px solid var(--line-on-bg); }
.feat-icon { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 12px; color: var(--bronze-soft); background: rgba(169, 129, 90, .16); }
.feat-icon svg { width: 20px; height: 20px; }
.features b { display: block; font-size: 15px; color: var(--ivory); }
.features small { display: block; font-size: 13.5px; line-height: 1.5; color: var(--on-bg-muted); }
@media (max-width: 860px) { .features { grid-template-columns: 1fr; } }

.list-title { margin: 24px 0 18px; font-size: clamp(24px, 3vw, 32px); line-height: 1.3; letter-spacing: -.01em; color: var(--ivory); text-wrap: balance; }
.card-tags { display: flex; gap: 8px; flex-wrap: wrap; }

.lib-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 8px 0 22px; border-bottom: 1px solid var(--line-on-bg); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px;
  border-radius: 999px; border: 1px solid rgba(232, 215, 189, .22); background: rgba(13, 20, 32, .4);
  color: var(--on-bg-muted); font-size: 15px; font-weight: 500; cursor: pointer;
  transition: all var(--t-fast) var(--ease-out);
}
.chip:hover { color: var(--ivory); border-color: rgba(232, 215, 189, .45); }
.chip .count {
  font-family: var(--font-mono); font-size: 12px; min-width: 22px; padding: 1px 6px; border-radius: 999px;
  background: rgba(232, 215, 189, .1); color: var(--champagne); text-align: center;
}
.chip[aria-pressed="true"] { background: var(--champagne); color: var(--navy-deep); border-color: var(--champagne); }
.chip[aria-pressed="true"] .count { background: rgba(13, 20, 32, .12); color: var(--navy-deep); }
.lib-count { font-size: 14px; color: var(--on-bg-muted); margin: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 20px; padding: 28px 0 96px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 14px;
  padding: 24px; border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(34, 48, 74, .78), rgba(22, 32, 50, .78));
  border: 1px solid rgba(232, 215, 189, .14);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 24px 48px -32px rgba(0, 0, 0, .8);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: transform var(--t-med) var(--ease-out), border-color var(--t-med) var(--ease-out), box-shadow var(--t-med) var(--ease-out);
}
.card:hover { transform: translateY(-2px); border-color: rgba(201, 164, 124, .55); box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 30px 60px -30px rgba(0, 0, 0, .9); }
.card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kw {
  font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; letter-spacing: .06em;
  color: var(--champagne); border: 1px solid rgba(201, 164, 124, .6); border-radius: 7px; padding: 3px 8px;
}
.kw small { font-family: var(--font-sans); font-weight: 500; letter-spacing: 0; color: var(--on-bg-muted); margin-right: 4px; font-size: 12px; }
.tag { font-size: 12.5px; color: var(--on-bg-muted); padding: 3px 10px; border-radius: 999px; background: rgba(232, 215, 189, .07); }
.tag-new { color: var(--navy-deep); background: var(--bronze-soft); font-weight: 700; letter-spacing: .06em; font-size: 11px; }
.card h3 { margin: 0; font-size: 22px; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; color: var(--ivory); text-wrap: balance; }
.card h3 a { text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.card p { margin: 0; color: var(--on-bg-muted); font-size: 15.5px; line-height: 1.6; }
.card-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line-on-bg); display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--on-bg-muted); }
.card-foot .go { display: inline-flex; align-items: center; gap: 6px; color: var(--champagne); font-weight: 600; }
.card-foot .go svg { width: 16px; height: 16px; transition: transform var(--t-fast) var(--ease-out); }
.card:hover .card-foot .go svg { transform: translateX(3px); }
.card .done-pill { color: var(--bronze-soft); font-weight: 600; }

.empty { display: none; padding: 48px 0 96px; max-width: 560px; }
.empty.is-on { display: block; }
.empty h3 { margin: 0 0 8px; font-size: 22px; }
.empty p { margin: 0 0 18px; color: var(--on-bg-muted); }

/* ───────── Trang bài: phần đầu trên nền sao ───────── */
.art-hero { padding: clamp(28px, 6vh, 64px) 0 clamp(48px, 8vh, 88px); }
.back {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--on-bg-muted);
  font-size: 15px; font-weight: 500; min-height: 44px; padding-right: 8px;
  transition: color var(--t-fast) var(--ease-out);
}
.back svg { width: 18px; height: 18px; transition: transform var(--t-fast) var(--ease-out); }
.back:hover { color: var(--ivory); }
.back:hover svg { transform: translateX(-3px); }
.art-hero-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: center; margin-top: 18px; }
.h1 { font-weight: 800; letter-spacing: -.025em; line-height: 1.1; font-size: clamp(36px, 5.2vw, 62px); margin: 16px 0 0; text-wrap: balance; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.meta-row .tag { font-size: 13.5px; padding: 5px 12px; }
.byline { display: flex; align-items: center; gap: 12px; margin-top: 28px; }
.avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid var(--bronze); background: var(--chocolate); }
.byline b { display: block; font-weight: 600; color: var(--ivory); font-size: 15.5px; }
.byline span { display: block; font-size: 13.5px; color: var(--on-bg-muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

/* khung tiến độ bên phải */
.progress-card {
  border-radius: var(--r-lg); overflow: hidden;
  background: linear-gradient(180deg, rgba(34, 48, 74, .9), rgba(20, 29, 46, .92));
  border: 1px solid rgba(232, 215, 189, .18);
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, .9), 0 1px 0 rgba(255, 255, 255, .05) inset;
}
.progress-card .pc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-on-bg); }
.pc-dots { display: flex; gap: 6px; }
.pc-dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(232, 215, 189, .22); }
.pc-head .pc-title { font-family: var(--font-mono); font-size: 12.5px; color: var(--on-bg-muted); }
.pc-body { padding: 18px; display: grid; gap: 10px; }
.pc-item {
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 12px; text-decoration: none;
  background: rgba(13, 20, 32, .45); border: 1px solid rgba(232, 215, 189, .08);
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
.pc-item:hover { border-color: rgba(201, 164, 124, .5); }
.pc-num {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 14px; color: var(--champagne); border: 1px solid rgba(201, 164, 124, .55);
  transition: background var(--t-med) var(--ease-out), color var(--t-med) var(--ease-out);
}
.pc-item b { display: block; font-size: 15px; font-weight: 600; color: var(--ivory); line-height: 1.35; }
.pc-item small { display: block; font-size: 12.5px; color: var(--on-bg-muted); }
.pc-state { font-size: 12px; color: var(--on-bg-muted); }
.pc-item.is-done .pc-num { background: var(--bronze); color: var(--navy-deep); border-color: var(--bronze); }
.pc-item.is-done .pc-state { color: var(--bronze-soft); font-weight: 600; }
.pc-foot { padding: 4px 18px 18px; }
.meter { height: 6px; border-radius: 999px; background: rgba(232, 215, 189, .12); overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--bronze), var(--champagne)); border-radius: inherit; transition: width 600ms var(--ease-out); }
.pc-foot p { margin: 10px 0 0; font-size: 13.5px; color: var(--on-bg-muted); }

/* ───────── Thanh đọc được bao nhiêu ───────── */
.read-bar { position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 60; pointer-events: none; }
.read-bar > i { display: block; height: 100%; width: 100%; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, var(--bronze), var(--champagne)); }

/* ───────── Tấm giấy ───────── */
.paper-wrap { padding-bottom: 96px; }
.paper {
  background: var(--paper); color: var(--on-paper);
  border-radius: 28px; position: relative;
  box-shadow: 0 0 0 1px rgba(232, 215, 189, .5), 0 60px 120px -50px rgba(0, 0, 0, .85), 0 0 120px -20px rgba(169, 129, 90, .18);
  display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 0;
}
.toc {
  padding: 44px 0 44px 36px; border-right: 1px solid var(--paper-line);
}
.toc-inner { position: sticky; top: calc(var(--header-h) + 24px); }
.toc h2 { font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--paper-muted); margin: 0 0 14px; font-weight: 600; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.toc a {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--paper-muted);
  font-size: 14.5px; line-height: 1.4; padding: 9px 14px 9px 12px; margin-right: 20px; border-radius: 10px;
  border-left: 2px solid transparent; min-height: 40px;
  transition: color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}
.toc a:hover { color: var(--espresso); background: rgba(169, 129, 90, .08); }
.toc a.is-active { color: var(--espresso); font-weight: 600; background: rgba(169, 129, 90, .12); border-left-color: var(--bronze); }
.toc .tick { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 1.5px solid #cdbfa9; display: grid; place-items: center; }
.toc .tick svg { width: 11px; height: 11px; opacity: 0; color: var(--ivory); }
.toc a.is-done .tick { background: var(--chocolate); border-color: var(--chocolate); }
.toc a.is-done .tick svg { opacity: 1; }
.toc .tick.plain { border-style: dashed; }
.toc-cta { margin-top: 26px; padding: 18px; margin-right: 20px; border-radius: 16px; background: var(--navy); color: var(--ivory); }
.toc-cta p { margin: 0 0 12px; font-size: 13.5px; line-height: 1.5; color: var(--on-bg-muted); }
.toc-cta .btn { width: 100%; white-space: normal; text-align: center; }

.prose { padding: 56px clamp(24px, 5vw, 72px) 64px; min-width: 0; }
.prose > * { max-width: 68ch; }
.prose h2 {
  font-size: clamp(26px, 2.6vw, 32px); line-height: 1.25; letter-spacing: -.015em; font-weight: 800;
  margin: 64px 0 18px; color: var(--espresso); text-wrap: balance;
}
.prose h2:first-child { margin-top: 0; }
.prose h2 .step-no {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-right: 14px;
  border-radius: 50%; background: var(--navy); color: var(--champagne);
  font-family: var(--font-sans); font-weight: 800; font-size: 19px; vertical-align: 4px;
}
.prose h3 { font-size: 20px; line-height: 1.35; margin: 36px 0 10px; font-weight: 700; color: var(--espresso); }
.prose p { margin: 0 0 18px; }
.prose a:not(.btn) { color: var(--chocolate); text-decoration-color: var(--bronze); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.prose a:not(.btn):hover { text-decoration-thickness: 2.5px; }
.prose strong { color: var(--espresso); font-weight: 700; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 20px; }
.prose li { margin: 6px 0; }
.prose li::marker { color: var(--bronze); font-weight: 700; }
.prose .intro { font-size: 19px; line-height: 1.7; color: var(--espresso); }

/* các bước nhỏ */
.steps { list-style: none; counter-reset: s; padding: 0 !important; margin: 26px 0 28px !important; display: grid; gap: 14px; }
.steps > li {
  counter-increment: s; position: relative; margin: 0; padding: 16px 18px 16px 62px; min-width: 0;
  background: #fff; border: 1px solid var(--paper-line); border-radius: 16px;
}
.steps > li::before {
  content: counter(s); position: absolute; left: 16px; top: 14px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; background: var(--champagne); color: var(--chocolate); font-weight: 800; font-size: 15px;
}
.steps > li > :last-child { margin-bottom: 0; }

/* chỗ bấm trên giao diện */
.ui {
  font-family: var(--font-sans); font-size: .92em; font-weight: 600; white-space: nowrap;
  color: var(--espresso); background: #F1E9DB; border: 1px solid #E2D4BD; border-bottom-width: 2px;
  padding: 1px 8px; border-radius: 7px;
}
.path { display: inline; }
.path .sep { color: var(--bronze); margin: 0 4px; font-weight: 700; }

/* khung chép */
.copy {
  display: flex; align-items: stretch; gap: 0; margin: 12px 0 4px; border-radius: 12px; overflow: hidden;
  background: var(--navy); border: 1px solid var(--navy);
}
.copy code {
  flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 14.5px; line-height: 1.55; color: var(--champagne);
  padding: 13px 16px; overflow-x: auto; white-space: nowrap;
}
.copy.multi code { white-space: pre-wrap; }
.copy .copy-btn {
  border: 0; border-left: 1px solid rgba(232, 215, 189, .16); background: rgba(232, 215, 189, .06); color: var(--ivory);
  min-width: 96px; padding: 0 16px; cursor: pointer; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background var(--t-fast) var(--ease-out);
}
.copy .copy-btn:hover { background: rgba(232, 215, 189, .14); }
.copy .copy-btn svg { width: 16px; height: 16px; }
.copy .copy-btn.is-done { background: var(--bronze); color: var(--navy-deep); }

/* hình minh hoạ */
.shot { margin: 22px 0 26px; }
.shot-zoom { display: block; cursor: zoom-in; border-radius: 14px; }
.shot-zoom:focus-visible { outline: 3px solid var(--bronze); outline-offset: 3px; }
.shot figcaption { margin-top: 10px; font-size: 13.5px; line-height: 1.5; color: var(--paper-muted); text-align: center; }
.shot img { width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--paper-line); box-shadow: 0 20px 44px -28px rgba(43, 36, 32, .5); background: #fff; }
.shot-slot {
  aspect-ratio: 16 / 9; border-radius: 14px; border: 1.5px dashed #D8C7AC; background: repeating-linear-gradient(-45deg, #F6F0E5 0 12px, #F3EBDD 12px 24px);
  display: grid; place-items: center; text-align: center; padding: 24px; color: var(--paper-muted); font-size: 14.5px;
}

/* khung lưu ý */
.note {
  display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 18px 20px; margin: 24px 0; border-radius: 16px;
  background: #F4ECDF; border: 1px solid #E8D9C1;
}
.note svg { width: 24px; height: 24px; color: var(--chocolate); margin-top: 2px; }
.note p:last-child { margin-bottom: 0; }
.note-title { font-weight: 700; color: var(--espresso); margin: 0 0 4px !important; }
.note.warn { background: #F6E9E1; border-color: #E9CDBD; }

/* ô tích xong bước */
.done-toggle {
  display: flex; align-items: center; gap: 14px; margin: 26px 0 8px; padding: 14px 18px; border-radius: 16px; cursor: pointer;
  border: 1.5px solid var(--paper-line); background: #fff; user-select: none; min-height: 60px;
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-med) var(--ease-out);
}
.done-toggle:hover { border-color: var(--bronze); }
.done-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.done-toggle .box {
  width: 28px; height: 28px; flex: none; border-radius: 8px; border: 2px solid #CDBFA9; display: grid; place-items: center;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.done-toggle .box svg { width: 16px; height: 16px; color: var(--ivory); stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset 320ms var(--ease-out); }
.done-toggle b { font-weight: 700; color: var(--espresso); display: block; }
.done-toggle small { color: var(--paper-muted); font-size: 14px; }
.done-toggle input:focus-visible + .box { outline: 2px solid var(--bronze); outline-offset: 3px; }
.done-toggle input:checked + .box { background: var(--chocolate); border-color: var(--chocolate); transform: scale(1.04); }
.done-toggle input:checked + .box svg { stroke-dashoffset: 0; }
.done-toggle:has(input:checked) { border-color: var(--chocolate); background: #F7F1E7; }

/* từ khó / lỗi thường gặp */
.faq { margin: 20px 0 28px; display: grid; gap: 10px; }
.faq details { border: 1px solid var(--paper-line); border-radius: 14px; background: #fff; }
.faq summary {
  cursor: pointer; list-style: none; padding: 15px 18px; font-weight: 600; color: var(--espresso);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 22px; line-height: 1; color: var(--bronze); transition: transform var(--t-fast) var(--ease-out); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details > div { padding: 0 18px 16px; color: #4a3d34; }
.faq details > div p:last-child { margin-bottom: 0; }

sup.cite a { font-size: 12px; font-weight: 700; text-decoration: none !important; padding: 0 2px; color: var(--chocolate) !important; }
.sources { font-size: 15px; color: #4a3d34; padding-left: 1.4em; }
.sources li { margin: 8px 0; }
.sources a { word-break: break-word; }

/* ô cuối bài */
.author-card {
  margin: 56px 0 0; padding: 26px; border-radius: 22px; background: var(--navy); color: var(--ivory);
  display: grid; grid-template-columns: 76px 1fr; gap: 20px; align-items: center; max-width: none !important;
}
.author-card img { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; border: 2px solid var(--bronze); }
.author-card h2 { margin: 0 0 4px !important; font-size: 21px !important; color: var(--ivory) !important; }
.author-card p { margin: 0 0 14px; color: var(--on-bg-muted); font-size: 15.5px; }

/* ───────── Thông báo nhỏ ───────── */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 80; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ivory); color: var(--espresso); padding: 12px 18px; border-radius: 12px; font-size: 15px; font-weight: 500;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .7); max-width: calc(100vw - 32px);
  transition: opacity var(--t-med) var(--ease-out), transform var(--t-med) var(--ease-out);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ───────── Chân trang ───────── */
.site-footer { border-top: 1px solid var(--line-on-bg); padding: 36px 0 44px; position: relative; z-index: 1; }
.site-footer .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer p { margin: 0; color: var(--on-bg-muted); font-size: 14.5px; }
.social { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--champagne); font-weight: 600; font-size: 15px; min-height: 44px; padding: 0 4px; }
.social svg { width: 22px; height: 22px; }
.social:hover { color: var(--ivory); }

/* ───────── Vào trang ───────── */
@media (prefers-reduced-motion: no-preference) {
  [data-enter] > * { animation: enter 700ms var(--ease-out) both; }
  [data-enter] > *:nth-child(2) { animation-delay: 60ms; }
  [data-enter] > *:nth-child(3) { animation-delay: 120ms; }
  [data-enter] > *:nth-child(4) { animation-delay: 180ms; }
  [data-enter] > *:nth-child(5) { animation-delay: 240ms; }
  [data-enter] > *:nth-child(6) { animation-delay: 300ms; }
}
@keyframes enter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ───────── Màn nhỏ ───────── */
@media (max-width: 1024px) {
  .paper { grid-template-columns: 1fr; }
  .toc { display: none; }
}
@media (max-width: 860px) {
  .art-hero-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  :root { --header-h: 60px; }
  body { font-size: 16.5px; }
  .brand .name { font-size: 20px; }
  .site-nav a.nav-link { display: none; }
  .btn-follow .label-long { display: none; }
  .paper { border-radius: 20px; }
  .prose { padding: 36px 20px 44px; }
  .prose h2 { margin-top: 48px; }
  .prose h2 .step-no { width: 38px; height: 38px; font-size: 17px; margin-right: 10px; }
  .steps > li { padding: 14px 14px 14px 56px; }
  .ui { white-space: normal; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
  .steps > li::before { left: 12px; }
  .copy { flex-direction: column; }
  .copy .copy-btn { border-left: 0; border-top: 1px solid rgba(232, 215, 189, .16); min-height: 46px; }
  .copy code { white-space: pre-wrap; word-break: break-all; }
  .author-card { grid-template-columns: 1fr; text-align: left; }
  .hero-actions .btn { flex: 1 1 auto; }
  .card { padding: 20px; }
}
@media (min-width: 641px) { .btn-follow .label-short { display: none; } }
