/* ---------- Thanh menu: son mai toi, logo giua, mep duoi vong cung om logo ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; height: 76px; transition: height .3s;
  background:
    repeating-radial-gradient(circle at 50% 120%, transparent 0 18px, rgba(232,189,98,.05) 19px 20px),
    linear-gradient(180deg, #2a1a10 0%, #160d08 100%);
  box-shadow: 0 8px 24px rgba(20,8,0,.45);
}
/* duong chi vang mep duoi, mo dan hai dau */
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, #b9782a 12%, #f6d58a 50%, #b9782a 88%, transparent);
}
/* vong cung vong xuong om logo (cung mau nen thanh menu + vien vang) */
.topbar-crest {
  position: absolute; left: 50%; top: calc(100% - 2px); width: 300px; height: 42px; transform: translateX(-50%);
  pointer-events: none; filter: drop-shadow(0 8px 10px rgba(20,8,0,.45)); transition: transform .3s;
}
.topbar-in { position: relative; height: 100%; display: flex; align-items: center; }

/* logo tron o giua, ngoi tren vong cung */
.brand {
  position: absolute; z-index: 3; left: 50%; top: 6px; width: 124px; height: 124px; transform: translateX(-50%);
  transition: top .3s, width .3s, height .3s;
}
.brand img { width: 100%; height: 100%; filter: drop-shadow(0 6px 12px rgba(0,0,0,.6)); transition: transform .4s; }
.brand::before {
  content: ""; position: absolute; inset: -10%; z-index: -1; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,200,90,.45), transparent 70%);
  animation: brand-glow 3.2s ease-in-out infinite;
}
.brand:hover img { transform: scale(1.06) rotate(-3deg); }
@keyframes brand-glow { 0%, 100% { opacity: .5; transform: scale(.92); } 50% { opacity: 1; transform: scale(1.05); } }

/* menu chia deu hai ben logo */
.nav { flex: 1; display: flex; align-items: center; height: 100%; }
/* 2 nua menu rong bang nhau -> khoang trong giua (nav-gap) luon nam dung duoi logo */
.nav-half { flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: space-around; height: 100%; }
.nav-gap { flex: none; width: 170px; }
.nav-half > a {
  position: relative; display: inline-flex; align-items: center; gap: 8px; height: 100%; padding: 0 6px;
  font: 700 18px/1 "LacLongQuan", var(--serif); letter-spacing: .06em; text-transform: uppercase; color: #ecd9b0;
  transition: color .25s, text-shadow .25s;
}
/* gach hoa van vang toa tu giua: 2 vach + vien thoi */
.nav-half > a::after {
  content: ""; position: absolute; left: 50%; bottom: 14px; width: 70px; height: 9px; transform: translateX(-50%) scaleX(0);
  background:
    linear-gradient(45deg, transparent 38%, #f6d58a 38% 62%, transparent 62%) center / 9px 9px no-repeat,
    linear-gradient(90deg, transparent, #f6d58a 40%, transparent 46%, transparent 54%, #f6d58a 60%, transparent) center / 100% 1px no-repeat;
  transition: transform .35s cubic-bezier(.2,.8,.2,1);
}
.nav-half > a:hover, .nav-half > a.on { color: #ffe9a8; text-shadow: 0 0 12px rgba(255,190,80,.7); }
.nav-half > a:hover::after, .nav-half > a.on::after { transform: translateX(-50%) scaleX(1); }
/* nut trang chu = ngoi thap */
.nav-home img { width: 40px; height: auto; transition: filter .25s, transform .25s; }
.nav-home span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.nav-home:hover img, .nav-home.on img { filter: drop-shadow(0 0 10px rgba(255,210,110,.9)); transform: translateY(-2px); }

/* tai khoan (chi khi da dang nhap) */
.nav-user { position: absolute; right: 0; top: 50%; transform: translateY(-50%); display: flex; gap: 6px; align-items: center; }
.burger { display: none; margin-left: auto; background: none; border: 0; width: 40px; height: 40px; cursor: pointer; }
.burger span { display: block; height: 2px; margin: 7px 6px; background: var(--gold-2); transition: .25s; }

/* thu gon khi cuon */
.topbar.scrolled { height: 60px; }
.topbar.scrolled .brand { top: 4px; width: 92px; height: 92px; }
.topbar.scrolled .topbar-crest { transform: translateX(-50%) scale(.8, .7); transform-origin: top center; }

@media (max-width: 1240px) {
  .nav-half > a { font-size: 16px; }
  .nav-gap { width: 150px; }
  .nav-user .btn span { display: none; }
}
@media (max-width: 960px) {
  .topbar, .topbar.scrolled { height: 64px; }
  .topbar-crest { display: none; }
  .brand, .topbar.scrolled .brand { left: 0; top: 4px; width: 80px; height: 80px; transform: none; }
  .burger { display: block; }
  .nav-gap { display: none; }
  .nav-half { display: contents; }
  .nav {
    position: fixed; inset: 64px 0 auto 0; z-index: 5; height: auto; flex-direction: column; align-items: stretch; gap: 2px;
    background: #160d08; padding: 12px 16px 18px; border-bottom: 1px solid rgba(201,154,59,.35);
    transform: translateY(calc(-100% - 80px)); visibility: hidden; transition: transform .3s, visibility .3s;
    max-height: calc(100vh - 64px); overflow: auto;
  }
  .nav.open { transform: none; visibility: visible; }
  .nav-half > a { height: auto; padding: 12px; font-size: 17px; }
  .nav-half > a::after { left: 12px; bottom: 4px; transform: scaleX(0); transform-origin: left; }
  .nav-half > a:hover::after, .nav-half > a.on::after { transform: scaleX(1); }
  .nav-home span { position: static; width: auto; height: auto; clip: auto; }
  .nav-home img { width: 30px; }
  .nav-user { position: static; transform: none; margin-left: auto; margin-right: 8px; }
}
@media (prefers-reduced-motion: reduce) { .brand::before { animation: none; } }

/* ---------- Thanh loi tat ben phai: cot o thoi so le, rong vang cuon phia sau ---------- */
.quick-bar {
  position: fixed; right: 8px; top: 50%; z-index: 40; width: 132px; transform: translateY(-50%);
  display: flex; flex-direction: column; padding: 30px 0 10px;
}
.qb-dragon {
  position: absolute; z-index: -1; left: -62%; top: -6%; width: 190%; max-width: none; height: auto; pointer-events: none; transform: scaleX(-1);
  /* rong do -> rong vang kim */
  filter: sepia(1) saturate(2.4) hue-rotate(-12deg) brightness(1.05) drop-shadow(0 4px 8px rgba(40,15,0,.5));
  opacity: .95; animation: qb-float 6s ease-in-out infinite;
}
@keyframes qb-float { 0%, 100% { transform: scaleX(-1) translateY(0); } 50% { transform: scaleX(-1) translateY(-6px); } }
.quick-bar a {
  --c1: #c8a46a; --c2: #8a6531; --c3: #4e3416;
  position: relative; width: 88px; height: 88px; margin-top: -40px; display: grid; place-items: center;
  color: #fff6dc; text-decoration: none; transition: transform .25s;
}
.quick-bar a:first-of-type { margin-top: 0; }
.quick-bar a:nth-of-type(odd) { align-self: flex-start; }
.quick-bar a:nth-of-type(even) { align-self: flex-end; }
.quick-bar a.q-dl { --c1: #e2452c; --c2: #a8261c; --c3: #5c0b06; }
.quick-bar a::before {
  content: ""; position: absolute; inset: 16%; z-index: -1; transform: rotate(45deg); border-radius: 3px;
  background:
    repeating-radial-gradient(circle at 100% 100%, transparent 0 7px, rgba(255,230,170,.16) 8px 9px),
    linear-gradient(135deg, var(--c1), var(--c2) 60%, var(--c3));
  border: 1.5px solid #e8bd62;
  box-shadow: 0 0 0 2px var(--c3), 0 8px 16px rgba(30,10,0,.45), inset 0 0 12px rgba(0,0,0,.3);
  transition: box-shadow .25s, filter .25s;
}
.quick-bar a::after { content: ""; position: absolute; inset: 22%; transform: rotate(45deg); border: 1px solid rgba(255,236,190,.55); pointer-events: none; }
.quick-bar a i { display: none; }
.quick-bar a span { font: 700 14px/1.15 "LacLongQuan", var(--serif); text-align: center; text-shadow: 0 1px 0 rgba(0,0,0,.5); }
.quick-bar a:hover { transform: scale(1.08); z-index: 2; }
.quick-bar a:hover::before { filter: brightness(1.12); box-shadow: 0 0 0 2px var(--c3), 0 10px 20px rgba(30,10,0,.5), 0 0 18px rgba(255,200,90,.8), inset 0 0 12px rgba(0,0,0,.25); }
/* man vua: thu nho cot */
@media (max-width: 1340px) {
  .quick-bar { width: 108px; }
  .quick-bar a { width: 72px; height: 72px; margin-top: -33px; }
  .quick-bar a span { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { .qb-dragon { animation: none; } }
/* dien thoai: thanh ngang duoi day */
@media (max-width: 960px) {
  .quick-bar { top: auto; bottom: 0; right: 0; left: 0; width: auto; transform: none; flex-direction: row; padding: 0; background: rgba(22,13,8,.97); border-top: 1px solid rgba(201,154,59,.45); }
  .qb-dragon { display: none; }
  .quick-bar a, .quick-bar a:nth-of-type(odd), .quick-bar a:nth-of-type(even) { flex: 1; width: auto; height: auto; margin: 0; padding: 8px 2px; align-self: stretch; }
  .quick-bar a::before, .quick-bar a::after { display: none; }
  .quick-bar a.q-dl { background: var(--red); }
  .quick-bar a i { display: block; font-size: 17px; color: var(--gold-2); margin-bottom: 2px; text-align: center; }
  .quick-bar a.q-dl i { color: #fff; }
  .quick-bar a span { font: 500 11px/1.2 var(--sans); }
  .quick-bar a span br { display: none; }
  .quick-bar a:hover { transform: none; }
}

/* Da dang nhap: nut tai khoan chi hien bieu tuong, chua cho no ben phai de khong de chu menu */
.nav-user .btn span { display: none; }
/* da dang nhap: chua cho nut tai khoan ben phai, chua bang ben trai de 2 nua van can */
@media (min-width: 961px) { .topbar-in:has(.nav-user) .nav { padding: 0 110px; } }
/* tai khoan quan tri co them nut banh rang (3 nut) -> chua rong hon */
@media (min-width: 961px) { .topbar-in:has(.nav-user > :nth-child(3)) .nav { padding: 0 165px; } }
@media (min-width: 961px) and (max-width: 1240px) { .topbar-in:has(.nav-user > :nth-child(3)) .nav-gap { width: 130px; } }
@media (min-width: 961px) and (max-width: 1100px) { .topbar-in:has(.nav-user) .nav-half > a { font-size: 13px; letter-spacing: .01em; padding: 0 3px; white-space: nowrap; } }

/* cat duong chi vang thang o doan vong cung duoi logo (tranh 2 vach cat ngang vong cung) */
@media (min-width: 961px) {
  .topbar::after {
    -webkit-mask: linear-gradient(90deg, #000 calc(50% - 150px), transparent calc(50% - 128px), transparent calc(50% + 128px), #000 calc(50% + 150px));
            mask: linear-gradient(90deg, #000 calc(50% - 150px), transparent calc(50% - 128px), transparent calc(50% + 128px), #000 calc(50% + 150px));
  }
  .topbar.scrolled::after {
    -webkit-mask: linear-gradient(90deg, #000 calc(50% - 120px), transparent calc(50% - 102px), transparent calc(50% + 102px), #000 calc(50% + 120px));
            mask: linear-gradient(90deg, #000 calc(50% - 120px), transparent calc(50% - 102px), transparent calc(50% + 102px), #000 calc(50% + 120px));
  }
}

/* hao quang sau logo: quang vang tho + tia sang xoay cham -> day logo noi len */
.brand::before {
  inset: -18%;
  background: radial-gradient(closest-side, rgba(255,226,150,.75), rgba(255,180,70,.38) 45%, rgba(214,120,40,.12) 70%, transparent 100%);
}
.brand::after {
  content: ""; position: absolute; inset: -34%; z-index: -2; border-radius: 50%; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(255,214,120,.55) 0deg 4deg, transparent 4deg 18deg);
  -webkit-mask: radial-gradient(closest-side, #000 30%, rgba(0,0,0,.5) 55%, transparent 78%);
          mask: radial-gradient(closest-side, #000 30%, rgba(0,0,0,.5) 55%, transparent 78%);
  animation: brand-rays 28s linear infinite; will-change: transform;
}
.brand img { filter: drop-shadow(0 0 10px rgba(255,205,110,.55)) drop-shadow(0 6px 12px rgba(0,0,0,.6)); }
@keyframes brand-rays { to { transform: rotate(360deg); } }
html.is-scrolling .brand::before { animation-play-state: paused; }
@media (max-width: 960px) { .brand::after { inset: -20%; opacity: .7; } }
@media (prefers-reduced-motion: reduce) { .brand::after { animation: none; } }
