/* Vô Giới · "Ma Pháp Trận" — mực đêm, vàng ấn triện, đỏ son */
:root {
  --muc: #0c0b14;
  --muc-2: #110f1a;
  --the: #15131f;
  --the-2: #1e1a2b;
  --vien: #2a2638;
  --vien-2: #3a3550;
  --chu: #ede8dc;
  --chu-2: #c9c3d6;
  --mo: #a49fb3;
  --vang: #e8b84a;
  --vang-sang: #f5d27e;
  --vang-toi: #1a1408;
  --son: #e5533d;
  --son-sang: #f08a78;
  --xanh: #5bd18b;
  --tim: #d7bffa;
  --serif: "Noto Serif", Georgia, serif;
  --sans: "Be Vietnam Pro", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --rong: 1200px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--muc); color: var(--chu); font-family: var(--sans); font-size: 16px; line-height: 1.6;
  min-height: 100vh; display: flex; flex-direction: column;
  background-image: radial-gradient(rgba(232, 184, 74, 0.07) 1px, transparent 1px);
  background-size: 28px 28px;
}
main { flex: 1; }
a { color: var(--vang); text-decoration: none; }
a:hover { color: var(--vang-sang); }
:focus-visible { outline: 2px solid var(--vang-sang); outline-offset: 3px; border-radius: 3px; }
img, svg { max-width: 100%; }
.an-chu { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.khung { max-width: var(--rong); margin: 0 auto; padding: 0 24px; }
.mono { font-family: var(--mono); }
.mo { color: var(--mo); }

/* ---------- đầu trang ---------- */
.dau { border-bottom: 1px solid var(--vien); background: rgba(12, 11, 20, 0.92); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(6px); }
.dau nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; padding-top: 12px; padding-bottom: 12px; }
.logo { display: flex; align-items: center; gap: 12px; color: var(--chu); min-height: 44px; }
.logo:hover { color: var(--chu); }
.logo b { font-family: var(--serif); font-weight: 800; font-size: 22px; letter-spacing: 3px; }
.logo svg { transition: transform 0.6s ease; }
.logo:hover svg { transform: rotate(90deg); }
.menu { display: flex; flex-wrap: wrap; gap: 0 22px; flex: 1 1 auto; font-weight: 500; font-size: 15px; }
.menu a { color: var(--mo); padding: 10px 0; display: inline-block; border-bottom: 2px solid transparent; }
.menu a:hover, .menu a[aria-current="page"] { color: var(--chu); }
.menu a[aria-current="page"] { border-bottom-color: var(--son); }
.tai-khoan { display: flex; align-items: center; gap: 10px; }

/* ---------- nút ---------- */
.nut {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 22px;
  border-radius: 4px; border: 1px solid var(--vang); background: transparent; color: var(--vang);
  font: 600 15px/1 var(--sans); cursor: pointer; text-align: center; transition: background 0.15s, color 0.15s;
}
.nut:hover { background: rgba(232, 184, 74, 0.1); color: var(--vang-sang); }
.nut.chinh { background: var(--vang); color: var(--vang-toi); border-color: var(--vang); font-weight: 700; }
.nut.chinh:hover { background: var(--vang-sang); }
.nut.nhat { border-color: var(--vien-2); color: var(--chu-2); }
.nut:disabled { opacity: 0.5; cursor: default; }
.nut-icon { min-width: 44px; min-height: 44px; padding: 0; border: 1px solid var(--vien-2); border-radius: 4px; background: transparent; color: var(--chu); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.nut-icon:hover { border-color: var(--vang); color: var(--vang-sang); }

/* ---------- tiêu đề mục có ấn ---------- */
.tieu-de { display: flex; align-items: center; gap: 14px; margin: 0 0 22px; font-family: var(--serif); font-weight: 700; font-size: 28px; line-height: 1.25; }
.tieu-de::before { content: ""; width: 12px; height: 12px; border: 1.5px solid var(--vang); transform: rotate(45deg); flex: none; box-shadow: inset 0 0 0 3px var(--muc), inset 0 0 0 6px var(--son); }
.tieu-de::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--vien-2), transparent); }
.nho { font-family: var(--mono); font-size: 12px; letter-spacing: 3px; color: var(--son-sang); text-transform: uppercase; }

/* ---------- thẻ ---------- */
.the { background: var(--the); border: 1px solid var(--vien); border-radius: 8px; padding: 26px; }
.luoi { display: flex; flex-wrap: wrap; gap: 20px; }
.luoi > * { min-width: 0; }

/* ---------- ma pháp trận ---------- */
@keyframes xoay { to { transform: rotate(360deg); } }
@keyframes xoay-nguoc { to { transform: rotate(-360deg); } }
.tran .vong-ngoai { transform-origin: 200px 200px; animation: xoay 140s linear infinite; }
.tran .vong-trong { transform-origin: 200px 200px; animation: xoay-nguoc 90s linear infinite; }
.tran .nhan { transform-origin: 200px 200px; }
.tran-nho .vong-ngoai { transform-origin: 60px 60px; animation: xoay 18s linear infinite; }
.tran .quy-dao { transform-origin: 200px 200px; animation: xoay 70s linear infinite; }
.tran .nguoc { transform-origin: 0 0; animation: xoay-nguoc 70s linear infinite; }
.tran:hover .quy-dao, .tran:hover .nguoc { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .tran .vong-ngoai, .tran .vong-trong, .tran .quy-dao, .tran .nguoc, .tran-nho .vong-ngoai { animation: none; } }

/* ---------- hero ---------- */
.hero { display: flex; flex-wrap: wrap; align-items: center; gap: 40px 48px; padding-top: 64px; padding-bottom: 56px; }
.hero-chu { flex: 1 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.hero h1 { margin: 0; font-family: var(--serif); font-weight: 800; font-size: clamp(38px, 6vw, 66px); line-height: 1.08; }
.hero h1 em { font-style: normal; color: var(--vang-sang); }
.hero p.loi { margin: 0; font-size: 18px; color: var(--chu-2); max-width: 560px; }
.hero-tran { flex: 1 1 380px; min-width: 0; display: flex; justify-content: center; }
.hero-tran svg { width: 100%; max-width: 440px; height: auto; }
.ip-hang { display: flex; flex-wrap: wrap; gap: 12px; }
.ip { flex: 1 1 240px; display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 16px; background: var(--the); border: 1px solid var(--vien); border-radius: 6px; }
.ip div { flex: 1; min-width: 0; }
.ip small { display: block; font-size: 12px; color: var(--mo); letter-spacing: 1px; }
.ip strong { font-family: var(--mono); font-size: 17px; color: var(--vang-sang); word-break: break-all; }
.trang-thai { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 14px; color: var(--mo); }
.cham { width: 8px; height: 8px; border-radius: 50%; background: var(--mo); flex: none; }
.cham.song { background: var(--xanh); box-shadow: 0 0 0 0 rgba(91, 209, 139, 0.6); animation: nhip 2s infinite; }
@keyframes nhip { 70% { box-shadow: 0 0 0 8px rgba(91, 209, 139, 0); } 100% { box-shadow: 0 0 0 0 rgba(91, 209, 139, 0); } }

.muc { padding-top: 8px; padding-bottom: 64px; }

/* ---------- thông báo ---------- */
.tb-ds { display: flex; flex-direction: column; }
.tb { display: flex; gap: 20px; padding: 20px 0; border-top: 1px solid var(--vien); }
.tb:last-child { border-bottom: 1px solid var(--vien); }
.tb-ngay { flex: 0 0 64px; text-align: center; font-family: var(--mono); }
.tb-ngay b { display: block; font-size: 26px; color: var(--vang-sang); line-height: 1.1; }
.tb-ngay span { font-size: 12px; color: var(--mo); }
.tb h3 { margin: 0 0 6px; font-size: 18px; line-height: 1.4; }
.tb h3 a { color: var(--chu); }
.tb h3 a:hover { color: var(--vang-sang); }
.tb p { margin: 0; color: var(--mo); font-size: 15px; white-space: pre-line; overflow-wrap: anywhere; }
.nhan-ghim { display: inline-block; font-size: 12px; font-weight: 600; color: var(--son-sang); border: 1px solid var(--son); border-radius: 3px; padding: 1px 8px; margin-bottom: 8px; }
.bai { max-width: 760px; }
.bai h1 { font-family: var(--serif); font-size: clamp(30px, 4.5vw, 44px); line-height: 1.2; margin: 8px 0 12px; }
.bai .noi-dung { font-size: 17px; color: var(--chu-2); white-space: pre-line; overflow-wrap: anywhere; line-height: 1.75; }

/* ---------- BXH ---------- */
.tab { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tab button { min-height: 44px; padding: 0 16px; border-radius: 4px; border: 1px solid var(--vien-2); background: transparent; color: var(--chu-2); font: 600 15px var(--sans); cursor: pointer; }
.tab button[aria-pressed="true"] { background: var(--vang); color: var(--vang-toi); border-color: var(--vang); }
.bxh { list-style: none; margin: 0; padding: 0; background: var(--the); border: 1px solid var(--vien); border-radius: 8px; }
.bxh li { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--vien); }
.bxh li:last-child { border-bottom: 0; }
.bxh .hang { width: 28px; font-family: var(--serif); font-weight: 800; font-size: 19px; color: var(--mo); text-align: center; }
.bxh li:nth-child(1) .hang { color: var(--vang-sang); }
.bxh li:nth-child(2) .hang { color: #d9d4e4; }
.bxh li:nth-child(3) .hang { color: #e0a27a; }
.bxh .ten { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bxh .ten small { display: block; font-weight: 400; font-size: 12px; color: var(--mo); }
.bxh .so { font-family: var(--mono); color: var(--chu-2); white-space: nowrap; }

/* ---------- ô nhập ---------- */
label.nhan { display: block; font-size: 13px; font-weight: 600; color: var(--chu-2); margin-bottom: 8px; }
.o {
  width: 100%; min-height: 48px; padding: 0 14px; background: var(--muc); border: 1px solid var(--vien-2); border-radius: 4px;
  color: var(--chu); font: 16px var(--sans);
}
.o:focus { border-color: var(--vang); outline: none; box-shadow: 0 0 0 3px rgba(232, 184, 74, 0.18); }
textarea.o { min-height: 180px; padding: 12px 14px; line-height: 1.6; resize: vertical; }
.o.ma { font-family: var(--mono); letter-spacing: 2px; text-transform: uppercase; font-size: 17px; }
.hang-nhap { display: flex; flex-wrap: wrap; gap: 10px; }
.hang-nhap .o { flex: 1 1 200px; width: auto; }
.tin { margin: 12px 0 0; font-size: 14px; min-height: 1.6em; }
.tin.tot { color: var(--xanh); }
.tin.xau { color: var(--son-sang); }

/* ---------- đăng nhập ---------- */
.dn { display: flex; flex-wrap: wrap; gap: 36px; align-items: flex-start; padding-top: 56px; padding-bottom: 72px; max-width: 1080px; }
.dn-chu { flex: 1 1 360px; min-width: 0; }
.dn-chu h1 { margin: 0 0 14px; font-family: var(--serif); font-size: clamp(32px, 4.5vw, 42px); line-height: 1.15; }
.buoc { list-style: none; margin: 24px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; counter-reset: b; }
.buoc li { display: flex; gap: 14px; align-items: flex-start; counter-increment: b; }
.buoc li::before { content: counter(b); flex: 0 0 32px; height: 32px; border: 1px solid var(--vang); border-radius: 50%; color: var(--vang-sang); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.buoc span { padding-top: 4px; }
.dn-hop { flex: 1 1 420px; min-width: 0; }
.lenh-hop { margin-top: 22px; border: 1px dashed var(--vang); border-radius: 8px; padding: 22px; display: flex; flex-wrap: wrap; align-items: center; gap: 22px; background: var(--muc-2); }
.lenh-hop .lenh { font-family: var(--mono); font-size: clamp(24px, 4vw, 32px); font-weight: 700; color: var(--vang-sang); letter-spacing: 2px; }

/* ---------- Thẻ Chuyển Sinh ---------- */
.the-cs {
  position: relative; overflow: hidden; border: 1px solid var(--vang); border-radius: 10px; padding: 30px;
  background: var(--the-2);
  box-shadow: inset 0 0 0 6px var(--the-2), inset 0 0 0 7px rgba(232, 184, 74, 0.35);
}
.the-cs .tran-nen { position: absolute; right: -90px; top: -90px; width: 340px; height: 340px; opacity: 0.18; pointer-events: none; }
.the-cs-dau { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; position: relative; }
.an-ten {
  width: 76px; height: 76px; flex: none; border-radius: 50%; border: 2px solid var(--son); color: var(--son-sang);
  display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 800; font-size: 34px;
  background: var(--muc); box-shadow: inset 0 0 0 4px var(--muc), inset 0 0 0 5px rgba(229, 83, 61, 0.5);
}
.the-cs h1 { margin: 0; font-family: var(--serif); font-size: clamp(28px, 4vw, 38px); line-height: 1.15; overflow-wrap: anywhere; }
.the-cs .phu { color: var(--mo); font-size: 14px; }
.chi-so { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 24px; position: relative; }
.chi-so div { background: var(--muc-2); border: 1px solid var(--vien); border-radius: 6px; padding: 14px 16px; }
.chi-so small { display: block; font-size: 12px; color: var(--mo); }
.chi-so .chu b { font-family: var(--sans); font-weight: 600; }
.chi-so b { display: block; font-family: var(--mono); font-size: 21px; margin-top: 4px; color: var(--chu); overflow-wrap: anywhere; }
.chi-so .lon b { font-family: var(--serif); font-size: 34px; color: var(--vang-sang); line-height: 1.1; }
.dau-an { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 3px; border: 1px solid var(--vien-2); color: var(--chu-2); }
.dau-an.vang { border-color: var(--vang); color: var(--vang-sang); }
.dau-an.son { border-color: var(--son); color: var(--son-sang); }

/* dấu son khi nhận code */
@keyframes dong-an { 0% { transform: scale(2.2) rotate(-18deg); opacity: 0; } 60% { transform: scale(0.92) rotate(-8deg); opacity: 1; } 100% { transform: scale(1) rotate(-8deg); opacity: 1; } }
.an-son { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border: 2.5px solid var(--son); border-radius: 6px; color: var(--son-sang); font-family: var(--serif); font-weight: 800; font-size: 15px; line-height: 1.1; text-align: center; white-space: pre-line; transform: rotate(-8deg); animation: dong-an 0.45s ease-out both; }
@media (prefers-reduced-motion: reduce) { .an-son { animation: none; } }

.lich-su { list-style: none; margin: 0; padding: 0; }
.lich-su li { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; padding: 12px 0; border-top: 1px solid var(--vien); font-size: 14px; }
.lich-su .mono { color: var(--chu); font-weight: 700; }
.lich-su .kq { flex: 1 1 220px; color: var(--mo); }
.tt-cho { color: var(--vang-sang); } .tt-xong { color: var(--xanh); } .tt-loi { color: var(--son-sang); }

/* ---------- cuối trang ---------- */
.cuoi { border-top: 1px solid var(--vien); margin-top: 24px; }
.cuoi div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding-top: 28px; padding-bottom: 28px; font-size: 13px; color: var(--mo); }

.trong { padding: 28px; text-align: center; color: var(--mo); border: 1px dashed var(--vien-2); border-radius: 8px; }
.sap-mo { text-align: center; padding: 72px 0; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.sap-mo h1 { margin: 0; font-family: var(--serif); font-size: clamp(30px, 5vw, 46px); }
.sap-mo svg { width: 220px; height: 220px; }

@media (max-width: 640px) {
  .khung { padding-left: 16px; padding-right: 16px; }
  .dau { position: static; }
  .menu { gap: 0 16px; font-size: 14px; }
  .dn { padding-top: 32px; }
  .the, .the-cs { padding: 20px; }
  .hero { padding-top: 40px; }
  .tieu-de { font-size: 24px; }
}
