/* Khung game cố định 540x960 (tỉ lệ 9:16), JS co giãn vừa cửa sổ, nền đen xung quanh. */
@font-face {
  font-family: "Baloo2";
  src: url("assets/fonts/Baloo2.ttf") format("truetype");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --ink: #1b2f57;
  --muted: #55688d;
  --gold: #ffd35a;
  --red: #e5534b;
  --green: #3fae6a;
  --navy: #0f2147;
  --font: "Baloo2", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
  font-family: var(--font);
  color: var(--ink);
  user-select: none;
  touch-action: manipulation;
}

button, input { font-family: var(--font); }

#stage.land { width: 960px; height: 540px; }
#stage.land.rot { transform: translate(-50%, -50%) rotate(90deg) scale(var(--s, 1)); }
#stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 540px;
  height: 960px;
  transform: translate(-50%, -50%) scale(var(--s, 1));
  transform-origin: center center;
  overflow: hidden;
  background: #0a1838 url("assets/final/bg_pattern.webp") center / cover no-repeat;
}

.screen { position: absolute; inset: 0; display: none; flex-direction: column; padding: 14px 16px; z-index: 1; }
.screen.active { display: flex; }
.hidden { display: none !important; }

.logo-wrap { display: flex; flex-direction: column; align-items: center; margin-top: 30px; }
.logo-wrap.small { margin-top: 6px; }
/* logo PNG đã đổi nền đen thành trong suốt, giữ nguyên ánh sáng viền */
.logo-img {
  width: 520px;
  max-width: 100%;
  height: auto;
  animation: logoFloat 3.4s ease-in-out infinite;
}
.logo-wrap.small .logo-img { width: 430px; }
.logo {
  margin: -10px auto 0;
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 2px;
  color: var(--gold);
  -webkit-text-stroke: 8px #5a2a00;
  paint-order: stroke fill;
  text-shadow: 0 7px 0 #5a2a00, 0 14px 18px rgba(0,0,0,.45);
  text-align: center;
  animation: logoFloat 3s ease-in-out infinite;
}
.logo.small { margin-top: -6px; font-size: 44px; }
.contact {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  text-align: center;
  color: #cfe0ff;
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
  text-shadow: 0 2px 0 var(--navy);
  z-index: 3;
}
.contact:active { color: var(--gold); }
@keyframes logoFloat { 50% { transform: translateY(-6px); } }

.chip {
  display: flex;
  align-items: center;
  height: 44px;
  border: 0 solid transparent;
  border-width: 0 24px;
  border-image: url("assets/final/plate.webp") 0 66 fill / 0 24px stretch;
  color: #fff;
  padding: 0 4px 3px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 2px 0 var(--navy);
}
.top-row { display: flex; justify-content: space-between; align-items: center; }
.lang-btn {
  min-width: 64px;
  height: 52px;
  padding: 0 14px 4px;
  border: 4px solid #3c74c4;
  border-radius: 16px;
  background: linear-gradient(#2c68b4, #164a8a);
  box-shadow: 0 4px 0 #0f2147;
  color: #fff;
  font: 800 24px/1 var(--font);
  -webkit-text-stroke: 4px var(--navy);
  paint-order: stroke fill;
  cursor: pointer;
}
.lang-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #0f2147; }
.lang-btn.auth-lang { position: absolute; top: 16px; right: 16px; z-index: 5; }
.top-actions { align-items: center; }
.top-actions { display: flex; gap: 8px; }
.round-btn { width: 64px; height: 64px; padding: 0; border: 0; background: none; cursor: pointer; transition: transform .08s; }
.round-btn img { width: 100%; height: 100%; object-fit: contain; }
.round-btn.small { width: 56px; height: 56px; }
.round-btn:active { transform: scale(.9); }

/* Nút chữ nhật dùng border-image để góc đá không bị méo */
.wbtn {
  display: block;
  width: 100%;
  min-height: 92px;
  margin: 8px 0;
  padding: 0 10px;
  border: 30px solid transparent;
  border-image: url("assets/final/btn_orange.webp") 28 fill / 30px stretch;
  background: transparent;
  font: 800 30px/1 var(--font);
  color: #fff;
  -webkit-text-stroke: 5px var(--navy);
  paint-order: stroke fill;
  text-shadow: 0 3px 0 var(--navy);
  cursor: pointer;
  transition: transform .08s, filter .15s;
}
.wbtn:active { transform: scale(.96); filter: brightness(.9); }
.wbtn.orange { border-image-source: url("assets/final/btn_orange.webp"); }
.wbtn.blue   { border-image-source: url("assets/final/btn_blue.webp"); }
.wbtn.green  { border-image-source: url("assets/final/btn_green.webp"); }
.wbtn.grey   { border-image-source: url("assets/final/btn_grey.webp"); }
.wbtn.small  { min-height: 80px; font-size: 26px; }


/* ---------- Popup: khung đá viền xanh giống nút ---------- */
.panel {
  position: relative;
  border: 44px solid transparent;
  border-image: url("assets/final/panel.webp") 42 fill / 44px stretch;
  padding: 0 4px;
  color: var(--ink);
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .45));
}
.panel .big, .panel p, .panel h3 { margin: 0; }
.center { text-align: center; display: flex; flex-direction: column; gap: 8px; }
.big { font-size: 30px; font-weight: 800; color: var(--ink); line-height: 1.1; }
.muted { color: var(--muted); font-size: 20px; font-weight: 600; margin: 2px 0; line-height: 1.2; }
.row-btns { display: flex; gap: 8px; }
.row-btns .wbtn { flex: 1; }

/* Ribbon tiêu đề gắn trên mép popup */
.ribbon {
  position: relative;
  width: 400px;
  height: 120px;
  margin: -118px auto 6px;
  background: url("assets/final/ribbon.webp") center / 100% 100% no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  -webkit-text-stroke: 6px #7a3000;
  paint-order: stroke fill;
  text-shadow: 0 3px 0 #7a3000;
  padding: 0 70px 6px;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,.35));
}
.ribbon span { display: block; text-align: center; }

input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 16px;
  border: 4px solid #3c74c4;
  box-shadow: inset 0 3px 0 rgba(0,0,0,.12);
  font-size: 24px;
  font-weight: 700;
  background: #fff;
  color: var(--ink);
  user-select: text;
}
input::placeholder { color: #8fa3c8; font-weight: 600; }
.code-input { text-align: center; letter-spacing: 5px; text-transform: uppercase; }

.menu { margin-top: auto; padding-bottom: 50px; }
/* Màn đăng nhập: cụm nút nằm giữa màn hình, ngay dưới logo */
#screen-auth .menu { margin-top: 36px; padding-bottom: 0; }
.code-box {
  align-self: center;
  margin-top: 8px;
  background: rgba(8, 20, 48, .72);
  border: 3px solid #4a7fc7;
  color: #fff;
  border-radius: 18px;
  padding: 2px 22px 4px;
  font-size: 22px;
  font-weight: 700;
}
.code-box b { color: var(--gold); letter-spacing: 3px; }


.timer.low { border-image-source: url("assets/final/btn_grey.webp"); animation: pulse .5s infinite alternate; color: #ffe0dc; -webkit-text-stroke-color: #a01610; text-shadow: 0 3px 0 #a01610; }
@keyframes pulse { to { transform: scale(1.1); } }

/* ---------- Kết quả ---------- */
/* Màn kết quả: cột flex theo chiều cao khung. Popup thống kê co giãn vừa phần còn lại và cuộn nếu thiếu chỗ. */
#screen-result { align-items: stretch; padding: 0 16px 18px; }
.result-hero {
  position: relative;
  flex: 0 0 auto;
  height: 290px;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}
.result-emblem { position: relative; z-index: 1; height: 170px; width: auto; max-width: 300px; object-fit: contain; filter: drop-shadow(0 8px 14px rgba(0,0,0,.5)); }
/* tia sáng quay phía sau tiêu đề */
.rays {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 760px;
  height: 760px;
  margin: -380px 0 0 -380px;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 226, 120, .55) 0deg 9deg, rgba(255, 226, 120, 0) 9deg 22deg);
  -webkit-mask-image: radial-gradient(circle, #000 12%, transparent 66%);
  mask-image: radial-gradient(circle, #000 12%, transparent 66%);
  opacity: 0;
  pointer-events: none;
}
#screen-result.win .rays { opacity: 1; animation: raysSpin 14s linear infinite; }
@keyframes raysSpin { to { transform: rotate(360deg); } }

.result-banner {
  position: relative;
  width: 430px;
  height: 100px;
  margin-top: -16px;
  z-index: 2;
  background: url("assets/final/ribbon.webp") center / 100% 100% no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 80px 8px;
  filter: drop-shadow(0 10px 12px rgba(0,0,0,.45));
  overflow: hidden;
}
.result-banner::after { /* vệt sáng lướt qua */
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 70px;
  left: -120px;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.65), transparent);
  transform: skewX(-18deg);
}
.result-title {
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  color: #fff;
  -webkit-text-stroke: 7px #5a0a5a;
  paint-order: stroke fill;
  text-shadow: 0 4px 0 #5a0a5a;
}
.result-sub {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 0;
  text-align: center;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  text-shadow: 0 2px 0 var(--navy), 0 0 8px rgba(0,0,0,.6);
}

#screen-result.win .result-hero { animation: heroDrop .8s cubic-bezier(.2, 1.5, .4, 1) both, floatY 3.2s ease-in-out .8s infinite; }
#screen-result.win .result-banner::after { animation: shine 2.8s ease-in-out 1s infinite; }
#screen-result.win .result-title { animation: titleGlow 1.6s ease-in-out 1s infinite; }
#screen-result.lose .result-hero { animation: heroSink .9s ease-out both, sway 4s ease-in-out .9s infinite; }
#screen-result.draw .result-hero { animation: heroDrop .7s ease-out both, floatY 4s ease-in-out .7s infinite; }
#screen-result.lose .result-banner { filter: grayscale(.85) brightness(.85) drop-shadow(0 10px 12px rgba(0,0,0,.45)); }
#screen-result.lose::after { content: ""; position: absolute; inset: 0; background: rgba(8, 14, 32, .4); pointer-events: none; z-index: 2; }

.stats-wrap {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0 0 10px;
}
#screen-result .stats-wrap { animation: panelRise .8s cubic-bezier(.2, 1.3, .4, 1) .35s both, floatY 3.6s ease-in-out 1.2s infinite; }
#screen-result.lose .stats-wrap { animation: panelRise .8s ease-out .5s both, sway 5s ease-in-out 1.3s infinite; }

@keyframes heroDrop { from { transform: translateY(-180px) scale(.78); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes heroSink { from { transform: translateY(-120px) rotate(-4deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes panelRise { from { transform: translateY(260px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes floatY { 50% { transform: translateY(-6px); } }
@keyframes sway { 50% { transform: translateY(3px) rotate(.8deg); } }
@keyframes shine { 0% { left: -120px; } 45%, 100% { left: 560px; } }
@keyframes titleGlow { 50% { transform: scale(1.06); filter: brightness(1.25) drop-shadow(0 0 10px #fff3a8); } }

/* Nội dung thống kê cuộn được khi màn hình thấp */
.stats-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 4px;
  scrollbar-width: thin;
  scrollbar-color: #3c74c4 transparent;
  user-select: none;
  -webkit-overflow-scrolling: touch;
}
.stats { width: 100%; border-collapse: collapse; font-size: 20px; font-weight: 600; }
.stats th, .stats td { padding: 1px 6px; border-bottom: 2px solid #d9c9a3; text-align: center; line-height: 1.25; }
.stats th { color: var(--muted); font-weight: 800; position: sticky; top: 0; background: #fbf1da; z-index: 1; }
.stats td:first-child, .stats th:first-child { text-align: left; }
/* Chỉ số hơn: xanh dương sáng và đậm. Chỉ số kém hơn hoặc bằng: đen và mảnh. */
.stats td { color: #111a2c; font-weight: 400; }
.stats td.hi { color: #0a7cff; font-weight: 800; text-shadow: 0 0 10px rgba(10, 124, 255, .25); }
.stats td:first-child { font-weight: 500; color: #111a2c; }

.result-menu { flex: 0 0 auto; z-index: 3; }
.result-menu .wbtn { margin: 0; }

/* ---------- Overlay, toast, spinner ---------- */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 12, 30, .68);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 20;
}
.overlay > .panel { width: 100%; animation: popupIn .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes popupIn { from { transform: scale(.7) translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.spinner {
  width: 64px;
  height: 64px;
  margin: 4px auto;
  border-radius: 50%;
  border: 8px solid #cfdcf3;
  border-top-color: #f08a1c;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: absolute;
  left: 50%;
  bottom: 70px;
  transform: translateX(-50%);
  max-width: 470px;
  background: rgba(8, 20, 48, .92);
  border: 3px solid #4a7fc7;
  color: #fff;
  padding: 6px 22px 8px;
  border-radius: 18px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  z-index: 30;
  text-align: center;
}

/* ---------- Popup hướng dẫn ---------- */
.guide-panel { display: flex; flex-direction: column; gap: 8px; }
.guide-body {
  max-height: 560px;
  overflow-y: auto;
  padding: 0 6px 0 2px;
  text-align: left;
  scrollbar-width: thin;
  scrollbar-color: #3c74c4 transparent;
  user-select: none;
  -webkit-overflow-scrolling: touch;
}
.guide-h {
  margin: 10px 0 6px;
  padding: 2px 12px 4px;
  border-radius: 12px;
  background: linear-gradient(#2c68b4, #164a8a);
  border: 3px solid #3c74c4;
  color: #fff;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
  text-shadow: 0 2px 0 var(--navy);
}
.guide-h:first-child { margin-top: 0; }
.guide-card, .guide-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 4px;
  border-bottom: 2px solid #e2d3ad;
}
.guide-info { flex: 1; min-width: 0; }
.guide-name { font-size: 24px; font-weight: 800; color: #0a5fd0; line-height: 1.1; }
.guide-p { margin: 0; font-size: 18px; font-weight: 500; line-height: 1.25; color: #111a2c; }
.guide-skill { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.25; color: #111a2c; }
.guide-stat { margin: 2px 0 0; font-size: 17px; font-weight: 500; color: #4a5b7c; }
.guide-stat.strong { font-weight: 800; color: #0a7cff; }
.guide-note { margin: 6px 0 0; font-size: 16px; font-weight: 600; color: #7a5a1a; line-height: 1.25; }
.guide-badge {
  flex: 0 0 auto;
  min-width: 74px;
  text-align: center;
  padding: 1px 8px 3px;
  border-radius: 12px;
  background: linear-gradient(#ffb23a, #e8820c);
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  text-shadow: 0 2px 0 #7a3000;
}
.guide-num {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  line-height: 32px;
  text-align: center;
  border-radius: 50%;
  background: linear-gradient(#2c68b4, #164a8a);
  border: 3px solid #3c74c4;
  color: #fff;
  font-weight: 800;
  font-size: 20px;
}
.mini-shape { flex: 0 0 auto; display: grid; gap: 3px; width: 100px; justify-content: center; align-content: center; }
.mini-shape i { width: 18px; height: 18px; border-radius: 5px; background: #cdd8ea; }
.mini-shape i.on { background: linear-gradient(#52b6ff, #1c7fe0); box-shadow: inset 0 -2px 0 rgba(0,0,0,.2); }
.mini-shape.orb i.on { background: linear-gradient(#ffe27a, #f0a010); }
.guide-card .spr { flex: 0 0 auto; width: 64px; height: 64px; }


/* Bảng xếp hạng */
.top-body { text-align: left; min-width: 330px; font-weight: 700; color: var(--ink); }
.top-body h4 { margin: 8px 0 4px; font-size: 20px; }
.top-body .row { display: flex; justify-content: space-between; gap: 12px; font-size: 17px; }

/* ---------- Màn trận Dance Battle (khung ngang 960x540, xem fitStage trong app.js) ---------- */
#screen-game { padding: 0; }
.dstage {
  position: absolute; left: 0; top: 0; width: 960px; height: 380px; overflow: hidden;
  background: url(assets/final/stage_bg.webp) center / 100% 100% no-repeat, #0e4a8a;
}
.dstage::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 56px; background: linear-gradient(transparent, rgba(255,255,255,.08)); pointer-events: none; }
.dcanvas { position: absolute; left: 0; top: 0; display: block; z-index: 1; }
.dnames { position: absolute; left: 0; right: 0; top: 10px; display: flex; justify-content: space-between; padding: 0 22px; pointer-events: none; z-index: 3; }
.dnames span { font: 800 26px/1 var(--font); color: #fff; text-shadow: 0 2px 0 var(--navy), 0 0 8px rgba(0,0,0,.6); max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dnames .me { color: var(--gold); }
.dpop { position: absolute; top: 56px; font: 800 38px/1 var(--font); -webkit-text-stroke: 6px var(--navy); paint-order: stroke fill; opacity: 0; pointer-events: none; z-index: 4; white-space: nowrap; }
.dpop.me { left: 70px; } .dpop.opp { right: 70px; }
.dpop.perfect { color: var(--gold); } .dpop.good { color: #6fe39a; } .dpop.miss { color: #ff7b7b; }
.dpop.show { animation: dpop 1.1s ease-out both; }
@keyframes dpop { 0% { opacity: 0; transform: scale(.4); } 15% { opacity: 1; transform: scale(1.25); } 30% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-18px); } }
.dcount { position: absolute; left: 50%; top: 120px; transform: translateX(-50%); font: 800 120px/1 var(--font); color: #fff; -webkit-text-stroke: 8px var(--navy); paint-order: stroke fill; z-index: 5; }
.dfallback { position: absolute; inset: 0; display: flex; justify-content: space-around; align-items: center; z-index: 2; pointer-events: none; }
.dfallback::before { content: attr(data-msg); position: absolute; top: 46px; left: 0; right: 0; text-align: center; color: #d6f4ff; font: 700 18px/1.2 var(--font); }
.dfallback .fb { font: 800 34px/1.2 var(--font); color: #fff; opacity: .8; }
.dhud {
  position: absolute; left: 0; right: 0; top: 380px; height: 160px; padding: 14px 22px;
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  background: linear-gradient(#2b86d8, #16529f); border-top: 3px solid #8fe6ff; z-index: 2;
}
.dcenter { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%) scale(.78); transform-origin: 50% 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 3; pointer-events: none; }
.dpanel { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0; text-shadow: 0 2px 6px rgba(0,0,0,.7); }
.dfoot { position: absolute; bottom: 8px; z-index: 3; pointer-events: none; text-shadow: 0 2px 6px rgba(0,0,0,.7); }
.dfoot.me { left: 25%; transform: translateX(-50%); } .dfoot.opp { left: 75%; transform: translateX(-50%); }
.darrows { display: flex; gap: 12px; }
.darrows i { width: 74px; height: 74px; border-radius: 50%; border: 3px solid #c4f1ff; background: #1f6fc4; color: #fff; font: 800 42px/68px var(--font); text-align: center; font-style: normal; }
.darrows i.done { background: linear-gradient(#ffe27a, #f0a010); border-color: #fff3c0; color: #5a3000; }
.darrows.dim { opacity: .6; }
.darrows.shake { animation: dshake .16s linear; }
@keyframes dshake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.dscore { color: #fff; font: 800 18px/1 var(--font); }
.dscore b { font-size: 36px; color: var(--gold); text-shadow: 0 3px 0 var(--navy); }
.dscore i { font-style: normal; margin-left: 8px; color: #6fe39a; font-size: 22px; }
.dclock { color: #fff; font: 800 30px/1 var(--font); display: flex; align-items: baseline; gap: 10px; }
.dclock small { font-size: 15px; color: #c4f1ff; }
.dbar { position: relative; width: 340px; height: 14px; border-radius: 8px; background: #2a67b0; margin-top: 12px; }
.dbar .dmark { position: absolute; left: 80%; top: -16px; width: 0; height: 0; transform: translateX(-50%); border-left: 9px solid transparent; border-right: 9px solid transparent; border-top: 14px solid var(--gold); }
.dbar .dmark::after { content: ""; position: absolute; left: -2px; top: 16px; width: 4px; height: 14px; background: var(--gold); }
.dbar .ddot { position: absolute; left: 0; top: -5px; width: 24px; height: 24px; margin-left: -12px; border-radius: 50%; background: radial-gradient(#fff, #7fd1ff); box-shadow: 0 0 12px #7fd1ff; }
.dspace { width: 294px; height: 122px; border: 2px solid #fff3c0; border-radius: 10px; background: linear-gradient(#ffb23a, #e8820c); color: #fff; font: 800 34px/1 var(--font); letter-spacing: 4px; text-shadow: 0 1px 0 #7a3000; box-shadow: 0 3px 0 #8a4a00; cursor: pointer; touch-action: manipulation; }
.dspace.hit, .dspace:active { transform: translateY(2px); box-shadow: 0 1px 0 #8a4a00; }
.dpad { display: flex; gap: 5px; }
.dpad button { width: 120px; height: 122px; border-radius: 50%; border: 2px solid #c4f1ff; background: #1f6fc4; color: #fff; font: 800 52px/1 var(--font); touch-action: manipulation; cursor: pointer; }
.dpad button:active { background: #3d9be6; transform: translateY(3px); }
#screen-game .hud-btns { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; z-index: 6; }
#screen-game .hud-btns .wbtn { width: 130px; min-height: 44px; border-width: 12px; border-image-width: 12px; font-size: 17px; }
#screen-game .hud-btns .round-btn { width: 44px; height: 44px; }

/* ---------- Đèn sân khấu (nằm sau canvas nhân vật) ---------- */
.dlights { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.dbeam { position: absolute; top: -6px; width: 170px; height: 400px; margin-left: -85px; transform-origin: 50% 0; mix-blend-mode: screen; opacity: .85;
  clip-path: polygon(46% 0, 54% 0, 100% 100%, 0 100%); filter: blur(7px); animation: dswing 5s ease-in-out infinite alternate; }
.dbeam::before { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, var(--bc) 0%, color-mix(in srgb, var(--bc) 35%, transparent) 55%, transparent 100%); }
.dbeam.b1 { left: 14%; --bc: #7fe8ff; animation-duration: 4.6s; --a: 24deg; }
.dbeam.b2 { left: 33%; --bc: #ff8fd8; animation-duration: 5.8s; animation-delay: -1.5s; --a: 30deg; }
.dbeam.b3 { left: 50%; --bc: #fff6a0; animation-duration: 6.6s; animation-delay: -3s; --a: 20deg; }
.dbeam.b4 { left: 67%; --bc: #8dffb8; animation-duration: 5.2s; animation-delay: -0.8s; --a: 30deg; }
.dbeam.b5 { left: 86%; --bc: #a7b8ff; animation-duration: 4.2s; animation-delay: -2.2s; --a: 24deg; }
@keyframes dswing { from { transform: rotate(calc(var(--a) * -1)); } to { transform: rotate(var(--a)); } }
.dfloor { position: absolute; bottom: 10px; width: 190px; height: 34px; margin-left: -95px; border-radius: 50%; mix-blend-mode: screen; filter: blur(9px); opacity: .55; animation: dsweep 4.8s ease-in-out infinite alternate; }
.dfloor.f1 { left: 30%; background: radial-gradient(#7fe8ff, transparent 70%); }
.dfloor.f2 { left: 70%; background: radial-gradient(#ff8fd8, transparent 70%); animation-delay: -2.4s; }
@keyframes dsweep { from { transform: translateX(-90px); } to { transform: translateX(90px); } }
.dcount { white-space: nowrap; }
.dcount.go { font-size: 78px; color: #fff3a0; }

/* ---------- Clip mở đầu: lớp phủ trong suốt trên màn trận (chặn bấm), chỉ có nút Bỏ qua + thanh tiến độ ---------- */
#intro { position: absolute; inset: 0; z-index: 30; }
.intro-tag { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); padding: 4px 16px; border-radius: 14px; background: rgba(0,0,0,.45); color: #fff; font: 800 16px/1.3 var(--font); letter-spacing: 3px; }
.intro-skip { position: absolute; left: 14px; bottom: 56px; min-width: 96px; height: 40px; padding: 0 10px; border: 2px solid #fff; border-radius: 22px; background: rgba(0,0,0,.5); color: #fff; font: 800 17px/1 var(--font); cursor: pointer; }
.intro-skip:active { transform: translateY(2px); }
.intro-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: rgba(255,255,255,.2); }
.intro-prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #7fe8ff, #ff8fd8); }
#stage.introing .hud-btns { display: none; }

/* đèn rõ hơn: phủ tối nhẹ nền để chùm sáng nổi lên */
.dlights::before { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(4,14,44,.62), rgba(4,14,44,.25) 70%, rgba(4,14,44,.1)); }
.dbeam { width: 230px; margin-left: -115px; height: 430px; opacity: 1; filter: blur(5px); }
.dbeam::before { background: linear-gradient(to bottom, var(--bc) 0%, color-mix(in srgb, var(--bc) 60%, transparent) 50%, transparent 100%); }
.dfloor { opacity: .95; height: 40px; width: 240px; margin-left: -120px; }
.contact { z-index: 6; text-shadow: 0 2px 0 var(--navy), 0 0 8px rgba(0,0,0,.7); }
.dpad button.pressed { background: #3d9be6; transform: translateY(3px); }
