/* Ghép Hình Khủng Long — căn hộ 5811109 của hub · bản 2.0 */
:root {
  --dinh: env(safe-area-inset-top, 0px);
  --day: env(safe-area-inset-bottom, 0px);
  --chu: #ffffff;
  --vien: #2d3440;
  --xanh: #3fb0f0;
  --la: #6cc24a;
  --vang: #ffc83d;
  --cam: #ff8a1f;
  --the: rgba(255, 255, 255, .95);
  --nen-chinh: url(anh/ui/bg_jungle.webp);     /* skin chung đổi được ba nền này */
  --nen-chon: url(anh/ui/bg_levelselect.webp);
  --nen-choi: url(anh/ui/bg_gameplay.webp);
}
/* Trong hub: dải đỉnh 46px (Lối ra + 5 nút) và dải đáy 60px (quảng cáo) là của hub — game nằm giữa.
   (Hợp đồng 1.2 ghi chừa 54px; bản 1.4 đổi thành 46px đỉnh + 60px đáy.) */
body.trong-hub {
  --dinh: calc(46px + env(safe-area-inset-top, 0px));
  --day: calc(60px + env(safe-area-inset-bottom, 0px));
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #57b6ec; }
body {
  font: 700 16px/1.3 "Baloo 2", "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--chu); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: none; overscroll-behavior: none;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
img { -webkit-user-drag: none; user-select: none; -webkit-touch-callout: none; }

#khung { position: fixed; inset: 0; overflow: hidden; }
.man {
  position: absolute; inset: 0; display: none; flex-direction: column;
  padding: var(--dinh) 0 var(--day);
  background: center / cover no-repeat;
}
.man.hien { display: flex; animation: vao .28s ease-out; }
@keyframes vao { from { opacity: 0; transform: scale(1.03); } }

/* ---------- màn chính ---------- */
#man-chinh { background-image: var(--nen-chinh); background-position: center bottom; align-items: center; justify-content: center; gap: 1.6vh; }
#logo { position: relative; z-index: 2; width: min(76vw, 52vh, 540px); height: auto; filter: drop-shadow(0 6px 10px rgba(0,0,0,.25)); animation: nhun 3s ease-in-out infinite; }
/* 30-11 truyện của bộ skin (tên game dưới logo + câu chuyện ngắn); bộ không có truyện thì khối ẩn */
#truyen-mo { position: relative; z-index: 2; max-width: min(88vw, 560px); margin-top: -1vh; padding: 8px 16px 10px; border-radius: 18px;
  background: rgba(0,0,0,.34); text-align: center; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
#truyen-mo[hidden] { display: none; }
#truyen-ten { margin: 0; font-size: clamp(20px, 3.4vh, 30px); color: var(--vang-truyen, #ffd76a); text-shadow: 0 2px 0 rgba(0,0,0,.45); }
#truyen-chuyen { margin: 4px 0 0; font-size: clamp(13px, 1.9vh, 16px); line-height: 1.35; text-shadow: 0 1px 0 rgba(0,0,0,.5); }
#nut-choi { position: relative; z-index: 2; width: min(32vw, 21vh, 180px); aspect-ratio: 1; animation: dap 1.4s ease-in-out infinite; }
#nut-choi img { width: 100%; height: 100%; }
.hang-chinh { position: relative; z-index: 2; display: flex; gap: 10px; }
.nut-chu {
  display: flex; align-items: center; gap: 6px; padding: 8px 16px 8px 10px; min-height: 48px; border-radius: 26px;
  background: linear-gradient(#7ed957, #4caf2a); box-shadow: 0 4px 0 #2f7d18, 0 6px 12px rgba(0,0,0,.25);
  font-size: 18px; text-shadow: 0 1px 0 #2f7d18;
}
.nut-chu span { font-size: 26px; }
.nut-chu b { background: rgba(0,0,0,.18); border-radius: 12px; padding: 0 8px; font-size: 15px; }
.nut-chu:active { transform: translateY(3px); box-shadow: 0 1px 0 #2f7d18; }
#chip-ban {
  position: absolute; z-index: 3; left: 10px; bottom: calc(var(--day) + 10px); padding: 6px 12px; min-height: 32px; border-radius: 16px;
  background: rgba(0,0,0,.28); font-size: 13px; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
#nut-am { position: absolute; z-index: 3; right: 10px; top: calc(var(--dinh) + 10px); }
.may { position: absolute; opacity: .95; pointer-events: none; }
.may1 { width: 150px; top: calc(var(--dinh) + 4%); left: -160px; animation: troi 38s linear infinite; }
.may2 { width: 120px; top: calc(var(--dinh) + 18%); left: -160px; animation: troi 52s linear -20s infinite; }
#dieu-hanh { position: absolute; left: 0; right: 0; bottom: var(--day); height: 30%; pointer-events: none; z-index: 1; }
@keyframes troi { to { transform: translateX(calc(100vw + 340px)); } }
@keyframes nhun { 50% { transform: translateY(-8px) rotate(-1deg); } }
@keyframes dap { 50% { transform: scale(1.08); } }

/* ---------- hàng đầu của game (ngay dưới dải đỉnh của hub) ---------- */
.hang-dau { position: relative; z-index: 5; flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 6px 10px; min-height: 58px; }
.hang-dau h1 {
  flex: 1; margin: 0; text-align: center; font-size: clamp(17px, 4.6vw, 26px); letter-spacing: .5px;
  text-shadow: 0 2px 0 var(--vien), 0 0 6px rgba(0,0,0,.35); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dau-giua { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.dau-giua h1 { flex: none; width: 100%; }
.thanh-tong { position: relative; width: min(60%, 240px); height: 16px; border-radius: 9px; background: rgba(0,0,0,.25); overflow: hidden; }
.thanh-tong i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #ffe066, #ff9f1c); transition: width .5s; }
.thanh-tong span { position: relative; display: block; text-align: center; font-size: 12px; line-height: 16px; text-shadow: 0 1px 0 var(--vien); }
.nut-tron {
  width: 48px; height: 48px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
  background: linear-gradient(#ffb43d, var(--cam)); box-shadow: 0 4px 0 #c85e00, 0 6px 10px rgba(0,0,0,.25);
  font-size: 26px; transition: transform .08s;
}
.nut-tron:active { transform: translateY(3px) scale(.96); box-shadow: 0 1px 0 #c85e00; }
.nut-tron img { width: 62%; height: 62%; }
.nut-tron.to { width: 64px; height: 64px; font-size: 32px; }
.nut-tron.nho { width: 44px; height: 44px; font-size: 22px; }
.nut-tron.xanh { background: none; box-shadow: none; }
.nut-tron.xanh img { width: 100%; height: 100%; }
.nut-tron.rung { animation: rung 1s ease-in-out infinite; }
@keyframes rung { 0%,100% { transform: scale(1); } 50% { transform: scale(1.14); box-shadow: 0 4px 0 #c85e00, 0 0 0 8px rgba(255,224,102,.55); } }
.o-sao { min-width: 48px; text-align: right; font-size: 18px; color: var(--vang); text-shadow: 0 2px 0 var(--vien); }

/* ---------- chọn màn ---------- */
#man-chon { background-image: var(--nen-chon); }
#luoi { position: relative;
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px 10px;
  padding: 8px 14px 16px; align-content: start; max-width: 980px; width: 100%; margin: 0 auto;
}
.o-man { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; animation: noi .35s backwards; }
.o-man .tron { position: relative; width: 100%; max-width: 128px; aspect-ratio: 1; }
.o-man .tron img.icon { width: 100%; height: 100%; filter: drop-shadow(0 4px 4px rgba(0,0,0,.25)); }
.o-man .so { position: absolute; left: 2px; top: 2px; width: 28px; height: 28px; border-radius: 50%; background: var(--xanh); display: grid; place-items: center; font-size: 15px; box-shadow: 0 2px 0 #1b6fa6; }
.o-man .khoa { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(40,50,70,.45); border-radius: 50%; }
.o-man .khoa img { width: 38%; }
.o-man .do { position: absolute; right: 0; bottom: 4px; padding: 1px 7px; border-radius: 10px; background: var(--cam); font-size: 11px; box-shadow: 0 2px 0 #c85e00; }
.o-man.dong .icon { filter: grayscale(.8) brightness(.8); }
.o-man.ke .tron { animation: dap 1.2s ease-in-out infinite; }
.o-man.ke .tron::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 4px solid #ffe066; box-shadow: 0 0 14px #ffe066; }
.o-man.lac { animation: lac .5s; }
.o-man .ten { font-size: 13px; text-shadow: 0 1px 0 var(--vien), 0 0 4px rgba(0,0,0,.5); text-align: center; }
.o-man .sao { height: 18px; display: flex; gap: 1px; }
.o-man .sao img { width: 18px; height: 18px; filter: sepia(1) saturate(6) hue-rotate(5deg) drop-shadow(0 1px 0 #b07800); }
.o-man .sao img.mo { opacity: .25; filter: grayscale(1); }
@keyframes noi { from { transform: scale(.5); opacity: 0; } }

/* ---------- bàn ghép ---------- */
#man-choi { background-image: var(--nen-choi); background-position: center bottom; }
#ban { position: relative; flex: 1; min-height: 0; }
#bong, #tron, #hut, .manh, .goi-y { position: absolute; left: 0; top: 0; transform-origin: 50% 50%; will-change: transform; }
#bong { filter: drop-shadow(0 3px 6px rgba(0,0,0,.18)); pointer-events: none; transition: opacity .3s; }
#hut { pointer-events: none; opacity: 0; filter: brightness(0) invert(1) drop-shadow(0 0 10px #ffe066) drop-shadow(0 0 4px #ffb703); transition: opacity .12s; z-index: 1; }
#hut.gan { animation: hut-gan .38s ease-in-out infinite; }
@keyframes hut-gan {
  50% { filter: brightness(0) invert(1) drop-shadow(0 0 18px #fff) drop-shadow(0 0 10px #ffd23f); }
}
#tron { opacity: 0; pointer-events: none; transition: opacity .5s; z-index: 30; }
#tron.hien { opacity: 1; }
/* Ghép xong: ba cú nhảy to (tính theo % chiều cao con, con nào cũng nhảy rõ) rồi nhún vui MÃI cho tới khi rời màn.
   Bản 2.0 đầu chỉ nhảy một lần 38px trong 1,6 giây rồi đứng im — Quân Thượng 26-10: "Có thấy ghép xong khủng long có nhún nhảy đâu". */
#tron.song { animation: song 2s ease-in-out, vui 1.2s ease-in-out 2s infinite; }
@keyframes song {
  0% { scale: 1 1; translate: 0 0; }
  8% { scale: 1.1 .86; translate: 0 4%; }
  20% { scale: .92 1.12; translate: 0 -38%; rotate: -5deg; }
  32% { scale: 1.12 .86; translate: 0 3%; rotate: 0deg; }
  44% { scale: .94 1.1; translate: 0 -26%; rotate: 5deg; }
  56% { scale: 1.08 .9; translate: 0 2%; rotate: 0deg; }
  68% { scale: .96 1.06; translate: 0 -15%; rotate: -3deg; }
  80% { scale: 1.05 .95; translate: 0 1%; rotate: 0deg; }
  100% { scale: 1 1; translate: 0 0; }
}
@keyframes vui {
  0%, 100% { scale: 1 1; translate: 0 0; rotate: 0deg; }
  25% { scale: 1.05 .94; translate: 0 2%; rotate: -2deg; }
  55% { scale: .96 1.06; translate: 0 -12%; rotate: 2deg; }
}
#khay { position: absolute; inset: 0; pointer-events: none; }
.o-khay { position: absolute; border-radius: 22px; background: rgba(255,255,255,.28); border: 3px dashed rgba(255,255,255,.7); transition: opacity .4s; }
.manh { touch-action: none; cursor: grab; filter: drop-shadow(0 4px 4px rgba(0,0,0,.25)); }
.manh.bay { transition: transform .32s cubic-bezier(.3,1.5,.6,1); }
.manh.keo { cursor: grabbing; filter: drop-shadow(0 14px 14px rgba(0,0,0,.32)); }
/* mảnh đang nhấc khỏi ngón: bóng dài đổ về phía tay, viền sáng để thấy trên nền rừng */
.manh.keo.nang { filter: drop-shadow(0 26px 12px rgba(0,0,0,.42)) drop-shadow(0 0 2px #fff); }
.manh.keo.san { filter: drop-shadow(0 0 8px #fff) drop-shadow(0 0 14px #ffd23f) drop-shadow(0 12px 8px rgba(0,0,0,.32)); }
.manh.keo.nang.san { filter: drop-shadow(0 0 8px #fff) drop-shadow(0 0 16px #ffd23f) drop-shadow(0 26px 12px rgba(0,0,0,.42)); }
.moc-tay {
  position: absolute; left: 0; top: 0; z-index: 80; width: 36px; height: 36px; margin: -18px 0 0 -18px;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, #fff 0 26%, rgba(255,196,40,.7) 27% 58%, transparent 68%);
  box-shadow: 0 0 0 8px rgba(255,224,102,.42);
}
.vong-san {
  position: absolute; left: 0; top: 0; z-index: 58; box-sizing: border-box; pointer-events: none;
  border: 5px solid #fff6b0; border-radius: 18px; transform-origin: 50% 50%;
  box-shadow: 0 0 0 6px rgba(255,196,40,.5), 0 0 18px #ffb703;
  animation: vong-san .4s ease-in-out infinite;
}
@keyframes vong-san {
  50% { box-shadow: 0 0 0 14px rgba(255,224,102,.18), 0 0 24px #fff; border-color: #fff; }
}
.manh.khop { pointer-events: none; filter: none; animation: dan .32s ease-out; }
@keyframes dan { 0% { scale: 1.12; } 45% { scale: .94 1.04; } 100% { scale: 1; } }
.manh.lac { animation: lac .5s; }
@keyframes lac { 20%,60% { rotate: -8deg; } 40%,80% { rotate: 8deg; } }
.manh.an { opacity: 0; transition: opacity .4s; }
.goi-y { pointer-events: none; opacity: 0; filter: brightness(0) invert(1) drop-shadow(0 0 8px #ffe066) drop-shadow(0 0 4px #ffe066); animation: nhay 1.6s ease-in-out; z-index: 1; }
@keyframes nhay { 15%,45%,75% { opacity: .9; } 30%,60%,100% { opacity: .15; } }
.lap-lanh { position: absolute; width: 14px; height: 14px; margin: -7px; border-radius: 50%; background: radial-gradient(#fff, #ffe066 50%, transparent 70%); pointer-events: none; animation: no .6s ease-out forwards; z-index: 40; }
@keyframes no { to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }
#tay {
  position: absolute; left: 0; top: 0; z-index: 70; font-size: 52px; line-height: 1; pointer-events: none; opacity: 0;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,.35)); margin: -6px 0 0 -18px;
}
#tay.chay { animation: tay 2.2s ease-in-out; }
@keyframes tay {
  0% { opacity: 0; transform: translate(var(--x0), var(--y0)) scale(1.2); }
  12% { opacity: 1; transform: translate(var(--x0), var(--y0)) scale(1.2); }
  22% { transform: translate(var(--x0), var(--y0)) scale(.95); }
  75% { opacity: 1; transform: translate(var(--x1), var(--y1)) scale(.95); }
  88% { opacity: 1; transform: translate(var(--x1), var(--y1)) scale(1.2); }
  100% { opacity: 0; transform: translate(var(--x1), var(--y1)) scale(1.2); }
}

#tien { position: absolute; left: 50%; bottom: calc(var(--day) + 8px); width: min(50vw, 260px); height: 10px; transform: translateX(-50%); border-radius: 6px; background: rgba(0,0,0,.25); overflow: hidden; pointer-events: none; }
#tien i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffe066, #ff9f1c); border-radius: 6px; transition: width .3s; }

/* ---------- công viên ---------- */
#man-vien { background-image: var(--nen-choi); background-position: center bottom; }
#vien { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#vien-trong { position: absolute; left: 50%; top: 26%; transform: translateX(-50%); width: min(86%, 380px); padding: 12px 16px; border-radius: 20px; text-align: center; background: rgba(0,0,0,.3); font-size: 17px; }
.con { position: absolute; left: 0; top: 0; transform-origin: 50% 100%; will-change: transform; cursor: pointer; }
.con .lat { width: 100%; height: 100%; transform-origin: 50% 50%; }
.con img { display: block; width: 100%; height: 100%; transform-origin: 50% 100%; }
.con .bong-chan { position: absolute; left: 12%; right: 12%; bottom: -6px; height: 14px; border-radius: 50%; background: rgba(0,40,0,.25); filter: blur(2px); z-index: -1; }
.con.moi::before { content: "MỚI"; position: absolute; left: 50%; top: -20px; transform: translateX(-50%); padding: 1px 8px; border-radius: 10px; background: var(--cam); font-size: 12px; box-shadow: 0 2px 0 #c85e00; animation: dap 1s infinite; }
.con.nhay img { animation: nhay-con .7s ease-out; }
@keyframes nhay-con { 0% { transform: scale(1.1, .85); } 35% { transform: translateY(-40%) scale(.92, 1.1); } 70% { transform: scale(1.08, .92); } 100% { transform: none; } }
.tim { position: absolute; z-index: 60; font-size: 26px; pointer-events: none; animation: tim 1s ease-out forwards; }
@keyframes tim { to { transform: translate(var(--dx), -90px) scale(1.4); opacity: 0; } }
.nhan-con { position: absolute; z-index: 61; padding: 4px 12px; border-radius: 14px; background: rgba(255,255,255,.95); color: var(--vien); font-size: 15px; white-space: nowrap; transform: translate(-50%, -100%); pointer-events: none; animation: nhan 1.8s ease-out forwards; }
@keyframes nhan { 0% { opacity: 0; margin-top: 10px; } 15%,80% { opacity: 1; margin-top: 0; } 100% { opacity: 0; } }

/* ---------- hộp chung: mừng · mốc phiên bản · đang nạp ---------- */
#mung { position: fixed; inset: 0; z-index: 100; display: grid; place-items: end center; padding: var(--dinh) 16px calc(var(--day) + 14px); background: linear-gradient(transparent 45%, rgba(20,40,70,.35)); }
#mung.an, #hop-ban.an, #nap.an { display: none; }
.the {
  position: relative; z-index: 2; width: min(92vw, 440px); padding: 18px 16px 20px; border-radius: 28px; text-align: center;
  background: var(--the); color: var(--vien); box-shadow: 0 10px 0 rgba(0,0,0,.12), 0 18px 40px rgba(0,0,0,.3);
  animation: bung .5s cubic-bezier(.3,1.6,.5,1);
}
@keyframes bung { from { transform: scale(.5); opacity: 0; } }
#mung h2 { margin: 0 0 6px; font-size: clamp(20px, 5.5vw, 28px); color: #ff7a00; }
.sao3 { display: flex; justify-content: center; align-items: flex-end; gap: 6px; }
.sao3 img { width: 60px; filter: drop-shadow(0 3px 0 #d99a00) sepia(1) saturate(6) hue-rotate(5deg); animation: bung .45s backwards; }
.sao3 img:nth-child(2) { width: 80px; animation-delay: .15s; }
.sao3 img:nth-child(3) { animation-delay: .3s; }
.sao3 img.tat { filter: grayscale(1); opacity: .3; }
#mung p { margin: 8px 0 14px; font-size: 18px; }
.hang-nut { display: flex; justify-content: center; align-items: center; gap: 8px; }
.hang-nut .nut-tron.to { width: min(60px, 16vw); height: min(60px, 16vw); font-size: min(30px, 8vw); }

#hop-ban { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; padding: var(--dinh) 14px var(--day); background: rgba(10,25,50,.55); }
#hop-ban .the { text-align: left; max-height: calc(100% - 20px); overflow-y: auto; touch-action: pan-y; }
#hop-ban h2 { margin: 0 0 10px; color: #ff7a00; font-size: 22px; }
.nut-dong { position: absolute; right: 10px; top: 10px; width: 44px; height: 44px; border-radius: 50%; background: #eef2f7; color: var(--vien); font-size: 20px; }
.moc { position: relative; padding: 10px 12px 10px 16px; margin: 0 0 10px; border-radius: 16px; background: #f3f7fb; border-left: 6px solid var(--xanh); }
.moc.nay { border-left-color: var(--la); background: #f0fbe9; }
.moc h3 { margin: 0; font-size: 17px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.moc h3 small { font-size: 12px; color: #6b7685; font-weight: 600; }
.moc ul { margin: 6px 0 6px; padding-left: 18px; font-weight: 600; font-size: 14px; color: #3c4655; }
.moc a { display: inline-block; margin-top: 2px; padding: 6px 12px; border-radius: 12px; background: var(--xanh); color: #fff; text-decoration: none; font-size: 14px; }

#nap { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; align-content: center; gap: 10px; background: rgba(40,120,190,.35); }
#nap .vong { width: 56px; height: 56px; border-radius: 50%; border: 7px solid rgba(255,255,255,.35); border-top-color: #fff; animation: quay .8s linear infinite; }
#nap b { text-shadow: 0 2px 0 var(--vien); }
@keyframes quay { to { transform: rotate(360deg); } }

#phao { position: fixed; inset: 0; z-index: 95; width: 100%; height: 100%; pointer-events: none; }

@media (max-height: 500px) {
  .the { padding: 10px 14px 12px; }
  #mung .the { width: min(64vw, 420px); }
  #mung h2 { font-size: 19px; }
  .sao3 img { width: 38px; } .sao3 img:nth-child(2) { width: 50px; }
  #mung p { margin: 4px 0 8px; font-size: 15px; }
  .nut-tron.to { width: 52px; height: 52px; font-size: 26px; }
  #logo { width: min(48vw, 46vh, 420px); }
  #truyen-chuyen { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01s !important; animation-iteration-count: 1 !important; }
  /* máy bật Giảm chuyển động vẫn thấy khủng long nhún nhẹ — đó là phần thưởng chính của ván */
  #tron.song { animation: vui 1.6s ease-in-out infinite !important; }
}

/* ================= bản 3.0: chế độ Khó · huy chương · thẻ khủng long · sổ sưu tập ================= */
.che-do { flex: 0 0 auto; display: flex; justify-content: center; gap: 0; margin: 0 auto 6px; padding: 4px; border-radius: 26px; background: rgba(0,0,0,.25); }
.che-do button { min-width: 104px; min-height: 44px; padding: 0 16px; border-radius: 22px; font-size: 17px; text-shadow: 0 1px 0 rgba(0,0,0,.3); transition: background .2s, transform .1s; }
.che-do button[aria-pressed="true"] { background: linear-gradient(#7ed957, #4caf2a); box-shadow: 0 3px 0 #2f7d18; }
#nut-kho[aria-pressed="true"] { background: linear-gradient(#6b5bd6, #43349e); box-shadow: 0 3px 0 #2a1f6e; }
body.che-kho #man-chon { background-image: linear-gradient(rgba(40,25,90,.45), rgba(40,25,90,.45)), var(--nen-chon); }
.o-man .huy { min-height: 22px; font-size: 20px; line-height: 22px; }
.o-man .huy i { font-size: 11px; font-style: normal; opacity: .8; text-shadow: 0 1px 0 var(--vien); }
body.van-kho #man-choi { background-image: linear-gradient(rgba(30,20,80,.35), rgba(30,20,80,.35)), var(--nen-choi); }
body.van-kho #tien i { background: linear-gradient(90deg, #c77dff, #6b5bd6); }
.mung-huy { display: none; align-items: center; justify-content: center; gap: 8px; margin-top: 4px; }
#mung.kho .mung-huy { display: flex; }
#mung.kho .sao3 { display: none; }
#mung-huy { font-size: 56px; line-height: 1; animation: bung .5s .2s backwards; }
#mung-huy-chu { font-size: 19px; color: #6b5bd6; }

#the-kl, #so-kl { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: var(--dinh) 14px var(--day); background: rgba(10,25,50,.6); }
#the-kl.an, #so-kl.an { display: none; }
.the-kl { max-height: calc(100% - 16px); overflow-y: auto; touch-action: pan-y; padding-top: 14px; }
.the-khung { height: min(30vh, 210px); display: grid; place-items: center; margin: 0 40px 4px; border-radius: 22px;
  background: radial-gradient(ellipse 72% 20% at 50% 90%, #8fd16a 97%, transparent 100%), linear-gradient(#bfe9ff, #e9f8ff); }
.the-khung img { max-width: 92%; max-height: 92%; animation: tho 2.2s ease-in-out infinite; transform-origin: 50% 100%; }
.the-khung img.lat { scale: -1 1; }
@keyframes tho { 50% { translate: 0 -6px; } }
.the-kl h2 { margin: 6px 0 0; color: #ff7a00; font-size: clamp(20px, 5.4vw, 26px); }
.the-la { font-size: 13px; color: #6b7685; font-weight: 600; }
.the-chip { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.the-chip span:empty { display: none; }
.the-chip span { padding: 4px 12px; border-radius: 14px; background: #eef7e8; color: #2f7d18; font-size: 14px; }
#the-ds { text-align: left; margin: 6px 4px 12px; padding-left: 22px; font-size: 16px; line-height: 1.45; color: #3c4655; }
#the-ds li { margin: 4px 0; }
#the-ds { list-style: none; padding-left: 4px; }
#the-ds li { padding-left: 1.4em; text-indent: -1.4em; }   /* 🦕 đầu dòng là chữ (bọc thành mảnh ic_khung_long), không dùng ::marker */
#the-nghe { margin: 0 auto; color: #fff; }
.the-so { max-height: calc(100% - 16px); overflow-y: auto; touch-action: pan-y; }
.the-so h2 { margin: 0 0 10px; color: #ff7a00; font-size: 22px; text-align: left; }
.the-so h2 small { color: #6b7685; font-size: 15px; }
#so-luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.o-so { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 6px; border-radius: 16px; background: #eef6fd; color: var(--vien); font-size: 12px; min-height: 96px; }
.o-so img { width: 100%; height: 62px; object-fit: contain; }
.o-so.chua { background: #e4e7ee; }
.o-so.chua span { font-size: 22px; color: #8a93a3; }
.o-so b { position: absolute; right: 4px; top: 2px; font-size: 18px; }
@media (max-height: 500px) { .the-khung { height: 30vh; } #the-ds { font-size: 14px; } .che-do button { min-height: 38px; } }
#the-kl { z-index: 130; }   /* thẻ mở từ sổ sưu tập phải nằm trên sổ */

/* ================= bản 4.0: nhiều thứ tiếng theo quốc gia của IP ================= */
.nut-chu em, #the-nghe em { font-style: normal; }
#nut-ngon {
  position: absolute; z-index: 3; right: 10px; bottom: calc(var(--day) + 10px); display: flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 4px 12px 4px 8px; border-radius: 20px; background: rgba(0,0,0,.28); font-size: 14px;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
#nut-ngon span { font-size: 22px; }
#hop-ngon { position: fixed; inset: 0; z-index: 125; display: grid; place-items: center; padding: var(--dinh) 14px var(--day); background: rgba(10,25,50,.55); }
#hop-ngon.an { display: none; }
.the-ngon { max-height: calc(100% - 16px); overflow-y: auto; touch-action: pan-y; }
.the-ngon h2 { margin: 0 0 8px; font-size: 30px; }
#ds-ngon { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
#ds-ngon button { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 6px 12px; border-radius: 16px; background: #eef6fd; color: var(--vien); font-size: 16px; text-align: left; }
#ds-ngon button span { font-size: 26px; }
#ds-ngon button[aria-pressed="true"] { background: linear-gradient(#7ed957, #4caf2a); color: #fff; box-shadow: 0 3px 0 #2f7d18; }
.ngon-nho { margin: 10px 0 0; font-size: 13px; color: #6b7685; font-weight: 600; }

/* ================= bản 5.0: chế độ Xoay · combo · huy hiệu · nhiệm vụ · chuyển cảnh · hạt bay · lưới lấp đầy ================= */
/* lưới chọn màn: số cột và cỡ ô do game.js tính (khopLuoi) để 12 ô lấp đầy khung, không bỏ trống nửa màn trên máy to */
#luoi { grid-template-columns: repeat(var(--cot, 3), var(--o, 110px)); justify-content: center; align-content: center; max-width: none; gap: 12px; }
.o-man .tron { width: var(--o, 110px); max-width: none; }
.o-man .ten { max-width: calc(var(--o, 110px) + 12px); font-size: clamp(10px, calc(var(--o, 110px) * .13), 17px); line-height: 1.12;
  white-space: normal; letter-spacing: -.2px; }   /* tên dài xuống dòng ở khoảng trắng (Tyrannosaurus / Rex), không bẻ giữa chữ, không cắt cụt */
.o-man .so { width: clamp(24px, calc(var(--o, 110px) * .24), 38px); height: clamp(24px, calc(var(--o, 110px) * .24), 38px); font-size: clamp(13px, calc(var(--o, 110px) * .13), 19px); }

.che-do button { min-width: 0; padding: 0 clamp(8px, 3vw, 16px); }
#nut-xoay[aria-pressed="true"] { background: linear-gradient(#ff8fc8, #e0479a); box-shadow: 0 3px 0 #9c1f62; }
body.che-xoay #man-chon { background-image: linear-gradient(rgba(150,30,90,.32), rgba(150,30,90,.32)), var(--nen-chon); }
body.van-xoay #man-choi { background-image: linear-gradient(rgba(150,30,90,.22), rgba(150,30,90,.22)), var(--nen-choi); }
body.van-xoay #tien i { background: linear-gradient(90deg, #ffb3d9, #e0479a); }
body.van-xoay .manh:not(.khop):not(.keo) { transition: transform .22s cubic-bezier(.3,1.5,.6,1); }

/* màn chính: nút thành tích (vàng) có chấm đỏ khi còn nhiệm vụ hôm nay */
.hang-chinh { flex-wrap: wrap; justify-content: center; padding: 0 12px; }
.nut-chu.vang { background: linear-gradient(#ffd45c, #ffa51f); box-shadow: 0 4px 0 #c46d00, 0 6px 12px rgba(0,0,0,.25); text-shadow: 0 1px 0 #b45f00; }
.nut-chu.vang:active { box-shadow: 0 1px 0 #c46d00; }
.nut-chu { position: relative; }
.nut-chu i { position: absolute; right: -6px; top: -8px; padding: 0 7px; border-radius: 11px; background: #ff3d5a; font-style: normal; font-size: 13px; line-height: 22px; box-shadow: 0 2px 0 #b3142c; display: none; }
#nut-tt.co-viec i { display: block; animation: dap 1.4s ease-in-out infinite; }
#nut-nhac { position: absolute; z-index: 3; right: 10px; top: calc(var(--dinh) + 10px); }
body:not(.trong-hub) #nut-nhac { right: 62px; }
#nut-nhac.tat { filter: grayscale(1) brightness(.85); }
#nut-nhac.tat::after { content: ""; position: absolute; width: 60%; height: 4px; border-radius: 2px; background: #c62828; rotate: -45deg; }

/* chuyển cảnh bong bóng */
#bong-chuyen { position: fixed; z-index: 200; border-radius: 50%; pointer-events: none; transform: scale(0); opacity: 0;
  background: radial-gradient(circle, #8be05a 0 55%, #4caf2a 56% 100%); }
#bong-chuyen.no { opacity: 1; transform: scale(1); transition: transform .26s cubic-bezier(.5,0,.75,0); }
#bong-chuyen.tan { opacity: 0; transform: scale(1.04); transition: opacity .34s ease-out; }

/* hạt bay nền: nằm trên nền màn, dưới mọi hộp, không ăn chạm */
#nen-hat { position: fixed; inset: 0; z-index: 4; width: 100%; height: 100%; pointer-events: none; }

/* khớp mảnh: vòng sóng · chữ điểm bay · nhãn combo */
.song-vong { position: absolute; z-index: 41; width: 20px; height: 20px; margin: -10px; border-radius: 50%; border: 5px solid #fff6a8; pointer-events: none; animation: song-vong .6s ease-out forwards; }
.song-vong.to { border-color: #ffd23f; box-shadow: 0 0 18px #ffb703; }
@keyframes song-vong { to { transform: scale(9); opacity: 0; border-width: 1px; } }
.song-vong.to { animation-name: song-vong-to; }
@keyframes song-vong-to { to { transform: scale(13); opacity: 0; border-width: 1px; } }
.chu-bay { position: absolute; z-index: 42; transform: translate(-50%, -50%); font-size: 24px; color: #fff; text-shadow: 0 2px 0 #2d3440, 0 0 8px rgba(0,0,0,.35); pointer-events: none; animation: chu-bay 1s ease-out forwards; white-space: nowrap; }
.chu-bay.vang { color: #ffe066; font-size: 28px; }
@keyframes chu-bay { 0% { opacity: 0; margin-top: 10px; scale: .6; } 20% { opacity: 1; scale: 1.15; } 100% { opacity: 0; margin-top: -60px; scale: 1; } }
#combo { position: absolute; z-index: 45; left: 50%; top: 8px; transform: translateX(-50%); padding: 4px 18px; border-radius: 22px; pointer-events: none;
  background: linear-gradient(#ff7a59, #ff3d5a); box-shadow: 0 4px 0 #b3142c; font-size: clamp(20px, 5.5vw, 30px); opacity: 0; white-space: nowrap; }
#combo.hien { animation: combo 1.4s ease-out forwards; }
@keyframes combo { 0% { opacity: 0; scale: .3; } 15% { opacity: 1; scale: 1.25; } 28% { scale: 1; } 80% { opacity: 1; } 100% { opacity: 0; translate: 0 -12px; } }
#chu-noi { position: absolute; z-index: 45; left: 50%; top: 40%; transform: translate(-50%, -50%); max-width: 90%; padding: 10px 18px; border-radius: 18px; text-align: center;
  background: rgba(20,30,50,.72); font-size: clamp(17px, 4.6vw, 24px); pointer-events: none; opacity: 0; }
#chu-noi.hien { animation: chu-noi 3.2s ease-out forwards; }
@keyframes chu-noi { 0% { opacity: 0; scale: .7; } 10%, 85% { opacity: 1; scale: 1; } 100% { opacity: 0; } }

/* xong con: tia nắng quay sau lưng khủng long */
#toa { position: absolute; left: 50%; top: 45%; width: 160vmax; height: 160vmax; margin: -80vmax 0 0 -80vmax; z-index: 0; pointer-events: none; opacity: 0;
  background: repeating-conic-gradient(rgba(255,255,220,.38) 0 9deg, transparent 9deg 22.5deg);
  -webkit-mask: radial-gradient(circle, #000 0, transparent 55%); mask: radial-gradient(circle, #000 0, transparent 55%); transition: opacity .6s; }
#toa.hien { opacity: 1; animation: quay 24s linear infinite; }

/* hộp mừng: dải huy hiệu mới */
#mung-tt { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: -6px 0 12px; }
#mung-tt:empty { display: none; }
#mung-tt span { padding: 4px 12px; border-radius: 14px; background: linear-gradient(#fff3c4, #ffe08a); color: #8a5300; font-size: 15px; animation: bung .5s .4s backwards; }

/* báo huy hiệu mới */
#bao-tt { position: fixed; z-index: 150; left: 50%; top: calc(var(--dinh) + 8px); display: flex; align-items: center; gap: 10px; padding: 8px 18px 8px 10px;
  border-radius: 24px; background: rgba(255,255,255,.97); color: var(--vien); box-shadow: 0 6px 18px rgba(0,0,0,.3); pointer-events: none;
  transform: translate(-50%, -160%); opacity: 0; max-width: calc(100% - 24px); }
#bao-tt b { font-size: 34px; line-height: 1; }
#bao-tt span { display: flex; flex-direction: column; font-size: 17px; }
#bao-tt small { font-size: 12px; color: #ff7a00; }
#bao-tt.hien { animation: bao-tt 3.4s cubic-bezier(.3,1.4,.5,1) forwards; }
@keyframes bao-tt { 0% { transform: translate(-50%, -160%); opacity: 0; } 12%, 85% { transform: translate(-50%, 0); opacity: 1; } 100% { transform: translate(-50%, -160%); opacity: 0; } }

/* hộp thành tích: nhiệm vụ hôm nay + lưới huy hiệu */
#hop-tt { position: fixed; inset: 0; z-index: 125; display: grid; place-items: center; padding: var(--dinh) 14px var(--day); background: rgba(10,25,50,.6); }
#hop-tt.an, #loi-nap.an { display: none; }
.the-tt { max-height: calc(100% - 16px); overflow-y: auto; touch-action: pan-y; text-align: left; width: min(94vw, 560px); }
.the-tt h2 { margin: 0 0 8px; color: #ff7a00; font-size: 20px; }
.the-tt h2 + ul { margin-top: 0; }
#tt-nv { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 8px; }
#tt-nv li { position: relative; overflow: hidden; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: #eef6fd; font-size: 15px; }
#tt-nv li i { font-style: normal; font-size: 22px; z-index: 1; }
#tt-nv li span { flex: 1; z-index: 1; }
#tt-nv li b { z-index: 1; color: #3fb0f0; }
#tt-nv li em { position: absolute; inset: 0 auto 0 0; width: calc(var(--p) * 100%); background: rgba(108,194,74,.22); }
#tt-nv li.dat { background: #e6f8dc; }
#tt-nv li.dat b { color: #2f7d18; }
#tt-chuoi { margin: 0 0 12px; color: #e0479a; font-size: 15px; min-height: 4px; }
#tt-luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.o-tt { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border-radius: 16px; background: #e4e7ee; text-align: center; }
.o-tt b { font-size: 34px; line-height: 1.1; filter: grayscale(1); opacity: .35; }
.o-tt span { font-size: 13px; color: #6b7685; }
.o-tt small { font-size: 11px; color: #8a93a3; font-weight: 600; line-height: 1.25; }
.o-tt.co { background: linear-gradient(#fff8dc, #ffe9a8); box-shadow: inset 0 0 0 2px #ffcf4d; }
.o-tt.co b { filter: none; opacity: 1; }
.o-tt.co span { color: #8a5300; }

#loi-nap { position: fixed; z-index: 160; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 14px 22px; border-radius: 20px; background: rgba(20,30,50,.85); font-size: 18px; }

@media (max-height: 500px) {
  .hang-chinh .nut-chu { min-height: 40px; padding: 4px 12px 4px 8px; font-size: 15px; }
  .hang-chinh .nut-chu span { font-size: 20px; }
}
@media (max-width: 340px) {
  .nut-chu { font-size: 15px; padding: 6px 12px 6px 8px; }
  .nut-chu span { font-size: 21px; }
}

/* ---------- bản 6.0 cho bé: bớt nút, một nút Tiếp to, một ⚙️ cho người lớn ---------- */
[hidden] { display: none !important; }
#mung-tiep { position: relative; width: min(104px, 26vw); height: min(104px, 26vw); animation: dap 1.2s ease-in-out infinite; }
#tay-tiep { position: absolute; right: -18px; bottom: -22px; font-size: 40px; font-style: normal; pointer-events: none; opacity: 0; }
#mung.goi #tay-tiep { opacity: 1; animation: cham-tiep 1.1s ease-in-out infinite; }
@keyframes cham-tiep { 0%, 100% { transform: translate(10px, 10px); } 50% { transform: translate(-6px, -8px) scale(.92); } }
#mung .the { cursor: pointer; }
#nut-cai { position: fixed; z-index: 90; right: 10px; top: calc(var(--dinh) + 8px); }
#hop-cai { position: fixed; inset: 0; z-index: 115; display: grid; place-items: center; padding: var(--dinh) 14px var(--day); background: rgba(10,25,50,.55); }
#hop-cai.an { display: none; }
#hop-cai .the { width: min(460px, 100%); max-height: calc(100% - 20px); overflow-y: auto; touch-action: pan-y; text-align: left; }
#hop-cai h2 { margin: 0 0 8px; }
.muc-cai { padding: 8px 0; border-top: 1px solid #e6ebf1; color: var(--vien); }
.muc-cai > b { display: block; margin-bottom: 6px; font-size: 16px; }
.muc-cai .chon { display: flex; flex-wrap: wrap; gap: 6px; }
.muc-cai button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 12px; border-radius: 20px; background: #eef2f7; color: var(--vien); font-size: 15px; }
.muc-cai button[aria-pressed="true"] { background: var(--la); color: #fff; }
.muc-cai button img { width: 28px; height: 28px; }
/* Trong hub, dải "Tiến trình của bạn sẽ không được lưu" (khách) và ô điểm của hub nằm ở 52–104px, dưới dải đỉnh 46px của hợp đồng:
   đẩy hàng đầu màn chơi xuống cho nút về menu không bị che (máy đứng đủ cao; máy nằm ngang giữ chỗ cho bàn ghép) */
@media (min-height: 600px) { body.trong-hub #man-choi .hang-dau { margin-top: 50px; } }

/* ---------- hộp 🌐 chơi online (online.js dựng) — dùng lại nếp .the và .muc-cai của bảng ⚙️ ---------- */
#hop-online { position: fixed; inset: 0; z-index: 116; display: grid; place-items: center; padding: var(--dinh) 14px var(--day); background: rgba(10,25,50,.55); }
#hop-online.an { display: none; }
#hop-online .the { width: min(460px, 100%); max-height: calc(100% - 20px); overflow-y: auto; touch-action: pan-y; text-align: left; }
#hop-online h2 { margin: 0 44px 6px 0; color: #ff7a00; font-size: 22px; }
#on-bao { min-height: 22px; margin: 0 0 6px; font-size: 15px; font-weight: 700; color: #1f7a3a; }
#hop-online .chon { align-items: center; }
#hop-online .chon span { font-size: 15px; font-weight: 700; }
#on-ma { width: 150px; min-height: 40px; padding: 4px 12px; border: 2px solid #cfd8e3; border-radius: 20px; font: inherit; font-size: 16px; color: var(--vien); background: #fff; user-select: text; -webkit-user-select: text; }
#hop-online .dong-ban { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: 100%; padding: 4px 0; }
#hop-online .dong-ban em { font-style: normal; font-size: 13px; font-weight: 700; color: #ff7a00; }
#hop-online .dong-ban .vao-cung { background: var(--la); color: #fff; }

/* ---------- 20-11 bộ giao diện thay HẾT nút + icon (phiếu 55811017) ----------
   game.js bọc mọi emoji nút/icon thành <x-ic data-ic="tên mảnh">. Bộ gốc: x-ic chỉ là chữ, trông y như cũ.
   Bộ có mảnh: <style id="skin-ic"> (game.js dựng) đặt ảnh + đẩy emoji ra khỏi khung. */
x-ic { font-style: normal; }
.co-anh { background: none !important; box-shadow: none !important; }
.co-anh > img, .co-anh > x-ic { width: 100% !important; height: 100% !important; vertical-align: 0 !important; }
.nut-dong.co-anh { color: transparent; }
/* nút dài + khung hộp của bộ (mảnh nut_dai_chinh · nut_dai_phu · khung_hop) — thiếu mảnh thì giữ gradient gốc */
body.co-nut_dai_chinh .nut-chu, body.co-nut_dai_chinh .che-do button[aria-pressed="true"],
body.co-nut_dai_chinh .muc-cai button[aria-pressed="true"] { background: var(--anh-nut_dai_chinh) center / 100% 100% no-repeat; box-shadow: none; }
body.co-nut_dai_phu .nut-chu.vang, body.co-nut_dai_phu .muc-cai button:not([aria-pressed="true"]) { background: var(--anh-nut_dai_phu) center / 100% 100% no-repeat; box-shadow: none; }
body.co-khung_hop .the { background: none; border: 0 solid transparent; border-image: var(--anh-khung_hop) 28% fill / 40px / 0 stretch; }
/* sao của bộ đã có màu riêng: bỏ lớp nhuộm vàng của ảnh gốc */
body.co-sao .sao3 img, body.co-sao .o-man .sao img:not(.mo) { filter: drop-shadow(0 2px 0 rgba(0,0,0,.2)); }
/* 21-11 chấm 5811031: thanh, ô khay, nhãn, số màn, tia sáng cũng theo bộ (mảnh o_khay · thanh_tien(_day) · the_nho · o_so · toa) */
body.co-o_khay .o-khay { background: var(--anh-o_khay) center / 100% 100% no-repeat; border: 0; }
body.co-thanh_tien #tien, body.co-thanh_tien .thanh-tong { background: var(--anh-thanh_tien) center / 100% 100% no-repeat; }
body.co-thanh_tien_day #tien i, body.co-thanh_tien_day .thanh-tong i { background: var(--anh-thanh_tien_day) left center / 100% 100% no-repeat; }
body.co-the_nho #combo, body.co-the_nho #chu-noi, body.co-the_nho .nhan-con, body.co-the_nho #bao-tt { background: var(--anh-the_nho) center / 100% 100% no-repeat; box-shadow: none; }
body.co-the_nho .nhan-con { color: #fff; text-shadow: 0 1px 0 var(--vien), 0 0 4px rgba(0,0,0,.5); }
body.co-o_so .o-man .so { background: var(--anh-o_so) center / contain no-repeat; box-shadow: none; }
body.co-toa #toa { background: var(--anh-toa) center / contain no-repeat; -webkit-mask: none; mask: none; }

/* ---------- sẵn sàng phát hành: nút thưởng 1 lần/ván & tạm dừng khi chờ quảng cáo ---------- */
#nut-thuong { min-height: 44px; padding: 4px 10px 4px 8px; gap: 4px; font-size: 16px; flex: 0 0 auto; }
#nut-thuong span { font-size: 20px; }
body.tam-dung-qc, body.tam-dung-qc *, body.the-an, body.the-an * { animation-play-state: paused !important; }
body.tam-dung-qc #khung { pointer-events: none; }
