/* Màn tải và màn đăng nhập có hiệu ứng (01/11/2026, chủ dự án: "thô sơ, chưa thuận mắt, không có hiệu ứng").
   Nạp sau style.css (index.html). Hiệu ứng chạy bằng CSS (tên game nhún, ánh chạy trên nút, thanh tải pixel, nội dung hiện dần)
   và canvas điểm ảnh của src/ui/man-dau.js (cánh hoa, đốm linh khí). Máy chậm (body.perf-calm) và người tắt chuyển động: đứng yên. */

#man-dau-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; image-rendering: pixelated; z-index: 0; }
#menu > :not(#man-dau-fx), #loading > :not(#man-dau-fx) { position: relative; z-index: 1; }

/* ---- màn tải: tên game, thanh tải pixel chạy, mẹo đổi dần ---- */
#loading { flex-direction: column; gap: 14px; }
#loading .ld-box { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px 22px 14px;
  background: radial-gradient(ellipse at 50% 50%, rgba(18, 8, 34, .78), rgba(18, 8, 34, .45) 70%, transparent); }
.ld-title, #menu h1 { font-family: var(--f-pixel) !important; font-weight: 400 !important; letter-spacing: 1px !important; }
.ld-title { font-size: 30px; color: #ffe39a;
  text-shadow: 2px 0 #3a1406, -2px 0 #3a1406, 0 2px #3a1406, 0 -2px #3a1406, 2px 2px #3a1406, 0 4px 0 #1a0820, 0 0 16px rgba(255, 190, 90, .65);
  animation: md-nhun 3s ease-in-out infinite; }
.ld-bar { position: relative; width: 220px; height: 14px; background: #1a0c26; overflow: hidden;
  box-shadow: 0 0 0 2px #e8b45a, 0 0 0 4px #3a1406, 0 4px 0 4px rgba(10, 4, 20, .55); image-rendering: pixelated; }
.ld-bar i { position: absolute; top: 2px; bottom: 2px; left: 2px; width: 40%;
  background: repeating-linear-gradient(90deg, #ffd46a 0 8px, #f2a43a 8px 10px);
  box-shadow: 0 -2px 0 #fff2b8 inset, 0 2px 0 #b8641a inset;
  animation: md-tai 1.6s steps(24) infinite; }
.ld-text { font-family: var(--f-pixel); font-size: 16px; color: #fff3c4;
  text-shadow: 1px 0 #2a1638, -1px 0 #2a1638, 0 1px #2a1638, 0 -1px #2a1638; }
.ld-text::after { content: ''; display: inline-block; width: 18px; text-align: left; animation: md-cham 1.2s steps(4) infinite; }
#ld-tip { min-height: 18px; max-width: 300px; font-family: var(--f-pixel); font-size: 14px; color: #d8c8ff; text-align: center;
  text-shadow: 1px 0 #1a0c26, -1px 0 #1a0c26, 0 1px #1a0c26, 0 -1px #1a0c26; opacity: 0; }
#ld-tip.in { animation: md-hien .5s steps(5) forwards; }

/* ---- màn đăng nhập: tên to, nhún nhẹ, ánh lướt; khung và nút hiện dần lần lượt ---- */
#menu h1 { font-size: 34px !important; color: #ffe39a !important;
  text-shadow: 2px 0 #3a1406, -2px 0 #3a1406, 0 2px #3a1406, 0 -2px #3a1406, 2px 2px #3a1406, 0 4px 0 #1a0820, 0 0 18px rgba(255, 190, 90, .6) !important;
  animation: md-nhun 3s ease-in-out infinite, md-hien .6s steps(6) both; }
body[data-le] #menu h1 { animation: md-nhun 3s ease-in-out infinite, md-hien .6s steps(6) both, hw-chu 2.2s ease-in-out infinite alternate; }
#menu .sub { margin: -4px 0 4px; font-family: var(--f-pixel); font-size: 16px; color: #e8d8ff;
  text-shadow: 1px 0 #1a0c26, -1px 0 #1a0c26, 0 1px #1a0c26, 0 -1px #1a0c26; animation: md-hien .6s .1s steps(6) both; }
#menu:not([hidden]) > #login-form, #menu:not([hidden]) > #logged { animation: md-len .45s .15s steps(6) both; }
#menu:not([hidden]) > #login-msg { animation: md-hien .4s .2s steps(4) both; }
#menu:not([hidden]) > #btn-guest { animation: md-len .45s .25s steps(6) both; }
#menu:not([hidden]) > .help, #menu:not([hidden]) > .health, #menu:not([hidden]) > .legal, #menu:not([hidden]) > #btn-install { animation: md-hien .5s .35s steps(5) both; }
#menu .help, #menu .health { border-left: 2px solid rgba(232, 180, 90, .55); }

/* ánh sáng lướt qua nút lớn mỗi vài giây (lớp phủ trên khung 9 mảnh, không đổi hình nút) */
#menu .menu-btn { position: relative; overflow: hidden; transition: filter .12s steps(2); }
#menu .menu-btn::after { content: ''; position: absolute; top: -8px; bottom: -8px; left: -40%; width: 24%; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 250, 220, .55), transparent); transform: skewX(-20deg);
  animation: md-anh 3.6s steps(18) infinite; }
#menu .menu-btn.alt::after { animation-delay: 1.4s; background: linear-gradient(90deg, transparent, rgba(220, 200, 255, .45), transparent); }
#menu .menu-btn:hover:not(:disabled) { filter: brightness(1.12) drop-shadow(0 0 6px rgba(255, 200, 110, .55)); }
#menu .menu-btn:disabled::after { animation: none; display: none; }
#menu input { transition: box-shadow .12s steps(2); }
#menu input:focus { outline: none; box-shadow: 0 0 0 2px #e8b45a, 0 0 10px rgba(255, 200, 110, .45); }

/* chớp linh khí lúc vào game (src/ui/man-dau.js thêm rồi tự gỡ) */
#man-dau-flash { position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  background: radial-gradient(circle at 50% 55%, #fff8e0 0, #ffe6a0 25%, rgba(255, 210, 140, .6) 55%, rgba(40, 20, 60, 0) 100%);
  animation: md-chop .7s steps(10) forwards; }

@keyframes md-nhun { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes md-tai { 0% { left: -40%; } 100% { left: 100%; } }
@keyframes md-cham { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
@keyframes md-hien { from { opacity: 0; } to { opacity: 1; } }
@keyframes md-len { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes md-anh { 0%, 70% { left: -40%; } 100% { left: 130%; } }
@keyframes md-chop { 0% { opacity: .95; } 100% { opacity: 0; } }

body.perf-calm #man-dau-fx { display: none; }
@media (prefers-reduced-motion: reduce) {
  .ld-title, #menu h1, #menu .sub, .ld-bar i, .ld-text::after, #ld-tip.in, #menu .menu-btn::after, #man-dau-flash,
  #menu:not([hidden]) > * { animation: none !important; opacity: 1 !important; }
  .ld-bar i { left: 2px; right: 2px; width: auto; }
  #man-dau-fx { display: none; }
}

/* ---- đăng nhập "đêm trăng" (chủ dự án 12/11/2026 07:46, ảnh GPT → tools/art/man_dn_dem.py): khung mái chùa âm dương vẽ sẵn 2 ô nhập
   và 2 thân nút (chữ trên nút đã xoá); ô nhập, nút thật đặt chồng đúng chỗ vẽ theo % (số in ra khi chạy script), chữ nút là chữ thật
   (3 thứ tiếng). Nền màn đăng nhập, màn tải: assets/icon/splash-dem.jpg (style-ui-kit2.css). ---- */
/* màn đăng nhập cao hơn máy thấp (huy hiệu lễ hội, lời chào Hệ Thống, khung mới): giữa màn khi vừa, dài thì cuộn được, không mất tên game */
body #menu { justify-content: flex-start; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
body #menu > h1 { margin-top: auto !important; }
body #menu > p.legal:last-of-type { margin-bottom: auto; }
body #menu #login-form { position: relative; width: min(88vw, 350px, 42dvh); max-width: none; aspect-ratio: 768 / 776; box-sizing: border-box; min-width: 0 !important;
  border: none !important; border-image: none !important; padding: 0 !important; margin: 0 0 20px; container-type: inline-size;
  background: url("assets/art/ui-dn-khung-dem.webp") center / 100% 100% no-repeat !important; image-rendering: auto; }
body #menu #login-form:has(#btn-google:not([hidden])) { margin-bottom: 70px; }
body #menu #login-form input { position: absolute; left: 20.7%; width: 49.8%; height: 9.8%; margin: 0; box-sizing: border-box;
  border: none !important; border-image: none !important; background: transparent !important; border-radius: 9px !important;
  padding: 0 7% 0 10.5% !important; font-size: 16px; color: #fff3d2 !important; text-shadow: 0 1px 0 #10082a; }
body #menu #login-form input::placeholder { color: #b8aee0; opacity: 1; }
body #menu #login-form input:focus { box-shadow: 0 0 0 2px rgba(255, 214, 120, .75), 0 0 12px rgba(255, 200, 110, .5) !important; }
body #menu #login-form #acc { top: 34.6%; }
body #menu #login-form #pwd { top: 47.6%; height: 9.9%; }
body #menu #login-form .row { display: contents; }
body #menu #login-form .row .menu-btn { position: absolute; margin: 0; padding: 0 !important; min-width: 0 !important; flex: none;
  border: none !important; border-image: none !important; background: none !important; box-shadow: none !important;
  font: 700 19px var(--f-title) !important; font-size: 5.2cqw !important; letter-spacing: .02em; }
body #menu #login-form #btn-login { left: 22.6%; top: 65.4%; width: 55.7%; height: 11.5%; border-radius: 22% / 50%; color: #3a1206 !important;
  text-shadow: 0 1px 0 rgba(255, 240, 200, .7) !important; }
body #menu #login-form #btn-signup { left: 33.2%; top: 80.6%; width: 33.8%; height: 7.4%; border-radius: 18% / 50%; color: #f4ecff !important;
  font-size: 15px !important; font-size: 4cqw !important; text-shadow: 0 1px 0 #10082a !important; }
body #menu #login-form .row .menu-btn:active:not(:disabled) { background: rgba(255, 244, 210, .2) !important; }
body #menu #login-form .row .menu-btn:disabled { background: rgba(20, 10, 40, .35) !important; }
body #menu #login-form #btn-forgot { position: absolute; top: 100%; left: 0; right: 0; margin: 0; padding: 2px; font-size: 13px; text-shadow: 1px 1px 0 #000, 0 0 6px #000; }
body #menu #login-form #btn-google { position: absolute; top: calc(100% + 24px); left: 15%; right: 15%; margin: 0; }

/* Nền màn tải và màn đăng nhập (chủ dự án 17/11/2026 02:28 gửi ảnh: đêm trăng tròn, lầu các trên núi, thác, đèn trời, hồ sen):
   assets/icon/nen-tai.jpg (tools/art/khung_kg.py: bỏ thanh trạng thái, xoá hộp và dòng mẹo vẽ sẵn). Hộp "Đang tải" dùng khung tím
   của bộ khung chủ dự án có vương miện (ui-kg-hop.webp), nằm đúng chỗ hộp trong ảnh. */
html body #loading, html body[data-le] #loading, html body #menu, html body[data-le] #menu {
  background: url("assets/icon/nen-tai.jpg") center / cover no-repeat, #1c1a3e !important; image-rendering: auto !important; }
html body #loading .ld-box { box-sizing: border-box; width: min(290px, 76vw); aspect-ratio: 598 / 347; justify-content: center; gap: 12px;   /* đúng cỡ hộp vẽ sẵn trong ảnh: che chỗ đã xoá */
  padding: 0 !important; border: 0 !important; box-shadow: none !important; background: none !important;
  border-image: url("assets/art/ui-kg-hop.webp") 70 48 48 fill / 34px 23px 23px / 0 stretch !important; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .55)); }
html body #loading .ld-title { font-size: 26px; }
html body #loading #ld-tip { text-shadow: 1px 0 #1b1030, -1px 0 #1b1030, 0 1px #1b1030, 0 -1px #1b1030; }
/* hai ô hướng dẫn di chuyển và khuyến nghị giờ chơi: khung bạc đinh vàng nền tím của bộ khung chủ dự án (17/11/2026 03:51) */
html body #menu .help, html body #menu .health { border-style: solid !important; border-color: transparent !important; border-width: 9px 12px !important;
  border-image: url("assets/art/ui-kg-the.webp") 30 fill / 9px / 0 stretch !important; background: none !important; box-shadow: none !important; padding: 2px 6px !important; }

/* ---- lời mời tải bản Android (src/core/apk-offer.js) ---- */
#apk-offer { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 14px); transform: translateX(-50%); z-index: 50;
  width: min(92vw, 360px); box-sizing: border-box; padding: 12px 14px; border-radius: 8px; background: rgba(18, 8, 34, .94);
  border: 1.5px solid var(--line-hi); box-shadow: 0 6px 20px rgba(0, 0, 0, .6); color: var(--ink); font: 14px/1.45 var(--f-body); text-align: center; }
#apk-offer p { margin: 0 0 10px; }
#apk-offer .apk-row { display: flex; gap: 10px; justify-content: center; }
#apk-offer .apk-yes { padding: 8px 18px; border-radius: 6px; background: #3f8f4e; color: #fff; font-weight: 700; text-decoration: none; }
#apk-offer .apk-no { padding: 8px 14px; border-radius: 6px; background: none; border: 1px solid var(--line); color: var(--ink-2); font: inherit; }
