/* TÀN KINH — design system website + Wiki (Tây Du dị bản hắc hóa)
   Font: SVN-Shikamaru cho tiêu đề quan trọng (giống game) · Be Vietnam Pro cho nội dung dài (dễ đọc trên web) */
@font-face { font-family: "TK Title"; src: url("/assets/fonts/shikamaru.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "TK Label"; src: url("/assets/fonts/signlanguage.woff2") format("woff2"); font-display: swap; }

:root {
  --bg: #0a090f; --bg2: #110f18; --bg3: #181524;
  --panel: rgba(20, 16, 30, .88); --panel-solid: #16131f;
  --line: #2b2340; --line2: #3d3158;
  --text: #ebe6f3; --muted: #a59cb8; --dim: #6f6785;
  --purple: #3b1f63; --violet: #9466ff; --violet-soft: rgba(148, 102, 255, .16);
  --crimson: #b3203a; --crimson-2: #e0334f;
  --gold: #c9a24a; --gold-2: #ecd38f; --gold-soft: rgba(201, 162, 74, .14);
  --ok: #5fcf8f; --warn: #f0b44c; --bad: #ff6a6a;
  --g-pham: #c9c9c9; --g-luong: #6fc3ff; --g-tinh: #c79bff; --g-bao: #ffd16a; --g-than: #ff6a5a;
  --r: 10px; --r-lg: 16px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .55);
  --f-title: "TK Title", "Be Vietnam Pro", serif;
  --f-body: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-h: 64px;
  --maxw: 1200px;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.65 var(--f-body); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--gold-2); text-decoration: none; }
a:hover { color: #fff; }
h1, h2, h3, .t-title { font-family: var(--f-title); font-weight: 400; letter-spacing: .02em; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(28px, 4.2vw, 48px); }
h2 { font-size: clamp(22px, 3vw, 34px); }
h3 { font-size: 20px; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); } .dim { color: var(--dim); }
.gold { color: var(--gold-2); } .crimson { color: var(--crimson-2); }

/* ---------- nav */
.nav { position: sticky; top: 0; z-index: 50; height: var(--nav-h); background: linear-gradient(180deg, rgba(10, 9, 15, .96), rgba(10, 9, 15, .82)); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: center; gap: 18px; height: 100%; }
.logo { font-family: var(--f-title); font-size: 26px; color: var(--gold-2); letter-spacing: .06em; white-space: nowrap; text-shadow: 0 0 18px rgba(148, 102, 255, .45); }
.logo small { display: block; font: 600 10px/1 var(--f-body); letter-spacing: .32em; color: var(--muted); margin-top: 2px; }
.nav-links { display: flex; gap: 4px; margin-left: auto; list-style: none; padding: 0; }
.nav-links a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--text); font-weight: 600; font-size: 14px; }
.nav-links a:hover, .nav-links a[aria-current="page"] { background: var(--violet-soft); color: var(--gold-2); }
.nav-cta { margin-left: 8px; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line2); color: var(--text); border-radius: 8px; width: 42px; height: 38px; font-size: 18px; }
@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav-links { display: none; position: absolute; top: var(--nav-h); left: 0; right: 0; flex-direction: column; background: var(--bg2); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; }
  .nav.open .nav-links { display: flex; }
}

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: var(--r); border: 1px solid var(--line2); background: var(--bg3); color: var(--text); font: 700 14px var(--f-body); cursor: pointer; transition: transform .12s, background .15s, border-color .15s; }
.btn:hover { border-color: var(--gold); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: wait; }
.btn-gold { background: linear-gradient(180deg, #e3c67c, #a87f2c); color: #1a1208; border-color: #f1dca0; text-shadow: 0 1px 0 rgba(255, 255, 255, .3); }
.btn-gold:hover { color: #000; background: linear-gradient(180deg, #f0d892, #b98d34); }
.btn-crimson { background: linear-gradient(180deg, #d0304c, #7d1024); border-color: #f0566f; color: #fff; }
.btn-play { font-family: var(--f-title); font-weight: 400; font-size: 22px; letter-spacing: .08em; min-height: 56px; padding: 0 34px; }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; }

/* ---------- hero + login */
.hero { position: relative; min-height: calc(100svh - var(--nav-h)); display: grid; align-items: center; overflow: hidden; isolation: isolate; }
.hero-bg { position: absolute; inset: 0; z-index: -2; }
.hero-bg img { width: 100%; height: 100%; object-fit: cover; object-position: 30% 50%; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(10, 9, 15, .15) 0%, rgba(10, 9, 15, .35) 45%, rgba(10, 9, 15, .9) 75%), linear-gradient(0deg, var(--bg) 0%, transparent 30%); }
.hero .wrap { display: grid; grid-template-columns: 1fr 400px; gap: 40px; align-items: center; width: 100%; padding-top: 32px; padding-bottom: 48px; }
.hero-copy h1 { font-size: clamp(44px, 7vw, 96px); color: var(--gold-2); text-shadow: 0 4px 30px rgba(0, 0, 0, .8), 0 0 40px rgba(148, 102, 255, .35); margin-bottom: .15em; }
.hero-copy .tagline { font-family: var(--f-title); font-size: clamp(16px, 2vw, 22px); color: var(--text); letter-spacing: .12em; text-shadow: 0 2px 12px #000; }
.hero-copy p { max-width: 520px; color: #d8d1e6; text-shadow: 0 2px 10px #000; }
.server-status { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: rgba(0, 0, 0, .55); border: 1px solid var(--line2); font-size: 13px; }
.server-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.server-status[data-state="on"] i { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.server-status[data-state="off"] i { background: var(--bad); }
@media (max-width: 900px) {
  .hero { min-height: auto; }
  .hero .wrap { grid-template-columns: 1fr; gap: 20px; padding-top: 28px; }
  .hero::after { background: linear-gradient(180deg, rgba(10, 9, 15, .25) 0%, rgba(10, 9, 15, .55) 40%, var(--bg) 92%); }
  .hero-bg img { object-position: 50% 30%; }
  .hero-copy { text-align: center; }
  .hero-copy p { margin-inline: auto; }
}

.auth { background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r-lg); box-shadow: var(--shadow), inset 0 1px 0 rgba(236, 211, 143, .12); padding: 22px; position: relative; }
.auth::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; background: linear-gradient(160deg, rgba(236, 211, 143, .55), transparent 35%, transparent 65%, rgba(148, 102, 255, .5)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.auth h2 { font-size: 24px; text-align: center; color: var(--gold-2); margin-bottom: 14px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px; background: rgba(0, 0, 0, .35); padding: 4px; border-radius: 10px; }
.auth-tabs button { min-height: 38px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: 700 14px var(--f-body); cursor: pointer; }
.auth-tabs button[aria-selected="true"] { background: var(--bg3); color: var(--gold-2); box-shadow: inset 0 0 0 1px var(--line2); }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field input { width: 100%; min-height: 44px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line2); background: #0d0b13; color: var(--text); font: 15px var(--f-body); }
.field input:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px var(--gold-soft); }
.auth .btn { width: 100%; }
.auth-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 10px 0 0; font-size: 13px; }
.auth-row button { background: none; border: 0; color: var(--gold-2); cursor: pointer; font: 600 13px var(--f-body); padding: 4px 0; }
.msg { min-height: 20px; font-size: 13px; margin: 8px 0 0; }
.msg.err { color: var(--bad); } .msg.ok { color: var(--ok); }
.chars { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; }
.chars li { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 9px; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); font-size: 14px; }
.chars li b { color: var(--gold-2); font-weight: 700; }
.hidden { display: none !important; }

/* ---------- sections */
.section { padding: 72px 0; position: relative; }
.section-head { text-align: center; margin-bottom: 36px; }
.section-head .kicker { font: 700 12px var(--f-body); letter-spacing: .35em; color: var(--crimson-2); text-transform: uppercase; }
.section-head h2 { color: var(--gold-2); margin-top: 6px; }
.section-head p { color: var(--muted); max-width: 640px; margin: 0 auto; }
.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--line2), var(--gold), var(--line2), transparent); margin: 0 auto; max-width: 600px; }
.bg-art { position: relative; isolation: isolate; overflow: hidden; }
.bg-art > img.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; opacity: .45; }
.bg-art::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, var(--bg) 0%, rgba(10, 9, 15, .55) 30%, rgba(10, 9, 15, .55) 70%, var(--bg) 100%); }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

.card { background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--gold); transform: translateY(-2px); }
.card-img { aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 16px; }
.card-body h3 { color: var(--gold-2); margin-bottom: 6px; }
.card-body p { color: var(--muted); font-size: 14px; margin: 0; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font: 700 11px/1.6 var(--f-body); border: 1px solid currentColor; white-space: nowrap; }
.b-live { color: var(--ok); } .b-dev { color: var(--warn); } .b-off { color: var(--dim); } .b-unv { color: var(--warn); border-style: dashed; }

/* class showcase */
.classes { display: grid; grid-template-columns: 240px 1fr; gap: 24px; }
.class-tabs { display: grid; gap: 8px; align-content: start; }
.class-tabs button { display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); cursor: pointer; font: 700 15px var(--f-body); }
.class-tabs button img { width: 40px; height: 40px; border-radius: 8px; image-rendering: pixelated; background: #000; }
.class-tabs button[aria-selected="true"] { border-color: var(--gold); background: linear-gradient(90deg, var(--gold-soft), transparent); color: var(--gold-2); }
.class-panel { display: grid; grid-template-columns: minmax(0, 360px) 1fr; gap: 24px; align-items: start; }
.class-panel .art { aspect-ratio: 3 / 4; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line2); background: #000; }
.class-panel .art img { width: 100%; height: 100%; object-fit: cover; }
.class-panel h3 { font-size: 32px; color: var(--gold-2); }
.skill-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.skill-chip { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 10px; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); font-size: 13px; }
.skill-chip img { width: 32px; height: 32px; border-radius: 6px; }
.branch { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 900px) {
  .classes { grid-template-columns: 1fr; }
  .class-tabs { grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); overflow-x: auto; padding-bottom: 6px; }
  .class-panel { grid-template-columns: 1fr; }
  .class-panel .art { max-width: 320px; margin: 0 auto; }
}

/* news */
.news-tabs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-bottom: 20px; }
.chip { min-height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line2); background: var(--bg2); color: var(--muted); font: 700 13px var(--f-body); cursor: pointer; }
.chip[aria-pressed="true"], .chip:hover { color: var(--gold-2); border-color: var(--gold); }
.news-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.news-list li { border-bottom: 1px solid var(--line); }
.news-list a { display: grid; grid-template-columns: 110px 1fr auto; gap: 14px; align-items: center; padding: 14px 4px; color: var(--text); }
.news-list a:hover { background: var(--violet-soft); }
.news-type { font: 700 12px var(--f-body); color: var(--crimson-2); }
.news-date { color: var(--dim); font-size: 13px; }
@media (max-width: 560px) { .news-list a { grid-template-columns: 1fr auto; } .news-type { grid-column: 1 / -1; } }

/* footer */
.footer { border-top: 1px solid var(--line); background: #07060b; padding: 36px 0 28px; color: var(--muted); font-size: 13px; }
.footer .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 24px; }
.footer h4 { color: var(--text); font: 700 14px var(--f-body); margin: 0 0 8px; }
.footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.footer .legal { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.footer .warn180 { color: var(--gold-2); font-weight: 700; }
@media (max-width: 700px) { .footer .cols { grid-template-columns: 1fr; } }

/* ---------- article / prose */
.page-head { padding: 48px 0 24px; border-bottom: 1px solid var(--line); background: radial-gradient(ellipse at 50% -40%, rgba(148, 102, 255, .25), transparent 60%); }
.crumbs { font-size: 13px; color: var(--dim); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.prose { max-width: 820px; min-width: 0; overflow-wrap: anywhere; }
.prose h2 { margin-top: 1.6em; color: var(--gold-2); font-size: 26px; }
.prose h3 { margin-top: 1.3em; color: var(--text); }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose code { background: var(--bg3); padding: 1px 6px; border-radius: 5px; font-size: .92em; }
.prose blockquote { margin: 1em 0; padding: 10px 16px; border-left: 3px solid var(--gold); background: var(--gold-soft); border-radius: 0 8px 8px 0; }
.prose blockquote.warn { border-color: var(--warn); background: rgba(240, 180, 76, .1); }
.prose img { border-radius: var(--r); border: 1px solid var(--line); margin: 12px 0; }
.toc { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; margin: 0 0 24px; font-size: 14px; }
.toc ol { margin: 6px 0 0; padding-left: 20px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--dim); margin-top: 6px; }

/* tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); margin: 12px 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--bg3); color: var(--gold-2); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- wiki */
.wiki-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 28px; padding: 28px 16px 64px; }
.wiki-side { position: sticky; top: calc(var(--nav-h) + 16px); align-self: start; max-height: calc(100vh - var(--nav-h) - 32px); overflow: auto; font-size: 14px; }
.wiki-side h4 { font: 700 12px var(--f-body); letter-spacing: .2em; color: var(--dim); text-transform: uppercase; margin: 16px 0 6px; }
.wiki-side a { display: flex; justify-content: space-between; padding: 6px 10px; border-radius: 8px; color: var(--text); }
.wiki-side a:hover, .wiki-side a[aria-current="page"] { background: var(--violet-soft); color: var(--gold-2); }
.wiki-side a span { color: var(--dim); font-size: 12px; }
@media (max-width: 900px) { .wiki-layout { grid-template-columns: minmax(0, 1fr); } .wiki-side { position: static; max-height: none; display: none; } .wiki-side.open { display: block; } }
.wiki-hero { position: relative; isolation: isolate; overflow: hidden; padding: 56px 0 40px; text-align: center; }
.wiki-hero img.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; opacity: .5; }
.wiki-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(10, 9, 15, .4), var(--bg)); }
.wiki-hero h1 { color: var(--gold-2); }
.searchbox { position: relative; max-width: 640px; margin: 18px auto 0; }
.searchbox input { width: 100%; min-height: 52px; padding: 0 16px 0 46px; border-radius: 14px; border: 1px solid var(--line2); background: rgba(10, 9, 15, .9); color: var(--text); font: 16px var(--f-body); }
.searchbox input:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px var(--gold-soft); }
.searchbox::before { content: "⌕"; position: absolute; left: 16px; top: 50%; transform: translateY(-52%); font-size: 22px; color: var(--muted); }
.search-results { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px); background: var(--panel-solid); border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow); max-height: 60vh; overflow: auto; text-align: left; }
.search-results a { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; padding: 8px 12px; color: var(--text); border-bottom: 1px solid var(--line); }
.search-results a:hover, .search-results a.active { background: var(--violet-soft); }
.search-results img, .search-results .ph { width: 36px; height: 36px; border-radius: 6px; background: #000; object-fit: contain; image-rendering: pixelated; }
.search-results small { color: var(--dim); }
.search-results .empty { padding: 14px; color: var(--muted); }
.nav-search { position: relative; width: 220px; }
.nav-search input { width: 100%; min-height: 36px; border-radius: 9px; border: 1px solid var(--line2); background: #0d0b13; color: var(--text); padding: 0 10px; font: 14px var(--f-body); }
@media (max-width: 1100px) { .nav-search { display: none; } }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.cat-tile { display: grid; justify-items: center; gap: 6px; padding: 18px 10px; border-radius: var(--r-lg); background: var(--bg2); border: 1px solid var(--line); color: var(--text); text-align: center; }
.cat-tile:hover { border-color: var(--gold); color: var(--gold-2); }
.cat-tile img { width: 48px; height: 48px; object-fit: contain; image-rendering: pixelated; }
.cat-tile b { font-size: 15px; } .cat-tile small { color: var(--dim); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 18px; padding: 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); }
.filters label { font-size: 12px; color: var(--dim); font-weight: 700; margin-right: 2px; }
.filters select, .filters input { min-height: 36px; border-radius: 8px; border: 1px solid var(--line2); background: #0d0b13; color: var(--text); padding: 0 8px; font: 14px var(--f-body); }
.filters input { flex: 1 1 180px; }
.filters .count { margin-left: auto; color: var(--muted); font-size: 13px; }

.entity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.ent { display: grid; justify-items: center; gap: 6px; padding: 10px 8px 12px; border-radius: 12px; background: var(--bg2); border: 1px solid var(--line); color: var(--text); text-align: center; font-size: 13px; line-height: 1.3; }
.ent:hover { border-color: var(--gold); }
.ent .ico { width: 72px; height: 72px; border-radius: 10px; display: grid; place-items: center; background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, .06), rgba(0, 0, 0, .5)); border: 2px solid var(--gc, var(--line2)); overflow: hidden; }
.ent .ico img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.ent .ico .glyph { font-family: var(--f-title); font-size: 30px; color: var(--gc, var(--muted)); }
.ent small { color: var(--dim); }
.g-pham { --gc: var(--g-pham); } .g-luong { --gc: var(--g-luong); } .g-tinh { --gc: var(--g-tinh); } .g-bao { --gc: var(--g-bao); } .g-than { --gc: var(--g-than); }
.gname { color: var(--gc); font-weight: 700; }

.entity-head { display: grid; grid-template-columns: 140px 1fr; gap: 24px; align-items: center; margin-bottom: 24px; }
.entity-head .ico { width: 140px; height: 140px; border-radius: 18px; border: 2px solid var(--gc, var(--line2)); display: grid; place-items: center; background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, .07), rgba(0, 0, 0, .6)); overflow: hidden; }
.entity-head .ico img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.entity-head h1 { margin-bottom: 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 3px 10px; border-radius: 999px; background: var(--bg3); border: 1px solid var(--line2); font-size: 12px; color: var(--muted); }
@media (max-width: 560px) { .entity-head { grid-template-columns: 1fr; justify-items: center; text-align: center; } .tags { justify-content: center; } }
.stat-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin: 0 0 20px; padding: 0; list-style: none; }
.stat-list li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; font-size: 14px; }
.stat-list li b { color: var(--gold-2); font-variant-numeric: tabular-nums; }
.linkchips { display: flex; flex-wrap: wrap; gap: 8px; }
.linkchip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); color: var(--text); font-size: 13px; }
.linkchip img { width: 28px; height: 28px; border-radius: 6px; object-fit: contain; image-rendering: pixelated; background: #000; }
.linkchip:hover { border-color: var(--gold); }
.note { font-size: 13px; color: var(--muted); padding: 10px 14px; background: var(--bg2); border: 1px dashed var(--line2); border-radius: var(--r); margin: 12px 0; }
.mob-img { image-rendering: pixelated; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
.wrap > h2, .wiki-layout h2 { margin-top: 32px; }
.wrap > h2:first-child { margin-top: 0; }
@media (max-width: 900px) { .hide-sm { display: none; } }

/* ---------- thanh cuộn (Zan 01/11): mảnh, tối, ngón vàng cổ → tím; Firefox + Chromium/Safari */
html { scrollbar-color: #5a4a2e var(--bg); scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #7a6232, #4b2f6e); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, var(--gold), #6b45a8); }
::-webkit-scrollbar-corner { background: transparent; }

/* mục lục Wiki: cuộn riêng, thanh cuộn ẩn tới khi rê chuột, mờ dần ở mép trên/dưới */
.wiki-side { padding: 4px 10px 24px 0; scrollbar-width: none; overscroll-behavior: contain;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 14px, #000 calc(100% - 28px), transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0, #000 14px, #000 calc(100% - 28px), transparent 100%); }
.wiki-side:hover { scrollbar-width: thin; scrollbar-color: rgba(201, 162, 74, .45) transparent; }
.wiki-side::-webkit-scrollbar { width: 4px; }
.wiki-side::-webkit-scrollbar-track { background: transparent; }
.wiki-side::-webkit-scrollbar-thumb { background: transparent; border: 0; border-radius: 4px; }
.wiki-side:hover::-webkit-scrollbar-thumb { background: rgba(201, 162, 74, .45); }
.wiki-side:hover::-webkit-scrollbar-thumb:hover { background: var(--gold); }
.wiki-side h4 { display: flex; align-items: center; gap: 8px; }
.wiki-side h4::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line2), transparent); }
.wiki-side a { position: relative; line-height: 1.4; transition: background .15s, color .15s; }
.wiki-side a[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 3px; background: var(--gold); }
/* bảng / ô kết quả tìm kiếm / tab hệ phái cuộn ngang cũng dùng thanh mảnh */
.tbl-wrap, .search-results, .class-tabs, .toc { scrollbar-width: thin; scrollbar-color: rgba(201, 162, 74, .45) transparent; }
.tbl-wrap::-webkit-scrollbar, .search-results::-webkit-scrollbar, .class-tabs::-webkit-scrollbar { width: 6px; height: 6px; }
.tbl-wrap::-webkit-scrollbar-thumb, .search-results::-webkit-scrollbar-thumb, .class-tabs::-webkit-scrollbar-thumb { background: rgba(201, 162, 74, .45); border: 0; border-radius: 6px; }
.tbl-wrap::-webkit-scrollbar-track, .search-results::-webkit-scrollbar-track, .class-tabs::-webkit-scrollbar-track { background: transparent; }

/* nút mở mục lục trên điện thoại */
.side-toggle { display: none; width: 100%; min-height: 42px; margin: 0 0 4px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg2); color: var(--gold-2); font: 700 14px var(--f-body); cursor: pointer; }
@media (max-width: 900px) {
  .side-toggle { display: block; }
  .wiki-side.open { display: block; max-height: 60vh; overflow: auto; position: static; -webkit-mask-image: none; mask-image: none; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg2); }
}

/* ---------------- Thiên Phú Đại Thụ */
.lead { font-size: 17px; color: var(--text); max-width: 900px; }
.small { font-size: 13px; } .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ok { color: var(--ok); } .warn { color: var(--warn); }
.t1 { color: #9fd3ff; } .t2 { color: var(--gold-2); } .t3 { color: #ff9f6a; }
.tp-facts { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin: 18px 0 8px; }
.tp-facts div { background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; text-align: center; }
.tp-facts b { display: block; font-size: 24px; color: var(--gold-2); line-height: 1.2; }
.tp-facts span { font-size: 12px; color: var(--muted); }
@media (max-width: 900px) { .tp-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tp-viewer { margin: 22px 0 8px; }
.tp-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.tp-bar input, .tp-bar select { min-height: 38px; border-radius: 9px; border: 1px solid var(--line2); background: #0d0b13; color: var(--text); font: 14px var(--f-body); padding: 0 10px; }
.tp-bar input { flex: 1 1 200px; min-width: 0; }
.tp-bar select { flex: 0 1 auto; max-width: 100%; }
.tp-hits { font-size: 13px; color: var(--gold-2); }
.tp-stage { position: relative; height: min(72vh, 720px); min-height: 420px; border: 1px solid var(--line2); border-radius: var(--r-lg); overflow: hidden; background: #0b0a10; }
.tp-stage canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.tp-stage canvas:active { cursor: grabbing; }
.tp-zoom { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 6px; }
.tp-zoom button { width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line2); background: rgba(16, 13, 24, .9); color: var(--gold-2); font: 700 18px var(--f-body); cursor: pointer; }
.tp-zoom button:hover { border-color: var(--gold); }
.tp-info { position: absolute; top: 10px; right: 10px; width: 300px; max-height: calc(100% - 20px); overflow: auto; background: rgba(14, 11, 21, .94); border: 1px solid var(--line2); border-radius: var(--r); padding: 12px 14px; font-size: 14px; scrollbar-width: thin; }
.tp-info ul { margin: 8px 0; padding-left: 18px; } .tp-info p { margin: 6px 0; }
.tp-tip b { display: block; font-size: 16px; color: var(--gold-2); } .tp-tip small { color: var(--dao); font-weight: 700; }
.tp-tip.t3 b { color: #ff9f6a; } .tp-tip.t0 b { color: var(--text); }
@media (max-width: 700px) { .tp-stage { height: 64vh; min-height: 360px; } .tp-info { top: auto; bottom: 8px; left: 8px; right: 8px; width: auto; max-height: 42%; } }
.tp-viewer.full { position: fixed; inset: 0; z-index: 100; margin: 0; padding: 10px; background: var(--bg); display: flex; flex-direction: column; }
.tp-viewer.full .tp-stage { flex: 1; height: auto; }
body.tp-lock { overflow: hidden; }
.tp-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 8px; }
.tp-legend span { display: inline-block; border-radius: 50%; border: 2px solid var(--violet); background: #1a1622; vertical-align: middle; margin-right: -8px; }
.tp-legend .l0 { width: 8px; height: 8px; } .tp-legend .l1 { width: 11px; height: 11px; } .tp-legend .l2 { width: 15px; height: 15px; border-color: var(--gold); }
.tp-legend .l3 { width: 17px; height: 17px; border-color: #c9a25c; box-shadow: 0 0 0 3px #0a090f, 0 0 0 4px #c9a25c; }
.tp-legend .ld { width: 13px; height: 13px; border: 2px dashed #e8e0ff; } .tp-legend .lr { width: 13px; height: 13px; background: #f2c76b; border-color: #ffe9a8; }
.tp-door { background: var(--panel-solid); border: 1px solid var(--line); border-top: 3px solid var(--dao); border-radius: var(--r-lg); padding: 14px; }
.tp-door h3, .tp-bcard h3, .tp-dcard h3 { display: flex; align-items: center; gap: 8px; }
.tp-door h3 img, .tp-bcard h3 img, .tp-dcard h3 img { width: 30px; height: 30px; image-rendering: pixelated; }
.tp-jobs td { padding: 6px 4px; vertical-align: top; border-top: 1px solid var(--line); }
.tp-bcard, .tp-dcard { border-left: 3px solid var(--dao); }
.tp-head { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 18px; align-items: center; margin: 8px 0 14px; padding: 16px; border-radius: var(--r-lg); background: radial-gradient(ellipse at 0 50%, color-mix(in srgb, var(--dao) 28%, transparent), transparent 70%), var(--panel-solid); border: 1px solid var(--line); }
.tp-head img { width: 96px; height: 96px; image-rendering: pixelated; }
.tp-head h1 { margin-bottom: 4px; } .tp-head p { margin: 0 0 10px; }
@media (max-width: 560px) { .tp-head { grid-template-columns: 1fr; justify-items: center; text-align: center; } .tp-head .tags { justify-content: center; } }
.dao-tag { display: inline-flex; align-items: center; gap: 4px; color: var(--dao); font-weight: 700; white-space: nowrap; }
.dao-tag img { width: 18px; height: 18px; image-rendering: pixelated; }
.tp-insight li { margin: 8px 0; }
.tp-bars { display: grid; gap: 6px; max-width: 720px; }
.tp-bars div { display: grid; grid-template-columns: minmax(120px, 230px) minmax(0, 1fr) 44px; gap: 10px; align-items: center; font-size: 14px; }
.tp-bars i { display: block; height: 10px; width: var(--w); border-radius: 5px; background: linear-gradient(90deg, var(--violet), var(--gold)); }
.tp-bars b { text-align: right; color: var(--gold-2); font-variant-numeric: tabular-nums; }
.tp-ms { background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; }
.tp-ms h3 small { display: block; font: 600 12px var(--f-body); color: var(--muted); }
.tp-sheet { padding-left: 18px; columns: 1; } .tp-sheet li { margin: 3px 0; font-size: 14px; }
.tp-sheet .more { color: #ffcf8a; } .tp-sheet .flag, .tp-mods .flag { color: #ff9f6a; font-weight: 700; }
.tp-mods { margin: 0; padding-left: 16px; font-size: 13.5px; } .tp-mods li { margin: 2px 0; }
.tp-card { background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; }
.tp-card h3 { margin-bottom: 4px; } .tp-card.ks { border-top: 3px solid #c9a25c; } .tp-card.trap { border-top: 3px solid var(--bad); }
.tp-card:target { box-shadow: 0 0 0 2px var(--gold); }
.tp-minor { display: flex; flex-wrap: wrap; gap: 8px; }
.tp-minor span { display: inline-flex; flex-direction: column; padding: 6px 10px; border-radius: 9px; background: var(--bg2); border: 1px solid var(--line); font-size: 13px; }
.tp-minor small { color: var(--muted); font-size: 11px; }
.tp-stack { display: flex; height: 26px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line2); max-width: 720px; }
.tp-stack span { background: color-mix(in srgb, var(--dao) 75%, #000); color: #fff; font: 700 11px/26px var(--f-body); text-align: center; overflow: hidden; white-space: nowrap; }
.tp-dist { display: flex; flex-wrap: wrap; gap: 10px; }
.tp-dist div { background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; text-align: center; min-width: 120px; }
.tp-dist b { display: block; font-size: 22px; color: var(--gold-2); } .tp-dist span { font-size: 12px; color: var(--muted); }
.tp-mss { align-items: start; }
@media (max-width: 900px) { .tp-mss { grid-template-columns: minmax(0, 1fr); } }
