/* Bố cục màn chính v2 (14/11/2026) — đi kèm home-layout.js, nạp SAU home-tidy.css.
 * body.hl-on do JS bật: điện thoại dọc + PC/tablet. Điện thoại xoay ngang (màn thấp) giữ thanh nút riêng.
 * Gỡ file này + home-layout.js là về bố cục cũ. */

:root { --hl-ink: #4a2f12; --hl-cream: #fff8ea; --hl-line: #cfa862; --hl-lip: #a87d3c; }

/* ---------------------------------------------------------------- 1. hàng Tầng · Chủ đề · Chùa */
body.hl-on #floor-nav { top: var(--hl-row-y, calc(var(--top-h) + 4px)); }
body.hl-on #shop-hub, body.hl-on #temple-hub {
  top: var(--hl-row-y) !important; bottom: auto !important;
  width: var(--hl-h, 34px) !important; min-width: 0 !important;
  height: var(--hl-h, 34px) !important; min-height: 0 !important;
  padding: 0 !important; justify-content: center; gap: 0 !important;
}
body.hl-on #floor-nav .floor-toggle { min-width: 0 !important; }
/* màn hẹp (≤400px): bỏ icon thang máy để cả hàng không chạm nút sự kiện */
@media (max-width: 400px) {
  body.hl-on #floor-nav .floor-toggle::before { display: none; }
  body.hl-on #floor-nav .floor-toggle { padding: 0 8px 0 10px !important; gap: 4px !important; }
}
body.hl-on #shop-hub { left: var(--hl-x1) !important; }
body.hl-on #temple-hub { left: var(--hl-x2) !important; }
body.hl-on #shop-hub > b, body.hl-on #temple-hub > b {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
body.hl-on #shop-hub > svg, body.hl-on #temple-hub > svg,
body.hl-on #shop-hub > img, body.hl-on #temple-hub > img { width: 22px; height: 22px; margin: 0; }

/* ---------------------------------------------------------------- 2. cột nút phải: 4 nút chính + Thêm */
body.hl-on:not(.building) .hl-folded { display: none !important; }
body.hl-on:not(.building) #side-actions { bottom: calc(var(--float-base) + 2 * var(--float-step)) !important; }
body.hl-on:not(.building) #btn-chat { bottom: calc(var(--float-base) + var(--float-step)) !important; }
body:not(.hl-on) #hl-more, body.building #hl-more { display: none !important; }
#hl-more { order: 9; }

.hl-dots { display: flex; gap: 3px; align-items: center; pointer-events: none; }
.hl-dots b { width: 5px; height: 5px; background: var(--hl-ink); box-shadow: 0 1px 0 rgba(255, 255, 255, .7); }
#hl-more.on .hl-dots b { background: #3a2400; }
.hl-dot {
  position: absolute; top: -3px; right: -2px; width: 11px; height: 11px;
  background: #e53935; border: 2px solid #fff3d6; border-radius: 50%; box-shadow: 0 1px 0 #7a1414; pointer-events: none;
}
.hl-dot[hidden] { display: none; }

/* ---------------------------------------------------------------- 3. bảng Tiện ích */
#hl-pop {
  position: fixed; z-index: 24; width: 224px; box-sizing: border-box; padding: 8px;
  background: var(--hl-cream); color: var(--hl-ink);
  border: 1.5px solid var(--hl-line); border-radius: 10px;
  box-shadow: 0 3px 0 var(--hl-lip), 0 0 0 2px rgba(18, 10, 28, .35);
}
#hl-pop[hidden] { display: none; }
#hl-pop::after { /* mũi nhọn chỉ về nút Thêm */
  content: ''; position: absolute; right: -7px; top: calc(var(--hl-nub, 20px) - 6px); width: 10px; height: 10px;
  background: var(--hl-cream); border-right: 1.5px solid var(--hl-line); border-top: 1.5px solid var(--hl-line);
  transform: rotate(45deg);
}
#hl-pop.in { animation: hl-in .14s steps(4) both; }
@keyframes hl-in { from { opacity: 0; transform: translateX(6px); } to { opacity: 1; transform: none; } }
.hl-pop-h { margin: 0 2px 6px; font: 800 11px/1 var(--display, 'Baloo 2'), sans-serif; letter-spacing: .12em; color: #9a6a24; }
.hl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.hl-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 60px; padding: 6px 2px 5px; box-sizing: border-box;
  background: linear-gradient(#fffaf0, #ffe7b8); color: var(--hl-ink);
  border: 1.5px solid var(--hl-line); border-radius: 8px; box-shadow: 0 3px 0 var(--hl-lip), inset 0 1px 0 #fff;
  font: 700 11.5px/1.15 var(--font, 'Be Vietnam Pro'), sans-serif; text-align: center; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: transform .08s, filter .12s;
}
.hl-tile .hl-ic { width: auto; height: 22px; max-width: 26px; object-fit: contain; image-rendering: pixelated; }
.hl-tile svg.hl-ic { width: 22px; }
.hl-tile small { font-size: 9.5px; font-weight: 600; color: #8a6a3c; line-height: 1.1; }
.hl-tile:hover { filter: brightness(1.04); }
.hl-tile:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--hl-lip), inset 0 1px 0 #fff; }
.hl-tile:focus-visible, #hl-more:focus-visible { outline: 3px solid #3d8bff; outline-offset: 2px; }
.hl-tile.on { background: linear-gradient(#ffe066, #ffbf1a); border-color: #cf9800; box-shadow: 0 3px 0 #a87800, inset 0 1px 0 #fff6c2; }
.hl-tile.lock { background: linear-gradient(#eee8dc, #d7cdbb); border-color: #9e917c; box-shadow: 0 3px 0 #726755, inset 0 1px 0 #fff; color: #594f43; }
.hl-tile.lock .hl-ic { filter: grayscale(1) opacity(.55); }
.hl-tile .hl-badge {
  position: absolute !important; top: -5px !important; right: -4px !important; left: auto !important;
  min-width: 17px; height: 17px; font-size: 10px; line-height: 14px; animation: none !important;
}

/* ---------------------------------------------------------------- 3b. nút TRÒ CHƠI (Phố Trò Chơi)
 * Ngay dưới chip sự kiện (chỗ banner UR cũ). Neon tím + chữ: khác hẳn các ô icon nên dễ thấy. */
#hl-arcade {
  position: fixed; z-index: 19; top: calc(var(--top-h) + 44px); right: var(--float-edge); /* JS đặt lại ngay dưới chip sự kiện */
  display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 10px 0 7px; box-sizing: border-box;
  background: linear-gradient(#5b3bd6, #3a1f9e); color: #fff;
  border: 1.5px solid #1e0f5c; border-radius: 11px;
  box-shadow: 0 3px 0 #1e0f5c, inset 0 1px 0 rgba(255, 255, 255, .35), 0 0 0 2px rgba(255, 74, 176, .55);
  font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform .08s, filter .12s;
}
#hl-arcade::before { /* dải đèn chạy viền trên như biển hiệu tiệm game */
  content: ''; position: absolute; left: 8px; right: 8px; top: -4px; height: 3px;
  background: repeating-linear-gradient(90deg, #ffd23a 0 3px, transparent 3px 7px);
  animation: hl-bulbs .9s steps(2) 6; pointer-events: none;
}
@keyframes hl-bulbs { to { background-position: 7px 0; } }
#hl-arcade::after { content: ''; position: absolute; inset: -4px -2px; } /* vùng chạm rộng hơn */
#hl-arcade .hl-joy { width: 28px; height: 28px; flex: 0 0 auto; image-rendering: pixelated; }
.hl-arc-t { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
.hl-arc-t b { font: 800 13px/1 var(--display, 'Baloo 2'), sans-serif; letter-spacing: .04em; color: #ffe66b; text-shadow: 0 2px 0 #1e0f5c; white-space: nowrap; }
.hl-arc-t small { margin-top: 2px; font: 700 9.5px/1 var(--font, 'Be Vietnam Pro'), sans-serif; color: #d9ccff; white-space: nowrap; }
#hl-arcade .hl-new {
  position: absolute; top: -9px; right: -4px; padding: 1px 5px; font: 800 9px/12px var(--display, 'Baloo 2'), sans-serif; font-style: normal;
  background: #ff3b5c; color: #fff; border: 1.5px solid #4a0716; border-radius: 4px; box-shadow: 0 2px 0 #4a0716;
}
#hl-arcade .hl-new[hidden] { display: none; }
#hl-arcade:hover { filter: brightness(1.08); }
#hl-arcade:active { transform: translateY(2px); box-shadow: 0 1px 0 #1e0f5c, inset 0 1px 0 rgba(255, 255, 255, .35), 0 0 0 2px rgba(255, 74, 176, .55); }
#hl-arcade:focus-visible { outline: 3px solid #3d8bff; outline-offset: 3px; }
#hl-arcade.busy { filter: saturate(.6) brightness(.9); pointer-events: none; }
#hl-arcade.err small::before { content: 'Chưa mở được · '; color: #ffb3b3; }
#hl-arcade.min .hl-arc-t small { font-size: 0; }
#hl-arcade.min .hl-arc-t small::before { content: '● Đang chơi'; font-size: 9.5px; color: #7dffb0; }
body:is(.building, .panel-open, .sheet-open, .shop-visit-on, .coaching) #hl-arcade { display: none; }
body:not(.hl-on) #hl-arcade { height: 40px; }

/* ---------------------------------------------------------------- 3c. banner UR: ẩn ở màn chính, hiện trong bảng Nhân viên */
body.hl-ur-moved #bn-hud { display: none !important; }
#hl-ur-slot { position: static !important; inset: auto !important; display: flex; justify-content: stretch; margin: 10px 10px 2px; padding-top: 6px; }
#hl-ur-slot .bn-btn { width: 100% !important; max-width: none !important; min-width: 0 !important; justify-content: flex-start; }
#hl-ur-slot .bn-txt { flex: 1 1 auto; }

/* ---------------------------------------------------------------- 4. PC: hàng trái rộng hơn chút cho chuột */
@media (min-width: 900px) and (min-height: 521px) {
  #hl-pop { width: 240px; }
  .hl-tile { min-height: 64px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  #hl-pop.in, #hl-arcade::before { animation: none; }
  #hl-arcade:active { transform: none; }
  .hl-tile:active { transform: none; }
}

/* v3.0: chưa tới cấp 30 → nút TRÒ CHƠI hiện khoá + nhãn cấp; bấm thì hiện gợi ý (không mở, không gọi máy chủ) */
#hl-arcade.lock > :not(.hl-lock) { filter: saturate(.35) brightness(.8); }
#hl-arcade .hl-lock { position: absolute; z-index: 3; right: -6px; top: -9px; padding: 1px 5px; background: #2a1840; border: 2px solid #000; border-radius: 3px; font: 800 9.5px/1.2 'Baloo 2', sans-serif; color: #ffd23a; font-style: normal; pointer-events: none; }
#hl-arc-tip { position: fixed; z-index: 95; width: 240px; padding: 7px 10px; background: #2a1846; border: 2px solid #000; border-radius: 4px; box-shadow: 3px 3px 0 #000; color: #fff; font: 700 12.5px/1.35 'Be Vietnam Pro', sans-serif; text-align: center; pointer-events: none; }
#hl-arcade[hidden] { display: none !important; }
