/* ==========================================================================
   Cờ Vua Việt Nam — giao diện cam nhẹ
   ========================================================================== */
:root {
  --orange: #ee7a2f;
  --orange-deep: #c2571a;      /* chữ/link trên nền trắng (độ tương phản ≥ 4.5:1) */
  --orange-soft: #ffe4cc;
  --apricot: #fff4ea;
  --ink: #2a2420;
  --muted: #6e625a;
  --line: #f0e2d4;
  --surface: #ffffff;
  --sq-light: #f7e6cf;
  --sq-dark: #d9955b;
  --ok: #2f8f5b;
  --bad: #c8412e;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(120, 60, 10, .06), 0 8px 24px -12px rgba(120, 60, 10, .18);
  --wrap: 1200px;
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::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 { transition: none !important; animation: none !important; } }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--ink); background: var(--surface); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--orange-deep); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { line-height: 1.22; margin: 0 0 .5em; letter-spacing: -.015em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.6rem); font-weight: 800; }
h2 { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.75rem); font-weight: 750; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 1em; }
.num, .elo { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; z-index: 100; border-radius: 6px; }
.skip:focus { left: 8px; }

/* ---------- Header ---------- */
.topbar { background: var(--apricot); font-size: .85rem; color: var(--muted); }
.topbar .wrap { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 36px; }
.topbar a { color: var(--ink); }
.topbar form { display: inline; }
.topbar button.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); cursor: pointer; }
.topbar-actions { display: flex; gap: 16px; align-items: center; }
.badge-due { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 10px; background: var(--orange); color: #fff; font-size: .75rem; text-align: center; font-weight: 700; }

.site-header { position: sticky; top: 0; z-index: 40; background: rgba(255, 255, 255, .94); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 24px; min-height: 68px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo svg { width: 38px; height: 38px; flex: none; }
.logo small { display: block; font-weight: 500; font-size: .72rem; color: var(--muted); letter-spacing: 0; }
.nav { margin-left: auto; }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; }
.nav a { display: block; padding: 8px 10px; border-radius: 999px; color: var(--ink); font-weight: 600; font-size: .94rem; }
.nav a:hover { background: var(--apricot); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--orange-soft); color: #7a3a0c; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--ink); margin: 4px 0; }
@media (max-width: 1100px) {
  .nav-toggle { display: block; }
  .nav { position: absolute; left: 0; right: 0; top: 100%; background: #fff; border-bottom: 1px solid var(--line); display: none; }
  .nav.is-open { display: block; }
  .nav ul { flex-direction: column; padding: 8px 16px 16px; }
  .nav a { border-radius: 10px; padding: 12px; }
  .topbar .tagline { display: none; }
}

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 999px; border: 1.5px solid transparent; font: inherit; font-weight: 650; font-size: .95rem; cursor: pointer; text-decoration: none !important; line-height: 1.2; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: #e06a1e; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--orange); }
.btn-soft { background: var(--apricot); color: #7a3a0c; }
.btn-soft:hover { background: var(--orange-soft); }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.w-full { width: 100%; }

.field { margin-bottom: 16px; }
.field label, .label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.input, .select, .textarea { width: 100%; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; background: #fff; color: var(--ink); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--orange); outline: none; box-shadow: 0 0 0 3px var(--orange-soft); }
.textarea { min-height: 120px; resize: vertical; }
.error-text { color: var(--bad); font-size: .85rem; margin-top: 4px; }
.hp { position: absolute; left: -5000px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

.alert { padding: 12px 16px; border-radius: 10px; margin: 16px 0; font-weight: 500; }
.alert-ok { background: #e9f6ee; color: #1e6b42; }
.alert-err { background: #fdecea; color: #9d2a1b; }

/* ---------- Page structure ---------- */
main { min-height: 50vh; }
.page-head { background: var(--apricot); padding: 28px 0 24px; margin-bottom: 32px; }
.page-head h1 { margin-bottom: 6px; }
.page-head p { color: var(--muted); max-width: 70ch; margin: 0; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.crumbs li + li::before { content: "/"; margin-right: 4px; color: #c9b5a3; }
.crumbs a { color: var(--muted); }
.section { padding: 40px 0; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-title h2 { margin: 0; }
.section-title a { font-weight: 600; font-size: .92rem; white-space: nowrap; }
.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; }
@media (max-width: 960px) { .layout-side { grid-template-columns: 1fr; } }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel-tint { background: var(--apricot); border-color: transparent; }
.panel h3 { margin-bottom: 12px; }
.stack > * + * { margin-top: 20px; }

/* ---------- Hero ---------- */
.hero { background: linear-gradient(180deg, var(--apricot) 0%, #fff 100%); padding: 40px 0 48px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(2rem, 1.3rem + 2.8vw, 3.3rem); line-height: 1.08; letter-spacing: -.03em; margin-bottom: 16px; }
.hero-lead { font-size: 1.1rem; color: var(--muted); max-width: 46ch; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0 32px; }
.hero-stats { display: flex; gap: 32px; flex-wrap: wrap; }
.hero-stats div { font-size: .88rem; color: var(--muted); }
.hero-stats strong { display: block; font-size: 1.6rem; color: var(--ink); font-weight: 800; font-variant-numeric: tabular-nums; }
.daily { background: #fff; border-radius: 20px; box-shadow: var(--shadow); padding: 18px; }
.daily-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.daily-head h2 { font-size: 1.05rem; margin: 0; }
.daily-head p { margin: 0; font-size: .85rem; color: var(--muted); }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; gap: 28px; } }

/* ---------- News ---------- */
.news-lead { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; }
.news-feature .thumb { aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; background: var(--orange-soft); margin-bottom: 14px; }
.news-feature .thumb img { width: 100%; height: 100%; object-fit: cover; }
.news-feature h3 { font-size: 1.45rem; line-height: 1.25; }
.news-feature h3 a, .news-row h3 a, .card h3 a { color: var(--ink); }
.news-list { display: flex; flex-direction: column; }
.news-row { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.news-row:first-child { border-top: 0; padding-top: 0; }
.news-row .thumb { aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; background: var(--orange-soft); }
.news-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.news-row h3 { font-size: 1rem; margin-bottom: 4px; line-height: 1.35; }
.meta { font-size: .82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.meta .cat { color: var(--orange-deep); font-weight: 600; }
.thumb-fallback { width: 100%; height: 100%; display: grid; place-items: center; background: repeating-conic-gradient(var(--sq-light) 0 25%, var(--orange-soft) 0 50%) 0 0 / 40px 40px; }
.thumb-fallback svg { width: 34%; opacity: .55; }
@media (max-width: 860px) { .news-lead { grid-template-columns: 1fr; } }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; }
.card { display: flex; flex-direction: column; }
.card .thumb { aspect-ratio: 16/10; border-radius: var(--radius); overflow: hidden; background: var(--orange-soft); margin-bottom: 12px; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card h3 { font-size: 1.05rem; line-height: 1.35; margin-bottom: 6px; }
.card p { color: var(--muted); font-size: .92rem; margin-bottom: 8px; }

/* ---------- Article ---------- */
.article { max-width: 760px; }
.article h1 { margin-bottom: 12px; }
.article .lead { font-size: 1.12rem; color: var(--muted); font-weight: 500; }
.prose { font-size: 1.05rem; line-height: 1.75; }
.prose img { border-radius: 10px; margin: 20px auto; }
.prose h2 { margin-top: 1.6em; }
.prose h3 { margin-top: 1.4em; }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .95rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.prose th { background: var(--apricot); }
.prose blockquote { margin: 1.4em 0; padding: 4px 0 4px 18px; border-left: 4px solid var(--orange); color: var(--muted); }
.prose ul, .prose ol { padding-left: 1.3em; }
.share { display: flex; gap: 8px; align-items: center; margin: 28px 0; flex-wrap: wrap; }

/* ---------- Tables (Elo, standings) ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th { text-align: left; font-weight: 650; font-size: .8rem; color: var(--muted); background: var(--apricot); padding: 10px 12px; white-space: nowrap; }
.table td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: #fffaf5; }
.table .r { text-align: right; }
.table .c { text-align: center; }
.table .rank { width: 48px; color: var(--muted); font-variant-numeric: tabular-nums; }
.table .elo { font-weight: 700; text-align: right; }
.table a { color: var(--ink); font-weight: 600; }
.table a:hover { color: var(--orange-deep); }
.table tr.top1 .rank { color: var(--orange-deep); font-weight: 800; }
.title-tag { display: inline-block; font-size: .72rem; font-weight: 800; color: #fff; background: var(--orange); border-radius: 5px; padding: 1px 5px; margin-right: 6px; vertical-align: 1px; letter-spacing: .02em; }
.title-tag.w { background: #b1477a; }
.gender { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #4d7fc0; margin-right: 6px; }
.gender.F { background: #d26a96; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 20px; }
.filters .field { margin: 0; }
.filters .input, .filters .select { padding: 9px 12px; }
.filters .grow { flex: 1 1 220px; }
.seg { display: inline-flex; background: var(--apricot); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg a { padding: 6px 14px; border-radius: 999px; color: var(--ink); font-weight: 600; font-size: .9rem; }
.seg a:hover { text-decoration: none; background: rgba(255, 255, 255, .7); }
.seg a.is-active { background: #fff; box-shadow: 0 1px 3px rgba(120, 60, 10, .15); color: #7a3a0c; }

/* Top 10 mini table on home */
.toplist { list-style: none; margin: 0; padding: 0; counter-reset: top; }
.toplist li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); counter-increment: top; }
.toplist li:first-child { border-top: 0; }
.toplist li::before { content: counter(top); color: var(--muted); font-variant-numeric: tabular-nums; font-size: .85rem; text-align: right; }
.toplist a { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toplist .elo { font-weight: 750; }

/* ---------- Tournaments ---------- */
.t-list { display: flex; flex-direction: column; gap: 14px; }
.t-row { display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.t-row:hover { border-color: #f3c6a0; }
.t-date { text-align: center; border-radius: 12px; background: var(--apricot); padding: 8px 4px; line-height: 1.1; }
.t-date b { display: block; font-size: 1.6rem; font-weight: 800; color: var(--orange-deep); font-variant-numeric: tabular-nums; }
.t-date span { font-size: .78rem; color: var(--muted); font-weight: 600; }
.t-row h3 { margin: 0 0 4px; font-size: 1.08rem; }
.t-row h3 a { color: var(--ink); }
.status { display: inline-block; font-size: .76rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.status-upcoming { background: var(--orange-soft); color: #7a3a0c; }
.status-ongoing { background: #dff3e6; color: #1e6b42; }
.status-finished { background: #eee8e3; color: #5b524b; }
@media (max-width: 640px) { .t-row { grid-template-columns: 64px minmax(0, 1fr); } .t-row .t-cta { grid-column: 1 / -1; } }

.t-hero { background: var(--apricot); padding: 28px 0; margin-bottom: 28px; }
.t-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 18px; }
.t-facts div { background: #fff; border-radius: 12px; padding: 12px 14px; }
.t-facts dt { font-size: .78rem; color: var(--muted); }
.t-facts dd { margin: 2px 0 0; font-weight: 650; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.tabs a { padding: 10px 16px; font-weight: 650; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.is-active { color: var(--ink); border-color: var(--orange); }
.section-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.section-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.section-card h3 { margin-bottom: 4px; }
.section-card nav { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.round-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.round-nav a { min-width: 40px; text-align: center; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.round-nav a.is-active { background: var(--orange); border-color: var(--orange); color: #fff; }
.res { font-weight: 750; text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pc { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1.5px solid #8b7b6f; vertical-align: -1px; margin-right: 6px; }
.pc.b { background: #3a312b; border-color: #3a312b; }

/* ---------- Player profile ---------- */
.profile { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 24px; align-items: center; }
.avatar { width: 120px; height: 120px; border-radius: 28px; background: var(--orange); color: #fff; display: grid; place-items: center; font-size: 2.6rem; font-weight: 800; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.ratings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 24px 0; }
.rating-box { background: var(--apricot); border-radius: var(--radius); padding: 16px; }
.rating-box span { font-size: .82rem; color: var(--muted); }
.rating-box strong { display: block; font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.chart { width: 100%; height: auto; }
.chart .grid line { stroke: var(--line); }
.chart text { font-size: 11px; fill: var(--muted); font-family: var(--font); }
@media (max-width: 560px) { .profile { grid-template-columns: 80px 1fr; } .avatar { width: 80px; height: 80px; font-size: 1.8rem; border-radius: 20px; } .ratings { grid-template-columns: 1fr; } }

/* ---------- Board ---------- */
.cb { position: relative; width: 100%; aspect-ratio: 1; user-select: none; -webkit-user-select: none; touch-action: none; }
.cb-grid { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); width: 100%; height: 100%; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 1px rgba(120, 60, 10, .12); }
.cb-sq { position: relative; }
.cb-light { background: var(--sq-light); }
.cb-dark { background: var(--sq-dark); }
.cb-pc { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; z-index: 2; pointer-events: none; }
.cb[data-static] .cb-pc { cursor: default; }
.cb-ghost { position: fixed; left: 0; top: 0; pointer-events: none; z-index: 1000; cursor: grabbing; }
.cb-coord { position: absolute; font-size: 10px; font-weight: 700; z-index: 1; line-height: 1; }
.cb-rank { top: 3px; left: 3px; }
.cb-file { bottom: 2px; right: 3px; }
.cb-light .cb-coord { color: var(--sq-dark); }
.cb-dark .cb-coord { color: var(--sq-light); }
.cb-last::after, .cb-sel::after, .cb-hint::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.cb-last::after { background: rgba(255, 200, 60, .42); }
.cb-sel::after { background: rgba(238, 122, 47, .55); }
.cb-hint::after { box-shadow: inset 0 0 0 4px #2f8f5b; background: rgba(47, 143, 91, .18); animation: pulse 1.4s ease-in-out infinite; }
.cb-dest::before { content: ""; position: absolute; width: 28%; height: 28%; left: 36%; top: 36%; border-radius: 50%; background: rgba(60, 30, 10, .28); z-index: 3; }
.cb-cap::before { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 5px rgba(60, 30, 10, .28); z-index: 3; }
.cb-wrong::after { content: ""; position: absolute; inset: 0; background: rgba(200, 65, 46, .6); z-index: 1; }
.cb-right::after { content: ""; position: absolute; inset: 0; background: rgba(47, 143, 91, .45); z-index: 1; }
.cb-sq:focus-visible { outline: 3px solid #1d4ed8; outline-offset: -3px; z-index: 5; }
@keyframes pulse { 50% { background: rgba(47, 143, 91, .32); } }

/* ---------- Trainer ---------- */
.trainer { display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 1fr); gap: 28px; align-items: start; }
.trainer-board-wrap { position: relative; }
.trainer-bar { height: 6px; background: var(--line); border-radius: 3px; margin-top: 12px; overflow: hidden; }
.trainer-bar > div { height: 100%; width: 0; background: var(--orange); transition: width .3s; }
.trainer-side { display: flex; flex-direction: column; gap: 14px; }
.trainer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.trainer-head h2 { font-size: 1.15rem; margin: 0; }
.mode-tabs { display: inline-flex; background: var(--apricot); border-radius: 999px; padding: 4px; }
.mode-tabs button { border: 0; background: none; font: inherit; font-weight: 650; padding: 6px 14px; border-radius: 999px; cursor: pointer; color: var(--muted); }
.mode-tabs button.is-active { background: #fff; color: #7a3a0c; box-shadow: 0 1px 3px rgba(120, 60, 10, .15); }
.trainer-comment { background: var(--apricot); border-radius: var(--radius); padding: 16px 18px; min-height: 96px; font-size: 1rem; line-height: 1.65; }
.trainer-comment p { margin: 0; }
.trainer-status { font-weight: 600; padding: 10px 14px; border-radius: 10px; border: 1.5px dashed var(--line); min-height: 46px; }
.trainer-status[data-kind="turn"] { border-color: var(--orange); border-style: solid; background: #fff; }
.trainer-status[data-kind="error"] { border-color: var(--bad); color: var(--bad); border-style: solid; }
.trainer-status[data-kind="ok"] { border-color: var(--ok); color: var(--ok); border-style: solid; }
.trainer-moves { display: flex; flex-wrap: wrap; gap: 2px 6px; font-size: .95rem; line-height: 1.9; min-height: 40px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-variant-numeric: tabular-nums; }
.mv-n { color: var(--muted); }
.mv { font-weight: 600; padding: 0 4px; border-radius: 5px; }
.mv.is-mine { color: #7a3a0c; }
.mv.is-current { background: var(--orange-soft); }
.mv-q { color: var(--orange); }
.trainer-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.trainer-done { background: #fff; border: 1.5px solid var(--orange); border-radius: var(--radius); padding: 16px; }
.trainer-done .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.trainer.is-train .learn-only { display: none; }
.trainer:not(.is-train) .train-only { display: none; }
@media (max-width: 900px) { .trainer { grid-template-columns: 1fr; } }
.trainer.compact { grid-template-columns: 1fr; gap: 12px; }
.trainer.compact .trainer-comment { min-height: 0; padding: 12px 14px; font-size: .93rem; }

/* ---------- Courses ---------- */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; }
.course-card { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.course-card .cover { padding: 18px 18px 0; background: var(--apricot); }
.course-card .cover .cb { max-width: 210px; margin: 0 auto; transform: translateY(10px); }
.course-card .body { padding: 26px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.course-card h3 { margin-bottom: 6px; }
.course-card h3 a { color: var(--ink); }
.course-card p { color: var(--muted); font-size: .92rem; flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { font-size: .76rem; font-weight: 650; padding: 3px 10px; border-radius: 999px; background: var(--apricot); color: #7a3a0c; }
.chip.dark { background: #3a312b; color: #fff; }
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin: 10px 0 4px; }
.progress > div { height: 100%; background: var(--orange); }
.chapter { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.chapter > header { padding: 14px 18px; background: var(--apricot); display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.chapter > header h3 { margin: 0; }
.chapter ol { list-style: none; margin: 0; padding: 0; }
.chapter li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); }
.chapter li:first-child { border-top: 0; }
.lvl { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 800; background: #f1ebe5; color: var(--muted); }
.lvl.on { background: var(--orange); color: #fff; }
.lvl.due { background: #fff; color: var(--orange-deep); box-shadow: inset 0 0 0 2px var(--orange); }
.chapter li a.title { color: var(--ink); font-weight: 600; }

/* ---------- Docs & videos ---------- */
.doc-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.doc-icon { width: 44px; height: 52px; border-radius: 8px; background: var(--orange-soft); color: var(--orange-deep); display: grid; place-items: center; font-size: .7rem; font-weight: 800; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.video { position: relative; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; background: #000; }
.video img, .video iframe { width: 100%; height: 100%; object-fit: cover; border: 0; }
.video button { position: absolute; inset: 0; background: none; border: 0; cursor: pointer; display: grid; place-items: center; }
.video button span { width: 64px; height: 64px; border-radius: 50%; background: rgba(238, 122, 47, .92); display: grid; place-items: center; }

/* ---------- Pagination ---------- */
.pager { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: 32px 0 8px; list-style: none; padding: 0; }
.pager a, .pager span { min-width: 40px; height: 40px; display: grid; place-items: center; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.pager a:hover { border-color: var(--orange); text-decoration: none; }
.pager .is-active span { background: var(--orange); border-color: var(--orange); color: #fff; }
.pager .is-disabled span { color: #cbbcb0; }

/* ---------- Footer ---------- */
.partners { border-top: 1px solid var(--line); padding: 24px 0; }
.partners .wrap { display: flex; flex-wrap: wrap; gap: 28px; align-items: center; justify-content: center; }
.partners img { height: 40px; width: auto; filter: grayscale(1); opacity: .7; }
.partners a:hover img { filter: none; opacity: 1; }
.site-footer { background: #2a2420; color: #d9cfc6; padding: 44px 0 24px; margin-top: 56px; font-size: .92rem; }
.site-footer a { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; }
.footer-grid h2 { font-size: .95rem; color: #fff; margin-bottom: 12px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 8px; }
.footer-bottom { border-top: 1px solid #463c35; margin-top: 32px; padding-top: 18px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: .82rem; color: #a99a8e; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); border: 1.5px dashed var(--line); border-radius: var(--radius); }
.auth-box { max-width: 440px; margin: 0 auto; }
.thumb .thumb-fallback img.fb-piece { width: 34%; height: auto; opacity: .55; object-fit: contain; }

/* ---------- Ván đấu ---------- */
.games-table td { padding-top: 8px; padding-bottom: 8px; }
.game-head { padding: 8px 0 20px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.game-players { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 16px; align-items: center; }
.game-players .gp { font-size: clamp(1.05rem, .9rem + .7vw, 1.45rem); font-weight: 700; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.game-players .gp:last-child { justify-content: flex-end; text-align: right; }
.game-players .gp a { color: var(--ink); }
.game-players .gp .pc { margin: 0; }
.game-score { font-size: clamp(1.4rem, 1.1rem + 1vw, 2rem); font-weight: 800; color: var(--orange-deep); white-space: nowrap; background: var(--apricot); padding: 4px 16px; border-radius: 12px; }
@media (max-width: 640px) {
  .game-players { grid-template-columns: 1fr; gap: 6px; }
  .game-players .gp:last-child { justify-content: flex-start; text-align: left; }
  .game-score { justify-self: start; }
}
.viewer { display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 1fr); gap: 28px; align-items: start; }
.viewer-controls { display: flex; gap: 6px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.viewer-controls .btn { min-width: 44px; }
.viewer-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.viewer-comment { background: var(--apricot); border-radius: 12px; padding: 12px 14px; font-size: .95rem; }
.viewer-moves { border: 1px solid var(--line); border-radius: 12px; max-height: 440px; overflow-y: auto; font-variant-numeric: tabular-nums; position: relative; }
.vm-row { display: grid; grid-template-columns: 52px 1fr 1fr; border-top: 1px solid #f7ede4; }
.vm-row:first-child { border-top: 0; }
.vm-n { padding: 6px 10px; color: var(--muted); background: #fdf8f3; font-size: .88rem; }
.vm-cell { padding: 6px 10px; color: var(--ink); font-weight: 600; }
a.vm-cell:hover { background: var(--apricot); text-decoration: none; }
.vm-cell.is-current { background: var(--orange); color: #fff; }
.vm-empty { color: var(--muted); font-weight: 400; }
.vm-nag { color: var(--orange-deep); margin-left: 1px; }
.vm-cell.is-current .vm-nag { color: #fff; }
.vm-comment { padding: 6px 12px 8px 62px; font-size: .88rem; color: var(--muted); border-top: 1px solid #f7ede4; background: #fffcf9; }
.vm-result { padding: 8px 12px; text-align: center; font-weight: 800; border-top: 1px solid var(--line); }
.viewer-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.game-facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .94rem; }
.game-facts dt { color: var(--muted); }
.game-facts dd { margin: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
@media (max-width: 900px) { .viewer { grid-template-columns: 1fr; } .viewer-moves { max-height: 300px; } }
