/* app/topbar.css — thanh đầu trang của trang chủ dùng ở trang con (app/topbar.js). Tự chứa: không phụ thuộc biến CSS của trang.
   Số đo = header trang chủ (home.css .top / lobby.css .hud-coin / .me-btn): cao 56, logo 36, ô xu 40, nút 44. Nền mận như thanh màn Nhiệm vụ. */
/* phần thanh cũ cần ẩn: mỗi trang tự khai ở <meta name="dtop" data-hide> (topbar.js) */
.dtop{position:sticky;top:0;z-index:30;padding-top:env(safe-area-inset-top);color:#fff;
  background:linear-gradient(180deg,#4a1d3b,#2a1022);box-shadow:0 2px 0 rgba(20,6,16,.35),0 6px 16px rgba(20,6,16,.22);
  font:600 14px/1.2 "Montserrat",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}
.dtop *{box-sizing:border-box}
.dtop-in{display:flex;align-items:center;gap:10px;height:56px;max-width:1200px;margin:0 auto;
  padding:0 max(16px,env(safe-area-inset-right)) 0 max(10px,env(safe-area-inset-left))}
.dtop .ic{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.dtop-map,.dtop-back{flex:none;cursor:pointer;border:0;padding:0;display:grid;place-items:center;width:44px;height:44px;border-radius:50%;color:#fff;text-decoration:none;
  background:rgba(255,255,255,.12);box-shadow:inset 0 0 0 1.5px rgba(255,214,110,.5)}
.dtop-map:hover,.dtop-back:hover{background:rgba(255,255,255,.2)}
.dtop-map:focus-visible,.dtop-back:focus-visible,.dtop-brand:focus-visible,.dtop-me:focus-visible,.dtop-login:focus-visible,.dtop-coin:focus-visible{outline:2px solid #ffd76e;outline-offset:2px}
.dtop-brand{display:flex;align-items:center;gap:10px;min-height:44px;min-width:0;margin-right:auto;color:#fff;text-decoration:none}
.dtop-mark{flex:none;width:36px;height:36px;fill:none;stroke:#fff;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
.dtop-mark .h{fill:#ffd2dc;stroke:none}
.dtop-t{display:flex;flex-direction:column;min-width:0;line-height:1.1}
.dtop-t b{font:700 19px/1.1 "Playfair Display",Georgia,serif;letter-spacing:-.01em;white-space:nowrap}
.dtop-t small{display:flex;align-items:center;gap:6px;margin-top:2px;font:500 12px/1.3 "Montserrat",system-ui,sans-serif;color:#fff3e6}
.dtop-t .tag{font:600 10px/1 "Montserrat",system-ui,sans-serif;letter-spacing:.04em;text-transform:uppercase;color:#8a6626;background:#f6ebd5;padding:3px 6px;border-radius:4px}
.dtop .dtop-coin{flex:none;display:inline-flex;align-items:center;gap:6px;min-height:44px;height:auto;padding:0 12px 0 6px;border:0;border-radius:999px;cursor:pointer;
  background:linear-gradient(180deg,#3b1830,#2a1022);color:#ffe9a8;text-decoration:none;font:700 14px/1 "Montserrat",system-ui,sans-serif;font-variant-numeric:tabular-nums;
  box-shadow:inset 0 0 0 1.5px rgba(255,214,110,.55),0 2px 6px rgba(42,16,34,.25)}
.dtop .dtop-coin[hidden]{display:none}
.dtop .dtop-coin .coin{width:24px;height:24px}
.dtop .dtop-coin b{color:#ffe9a8;font:inherit}
.dtop-act{flex:none;display:flex;align-items:center}
.dtop-me{display:flex;align-items:center;gap:8px;min-height:44px;max-width:220px;padding:3px 12px 3px 3px;border-radius:999px;cursor:pointer;
  border:1.5px solid #eadcd4;background:#fffdfb;color:#2f2626;font:600 14px "Montserrat",system-ui,sans-serif}
.dtop-me .nm{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.dtop-me .dot{flex:none;width:8px;height:8px;border-radius:50%;background:#86621f}
.dtop-av{flex:none;display:grid;place-items:center;width:36px;height:36px;border-radius:50%;overflow:hidden;background:#f7e3e2;color:#7e2f3a;font:700 15px "Montserrat",system-ui,sans-serif}
.dtop-av img{width:100%;height:100%;object-fit:cover;object-position:50% 12%}
.dtop-login{display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 16px;border-radius:999px;cursor:pointer;
  border:1.5px solid #eadcd4;background:#fffdfb;color:#2f2626;font:600 14px "Montserrat",system-ui,sans-serif;white-space:nowrap}
@media (max-width:599px){
  .dtop-me{padding:3px}.dtop-me .nm,.dtop-me .dot{display:none}
  .dtop-login{width:44px;padding:0;justify-content:center}.dtop-login span{display:none}
}
@media (max-width:440px){.dtop-t{display:none}.dtop-in{gap:8px}}
/* 10/11 QA điện thoại: màn ≤ 400 px (iPhone SE 375, Galaxy 360) có Back + Bản đồ + logo + xu + Bạn bè + Tôi -> logo bị ép còn 22 px (vùng chạm < 44, logo tràn đè ô xu).
   Logo giữ đủ 44 px, bớt khe giữa các nút + đệm ô xu để vẫn vừa một hàng */
@media (max-width:400px){
  .dtop-in{gap:4px;padding-right:max(10px,env(safe-area-inset-right))}
  .dtop-brand{flex:none;min-width:44px;justify-content:center}
  .dtop .dtop-coin{gap:4px;padding:0 8px 0 4px}
}
/* 10/11 QA: số xu rất lớn (15 chữ số) đẩy avatar ra khỏi màn 390 -> màn hẹp: ô xu được co, số dài cắt "…" (số đầy đủ vẫn trong DOM / bấm ô xu xem) */
@media (max-width:600px){
  .dtop .dtop-coin{flex:0 1 auto;min-width:72px;overflow:hidden}
  .dtop .dtop-coin b{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .dtop .dtop-coin .coin,.dtop .dtop-coin svg{flex:none}
}
/* 10/11 QA iPhone SE 320 px: 5 nút 44 px + ô xu 72 px lòi nút Tôi 2 px khỏi mép phải -> bớt khe + đệm, ô xu co tới 64 px (nút vẫn 44 px) */
@media (max-width:340px){
  .dtop-in{gap:2px;padding:0 max(6px,env(safe-area-inset-right)) 0 max(6px,env(safe-area-inset-left))}
  .dtop .dtop-coin{min-width:64px}
}
/* 11/11 UX-115: ≤ 360 px ô xu hiện số rút gọn ("490K", app/topbar.js) -> đồng xu nhỏ + bớt đệm để số rút gọn luôn đủ chỗ (không "…") */
@media (max-width:360px){
  .dtop .dtop-coin{gap:3px;padding:0 7px 0 3px}
  .dtop .dtop-coin .coin,.dtop .dtop-coin svg{width:20px;height:20px}
}

/* Khu giải trí (play/): màn chọn game là ảnh tràn màn -> thanh nổi trong suốt đè lên ảnh, y như trang chủ trên bản đồ (town.css html.at-hero) */
body.has-dtop:not(.gl-open)>.dtop:has(~.main .games){position:fixed;left:0;right:0;
  background:linear-gradient(180deg,rgba(24,10,20,.5),rgba(24,10,20,0));box-shadow:none}
body.has-dtop:not(.gl-open)>.dtop:has(~.main .games) .dtop-t b{text-shadow:0 1px 3px rgba(0,0,0,.55)}
body.has-dtop:not(.gl-open)>.dtop:has(~.main .games) .dtop-t small{text-shadow:0 1px 2px rgba(0,0,0,.6)}

/* 09/11 chiều: thanh ở MỌI màn. data-mode="fixed" (rạp cưới demo/, Thiết lập nhân vật): trang toàn màn -> thanh cố định trên cùng,
   --safe-t của trang (mọi phần tử bám mép trên đều dùng biến này) được cộng thêm 56px để tự lùi xuống dưới thanh. */
html.dtop-fixed .dtop{position:fixed;left:0;right:0}
html.dtop-fixed{--safe-t:calc(env(safe-area-inset-top,0px) + 56px)}
/* data-mode="game" (game/*): .room/.stage vốn cao 100dvh -> trừ chiều cao thanh; thanh riêng của game bỏ phần chừa tai thỏ (thanh chung đã chừa) */
html.dtop-game .room,html.dtop-game .stage{height:calc(100dvh - 56px - env(safe-area-inset-top,0px))}
html.dtop-game .bar{padding-top:8px}
/* nút Back/Bản đồ giữ 44 px cả ở màn hẹp (quy tắc vùng chạm >= 44, QA điện thoại 09/11) */
/* lớp phủ game toàn màn của trang chủ khu (play/ #gl, rạp demo/ #bayLayer) lùi xuống dưới thanh -> thanh + Back luôn thấy khi đang chơi */
html.has-dtop #gl.gl{top:calc(56px + env(safe-area-inset-top,0px))}
html.has-dtop #bayLayer.bay-layer{top:calc(56px + env(safe-area-inset-top,0px))}
@media (min-width:900px){html.has-dtop #bayLayer.bay-layer{top:72px}}
html.has-dtop #bayLayer .bay-x{top:10px}
@media (min-width:1024px){html.has-dtop .gl:not([hidden])~.side,html.has-dtop body.gl-open .side{top:calc(56px + env(safe-area-inset-top,0px))}}   /* play/: cột chat cạnh game cũng dưới thanh */
@media (max-width:1023px) and (orientation:landscape) and (min-width:600px){html.has-dtop .side{top:calc(56px + env(safe-area-inset-top,0px))}}
/* data-look="clear" (rạp cưới): thanh trong suốt — dải tối mờ dần đè lên cảnh 3D, y như trang chủ trên bản đồ (town.css html.at-hero) */
.dtop.dtop-clear{background:linear-gradient(180deg,rgba(24,10,20,.5),rgba(24,10,20,0));box-shadow:none}
.dtop-clear .dtop-t b{text-shadow:0 1px 3px rgba(0,0,0,.55)}
.dtop-clear .dtop-t small{text-shadow:0 1px 2px rgba(0,0,0,.6)}
.dtop-clear .dtop-mark{filter:drop-shadow(0 1px 2px rgba(0,0,0,.5))}
.dtop-clear .dtop-map,.dtop-clear .dtop-back{background:rgba(24,10,20,.35);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}
/* 09/11 (chủ sản phẩm): MỌI màn chơi game dùng thanh trong suốt — game/* (data-look=clear) + Khu giải trí khi đang mở game (Cờ caro, Tá lả…
   trong lớp #gl): lớp game lên sát mép trên, thanh nổi trong suốt đè lên; thanh riêng của game (nút âm thanh, xếp hạng) lùi xuống dưới thanh. */
html.dtop-game .dtop-clear{position:fixed;left:0;right:0}
html.dtop-game .room,html.dtop-game .stage{height:100dvh}
html.dtop-game .bar{padding-top:calc(64px + env(safe-area-inset-top,0px))}
html.has-dtop body.gl-open>.dtop-clear{position:fixed;left:0;right:0;z-index:55}
html.has-dtop:has(.dtop-clear) #gl.gl{top:0}
@media (min-width:1024px){html.has-dtop:has(.dtop-clear) body.gl-open .side{top:0}}
html.has-dtop:has(.dtop-clear) #gl #caroBox{padding-top:calc(64px + var(--safe-t))}   /* Cờ caro (play/caro.js) trong lớp #gl */
@media (min-width:1024px){html.has-dtop body.gl-open>.dtop-clear{right:var(--side-w)}}   /* máy tính: cột chat bên phải -> thanh chỉ trên phần game */

.dtop-fh-slot{flex:none;display:flex}.dtop-fh-slot:empty{display:none}   /* 10/11 icon Bạn bè khi đang chơi game (app/friends.js) */

/* ===== iPad (html.is-tablet) 15/11 ===== thanh vẫn cao 56 (hơn 10 chỗ cộng cứng 56 px); nút 48, lề rộng hơn, chữ nhãn >= 12 px */
html.is-tablet .dtop-in{gap:12px;padding:0 max(var(--tab-gut,24px),env(safe-area-inset-right)) 0 max(16px,env(safe-area-inset-left))}
html.is-tablet .dtop-map,html.is-tablet .dtop-back{width:var(--tab-hit,48px);height:var(--tab-hit,48px)}
html.is-tablet .dtop-brand{min-height:var(--tab-hit,48px)}
html.is-tablet .dtop .dtop-coin,html.is-tablet .dtop-me,html.is-tablet .dtop-login{min-height:var(--tab-hit,48px)}
html.is-tablet .dtop .dtop-coin{padding:0 14px 0 8px;font-size:15px}
html.is-tablet .dtop-me{padding:3px 14px 3px 4px;font-size:15px}
html.is-tablet .dtop-av{width:40px;height:40px}
html.is-tablet .dtop-t .tag{font-size:12px}
html.is-tablet .dtop .dg-q{width:var(--tab-hit,48px);height:var(--tab-hit,48px);min-width:var(--tab-hit,48px)}
/* IPAD-101 (sửa đợt 1): thẻ "BẢN XEM TRƯỚC" luôn 1 dòng. Máy bảng DỌC hẹp (768 / 820) đang mở game = thanh đủ 7 phần tử, cột chữ chỉ còn ~140 px
   -> bỏ chữ "thiep.site" (nút chữ trơn trong <small>: font-size 0), chỉ giữ thẻ dưới tên; khe + lề phải gọn lại để tên không bị ép */
html.is-tablet .dtop-t .tag{white-space:nowrap}
@media (max-width:900px){
  html.is-tablet.tab-port .dtop-in{gap:8px;padding-right:max(16px,env(safe-area-inset-right))}
  html.is-tablet.tab-port .dtop-t small{font-size:0;gap:0}
  html.is-tablet.tab-port .dtop-t .tag{font-size:12px}
}
/* IPAD-032 (phần còn lại): chữ hạng .rk-chip (app/rank.js chèn CSS, 11,5 px) >= 12 trên mọi trang có thanh đầu chung */
html.is-tablet .rk-chip{font-size:12px}
