/* ============================================================
   CHIA SE DAM ME - DESIGN SYSTEM
   Fonts self-host tu /assets/fonts, khong nhung base64
   ============================================================ */

/* === FONTS === */
@font-face {
  font-family: 'Lora';
  src: url('/assets/fonts/Lora-Variable.woff2') format('woff2-variations'),
       url('/assets/fonts/Lora-Variable.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/assets/fonts/BeVietnamPro-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/assets/fonts/BeVietnamPro-Medium.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/assets/fonts/BeVietnamPro-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}

/* === VARIABLES === */
:root {
  /* Light (mac dinh) */
  --paper: #FFFFFF;
  --paper-2: #F7F7FB;
  --card-bg: #FFFFFF;
  --ink: #1C1C28;
  --muted: #5E5E70;
  --border: #E9E9F1;

  --accent: #0E6E8C;         /* xanh bien dam - tien hoa tu xanh ngoc cu, khong nhay mau */
  --accent-soft: #E2F1F5;
  --accent-2: #7550B5;       /* tim tram - chuyen muc Cam xuc (da dieu chinh dam hon de dat WCAG AA) */
  --accent-2-soft: #EFE9F7;

  --color-error: #D32F2F;
  --color-success: #1E8E5A;
  --on-accent: #FFFFFF;

  --font-serif: 'Lora', Georgia, serif;
  --font-sans: 'Be Vietnam Pro', -apple-system, 'Segoe UI', sans-serif;

  --radius: 14px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  --sec-top: 40px;
  --sec-bot: 70px;
  --sec-gap: 18px;

  --shadow-card: 0 2px 4px rgba(28,28,40,.06), 0 16px 36px rgba(28,28,40,.11);
  --shadow-card-hover: 0 4px 8px rgba(28,28,40,.08), 0 22px 44px rgba(28,28,40,.14);

  --z-nav: 100;
  --z-toast: 500;
}

[data-theme="dark"] {
  --paper: #14141C;
  --paper-2: #1B1B26;
  --card-bg: #1C1C28;
  --ink: #CACAD4;
  --muted: #A8A8BC;
  --border: #2E2E3D;

  --accent: #4FC1DB;
  --accent-soft: #123640;
  --accent-2: #B79AE0;
  --accent-2-soft: #2B2340;

  --color-error: #EF9A9A;
  --color-success: #7FD9AE;
  --on-accent: #14141C;

  --shadow-card: 0 2px 4px rgba(0,0,0,.4), 0 16px 40px rgba(0,0,0,.48);
  --shadow-card-hover: 0 4px 10px rgba(0,0,0,.45), 0 22px 50px rgba(0,0,0,.55);
}

/* === RESET / BASE === */
*, *::before, *::after { box-sizing: border-box; }

html {
  min-height: 100vh;
  min-height: 100dvh;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper-2);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  transition: background .25s, color .25s;
  -webkit-font-smoothing: antialiased;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Thanh gradient thuong hieu: xanh ngoc goc (trai) dam dan sang xanh bien (phai) -
   co dinh mau, khong doi theo theme, nhu mot dau an thuong hieu on dinh */
.brand-bar {
  height: 4px;
  background: linear-gradient(90deg, #0EA99C 0%, #0B4F66 100%);
}

img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }

a { color: inherit; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--on-accent);
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 9999;
}
.skip-link:focus {
  left: 0;
}

/* Focus ro rang tren moi trinh duyet, khong xoa outline */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* === LAYOUT === */
.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(16px, 5vw, 28px) clamp(16px, 4.5vw, 32px) var(--sec-bot);
}

.site-header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}

.brand-mark-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
}

.brand-mark {
  width: 78px;
  height: 78px;
  border-radius: 19px;
}

.brand-since {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--muted);
  white-space: nowrap;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: clamp(29.5px, 5vw, 43px);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.slogan {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 15px;
  color: var(--accent);
  margin-top: 4px;
  text-wrap: balance;
}

.site-header-top {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.main-nav {
  display: flex;
  gap: 4px;
  font-size: 13.5px;
  font-weight: 500;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.main-nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  transition: background-color .15s, color .15s;
}
.main-nav a:hover { color: var(--accent); background: var(--accent-soft); }
.main-nav a.active { color: var(--accent); background: var(--accent-soft); }

/* === COMPONENTS === */

/* Nut icon tron - Chuyen doi sang/toi */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--ink);
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle svg { width: 19px; height: 19px; }
.icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn-primary:hover { opacity: .9; color: var(--on-accent); }

/* Entry card (danh sach bai) */
.entry, .post, .static-page {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.entry {
  position: relative;
  padding: 22px 26px;
  margin-bottom: var(--sec-gap);
  border-left: 4px solid var(--accent);
  transition: border-color .2s, box-shadow .2s, transform .15s;
}
.entry-essay { border-left-color: var(--accent-2); }
.entry:hover { border-color: var(--accent); border-left-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }
.entry-essay:hover { border-color: var(--accent-2); border-left-color: var(--accent-2); }

.meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.post-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.meta-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* Nut chia se bai viet */
.share-btn {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.share-btn:hover { border-color: var(--accent); color: var(--accent); }
.share-btn svg { width: 17px; height: 17px; }
.share-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity .15s, transform .15s;
}
.share-btn.share-btn--thongbao::after { opacity: 1; transform: translateY(0); }

/* Khoi "instruction mau" - co the mo/thu gon, co nut copy */
/* Thanh tien do doc bai viet - dinh sat dinh trang, chay theo % da cuon */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #0EA99C 0%, #0B4F66 100%);
  z-index: var(--z-toast);
  transition: width .12s linear;
}

/* Muc luc tu dong cho bai dai - chi hien tren desktop that rong (>=1400px),
   vi tri bam theo tam cua .wrap (max-width 720px) de luon nam gon trong
   khoang trang con lai 2 ben, khong dung vao noi dung chinh. */
.toc {
  position: fixed;
  top: 150px;
  left: calc(50% + 380px);
  width: 230px;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  z-index: var(--z-nav);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .2s;
}
.toc.toc--hien { opacity: 1; visibility: visible; pointer-events: auto; }
.toc-label {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 10px;
}
.toc-list { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--border); }
.toc-list a {
  display: block;
  padding: 6px 0 6px 14px;
  margin-left: -2px;
  border-left: 2px solid transparent;
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--muted);
  text-decoration: none;
}
.toc-list a:hover { color: var(--ink); }
.toc-tech .toc-list a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.toc-essay .toc-list a.active { color: var(--accent-2); border-left-color: var(--accent-2); font-weight: 600; }

/* Duoi 1400px khong du cho - an han bang CSS, JS cung tu bo qua khong tinh toan */
@media (max-width: 1399px) {
  .toc { display: none !important; }
}

.instruction-box {
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--card-bg);
}
.instruction-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 18px;
  border: none;
  background: var(--paper-2);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 16.5px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.instruction-toggle:hover { background: var(--accent-soft); }
.instruction-toggle-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.instruction-toggle-title { font-weight: 700; }
.instruction-toggle-preview {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--muted);
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.instruction-toggle[aria-expanded="true"] .instruction-toggle-preview { display: none; }
.instruction-chevron { width: 20px; height: 20px; flex-shrink: 0; transition: transform .2s; color: var(--accent); }
.instruction-toggle[aria-expanded="true"] .instruction-chevron { transform: rotate(180deg); }
.instruction-body { padding: 18px 20px 22px; position: relative; }
.instruction-copy {
  position: absolute;
  top: 16px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--card-bg);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.instruction-copy svg { width: 14px; height: 14px; }
.instruction-copy:hover { border-color: var(--accent); color: var(--accent); }
.instruction-copy.instruction-copy--done { border-color: var(--accent); color: var(--accent); }
.instruction-content {
  padding-right: 90px;
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
}
.instruction-content > *:first-child { margin-top: 0; }
.instruction-content > *:last-child { margin-bottom: 0; }
.instruction-content h1, .instruction-content h2, .instruction-content h3 {
  font-size: 17px;
  margin: 18px 0 8px;
}
.instruction-content ul, .instruction-content ol { padding-left: 22px; margin: 10px 0; }
.instruction-content li { margin-bottom: 6px; }
.instruction-content p { margin: 10px 0; }
@media (max-width: 480px) {
  .instruction-content { padding-right: 0; }
  .instruction-copy { position: static; margin-bottom: 14px; }
}

.share-end {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  font-size: 14.5px;
  color: var(--muted);
}
.date { font-size: 12.5px; color: var(--muted); font-weight: 500; }

.tag {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  text-decoration: none;
}
.tag-tech { background: var(--accent-soft); color: var(--accent); }
.tag-essay { background: var(--accent-2-soft); color: var(--accent-2); }
.tag:hover { opacity: .85; }
.tag-block {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(28,28,40,.05), 0 4px 10px rgba(28,28,40,.07);
  transition: transform .12s, box-shadow .12s;
}
.tag-block:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(28,28,40,.07), 0 8px 16px rgba(28,28,40,.10); }
.tag-block:active { transform: translateY(0); }
[data-theme="dark"] .tag-block { box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 12px rgba(0,0,0,.35); }
[data-theme="dark"] .tag-block:hover { box-shadow: 0 2px 4px rgba(0,0,0,.35), 0 8px 20px rgba(0,0,0,.4); }

/* Lam noi bat 3 chuyen muc co bai viet gan day nhat - giu nguyen mau
   teal/tim theo loai, chi tang dan cuong do bong+vien theo do moi */
.tag-tech.tag-rank-1 { border: 1.5px solid var(--accent); box-shadow: 0 3px 8px rgba(14,110,140,.32), 0 10px 22px rgba(14,110,140,.20); }
.tag-tech.tag-rank-2 { border: 1px solid var(--accent); box-shadow: 0 2px 6px rgba(14,110,140,.20), 0 7px 16px rgba(14,110,140,.13); }
.tag-tech.tag-rank-3 { box-shadow: 0 2px 5px rgba(14,110,140,.13), 0 5px 12px rgba(14,110,140,.08); }

.tag-essay.tag-rank-1 { border: 1.5px solid var(--accent-2); box-shadow: 0 3px 8px rgba(124,92,191,.32), 0 10px 22px rgba(124,92,191,.20); }
.tag-essay.tag-rank-2 { border: 1px solid var(--accent-2); box-shadow: 0 2px 6px rgba(124,92,191,.20), 0 7px 16px rgba(124,92,191,.13); }
.tag-essay.tag-rank-3 { box-shadow: 0 2px 5px rgba(124,92,191,.13), 0 5px 12px rgba(124,92,191,.08); }

[data-theme="dark"] .tag-tech.tag-rank-1 { box-shadow: 0 3px 10px rgba(79,193,219,.4), 0 10px 26px rgba(79,193,219,.25); }
[data-theme="dark"] .tag-tech.tag-rank-2 { box-shadow: 0 2px 7px rgba(79,193,219,.28), 0 7px 18px rgba(79,193,219,.16); }
[data-theme="dark"] .tag-tech.tag-rank-3 { box-shadow: 0 2px 6px rgba(79,193,219,.18), 0 5px 14px rgba(79,193,219,.10); }

[data-theme="dark"] .tag-essay.tag-rank-1 { box-shadow: 0 3px 10px rgba(183,154,224,.4), 0 10px 26px rgba(183,154,224,.25); }
[data-theme="dark"] .tag-essay.tag-rank-2 { box-shadow: 0 2px 7px rgba(183,154,224,.28), 0 7px 18px rgba(183,154,224,.16); }
[data-theme="dark"] .tag-essay.tag-rank-3 { box-shadow: 0 2px 6px rgba(183,154,224,.18), 0 5px 14px rgba(183,154,224,.10); }

.entry h2, .post-title {
  font-family: var(--font-serif);
  margin: 0 0 9px;
  font-weight: 700;
  line-height: 1.3;
  font-size: clamp(20.5px, 3.2vw, 25px);
}
.entry h2 a { color: var(--ink); text-decoration: none; }
.entry h2 a:hover { color: var(--accent); }
.entry h2 a::after {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
}
.entry .tag { position: relative; z-index: 1; }

.excerpt {
  font-family: var(--font-serif);
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.7;
}

.section-label {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 34px 0 14px;
}

/* Noi dung 1 bai viet day du */
.post {
  padding: 26px 28px 34px;
  margin-bottom: 24px;
  border-top: 4px solid var(--accent);
}
.post-essay { border-top-color: var(--accent-2); }
.post-body {
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.8;
  color: var(--ink);
}
.post-body img { display: block; margin: 20px auto 8px; }
.post-body img + em {
  display: block;
  text-align: center;
  font-size: 13.5px;
  font-style: italic;
  color: var(--muted);
  line-height: 1.4;
}
.post-body a { color: var(--accent); }
.post-body blockquote {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  margin: 24px 0;
  padding: 16px 20px;
  color: var(--ink);
}
.post-body blockquote p { margin: 0; }
.post-body blockquote p + p { margin-top: 10px; }
.post-essay .post-body blockquote { background: var(--accent-2-soft); border-left-color: var(--accent-2); }
.post-body pre, .post-body code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  background: var(--paper-2);
  border-radius: var(--radius-sm);
  font-size: .85em;
}
.post-body pre { padding: 14px 16px; overflow-x: auto; }
.post-body code { padding: 2px 6px; }

.static-page { padding: 26px 28px 34px; border-top: 4px solid var(--accent); }

/* Pagination */
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--muted);
}
.pager-link { text-decoration: none; color: var(--accent); font-weight: 500; }
.pager-link:hover { text-decoration: underline; }

/* Category grid */
.category-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.cat-count { font-weight: 400; opacity: .7; margin-left: 5px; }
.tag-all { background: var(--accent); color: var(--on-accent); }
.tag-all:hover { background: var(--accent); opacity: .92; }
.tag-all .cat-count { opacity: .85; }

.empty-state { color: var(--muted); font-style: italic; }
.back-link { margin-top: 24px; }
.back-link a { color: var(--accent); text-decoration: none; font-size: 14px; }
.back-link a:hover { text-decoration: underline; }

/* Bai viet cung chu de */
.related-posts { margin-top: 8px; margin-bottom: 24px; }
.related-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.related-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.related-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.related-essay { border-left-color: var(--accent-2); }
.related-essay:hover { border-color: var(--accent-2); }
.related-date { font-size: 11.5px; color: var(--muted); }
.related-title { font-size: 14.5px; font-weight: 600; color: var(--ink); line-height: 1.4; }

.site-footer {
  margin-top: 34px;
  font-size: 12.5px;
  color: var(--muted);
}

/* Style nut dung chung (banner cai dat PWA) */
.toast-btn {
  flex-shrink: 0;
  border: none;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}
@keyframes toast-slide-up {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* View Transitions - fade nhe khi chuyen trang (progressive enhancement,
   trinh duyet khong ho tro se tu bo qua toan bo khoi nay) */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: .18s;
  }
}

/* Bottom navigation kieu app - chi mobile, tao cam giac native app */
.bottom-nav {
  display: none;
}

/* Banner goi y cai dat PWA */
.install-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: var(--z-toast);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  color: var(--ink);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  padding: 13px 12px 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  box-shadow: var(--shadow-card);
  animation: toast-slide-up .25s ease-out;
}
.install-banner span { flex: 1; line-height: 1.4; }
.install-banner .toast-btn { flex-shrink: 0; }
.install-close {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}
.install-close:hover { color: var(--ink); }

/* Nut back to top */
.back-to-top {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: var(--z-toast);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s, border-color .2s, color .2s;
}
.back-to-top.visible { opacity: 1; transform: translateY(0); }
.back-to-top:hover { border-color: var(--accent); color: var(--accent); }
.back-to-top svg { width: 20px; height: 20px; }

@media (max-width: 767px) {
  .back-to-top { bottom: calc(70px + env(safe-area-inset-bottom)); right: 16px; }
  .install-banner { bottom: calc(74px + env(safe-area-inset-bottom)); }
  .slogan { font-size: 13.5px; }
  .cat-all-row { flex-basis: 100%; }
  .cat-all-row .tag-all { width: 100%; justify-content: center; }
}

/* === RESPONSIVE - 3 LOP === */

/* Mobile: bottom nav kieu app, mac dinh khong can media query cho phan con lai */
@media (max-width: 767px) {
  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(58px + env(safe-area-inset-bottom));
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: var(--z-nav);
  }
  .bn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 44px;
    color: var(--muted);
    text-decoration: none;
    font-size: 10.5px;
    font-weight: 500;
  }
  .bn-item svg { width: 21px; height: 21px; }
  .bn-item.active { color: var(--accent); }
  .bn-toggle {
    background: none;
    border: none;
    font-family: inherit;
  }
  .wrap { padding-bottom: calc(58px + env(safe-area-inset-bottom) + 24px); }
  .site-header-top .theme-toggle { display: none; }
  .main-nav { display: none; }

  /* Giam padding ngang - tranh cong don wrap + card padding chiem qua nhieu
     be ngang man hinh nho, khien noi dung bi hep va bai viet keo qua dai */
  .wrap { padding-left: 12px; padding-right: 12px; }
  .entry { padding: 18px 16px; }
  .post, .static-page { padding: 20px 16px 26px; }
}

/* Tablet */
@media (min-width: 768px) {
  .wrap { max-width: 740px; padding-top: 18px; }
  .entry { padding: 26px 32px; }
  .post, .static-page { padding: 34px 44px 48px; }
  .related-grid { grid-template-columns: 1fr 1fr; }
  .brand-mark { width: 84px; height: 84px; border-radius: 20px; }
}

/* Desktop */
@media (min-width: 1200px) {
  .wrap { max-width: 800px; }
  .post-body { font-size: 17px; }
  .excerpt { font-size: 17px; }
}
