/* TikGame — nền tối, đen chủ đạo (theo màn chính TikTok Studio; bộ thiết kế v5 đã duyệt 11/11). */
:root {
  --bg: #161616; --bg-top: #1e1e1e; --card: #232323; --card-2: #2b2b2b; --line: #393939; --line-2: #2f2f2f;
  --text: #fff; --muted: #8a8b91; --soft: #c9c9cf;
  --accent: #fe2c55; --accent-ink: #fff; --accent-soft: rgba(254, 44, 85, .16);
  --green: #2bd46b; --green-soft: rgba(43, 212, 107, .14); --blue: #3aa0ff; --warn: #ffb547;
  --r: 8px; --r-chip: 6px; --r-lg: 12px;
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.5 var(--font); min-height: 100vh; }
body.app { background: linear-gradient(180deg, var(--bg-top) 0, var(--bg) 280px); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; }
p { margin: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.link { color: var(--accent); font-weight: 600; }

/* Logo: chấm đỏ hồng có 2 vòng sóng + chữ trắng đậm */
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 22px; letter-spacing: -.02em; }
.logo svg { width: 34px; height: 22px; flex: none; }
.logo small { font-weight: 500; font-size: 13px; color: var(--muted); letter-spacing: 0; }

/* Nút */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--r);
  border: 1px solid transparent; font: 700 15px/1 var(--font); cursor: pointer; white-space: nowrap; transition: filter .15s, background .15s; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-secondary { background: var(--card-2); color: var(--text); border-color: var(--line); }
.btn-light { background: #fafafa; color: #111; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-lg { min-height: 52px; font-size: 17px; padding: 0 24px; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: var(--r-chip); }
.btn-block { width: 100%; }

/* Thẻ, chip, ô nhập */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.card-pad { padding: 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 10px; border-radius: var(--r-chip); background: var(--card-2);
  color: var(--soft); font-weight: 600; font-size: 13px; border: 1px solid var(--line-2); white-space: nowrap; }
.chip-on { background: var(--green-soft); color: var(--green); border-color: transparent; }
.chip-on::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.chip-accent { background: var(--accent-soft); color: #ff6f8c; border-color: transparent; }
.chip-warn { background: rgba(255, 181, 71, .12); color: var(--warn); border-color: transparent; }
.chip-err { background: var(--accent-soft); color: #ff6f8c; border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { min-height: 40px; padding: 0 14px; border-radius: var(--r-chip); background: var(--card-2); color: var(--soft); border: 1px solid var(--line);
  font: 600 14px/1 var(--font); cursor: pointer; }
.pick.on { background: #fafafa; color: #111; border-color: #fafafa; }
.pick:disabled { opacity: .4; cursor: not-allowed; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 700; font-size: 14px; }
.input { width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--card-2); color: var(--text);
  font: 500 16px var(--font); outline: none; }
.input:focus { border-color: #6b6b72; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); color: var(--soft); font-size: 14px; }
.note::before { content: 'i'; flex: none; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--muted); color: var(--muted);
  font: 700 12px/17px var(--font); text-align: center; }
.alert { padding: 12px 14px; border-radius: var(--r); background: var(--accent-soft); color: #ff8ea5; font-weight: 600; font-size: 14px; }
.ok-msg { padding: 12px 14px; border-radius: var(--r); background: var(--green-soft); color: var(--green); font-weight: 600; font-size: 14px; }
.divider { height: 1px; background: var(--line-2); margin: 4px 0; }
.toggle { position: relative; width: 52px; height: 30px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle span { position: absolute; inset: 0; border-radius: 15px; background: #3a3a3a; transition: background .15s; cursor: pointer; }
.toggle span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { transform: translateX(22px); }
.tabs { display: flex; border-bottom: 1px solid var(--line-2); overflow-x: auto; scrollbar-width: none; }
.tabs a { flex: 1; text-align: center; padding: 12px 10px; color: var(--muted); font-weight: 700; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--text); border-bottom-color: var(--text); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg button { background: none; border: 0; color: var(--muted); font: 700 15px var(--font); padding: 13px 8px; cursor: pointer; border-bottom: 3px solid transparent; }
.seg button.on { color: var(--text); border-bottom-color: var(--text); background: var(--card-2); }

/* Khung ứng dụng (điện thoại trước, máy tính thì giữa màn) */
.shell { max-width: 560px; margin: 0 auto; padding: 16px 16px 96px; display: grid; gap: 16px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--card-2); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 800; color: var(--soft); }
.page-title { font-size: 34px; }
.back { display: inline-flex; align-items: center; gap: 10px; }
.back svg { width: 26px; height: 26px; }
.sub { color: var(--muted); font-size: 15px; margin-top: 2px; }
.nav { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(18, 18, 18, .96); border-top: 1px solid var(--line-2); backdrop-filter: blur(10px);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); z-index: 20; }
.nav div { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
.nav a { display: grid; justify-items: center; gap: 2px; color: var(--muted); font-size: 12px; font-weight: 600; }
.nav a svg { width: 26px; height: 26px; }
.nav a.on { color: var(--text); }
.bottom-cta { position: sticky; bottom: 76px; z-index: 5; }

/* Thẻ số dư */
.balance { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px; background: #242424; border: 1px solid var(--line); border-radius: var(--r); }
.balance .amt { font-size: 38px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.balance .lbl { font-weight: 700; color: var(--soft); }

/* Thẻ phòng */
.room { display: grid; gap: 14px; padding: 14px; }
.room-head { display: grid; grid-template-columns: 112px 1fr; gap: 14px; align-items: center; }
.room-head img, .thumb { width: 112px; height: 112px; object-fit: cover; border-radius: var(--r); }
.room-head h3 { font-size: 22px; }
.room-meta { display: grid; gap: 8px; justify-items: start; }

/* Bước mở phòng */
.steps { display: flex; align-items: center; gap: 8px; }
.steps .s { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--muted); white-space: nowrap; font-size: 14px; }
.steps .s i { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); font-style: normal; color: var(--soft); }
.steps .s.on { color: var(--text); }
.steps .s.on i { background: var(--accent); color: #fff; }
.steps .s.done i { background: var(--card-2); color: var(--text); }
.steps .bar { flex: 1; height: 1px; background: var(--line); min-width: 12px; }
.gcard { position: relative; overflow: hidden; padding: 0; cursor: pointer; text-align: left; color: inherit; font: inherit; width: 100%; }
.gcard img { width: 100%; height: 190px; object-fit: cover; object-position: center 35%; }
.gcard .gbody { padding: 14px 16px 16px; display: grid; gap: 8px; }
.gcard .gtitle { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gcard .gtitle h3 { font-size: 22px; }
.gcard.sel { border: 2px solid var(--accent); }
.gcard.sel::after { content: ''; position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center/20px no-repeat; }
.gcard.full img { filter: brightness(.45) saturate(.6); }
.gcard.full { cursor: default; }
.linkbox { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; }
.linkbox code { flex: 1; font: 600 16px/1.3 var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.howto { display: grid; }
.howto li { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-2); font-weight: 600; }
.howto li:last-child { border-bottom: 0; }
.howto li b { width: 36px; height: 36px; border-radius: 50%; background: var(--card-2); display: grid; place-items: center; }
ol.howto { list-style: none; margin: 0; padding: 4px 16px; }

/* Cài đặt phòng */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.scenes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.scene { position: relative; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: var(--card-2); cursor: pointer; padding: 0; color: inherit; font: inherit; text-align: center; }
.scene img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.scene.blur img { filter: blur(6px) brightness(.7); }
.scene span { display: block; padding: 8px 4px; font-weight: 700; font-size: 13px; }
.scene.on { border: 2px solid var(--accent); }
.scene .soon { position: absolute; top: 8px; right: 8px; }
.scene:disabled { cursor: not-allowed; }
.scene:disabled span { color: var(--muted); }
.cmds { display: grid; }
.cmds div { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-2); align-items: center; }
.cmds div:last-child { border-bottom: 0; }

/* Ví */
.qr { display: grid; grid-template-columns: 140px 1fr; gap: 16px; align-items: center; }
.qr img { width: 140px; height: 140px; border-radius: var(--r); background: #fff; object-fit: contain; }
.hist { display: grid; }
.hist div { display: flex; justify-content: space-between; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line-2); }
.hist div:last-child { border-bottom: 0; }
.plus { color: var(--green); font-weight: 700; }
.minus { font-weight: 700; }

/* Trang công khai (máy tính) */
.site-head { position: sticky; top: 0; z-index: 30; background: rgba(22, 22, 22, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-2); }
.site-head .in { max-width: 1200px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 24px; }
.site-head nav { display: flex; gap: 6px; flex: 1; justify-content: center; }
.site-head nav a { padding: 8px 14px; font-weight: 700; color: var(--soft); border-bottom: 3px solid transparent; }
.site-head nav a.on { color: #fff; border-bottom-color: #fff; }
.site-head .acts { display: flex; gap: 10px; align-items: center; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 32px; align-items: center; padding: 56px 0 40px; }
.hero .eyebrow { color: var(--muted); font-size: 20px; font-weight: 500; }
.hero h1 { font-size: 54px; margin: 14px 0; }
.hero .lead { color: var(--muted); font-size: 21px; }
.hero .cta { display: flex; gap: 14px; margin: 28px 0 16px; flex-wrap: wrap; }
.phones { position: relative; height: 520px; }
.phone { position: absolute; width: 250px; aspect-ratio: 9 / 18.5; border-radius: 36px; border: 6px solid #3a3a3a; background: #000; overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.phone img { width: 100%; height: 100%; object-fit: cover; }
.phone.p1 { left: 4%; top: 20px; transform: rotate(-4deg); }
.phone.p2 { right: 4%; top: 0; transform: rotate(5deg); }
.bubble { position: absolute; background: #1f1f1f; border: 1px solid #4a4a4a; border-radius: 22px; padding: 10px 18px; font-weight: 700; font-size: 20px; z-index: 2; }
.section { padding: 40px 0; }
.section h2 { font-size: 32px; margin-bottom: 20px; }
.games { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.game-tile { overflow: hidden; display: grid; }
.game-tile .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; }
.game-tile .top h3 { font-size: 24px; }
.game-tile img { width: 100%; height: 260px; object-fit: cover; }
.game-tile .bot { padding: 16px 18px; display: grid; gap: 12px; }
.game-tile.soon .ph { height: 260px; background: linear-gradient(160deg, #262626, #1b1b1b); }
.steps3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.steps3 .card { padding: 20px; display: grid; gap: 10px; }
.steps3 .n { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; font-weight: 800; }
.faq details { border-bottom: 1px solid var(--line-2); padding: 16px 0; }
.faq summary { font-weight: 700; font-size: 17px; cursor: pointer; }
.faq p { color: var(--soft); margin-top: 10px; }
.foot { border-top: 1px solid var(--line-2); padding: 28px 0 40px; color: var(--muted); font-size: 14px; margin-top: 30px; }
.game-hero { display: grid; grid-template-columns: 1fr 340px; gap: 32px; padding: 32px 0; align-items: start; }
.game-hero .card { padding: 28px; display: grid; gap: 16px; }
.game-hero h1 { font-size: 52px; }
.game-hero .price { font-size: 40px; font-weight: 800; }
.game-hero .price small { font-size: 24px; }
.cmd-table { overflow: hidden; }
.cmd-table div { display: grid; grid-template-columns: 300px 1fr; gap: 20px; padding: 12px 20px; border-bottom: 1px solid var(--line-2); align-items: center; }
.cmd-table div:last-child { border-bottom: 0; }
.cmd-table .chip { font-size: 15px; min-height: 34px; color: #fff; }
.auth { max-width: 420px; margin: 40px auto; padding: 0 16px; display: grid; gap: 18px; }

/* Quản trị */
.admin { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.admin aside { border-right: 1px solid var(--line-2); padding: 24px 14px; display: grid; align-content: start; gap: 8px; }
.admin aside a { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--r); border: 1px solid var(--line); font-weight: 600; }
.admin aside a.logo { border: 0; padding: 4px 6px 0; }
.admin aside .logo small { white-space: nowrap; }
.admin aside a.on { background: var(--card-2); font-weight: 800; }
.admin main { padding: 32px; display: grid; gap: 20px; align-content: start; }
.admin h1 { font-size: 40px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-weight: 800; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.tbl td { padding: 14px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.stepper { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.stepper button { width: 40px; height: 38px; background: var(--card-2); color: #fff; border: 0; font-size: 20px; cursor: pointer; }
.stepper span { min-width: 52px; display: grid; place-items: center; font-weight: 800; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stats .card { padding: 18px; display: grid; gap: 4px; }
.stats b { font-size: 30px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: #fafafa; color: #111; padding: 12px 18px; border-radius: var(--r); font-weight: 700; z-index: 99; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }

@media (max-width: 900px) {
  .site-head nav { display: none; }
  .hero { grid-template-columns: 1fr; padding-top: 28px; }
  .hero h1 { font-size: 36px; }
  .hero .lead { font-size: 17px; }
  .phones { height: 430px; }
  .phone { width: 200px; }
  .games, .steps3 { grid-template-columns: 1fr; }
  .game-hero { grid-template-columns: 1fr; }
  .game-hero h1 { font-size: 38px; }
  .cmd-table div { grid-template-columns: 1fr; gap: 6px; }
  .admin { grid-template-columns: 1fr; }
  .admin aside { grid-auto-flow: column; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line-2); }
  .admin main { padding: 18px; }
  .stats, .grid2 { grid-template-columns: 1fr 1fr; }
  .tbl { font-size: 14px; }
}
@media (max-width: 420px) {
  .page-title { font-size: 30px; }
  .balance .amt { font-size: 32px; }
  .room-head { grid-template-columns: 92px 1fr; }
  .room-head img { width: 92px; height: 92px; }
  .qr { grid-template-columns: 110px 1fr; }
  .qr img { width: 110px; height: 110px; }
  .steps .s span { display: none; }
  .steps .s.on span { display: inline; }
}
