:root {
  color-scheme: light;
  font-family:
    "Noto Sans",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  /* Landing V2 Design Tokens (Theme đồng bộ hoàn toàn với Landing) */
  --landing-ink: #301706;
  --landing-ink-light: #5f3719;
  --landing-muted: #724216;
  --landing-paper: #fff4d8;
  --landing-paper-warm: #f2d492;
  --landing-paper-deep: #d6a756;
  --landing-cinnabar: #8f2414;
  --landing-cinnabar-hover: #b72f19;
  --landing-gold: #bd7a2a;
  --landing-gold-dark: #7a431c;
  --landing-wood: #3a1c09;
  --landing-wood-dark: #1e1108;
  --landing-green: #31551f;
  --landing-forest: #263a27;
  --landing-forest-dark: #17281d;
  --landing-line: rgba(95, 55, 25, 0.25);
  --landing-line-gold: rgba(189, 122, 42, 0.55);
  --landing-shadow: 0 1rem 2.5rem rgba(30, 17, 8, 0.16);
  --landing-font-display: "Times New Roman", "Playfair Display", "Noto Serif", Georgia, serif;

  /* Legacy tokens tương thích */
  --ink: var(--landing-ink);
  --muted: var(--landing-muted);
  --paper: var(--landing-paper);
  --paper-deep: var(--landing-paper-deep);
  --line: var(--landing-line);
  --gold: var(--landing-gold);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  min-height: 100dvh;
}

html:not([data-lang="en"]) [data-content-lang="en"],
html[data-lang="en"] [data-content-lang="vi"] {
  display: none;
}

body {
  min-height: 100dvh;
  margin: 0;
  color: var(--landing-ink);
  background:
    linear-gradient(rgba(255, 244, 216, 0.93), rgba(242, 212, 146, 0.92)),
    repeating-linear-gradient(95deg, transparent 0 9px, rgba(95, 55, 25, 0.025) 10px 11px);
  line-height: 1.76;
}

a {
  color: var(--landing-wood);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--landing-line-gold);
  overflow-wrap: anywhere;
  word-break: break-word;
  transition:
    color 140ms ease,
    text-decoration-color 140ms ease;
}

a:hover {
  color: var(--landing-cinnabar);
  text-decoration-color: var(--landing-cinnabar);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--landing-gold);
  outline-offset: 3px;
}

/* Header & Điều hướng chính */
.content-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 2px solid rgba(95, 55, 25, 0.32);
  background: rgba(255, 244, 216, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(48, 23, 6, 0.05);
}

.content-nav__inner {
  width: min(1180px, calc(100% - clamp(24px, 5vw, 72px)));
  margin-inline: auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
  padding-block: 8px;
}

.content-brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--landing-forest);
  font-family: var(--landing-font-display);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  text-decoration: none !important;
  transition: opacity 140ms ease;
}

.content-brand:hover {
  opacity: 0.88;
}

.content-brand img {
  height: clamp(42px, 5vw, 54px);
  width: auto;
  object-fit: contain;
  vertical-align: middle;
}

.content-brand-motif,
.content-brand__motif {
  color: var(--landing-gold);
  font-size: 1.1rem;
}

.content-nav__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 22px;
  justify-content: flex-end;
}

.content-language-switch {
  display: inline-flex;
  gap: 0.3rem;
  padding: 0.3rem;
  border: 1px solid var(--landing-line-gold);
  border-radius: 999px;
  background: rgba(255, 244, 216, 0.78);
  white-space: nowrap;
}

.content-language-switch .lang-btn {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border: none;
  border-radius: 999px;
  background: none;
  color: var(--landing-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

.content-language-switch .lang-btn[aria-pressed="true"] {
  color: #fff8eb;
  background: var(--landing-cinnabar);
  box-shadow: 0 2px 6px rgba(169, 42, 26, 0.35);
}

.content-language-switch .lang-btn img {
  width: 24px;
  height: 16px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(30, 17, 8, 0.25);
}

.content-article section[id],
.content-article h2[id] {
  scroll-margin-top: 170px;
}

.content-nav__links a {
  color: var(--landing-wood);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  position: relative;
  transition: color 140ms ease;
}

.content-nav__links a:hover {
  color: var(--landing-cinnabar);
}

.content-nav__links a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -4px;
  left: 0;
  height: 2px;
  background: var(--landing-cinnabar);
  transform: scaleX(0);
  transition: transform 140ms ease;
}

.content-nav__links a:hover::after,
.content-nav__links a:focus-visible::after {
  transform: scaleX(1);
}

.content-nav__links a[href="/play"],
.content-nav__cta {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.15rem;
  border: 2px solid #d69a36;
  border-radius: 5px;
  color: #fff4d8 !important;
  background: linear-gradient(#3e672b, #294d20);
  box-shadow:
    0 3px 0 #173516,
    0 6px 14px rgba(26, 17, 8, 0.18);
  font-weight: 900;
  letter-spacing: 0.03em;
  text-decoration: none !important;
  transition:
    transform 120ms ease,
    box-shadow 120ms ease;
}

.content-nav__links a[href="/play"]::after,
.content-nav__cta::after {
  display: none !important;
}

.content-nav__links a[href="/play"]:hover,
.content-nav__cta:hover {
  transform: translateY(-1px);
  box-shadow:
    0 4px 0 #173516,
    0 8px 18px rgba(26, 17, 8, 0.24);
}

/* Khung nội dung chính & Bố cục đọc bài dài */
.content-shell {
  width: min(1180px, calc(100% - clamp(24px, 5vw, 72px)));
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 40px;
  padding-block: clamp(32px, 5vw, 64px);
  align-items: start;
}

.content-article,
.content-aside {
  min-width: 0;
}

/* Breadcrumb */
.content-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  color: var(--landing-muted);
}

.content-breadcrumb a {
  color: var(--landing-muted);
  text-decoration: none;
  font-weight: 600;
  transition: color 140ms ease;
}

.content-breadcrumb a:hover,
.content-breadcrumb a:focus-visible {
  color: var(--landing-cinnabar);
}

.content-breadcrumb span[aria-hidden="true"] {
  color: var(--landing-gold);
}

/* Hero Card (Đồng bộ khung bảng biển/xanh lục bảo của Landing Hero) */
.content-hero {
  position: relative;
  padding: clamp(32px, 5vw, 48px);
  border: 2px solid var(--landing-gold);
  border-radius: 12px;
  background:
    radial-gradient(circle at 80% 30%, rgba(223, 177, 73, 0.16), transparent 30rem),
    linear-gradient(135deg, var(--landing-forest), var(--landing-forest-dark));
  color: #fff4d8;
  box-shadow:
    0 4px 0 var(--landing-forest-dark),
    var(--landing-shadow);
  margin-bottom: 36px;
}

.content-hero::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed rgba(223, 177, 73, 0.45);
  border-radius: 8px;
  pointer-events: none;
}

.content-eyebrow,
.content-hero .content-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
  color: #e4a83f;
  font-family: var(--landing-font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1.4;
}

h1,
.content-hero h1 {
  margin: 0;
  color: #fff8df;
  font-family: var(--landing-font-display);
  font-size: clamp(2.2rem, 4.4vw, 3.4rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-shadow: 0 3px 0 rgba(24, 12, 5, 0.35);
}

.content-hero h2 {
  margin: 0;
  color: #fff8df;
  font-family: var(--landing-font-display);
  font-size: clamp(1.8rem, 3.6vw, 2.6rem);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.02em;
  text-shadow: 0 3px 0 rgba(24, 12, 5, 0.35);
}

.content-hero h3 {
  margin: 0;
  color: #fff4d8;
  font-family: var(--landing-font-display);
  font-size: 1.3rem;
  font-weight: 750;
  line-height: 1.35;
}

.content-lead,
.content-hero .content-lead {
  margin: 18px 0 0;
  color: #f4dfae;
  font-size: clamp(1.02rem, 1.6vw, 1.15rem);
  line-height: 1.76;
}

.content-meta,
.content-hero .content-meta {
  margin: 16px 0 0;
  color: #dbc78e;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Các đoạn nội dung và tiêu đề */
.content-section {
  padding-block: 32px;
  border-top: 1px solid var(--landing-line);
}

.content-section:first-of-type {
  border-top: none;
  padding-top: 0;
}

h2,
.content-section h2 {
  margin: 0 0 16px;
  color: var(--landing-forest);
  font-family: var(--landing-font-display);
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

h3,
.content-section h3 {
  margin: 22px 0 10px;
  color: var(--landing-wood);
  font-family: var(--landing-font-display);
  font-size: 1.28rem;
  font-weight: 750;
  line-height: 1.35;
}

.content-section,
.content-article,
.content-hero {
  overflow-wrap: anywhere;
  word-break: normal;
}

.content-section p,
.content-related p {
  color: var(--landing-ink-light);
  font-size: 1.02rem;
  line-height: 1.78;
  margin: 0 0 16px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.content-section p:last-child,
.content-related p:last-child {
  margin-bottom: 0;
}

.content-section ul,
.content-section ol {
  color: var(--landing-ink-light);
  font-size: 1.02rem;
  line-height: 1.76;
  padding-left: 24px;
  margin: 0 0 18px;
}

.content-section li {
  margin-bottom: 8px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Mục lục bên hông (Sticky Aside Table of Contents) */
.content-aside {
  position: sticky;
  top: 84px;
  max-height: calc(100svh - 110px);
  overflow-y: auto;
  padding-bottom: 8px;
}

.content-aside__box {
  padding: 22px 20px;
  border: 2px solid var(--landing-gold);
  border-radius: 10px;
  background: rgba(255, 244, 216, 0.92);
  box-shadow:
    0 4px 0 #9a5b20,
    0 8px 24px rgba(48, 23, 6, 0.08);
}

.content-aside__box h2 {
  margin: 0 0 14px;
  color: var(--landing-forest);
  font-family: var(--landing-font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(189, 122, 42, 0.35);
}

.content-aside__box a {
  display: block;
  padding: 6px 0;
  color: var(--landing-wood);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.45;
  transition:
    color 140ms ease,
    padding-left 140ms ease;
}

.content-aside__box a:hover {
  color: var(--landing-cinnabar);
  padding-left: 4px;
}

/* Tài liệu liên quan */
.content-related {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--landing-line);
}

.content-related h2 {
  font-size: 1.3rem;
  color: var(--landing-forest);
}

.content-related p {
  margin: 8px 0;
}

/* Footer đồng bộ Landing Footer */
.content-footer {
  width: min(1180px, calc(100% - clamp(24px, 5vw, 72px)));
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px 24px;
  padding-block: 28px 42px;
  color: var(--landing-muted);
  border-top: 2px solid rgba(95, 55, 25, 0.32);
  font-size: 0.92rem;
}

.content-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
}

.content-footer__links a {
  color: var(--landing-wood);
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  transition: color 140ms ease;
}

.content-footer__links a:hover {
  color: var(--landing-cinnabar);
}

/* Hình ảnh minh họa bài viết cẩm nang */
.content-figure {
  margin-block: 24px;
  padding: 12px;
  border: 2px solid var(--landing-gold);
  border-radius: 12px;
  background: rgba(255, 244, 216, 0.95);
  box-shadow: 0 4px 0 #9a5b20;
  text-align: center;
}

.content-figure img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
}

.content-figure figcaption {
  margin-top: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--landing-muted);
  font-style: italic;
}

/* Sơ đồ bàn cờ và minh họa tình huống */
.board-diagram {
  margin-block: 24px;
  padding: 20px;
  border: 2px solid var(--landing-gold);
  border-radius: 12px;
  background: rgba(255, 244, 216, 0.95);
  box-shadow: 0 4px 0 #9a5b20;
  overflow-x: auto;
}

.board-diagram__caption {
  margin-bottom: 12px;
  font-size: 0.98rem;
  font-weight: 750;
  color: var(--landing-forest);
  font-family: var(--landing-font-display);
}

.board-layout {
  display: grid;
  grid-template-columns: 84px repeat(5, 1fr) 84px;
  grid-template-rows: auto auto;
  gap: 8px;
  min-width: 540px;
  text-align: center;
}

.board-pit {
  padding: 10px 6px;
  border: 1px solid var(--landing-line);
  border-radius: 8px;
  background: var(--landing-paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  line-height: 1.35;
}

.board-pit--quan {
  grid-row: 1 / span 2;
  border-radius: 36px 8px 8px 36px;
  background: var(--landing-paper-warm);
  border: 2px solid var(--landing-gold);
}

.board-pit--quan-right {
  grid-column: 7;
  border-radius: 8px 36px 36px 8px;
}

.board-pit--player {
  background: var(--landing-paper);
  border-color: var(--landing-line);
}

.board-pit--highlight {
  outline: 2px solid var(--landing-green);
  background: #e8f0e2;
  font-weight: 700;
}

.board-pit--target {
  outline: 2px dashed var(--landing-cinnabar);
  background: rgba(143, 36, 20, 0.1);
}

.board-pit__name {
  font-size: 0.78rem;
  color: var(--landing-muted);
  font-weight: 600;
}

.board-pit__stones {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--landing-wood-dark);
  margin-top: 2px;
}

.board-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--landing-muted);
}

.board-legend__item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.board-legend__dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--landing-line);
}

/* Thẻ Cẩm nang & Lưới bài viết (Đồng bộ Landing Card V2) */
.cam-nang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
  margin-block: 28px;
}

.cam-nang-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 2px solid var(--landing-gold);
  border-radius: 1.25rem 0.45rem 1.25rem 0.45rem;
  background: rgba(255, 244, 216, 0.88);
  box-shadow:
    0 4px 0 #9a5b20,
    0 8px 24px rgba(48, 23, 6, 0.08);
  text-decoration: none !important;
  color: var(--landing-ink);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.cam-nang-card:hover {
  transform: translateY(-2px);
  border-color: #d69a36;
  box-shadow:
    0 6px 0 #9a5b20,
    0 12px 30px rgba(48, 23, 6, 0.12);
}

.cam-nang-card__tag {
  align-self: flex-start;
  margin-bottom: 12px;
  padding: 3px 10px;
  border-radius: 4px;
  background: rgba(49, 85, 31, 0.12);
  border: 1px solid rgba(49, 85, 31, 0.35);
  color: var(--landing-green);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cam-nang-card__title {
  font-size: 1.25rem;
  font-weight: 750;
  color: var(--landing-forest);
  font-family: var(--landing-font-display);
  margin: 0 0 10px;
  line-height: 1.32;
}

.cam-nang-card__desc {
  font-size: 0.95rem;
  color: var(--landing-ink-light);
  margin: 0 0 18px;
  line-height: 1.6;
  flex-grow: 1;
}

.cam-nang-card__action {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--landing-cinnabar);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: gap 140ms ease;
}

.cam-nang-card:hover .cam-nang-card__action {
  gap: 10px;
}

/* Bảng phân tích và so sánh thế cờ */
.situation-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-block: 22px;
  font-size: 0.95rem;
  border: 2px solid var(--landing-gold);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 0 #9a5b20;
}

.situation-table th {
  background: var(--landing-forest);
  color: #fff4d8;
  font-family: var(--landing-font-display);
  padding: 12px 14px;
  font-weight: 700;
  text-align: left;
  border-bottom: 2px solid var(--landing-gold);
}

.situation-table td {
  padding: 10px 14px;
  border-top: 1px solid var(--landing-line);
  color: var(--landing-ink-light);
  background: rgba(255, 244, 216, 0.85);
}

.situation-table tr:nth-child(even) td {
  background: rgba(242, 212, 146, 0.45);
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
  .content-nav__inner {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
  }

  .content-nav__links {
    grid-row: 2;
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .content-language-switch {
    grid-row: 1;
    grid-column: 2;
  }

  .content-shell {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .content-aside {
    position: static;
    max-height: none;
  }
}

@media (max-width: 680px) {
  .board-layout {
    min-width: 640px;
    grid-template-columns: 84px repeat(5, minmax(74px, 1fr)) 84px;
  }

  .board-pit__name,
  .board-pit__stones {
    overflow-wrap: normal;
    word-break: normal;
  }

  .content-nav__inner {
    gap: 8px 12px;
  }

  .content-brand {
    font-size: 1.05rem;
    gap: 6px;
  }

  .content-nav__links {
    width: 100%;
    justify-content: flex-start;
    gap: 8px 16px;
  }

  .content-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

.content-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}
.content-table-scroll .situation-table {
  min-width: 640px;
  overflow-wrap: normal;
  word-break: normal;
}
.content-table-scroll:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}
