/* Trang cổng Game1Tap — màu lấy từ README logo (game1tap-logo/README.md). Điện thoại trước, máy tính sau. */
:root {
  --bg-0: #06135a;
  --bg-1: #0b2a9a;
  --card: #10308f;
  --card-hi: #1a44b8;
  --line: rgba(255, 255, 255, .14);
  --ink: #000c49;
  --white: #fff;
  --text: #fff;
  --text-2: #b9cbff;
  --yellow: #fdee36;
  --yellow-2: #fdd51f;
  --orange: #fd6500;
  --orange-2: #fb9c00;
  --red: #fd6437;
  --cyan: #01e8fd;
  --cyan-2: #00b1fd;
  --gold: #ffd23f;
  --silver: #dfe7f5;
  --bronze: #e58a4a;
  --radius: 20px;
  --font: 'Baloo 2', ui-rounded, 'Arial Rounded MT Bold', 'Segoe UI', system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --tabbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
/* Trang chủ ý chỉ có một giao diện tối xanh thương hiệu (không đổi theo chế độ sáng/tối của máy). */
:root { padding-top: env(safe-area-inset-top, 0px); }
body::before { content: ''; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 31; background: var(--bg-0); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-0);
  background-image:
    radial-gradient(120% 60% at 50% -10%, #2a6cf0 0%, rgba(42, 108, 240, 0) 60%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
html[lang="zh-CN"] body, html[lang="ko"] body { --font: system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Baloo 2', sans-serif; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }

/* ---------- đầu trang ---------- */
.app { max-width: 1440px; margin: 0 auto; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding-block: 8px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: rgba(6, 19, 90, .86);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.logo { height: 40px; width: auto; flex: none; }
.topbar .grow { flex: 1; }
/* nút loa (bộ giao diện chung g1-tron), tối thiểu 44 điểm */
.topbar .sound-btn { --d: 44px; flex: none; }
@media (max-width: 360px) { .topbar .logo { height: 34px; } .topbar { gap: 6px; } }
/* ghi công ở Hồ sơ */
.panel.credits p { margin: 0; font-size: 13px; color: var(--text-2); font-weight: 600; line-height: 1.5; }
.tickets {
  display: flex; align-items: center; gap: 4px;
  height: 40px; padding: 0 4px 0 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, #0a1f6e, #071552);
  border: 2px solid rgba(255, 255, 255, .22);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .08);
}
.tickets .g1-ve { flex: none; }
.tickets .n { font-weight: 800; font-size: 19px; line-height: 1; min-width: 18px; text-align: center; padding-top: 2px; }
.tickets .n.bump { animation: bump .5s cubic-bezier(.3, 1.6, .5, 1); }
.plus {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 24px; font-weight: 800; line-height: 1;
  color: var(--ink);
  background: linear-gradient(180deg, #7cff6b, #22c55e);
  box-shadow: 0 3px 0 #13843c, inset 0 2px 0 rgba(255, 255, 255, .6);
  transition: transform .08s;
}
.plus:active { transform: translateY(2px); box-shadow: 0 1px 0 #13843c; }
.avatar {
  --a: #00b1fd; --b: #005cfb;
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-weight: 800; font-size: 15px; color: #fff; line-height: 1;
  background: linear-gradient(145deg, var(--a), var(--b));
  border: 2px solid #fff;
  box-shadow: 0 2px 0 rgba(0, 12, 73, .6);
  text-shadow: 0 1px 0 rgba(0, 12, 73, .55);
  padding-top: 2px;
}
.me-btn .avatar { width: 40px; height: 40px; font-size: 18px; border-width: 3px; }

/* ---------- vùng nội dung ---------- */
.view { padding-block: 12px calc(var(--tabbar-h) + var(--safe-b) + 24px); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); outline: none; min-height: 60vh; min-width: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 18px 2px 10px; }
.section-head h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: .2px; }
.mock-pill {
  font-size: 11px; font-weight: 700; color: var(--ink);
  background: var(--yellow); border-radius: 999px; padding: 2px 8px 1px; white-space: nowrap;
}

/* ---------- băng Giải tuần ---------- */
.week {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius);
  color: var(--ink);
  background: linear-gradient(135deg, #ffe94a 0%, #fdc10f 45%, #fb8c00 100%);
  border: 3px solid var(--ink);
  box-shadow: 0 5px 0 var(--ink), inset 0 3px 0 rgba(255, 255, 255, .55);
}
.week::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, .0) 0 26px, rgba(255, 255, 255, .16) 26px 40px);
}
.week .trophy { grid-row: span 2; width: 52px; height: 52px; position: relative; z-index: 1; }
/* ảnh nền (mục 10) nằm ở lớp ::before; nền cam phía sau nối màu ảnh */
.week.has-bg { background: linear-gradient(90deg, #fd9a0c, #fb6f14); }
.week.has-bg::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: var(--wbg) left center / cover no-repeat; }
.week.has-bg::after { display: none; }
.week .trophy-space { width: 104px; height: 64px; }
/* chữ nằm trên ảnh nền nhiều chi tiết: đặt nền sáng mờ phía sau cho dễ đọc */
.week.has-bg .w-title { text-shadow: 0 1px 0 rgba(255, 255, 255, .7); }
.week.has-bg .my-rank { background: rgba(255, 255, 255, .62); }
.week.has-bg .prizes { background: rgba(255, 255, 255, .62); border-radius: 12px; padding: 4px 8px; justify-self: start; }
.week.has-bg .p-lbl { opacity: 1; }
.week.has-bg .p-chip { background: rgba(255, 255, 255, .85); }
.week .w-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }
.week .w-title { font-size: 21px; font-weight: 800; line-height: 1.05; }
.week .w-ends { font-size: 13px; font-weight: 700; opacity: .8; }
.countdown { display: flex; align-items: center; gap: 3px; position: relative; z-index: 1; flex-wrap: wrap; }
.countdown .box {
  min-width: 34px; padding: 3px 6px 1px; border-radius: 8px; text-align: center;
  font-weight: 800; font-size: 18px; line-height: 1.15; font-variant-numeric: tabular-nums;
  color: #fff; background: var(--ink);
}
.countdown .box.day { color: var(--yellow); margin-right: 4px; }
.countdown .sep { font-weight: 800; }
.week .my-rank {
  grid-column: 1 / -1; position: relative; z-index: 1;
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px; padding: 6px 8px 6px 12px;
  border-radius: 14px; background: rgba(0, 12, 73, .12);
  font-weight: 700; font-size: 14px;
}
.week .my-rank .r { font-size: 20px; font-weight: 800; }
.week .my-rank .g { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week .my-rank .chev { font-size: 22px; font-weight: 800; line-height: 1; }

.prizes { grid-column: 1 / -1; position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 2px; }
.p-lbl { font-size: 11px; font-weight: 800; opacity: .8; margin-right: 2px; }
.p-chip { display: inline-flex; align-items: center; gap: 2px; padding: 1px 7px 0 2px; border-radius: 999px; background: rgba(255, 255, 255, .55); border: 2px solid var(--ink); font-size: 12px; font-weight: 800; color: var(--ink); white-space: nowrap; }
.p-chip .medal { width: 18px; height: 18px; }
.p-chip.small { padding: 1px 8px 0; margin: 2px 0 4px; font-size: 12px; background: var(--yellow); }

/* ---------- ô điểm danh ---------- */
.checkin {
  display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 10px;
  margin-top: 12px; padding: 10px 12px; border-radius: var(--radius);
  background: linear-gradient(135deg, #1fbf55, #0f8f6a); border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink);
}
.checkin.claimed { background: linear-gradient(135deg, #2a4fc4, #193a9e); }
.ci-gift { width: 52px; height: 52px; display: grid; place-items: center; }
.ci-gift svg, .ci-gift img { width: 52px; height: 52px; }
.checkin:not(.claimed) .ci-gift { animation: wiggle 1.6s ease-in-out infinite; }
.ci-txt { min-width: 0; display: grid; line-height: 1.15; }
.ci-txt strong { font-size: 18px; font-weight: 800; }
.ci-txt span { font-size: 13px; font-weight: 600; opacity: .9; }
.ci-btn { flex: none; min-width: 0; padding-left: 16px; padding-right: 16px; animation: pulse 1.4s ease-in-out infinite; }
.ci-next { display: grid; justify-items: end; gap: 2px; font-size: 12px; font-weight: 700; color: var(--text-2); }
.ci-next .countdown .box { font-size: 14px; min-width: 26px; padding: 2px 4px 0; background: rgba(0, 12, 73, .6); }
@keyframes wiggle { 0%, 70%, 100% { rotate: 0deg; scale: 1; } 76% { rotate: -10deg; scale: 1.08; } 84% { rotate: 9deg; scale: 1.08; } 92% { rotate: -4deg; } }
@keyframes pulse { 0%, 100% { scale: 1; } 50% { scale: 1.06; } }

/* ---------- thẻ game (điện thoại: mỗi dòng 1 game) ---------- */
.games { display: grid; gap: 14px; }
.game {
  position: relative;
  display: grid; grid-template-columns: 124px 1fr; gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card-hi), var(--card));
  border: 2px solid rgba(255, 255, 255, .16);
  box-shadow: 0 6px 0 rgba(0, 12, 73, .75), 0 14px 28px rgba(0, 0, 0, .25);
}
.game .left { min-width: 0; }
.cover {
  position: relative; display: block; width: 100%; max-width: 100%; aspect-ratio: 3 / 4;
  border-radius: 16px; overflow: hidden;
  background: linear-gradient(160deg, #2a6cf0, #0b2a9a);
  border: 3px solid var(--ink);
  box-shadow: 0 4px 0 var(--ink);
}
.cover img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; }
/* logo chữ tên game (ảnh nền trong suốt ~2:1) ở 1/4 dưới ảnh bìa, có bóng mờ phía sau cho nổi */
.cover-logo {
  position: absolute; left: 0; right: 0; bottom: 0; height: 34%;
  display: grid; place-items: center; padding: 4px 8%;
  background: linear-gradient(180deg, rgba(0, 12, 73, 0), rgba(0, 12, 73, .55) 55%, rgba(0, 12, 73, .7));
  pointer-events: none;
}
.cover-logo img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .45)); }
.cover:active { transform: translateY(2px); }
.g-name { margin: 8px 0 0; font-size: 17px; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.g-plays { margin: 1px 0 0; font-size: 13px; font-weight: 600; color: var(--cyan); display: flex; align-items: center; gap: 4px; }
.g-plays svg { width: 13px; height: 13px; flex: none; }
.game .right { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.top-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.top-head .lbl { font-size: 13px; font-weight: 800; color: var(--yellow); text-transform: uppercase; letter-spacing: .4px; }
html[lang="zh-CN"] .top-head .lbl, html[lang="ko"] .top-head .lbl { text-transform: none; letter-spacing: 0; }
.top-head a { font-size: 12px; font-weight: 700; color: var(--text-2); white-space: nowrap; }
.top3 { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.top3 li {
  display: grid; grid-template-columns: 24px 32px 1fr auto; align-items: center; gap: 6px;
  padding: 4px 8px 4px 4px; border-radius: 12px;
  background: rgba(0, 12, 73, .32);
}
.top3 li.me { background: linear-gradient(90deg, rgba(253, 101, 0, .55), rgba(253, 101, 0, .2)); }
.top3 .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 14px; }
.top3 .sc { font-weight: 800; font-size: 14px; color: var(--yellow); font-variant-numeric: tabular-nums; }
.top3 .empty { display: block; padding: 10px; font-size: 13px; color: var(--text-2); background: none; }
.medal { width: 24px; height: 24px; display: block; }
span.medal > img.medal { width: 100%; height: 100%; }
.pod .medal img { width: 100%; height: 100%; }
.right .btn-play { margin-top: auto; }

/* ---------- nút: bộ giao diện chung g1-ui/g1-ui.css (lớp g1-nut); ở đây chỉ chỉnh chỗ đặt ---------- */
.g1-nut.pop { animation: pop .38s cubic-bezier(.3, 1.7, .5, 1); }
.g1-nut .g1-ve { flex: none; }
.actions .g1-nut, .ld-foot .g1-nut { width: 100%; }
@keyframes pop { 0% { scale: 1; } 30% { scale: .9; } 65% { scale: 1.07; } 100% { scale: 1; } }
@keyframes bump { 0% { scale: 1; } 40% { scale: 1.6; color: var(--yellow); } 100% { scale: 1; } }

/* ---------- ô Sắp ra mắt (làm mờ) ---------- */
.game.soon { opacity: .62; filter: saturate(.55); }
.game.soon .cover { background: radial-gradient(60% 50% at 30% 30%, #ff9a3d, transparent 70%), radial-gradient(60% 60% at 70% 70%, #2ee6ff, transparent 70%), linear-gradient(160deg, #5b3fd6, #0b2a9a); }
.game.soon .cover .blur { position: absolute; inset: 0; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: grid; place-items: center; }
.game.soon .cover .q { font-size: 64px; font-weight: 800; color: rgba(255, 255, 255, .85); text-shadow: 0 4px 0 var(--ink); }
.soon-tag {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  padding: 3px 10px 1px; border-radius: 999px;
  font-size: 12px; font-weight: 800; color: var(--ink); background: var(--cyan);
}
.ghost-line { height: 32px; border-radius: 12px; background: rgba(0, 12, 73, .32); }

/* ---------- thanh dưới (máy tính: cột trái) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
  background: rgba(6, 19, 90, .94);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-size: 12px; font-weight: 700; color: var(--text-2);
  min-width: 0;
}
.tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.tab .ico { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 12px; transition: transform .15s; }
.tab .ico svg { width: 26px; height: 26px; }
.tab .ico img { width: 30px; height: 30px; filter: saturate(.45) brightness(.9); opacity: .8; transition: filter .15s, opacity .15s; }
.tab[aria-current="page"] .ico:has(img) { background: none; box-shadow: none; transform: translateY(-3px) scale(1.12); }
.tab[aria-current="page"] .ico img { filter: drop-shadow(0 3px 0 var(--ink)); opacity: 1; }
.tab[aria-current="page"] { color: #fff; }
.tab[aria-current="page"] .ico { background: linear-gradient(180deg, #ffb21a, #fd6500); box-shadow: 0 3px 0 var(--ink); transform: translateY(-3px); animation: pop .35s; }
.tab:active .ico { transform: scale(.88); }

/* ---------- trang Xếp hạng ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: 4px 14px 4px 4px; border-radius: 999px;
  font-weight: 800; font-size: 15px;
  background: rgba(255, 255, 255, .08); border: 2px solid rgba(255, 255, 255, .16);
}
.chip img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; object-position: top; }
.chip[aria-current="true"] { background: #fff; color: var(--ink); border-color: #fff; box-shadow: 0 3px 0 var(--ink); }
.rank-hero { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 2px 4px; flex-wrap: wrap; }
.rh-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rh-cup { width: 52px; height: 52px; flex: none; display: grid; place-items: center; }
.rh-cup img, .rh-cup svg { width: 52px; height: 52px; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .35)); }
.rank-hero h1 { margin: 0; font-size: 26px; font-weight: 800; line-height: 1.1; }
.rank-hero .sub { font-size: 13px; font-weight: 600; color: var(--text-2); }
.mini-count { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--text-2); }
.mini-count .countdown .box { font-size: 15px; min-width: 28px; padding: 2px 5px 0; background: rgba(0, 12, 73, .7); }

.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 8px; margin: 18px 0 14px; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; text-align: center; }
.pod .avatar { width: 56px; height: 56px; font-size: 24px; border-width: 3px; }
.pod.p1 .avatar { width: 72px; height: 72px; font-size: 30px; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(255, 210, 63, .35), 0 3px 0 var(--ink); }
.pod.p2 .avatar { border-color: var(--silver); }
.pod.p3 .avatar { border-color: var(--bronze); }
.av-wrap { position: relative; display: inline-block; margin: 22px 0 26px; }
.av-frame { position: absolute; left: 50%; top: 50%; width: 182%; height: 182%; translate: -50% -53.6%; pointer-events: none; }
.av-frame img { width: 100%; height: 100%; max-width: none; display: block; }
.pod .nm { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; font-size: 14px; }
.pod .sc { font-weight: 800; color: var(--yellow); font-size: 15px; font-variant-numeric: tabular-nums; }
.pod .stand {
  width: 100%; display: grid; place-items: center;
  border-radius: 14px 14px 6px 6px; border: 3px solid var(--ink);
  font-weight: 800; font-size: 28px; color: var(--ink);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, .55);
}
.pod.p1 .stand { height: 86px; background: linear-gradient(180deg, #fff1a0, var(--gold) 40%, #e9a400); }
.pod.p2 .stand { height: 62px; background: linear-gradient(180deg, #ffffff, var(--silver) 40%, #a9b6cf); }
.pod.p3 .stand { height: 48px; background: linear-gradient(180deg, #ffd1a8, var(--bronze) 40%, #b45f25); }
.pod .medal { width: 30px; height: 30px; margin-bottom: -2px; }

.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.board li {
  display: grid; grid-template-columns: 40px 36px 1fr auto; align-items: center; gap: 10px;
  padding: 7px 12px 7px 8px; border-radius: 14px;
  background: rgba(255, 255, 255, .07);
}
.board .rk { text-align: center; font-weight: 800; font-size: 16px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.board .avatar { width: 36px; height: 36px; }
.board .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 15px; }
.board .sc { font-weight: 800; font-size: 16px; color: var(--yellow); font-variant-numeric: tabular-nums; }
.board li.me, .me-bar .row {
  background: linear-gradient(90deg, #ff9a1a, #fd6500);
  border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
  color: #fff;
}
.board li.me .rk, .me-bar .rk { color: #fff; }
.board li.me .sc, .me-bar .sc { color: #fff; text-shadow: 0 2px 0 rgba(0, 12, 73, .4); }
.you-tag { display: inline-block; margin-left: 6px; padding: 1px 7px 0; border-radius: 999px; background: var(--ink); color: var(--yellow); font-size: 11px; font-weight: 800; vertical-align: 2px; }
.me-bar {
  position: fixed; left: 0; right: 0; z-index: 35;
  bottom: calc(var(--tabbar-h) + var(--safe-b));
  padding: 8px 16px 10px;
  background: linear-gradient(180deg, rgba(6, 19, 90, 0), rgba(6, 19, 90, .95) 30%);
  transition: transform .2s, opacity .2s;
}
.me-bar.hide { transform: translateY(20px); opacity: 0; pointer-events: none; }
.me-bar .wrap { max-width: 720px; margin: 0 auto; display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.me-bar .row { display: grid; grid-template-columns: 34px 32px 1fr auto; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 14px; min-width: 0; }
.me-bar .row .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.me-bar .rk { text-align: center; font-weight: 800; }
.me-bar .g1-nut { width: auto; flex: none; }

/* ---------- trang Sắp có / Hồ sơ ---------- */
.soon-page { display: grid; place-items: center; text-align: center; padding: 48px 16px; gap: 6px; }
.soon-page .big { width: 96px; height: 96px; display: grid; place-items: center; border-radius: 28px; background: linear-gradient(180deg, #ffb21a, #fd6500); border: 3px solid var(--ink); box-shadow: 0 6px 0 var(--ink); }
.soon-page .big svg { width: 58px; height: 58px; }
.soon-page h1 { margin: 14px 0 0; font-size: 28px; font-weight: 800; }
.soon-page p { margin: 0; color: var(--text-2); font-weight: 600; }
.panel { max-width: 520px; margin: 8px auto 0; padding: 14px; border-radius: var(--radius); background: rgba(255, 255, 255, .07); border: 2px solid var(--line); }
.panel h2 { margin: 0 0 10px; font-size: 18px; font-weight: 800; }
/* hộp thư (Hồ sơ): tin hoàn vé, giải tuần */
.inbox { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.inbox li { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: start; padding: 10px; border-radius: 14px; background: rgba(0, 12, 73, .3); border: 2px solid transparent; }
.inbox li.unread { border-color: var(--yellow); }
.inbox li.muted { display: block; color: var(--text-2); font-weight: 600; background: none; padding: 4px 0; }
.inbox .ib-ico, .inbox .ib-img { width: 44px; height: 44px; display: block; object-fit: contain; }
.inbox .ib-txt { min-width: 0; }
.inbox b { display: block; font-size: 15px; }
.inbox p { margin: 2px 0; font-size: 13px; color: var(--text-2); font-weight: 600; }
.inbox small { font-size: 11px; color: var(--text-2); }
.langs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lang-btn { padding: 10px 12px 8px; border-radius: 14px; font-weight: 800; text-align: left; background: rgba(0, 12, 73, .35); border: 2px solid transparent; }
.lang-btn[aria-pressed="true"] { border-color: var(--cyan); background: rgba(1, 232, 253, .15); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; font-weight: 700; }
/* công tắc: nút thật 60×44 (vùng chạm đủ 44, kiểm định vòng 6, T-3); hình rãnh 56×32 vẽ bằng ::before, núm bằng ::after */
.switch { width: 60px; height: 44px; padding: 0; position: relative; background: none; border: 0; flex: none; }
.switch::before { content: ''; position: absolute; left: 2px; top: 6px; width: 56px; height: 32px; box-sizing: border-box; border-radius: 999px; background: #3a4a85; border: 2px solid var(--ink); transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 10px; left: 6px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch[aria-checked="true"]::before { background: #22c55e; }
.switch[aria-checked="true"]::after { left: 30px; }

/* ---------- hộp thoại (mua vé, xác nhận): khung g1-hop của bộ giao diện chung, nền sáng chữ tối ---------- */
.sheet-back {
  position: fixed; inset: 0; z-index: 90; background: rgba(0, 6, 40, .66);
  display: flex; align-items: center; justify-content: center;
  padding: calc(12px + var(--safe-t, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(12px + var(--safe-b)) max(16px, env(safe-area-inset-left, 0px));
  animation: fade .18s;
}
.sheet { width: 100%; max-width: 440px; animation: pop-in .3s cubic-bezier(.2, 1.4, .4, 1); --hop-chu: #0b1a5c; --hop-chu-2: #3a4a86; --hop-cam: #c25400; }
/* tiêu đề dài (5 thứ tiếng) được xuống 2 dòng trong dải xanh thay vì bị cắt */
.sheet .g1-hop__tieu-de { white-space: normal; text-align: center; line-height: 1.05; font-size: clamp(18px, 5.6vw, 24px); }
.sheet .hop-body { max-height: calc(88vh - 120px); overflow: auto; overscroll-behavior: contain; padding: 2px; margin: -2px; }
.sheet .sub { text-align: center; margin: 2px 0 14px; color: var(--hop-chu-2); font-weight: 700; }
.sheet .actions { display: grid; gap: 10px; margin-top: 16px; }
.sheet .note { margin: 14px 0 0; padding: 8px 12px; border-radius: 12px; background: #fff3b0; color: #6a4b00; font-size: 13px; font-weight: 700; }
.sheet .play-cover { width: 120px; margin: 4px auto 10px; }
.packs { display: grid; gap: 10px; padding-top: 6px; }
.pack {
  position: relative;
  display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 10px;
  padding: 8px 12px 8px 8px; border-radius: 16px; text-align: left; color: var(--hop-chu);
  background: #dfe9ff; border: 3px solid #b9cbf5;
}
.pack[aria-pressed="true"] { border-color: #f5a400; background: #fff3c4; }
.pack[disabled] { opacity: .55; cursor: default; }
/* tắt bán vé (QĐ-31) */
.sheet .paused-note { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: #ffe1d6; border: 2px solid var(--red); color: #7a1c00; font-weight: 800; text-align: center; }
/* đơn đã mua, dưới màn mua vé */
.orders { margin-top: 14px; font-size: 14px; color: var(--hop-chu); }
.orders summary { min-height: 44px; display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--hop-chu-2); cursor: pointer; }
.orders ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.orders li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 8px 12px; border-radius: 12px; background: #e6eeff; }
.orders .o-what { font-weight: 800; }
.orders .o-price { font-weight: 800; color: var(--hop-cam); }
.orders .o-meta { grid-column: 1 / -1; font-size: 11px; color: var(--hop-chu-2); overflow-wrap: anywhere; }
.pack .pk-ico { width: 52px; height: 52px; display: grid; place-items: center; }
.pack .pk-n { font-size: 20px; font-weight: 800; }
.pack .pk-price { font-size: 18px; font-weight: 800; color: var(--hop-cam); display: grid; justify-items: end; line-height: 1.1; }
.pack .pk-price small { font-size: 11px; font-weight: 700; color: var(--hop-chu-2); }
@keyframes pop-in { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.pack .best { position: absolute; top: -10px; right: 12px; padding: 1px 8px 0; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--red); color: #fff; border: 2px solid var(--ink); }
@keyframes rise { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- thông báo ngắn ---------- */
#toast-root { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); z-index: 95; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
/* đang trong game: thông báo lên đầu màn, không đè nút «Về trang game» ở cuối màn kết quả của game */
body.in-game #toast-root { top: calc(env(safe-area-inset-top, 0px) + 64px); bottom: auto !important; }
.toast { max-width: 440px; padding: 10px 16px 8px; border-radius: 16px; background: #fff; color: var(--ink); font-weight: 700; box-shadow: 0 5px 0 var(--ink); border: 3px solid var(--ink); animation: rise .25s cubic-bezier(.2, 1.4, .4, 1); }

/* ---------- khung chờ ---------- */
.skel { background: linear-gradient(90deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .14), rgba(255, 255, 255, .06)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; border-radius: 14px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.error-box { text-align: center; padding: 40px 16px; display: grid; gap: 14px; justify-items: center; color: var(--text-2); font-weight: 700; }
.error-box .g1-nut { width: auto; }

/* ---------- màn tải game ---------- */
.loader {
  position: fixed; inset: 0; z-index: 80; overflow: hidden auto;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding-block: calc(12px + env(safe-area-inset-top, 0px)) calc(20px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--bg-0); animation: fade .2s;
}
.ld-bg { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(28px) saturate(1.2) brightness(.45); transform: scale(1.1); z-index: 0; }
.loader > *:not(.ld-bg) { position: relative; z-index: 1; }
.ld-top { width: 100%; max-width: 520px; display: grid; grid-template-columns: 40px 64px 1fr; gap: 12px; align-items: center; }
.ld-close { flex: none; --d: 44px; }
.ld-thumb { width: 64px; border-width: 2px; border-radius: 12px; box-shadow: 0 3px 0 var(--ink); }
.ld-txt { min-width: 0; }
.ld-txt h2 { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.1; }
.ld-txt .ld-logo-chu img { display: block; height: 60px; width: auto; max-width: 100%; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .4)); }
.ld-txt p { margin: 2px 0 0; font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ld-stage { flex: 1; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; }
.ld-char { width: min(46vw, 190px); height: auto; margin-bottom: -26px; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .35)); animation: bob 1.6s ease-in-out infinite; z-index: 2; }
.ld-logo { position: relative; width: min(66vw, 260px); }
.ld-logo img { display: block; width: 100%; height: auto; }
.ld-gray { filter: grayscale(1) brightness(1.35) contrast(.7); opacity: .85; }
.ld-color { position: absolute; inset: 0; }
.ld-logo.bounce { animation: logo-bounce .7s cubic-bezier(.3, 1.6, .5, 1); }
.ld-pct { margin-top: 8px; font-size: 15px; font-weight: 800; color: var(--yellow); font-variant-numeric: tabular-nums; }
.ld-status { font-size: 13px; font-weight: 700; color: var(--text-2); min-height: 1.3em; text-align: center; }
.loader.done .ld-pct { display: none; }
.loader.done .ld-status { font-size: 20px; color: #fff; }
.loader.failed .ld-status { color: #ffd0c4; max-width: 300px; }
.ld-foot { width: 100%; max-width: 420px; display: grid; gap: 10px; min-height: 64px; }
.ld-foot .g1-nut { animation: rise .35s cubic-bezier(.2, 1.4, .4, 1); }
.ld-have { margin: 0; text-align: center; font-size: 13px; font-weight: 600; color: var(--text-2); }
.loader > .ld-frames { position: fixed; inset: 0; z-index: 5; visibility: hidden; pointer-events: none; }
.loader > .ld-frames.show { visibility: visible; pointer-events: auto; background: #000; }
.game-frame { width: 100%; height: 100%; border: 0; display: block; }
.game-back { position: absolute; top: calc(8px + env(safe-area-inset-top, 0px)); left: calc(8px + env(safe-area-inset-left, 0px)); --d: 44px; }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
@keyframes logo-bounce { 0% { scale: 1; } 35% { scale: 1.14; } 60% { scale: .95; } 80% { scale: 1.03; } 100% { scale: 1; } }

/* lớp chứa đoạn intro (do intro.js vẽ vào) */
.intro-root { position: fixed; inset: 0; z-index: 100; background: var(--bg-0); }

/* ---------- máy tính: lưới nhiều cột, thanh trái ---------- */
@media (min-width: 960px) {
  :root { --tabbar-h: 0px; }
  .app { display: grid; grid-template-columns: 220px 1fr; grid-template-rows: auto 1fr; }
  .topbar { grid-column: 1 / -1; padding-block: 10px; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); gap: 14px; }
  .logo { height: 48px; }
  .tabbar {
    position: sticky; top: calc(74px + env(safe-area-inset-top, 0px)); bottom: auto; left: auto; right: auto;
    align-self: start; height: auto; padding: 16px 12px;
    display: flex; flex-direction: column; gap: 4px;
    background: none; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .tab { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 8px 12px; border-radius: 16px; font-size: 17px; }
  .tab:hover { background: rgba(255, 255, 255, .07); color: #fff; }
  .tab[aria-current="page"] { background: rgba(255, 255, 255, .1); }
  .tab[aria-current="page"] .ico { transform: none; }
  .view { padding-block: 20px 48px; padding-left: 28px; padding-right: max(28px, env(safe-area-inset-right, 0px)); }
  .week { grid-template-columns: auto auto auto 1fr; grid-template-rows: auto; gap: 0 16px; padding: 10px 18px; }
  .week .trophy { grid-row: auto; width: 56px; height: 56px; }
  .week .w-top { flex-direction: column; align-items: flex-start; gap: 0; }
  .week .w-title { font-size: 26px; }
  .prizes { grid-column: 1 / -1; }
  /* băng rộng: ảnh nền giữ tỉ lệ, sát trái (cúp nằm trọn), phần phải tô cam nối màu ảnh */
  /* băng rộng: ảnh chỉ phủ phần trái (cúp nằm trọn), mép phải mờ dần vào nền cam */
  .week.has-bg { min-height: 132px; }
  .week.has-bg::before { right: auto; width: 420px; -webkit-mask-image: linear-gradient(90deg, #000 65%, transparent); mask-image: linear-gradient(90deg, #000 65%, transparent); }
  .week .trophy-space { width: 150px; height: 100px; }
  .checkin { max-width: 640px; }
  .week .my-rank { grid-column: auto; justify-self: end; margin: 0; padding: 8px 12px 8px 16px; font-size: 16px; }
  .countdown .box { font-size: 22px; min-width: 42px; }
  .section-head { margin-top: 14px; }
  .section-head h2 { font-size: 26px; }
  .games { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; }
  .game { grid-template-columns: 1fr; padding: 12px 12px 16px; }
  .game .right { gap: 8px; }
  .g-name { font-size: 21px; }
  .g-plays { font-size: 14px; }
  .game:not(.soon):hover { transform: translateY(-4px); transition: transform .15s; }
  .game:not(.soon):hover .cover img { transform: scale(1.04); transition: transform .3s; }
  .rank-wrap { max-width: 760px; }
  .me-bar { left: 220px; bottom: 0; padding-left: 28px; padding-right: 28px; }
  .me-bar .wrap { margin: 0; max-width: 760px; }
  #toast-root { bottom: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* tài khoản, hồ sơ, văn bản pháp lý, cửa hàng (bản chạy máy chủ thật) */
.account-card{display:grid;gap:8px;margin-bottom:14px}
.account-card h2{margin:0}
.account-card p{margin:0}
.account-card .g1-nut{justify-self:start;text-decoration:none}
.me-panel{display:flex;align-items:center;gap:12px}
.me-panel>div{flex:1;min-width:0}
.me-panel strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.me-panel p{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;opacity:.75}
.me-panel .g1-nut{text-decoration:none}
.legal ul{list-style:none;margin:0;padding:0;display:grid;gap:8px}
.legal a{color:inherit;font-weight:700}
.shop-panel{display:grid;gap:10px}
.shop-panel p{margin:0}
.ld-foot a.g1-nut{text-decoration:none}
