/* ==========================================================================
   NÚT TRÊN HEADER — kiểu HUD "máy móc": vát góc chéo (2 góc lớn + 2 góc nhỏ), viền sáng mảnh,
   vạch kỹ thuật ở cạnh trên/dưới. Cùng ngôn ngữ với khung hero, thẻ game và hộp tìm kiếm.
   Gồm: Nhận Tất Cả Việt Hóa · số Cá · Nạp Cá · Kho đồ · Tìm kiếm · Đăng nhập.
   ========================================================================== */
/* ---- nhóm A: tự cắt hình bằng clip-path (không có phần tử con nằm ngoài viền) ---- */
html body header :is(nav.links a.nav-role,.ca-balance,.support-btn,.hs-btn,.login-btn:not(.is-logged-in):not(.kho-do-link)){
  --c1:10px;--c2:4px;
  --bd1:#8cc8ff;--bd2:#2f6bff;--f1:#0f2142;--f2:#0a1630;--tk:#bfe3ff;
  position:relative;isolation:isolate;overflow:visible;
  border:1px solid transparent;border-radius:0;outline:0;box-shadow:none;
  background:linear-gradient(135deg,var(--bd1),var(--bd2));
  clip-path:polygon(var(--c1) 0,calc(100% - var(--c2)) 0,100% var(--c2),100% calc(100% - var(--c1)),calc(100% - var(--c1)) 100%,var(--c2) 100%,0 calc(100% - var(--c2)),0 var(--c1));
  transition:filter .18s ease,transform .18s ease;
}
html body header :is(nav.links a.nav-role,.ca-balance,.support-btn,.hs-btn,.login-btn:not(.is-logged-in):not(.kho-do-link))::before{
  content:"";position:absolute;inset:.5px;z-index:-1;pointer-events:none;
  background:
    linear-gradient(var(--tk),var(--tk)) 14px 0/16px 2px no-repeat,
    linear-gradient(var(--tk),var(--tk)) right 14px bottom 0/16px 2px no-repeat,
    linear-gradient(180deg,rgba(255,255,255,.10),rgba(255,255,255,0) 55%),
    linear-gradient(135deg,var(--f1),var(--f2));
  clip-path:polygon(calc(var(--c1) - .9px) 0,calc(100% - var(--c2) + .9px) 0,100% calc(var(--c2) - .9px),100% calc(100% - var(--c1) + .9px),calc(100% - var(--c1) + .9px) 100%,calc(var(--c2) - .9px) 100%,0 calc(100% - var(--c2) + .9px),0 calc(var(--c1) - .9px));
}
html body header :is(nav.links a.nav-role,.ca-balance,.support-btn,.hs-btn,.login-btn:not(.is-logged-in):not(.kho-do-link)):hover{
  --bd1:#ffe08a;--bd2:#ff9a3d;--tk:#ffe9b0;filter:brightness(1.12);
}
/* ---- nhóm B: Kho đồ (có chấm đỏ số lượng nằm ngoài viền → vẽ hình bằng ::before/::after, không clip chính nút) ---- */
html body header .kho-do-link{
  --c1:10px;--c2:4px;--bd1:#8cc8ff;--bd2:#2f6bff;--f1:#0f2142;--f2:#0a1630;--tk:#bfe3ff;
  position:relative;isolation:isolate;border:1px solid transparent;border-radius:0;background:none!important;box-shadow:none;
  transition:filter .18s ease,transform .18s ease;
}
html body header .kho-do-link::before,html body header .kho-do-link::after{content:"";position:absolute;z-index:-1;pointer-events:none;}
html body header .kho-do-link::before{
  inset:-1px;background:linear-gradient(135deg,var(--bd1),var(--bd2));
  clip-path:polygon(var(--c1) 0,calc(100% - var(--c2)) 0,100% var(--c2),100% calc(100% - var(--c1)),calc(100% - var(--c1)) 100%,var(--c2) 100%,0 calc(100% - var(--c2)),0 var(--c1));
}
html body header .kho-do-link::after{
  inset:.5px;
  background:
    linear-gradient(var(--tk),var(--tk)) 14px 0/16px 2px no-repeat,
    linear-gradient(var(--tk),var(--tk)) right 14px bottom 0/16px 2px no-repeat,
    linear-gradient(180deg,rgba(255,255,255,.10),rgba(255,255,255,0) 55%),
    linear-gradient(135deg,var(--f1),var(--f2));
  clip-path:polygon(calc(var(--c1) - .9px) 0,calc(100% - var(--c2) + .9px) 0,100% calc(var(--c2) - .9px),100% calc(100% - var(--c1) + .9px),calc(100% - var(--c1) + .9px) 100%,calc(var(--c2) - .9px) 100%,0 calc(100% - var(--c2) + .9px),0 calc(var(--c1) - .9px));
}
html body header .kho-do-link:hover{--bd1:#ffe08a;--bd2:#ff9a3d;--tk:#ffe9b0;filter:brightness(1.12);}
/* bỏ khung trắng/xám hiện ra ngoài khi rê chuột (do .login-btn:hover đổi border-color) */
html body header .kho-do-link,html body header .kho-do-link:hover,html body header .kho-do-link:focus,html body header .kho-do-link:active{border-color:transparent !important;outline:0;}
/* chấm đỏ số lượng: vát góc cho đồng bộ, vẫn nằm ngoài viền */
html body .inv-badge{border-radius:0;border:0;min-width:20px;height:20px;line-height:20px;top:-9px;right:-9px;background:#e5384f;
  clip-path:polygon(5px 0,100% 0,100% calc(100% - 5px),calc(100% - 5px) 100%,0 100%,0 5px);box-shadow:none;}

/* ---- màu riêng từng nút ---- */
/* Nhận Tất Cả Việt Hóa: vàng */
html body header nav.links a.nav-role.nav-role.nav-role{--c1:12px;--c2:5px;--bd1:#fff1c2;--bd2:#f2a31a;--f1:#ffd166;--f2:#f2a31a;--tk:#fff7d6;color:#1a1200;outline:0!important;box-shadow:none!important;animation:roleBeat 1.7s ease-in-out infinite;}
html body header nav.links a.nav-role.nav-role.nav-role::before{
  background:
    radial-gradient(circle,#1a1200 1.6px,transparent 2.2px) 11px 50%/6px 6px no-repeat,
    radial-gradient(circle,#1a1200 1.6px,transparent 2.2px) right 11px top 50%/6px 6px no-repeat,
    linear-gradient(var(--tk),var(--tk)) 20px 0/18px 2px no-repeat,
    linear-gradient(var(--tk),var(--tk)) right 20px bottom 0/18px 2px no-repeat,
    linear-gradient(180deg,rgba(255,255,255,.35),rgba(255,255,255,0) 55%),
    linear-gradient(135deg,var(--f1),var(--f2));
}
html body header nav.links a.nav-role.nav-role.nav-role{padding-left:30px;padding-right:30px;}
html body header nav.links a.nav-role.nav-role.nav-role:hover{--bd1:#fff;--bd2:#ffd166;color:#1a1200;transform:translateY(-2px);box-shadow:none;}
html body header nav.links{animation:navPulse 1.7s ease-in-out infinite;}
@keyframes navPulse{0%,100%{filter:drop-shadow(0 0 3px rgba(242,177,52,.45));}50%{filter:drop-shadow(0 0 12px rgba(242,177,52,.9));}}
/* số Cá: viền vàng, nền tối */
html body header .ca-balance.ca-balance.ca-balance{--bd1:#ffd36a;--bd2:#a8710c;--f1:#1d1707;--f2:#120e04;--tk:#ffd36a;}
/* Nạp Cá: tím */
html body header .support-btn.support-btn.support-btn{--bd1:#e9c8ff;--bd2:#a855f7;--f1:#8b5cf6;--f2:#c026d3;--tk:#f6e6ff;color:#fff;}
html body header .support-btn.support-btn.support-btn:hover{--bd1:#fff;--bd2:#e9a8ff;transform:translateY(-1px);}
/* tìm kiếm trên điện thoại: ô vuông vát góc */
@media(max-width:640px){html body header .hs-btn{--c1:8px;--c2:3px;}}

/* ---- giao diện sáng ---- */
html[data-theme="light"] body header :is(.hs-btn,.login-btn:not(.is-logged-in):not(.kho-do-link),.kho-do-link){--bd1:#74a8ff;--bd2:#2f6bff;--f1:#ffffff;--f2:#eaf1ff;--tk:#2f6bff;}
html[data-theme="light"] body header .ca-balance.ca-balance.ca-balance{--f1:#fff8e6;--f2:#ffeec2;--bd1:#f0a400;--bd2:#c98a14;--tk:#f0a400;}
html[data-theme="light"] body header :is(.hs-btn,.login-btn:not(.is-logged-in):not(.kho-do-link),.kho-do-link):hover{--bd1:#ffc94d;--bd2:#f0a400;--tk:#f0a400;}

/* ==========================================================================
   AVATAR ĐÃ ĐĂNG NHẬP (góc phải header) — kiểu HUD tương lai
   Khung bát giác viền neon có ánh sáng chạy quanh, nền tối có lưới + vạch quét, hình người xanh băng,
   dấu ✓ thành huy hiệu lục giác xanh lá phát sáng. Rê chuột: viền chuyển vàng như thẻ game.
   ========================================================================== */
html body header .login-btn.is-logged-in,
html.has-session body header #loginBtn,
html.has-session body header #gLogin{
  position:relative;display:inline-flex;align-items:center;justify-content:center;
  width:40px;height:40px;padding:0 !important;border:0 !important;border-radius:0 !important;
  background:none !important;box-shadow:none !important;overflow:visible !important;transition:transform .2s;
}
html body header .login-btn.is-logged-in:hover,
html.has-session body header #loginBtn:hover,
html.has-session body header #gLogin:hover{transform:translateY(-1px);}
html body header .login-btn.is-logged-in .lb-avatar,
html.has-session body header #loginBtn .lb-avatar,
html.has-session body header #gLogin .lb-avatar{
  --ring:linear-gradient(115deg,#1de9f0 0%,#2a7bff 30%,#bff7ff 50%,#2a7bff 70%,#1de9f0 100%);--halo:rgba(29,233,240,.7);
  position:relative;display:block;width:100%;height:100%;filter:drop-shadow(0 0 4px var(--halo));transition:filter .25s;
}
html body header .login-btn.is-logged-in:hover .lb-avatar,
html.has-session body header #loginBtn:hover .lb-avatar,
html.has-session body header #gLogin:hover .lb-avatar{--ring:linear-gradient(115deg,#ffb84a 0%,#ff8a1f 30%,#fff1c2 50%,#ff8a1f 70%,#ffb84a 100%);--halo:rgba(242,177,52,.85);}
html body header .login-btn.is-logged-in .lb-avatar::before,
html.has-session body header #loginBtn .lb-avatar::before,
html.has-session body header #gLogin .lb-avatar::before{
  content:"";position:absolute;inset:0;background:var(--ring) 0 0/80px 80px repeat;animation:avRing 4s linear infinite;
  clip-path:polygon(11px 0,calc(100% - 11px) 0,100% 11px,100% calc(100% - 11px),calc(100% - 11px) 100%,11px 100%,0 calc(100% - 11px),0 11px);
}
@keyframes avRing{to{background-position:80px 80px}}
html body header .login-btn.is-logged-in .lb-avatar::after,
html.has-session body header #loginBtn .lb-avatar::after,
html.has-session body header #gLogin .lb-avatar::after{
  content:"";position:absolute;top:0;left:50%;width:14px;height:2.5px;transform:translateX(-50%);background:#fff;z-index:2;
  clip-path:polygon(0 0,100% 0,85% 100%,15% 100%);
}
html body header .login-btn.is-logged-in .lb-avatar .av-svg,
html.has-session body header #loginBtn .lb-avatar .av-svg,
html.has-session body header #gLogin .lb-avatar .av-svg{
  position:absolute;inset:2.5px;width:calc(100% - 5px);height:calc(100% - 5px);display:block;
  background:
    repeating-linear-gradient(0deg,rgba(255,255,255,.05) 0 1px,transparent 1px 3px),
    radial-gradient(circle at 50% 28%,rgba(29,233,240,.38),transparent 68%),
    linear-gradient(160deg,#0c3547,#06172a);
  clip-path:polygon(9px 0,calc(100% - 9px) 0,100% 9px,100% calc(100% - 9px),calc(100% - 9px) 100%,9px 100%,0 calc(100% - 9px),0 9px);
}
html body header .login-btn.is-logged-in .lb-avatar .av-svg circle:first-of-type,
html.has-session body header #loginBtn .lb-avatar .av-svg circle:first-of-type,
html.has-session body header #gLogin .lb-avatar .av-svg circle:first-of-type{fill:transparent;}
html body header .login-btn.is-logged-in .lb-avatar .av-svg :is(circle:nth-of-type(2),path),
html.has-session body header #loginBtn .lb-avatar .av-svg :is(circle:nth-of-type(2),path),
html.has-session body header #gLogin .lb-avatar .av-svg :is(circle:nth-of-type(2),path){fill:#c8fbff;filter:drop-shadow(0 0 2px rgba(29,233,240,.8));}
html body header .login-btn.is-logged-in .lb-check,
html.has-session body header #loginBtn .lb-check,
html.has-session body header #gLogin .lb-check{
  position:absolute;right:-5px;bottom:-5px;z-index:3;width:17px;height:17px;display:flex;align-items:center;justify-content:center;isolation:isolate;
  border:0;border-radius:0;background:none;color:#02201a;font-size:10px;font-weight:900;line-height:1;
  filter:drop-shadow(1.5px 0 0 #06101f) drop-shadow(-1.5px 0 0 #06101f) drop-shadow(0 1.5px 0 #06101f) drop-shadow(0 -1.5px 0 #06101f) drop-shadow(0 0 4px rgba(52,229,160,.85));
}
html body header .login-btn.is-logged-in .lb-check::before,
html.has-session body header #loginBtn .lb-check::before,
html.has-session body header #gLogin .lb-check::before{
  content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(135deg,#9bffd8,#18d48f 55%,#0fb67a);
  clip-path:polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%);
}
html[data-theme="light"] body header .login-btn.is-logged-in .lb-avatar,
html[data-theme="light"].has-session body header #loginBtn .lb-avatar,
html[data-theme="light"].has-session body header #gLogin .lb-avatar{
  --ring:linear-gradient(115deg,#f0a400 0%,#ff8a1f 30%,#fff0c2 50%,#ff8a1f 70%,#f0a400 100%);--halo:rgba(240,164,0,.6);
}
