/* AppTrending.buzz — design system "Data-Dense Dashboard" (ui-ux-pro-max):
   xanh dương chủ đạo + hổ phách nhấn, Fira Sans (chữ) / Fira Code (số), sáng & tối. */
@import url('/fonts/fonts.css');

:root {
  color-scheme: light;
  /* bề mặt & chữ */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e9eef6;
  --border: #e2e8f0;
  --grid: #eef2f7;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #56657a;
  /* thương hiệu */
  --accent: #003ff7;          /* primary = màu xanh của logo AppTrending */
  --accent-hover: #0033cc;
  --accent-soft: #e0e9ff;
  --on-accent: #ffffff;
  --hl: #d97706;              /* hổ phách: chỉ dùng tô nền/viền */
  --hl-text: #b45309;         /* hổ phách: dùng cho chữ (5:1) */
  --hl-soft: #fef3c7;
  --focus: #003ff7;
  /* trạng thái */
  --good: #15803d;
  --bad: #b91c1c;
  --new: #b45309;
  /* dữ liệu (bảng màu đã kiểm tra mù màu) */
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --others: #cbd5e1;
  --shadow: 0 1px 2px rgb(15 23 42 / .06), 0 1px 3px rgb(15 23 42 / .08);
  --shadow-lg: 0 12px 32px rgb(15 23 42 / .18);
  --radius: 12px;
  --mono: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Fira Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0b1120; --surface: #111827; --surface-2: #1e293b; --surface-3: #263449; --border: #273449; --grid: #1c2638;
    --text: #e2e8f0; --text-2: #cbd5e1; --muted: #94a3b8;
    --accent: #6b93ff; --accent-hover: #8dacff; --accent-soft: rgb(107 147 255 / .16); --on-accent: #0b1120;
    --hl: #f59e0b; --hl-text: #fbbf24; --hl-soft: rgb(245 158 11 / .16); --focus: #6b93ff;
    --good: #4ade80; --bad: #f87171; --new: #fbbf24;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #0ca30c; --series-7: #9085e9; --series-8: #e66767; --others: #475569;
    --shadow: 0 1px 2px rgb(0 0 0 / .4); --shadow-lg: 0 12px 40px rgb(0 0 0 / .55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120; --surface: #111827; --surface-2: #1e293b; --surface-3: #263449; --border: #273449; --grid: #1c2638;
  --text: #e2e8f0; --text-2: #cbd5e1; --muted: #94a3b8;
  --accent: #6b93ff; --accent-hover: #8dacff; --accent-soft: rgb(107 147 255 / .16); --on-accent: #0b1120;
  --hl: #f59e0b; --hl-text: #fbbf24; --hl-soft: rgb(245 158 11 / .16); --focus: #6b93ff;
  --good: #4ade80; --bad: #f87171; --new: #fbbf24;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #0ca30c; --series-7: #9085e9; --series-8: #e66767; --others: #475569;
  --shadow: 0 1px 2px rgb(0 0 0 / .4); --shadow-lg: 0 12px 40px rgb(0 0 0 / .55);
}

/* ---------- nền tảng ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.ico { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.num, th.num, td.num, .kv b, .dl-total, .score, .idx, .when { font-family: var(--mono); font-variant-numeric: tabular-nums; }
code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 24px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; flex: none; }
.logo svg { width: 20px; height: 20px; }
h1 { font-family: var(--mono); font-size: 16px; font-weight: 600; margin: 0; letter-spacing: -.01em; white-space: nowrap; }
h1 span { color: var(--muted); font-weight: 500; }
.status { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 13px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); flex: none; }
.pill.busy .dot { background: var(--hl); }

/* ---------- nút ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 12px; cursor: pointer; color: var(--text); font-weight: 500; text-decoration: none; line-height: 1.35;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease; }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--surface-2); color: var(--text); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.icon { padding: 6px; }
.btn.primary, .btn.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.primary:hover, .btn.on:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn.google { background: var(--surface); }

main { max-width: 1320px; margin: 0 auto; padding: 18px 24px 48px; }

.banner { display: flex; gap: 10px; align-items: flex-start; background: var(--hl-soft); border: 1px solid color-mix(in srgb, var(--hl) 35%, var(--border));
  border-left: 4px solid var(--hl); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; color: var(--text); font-size: 13.5px; }

/* ---------- bộ lọc ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin-bottom: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.fgroup { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fgroup > .flabel { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.fgroup.grow { flex: 1 1 220px; }
.seg { display: inline-flex; align-items: stretch; height: 36px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 2px; }
.seg button { border: 0; background: none; padding: 0 11px; border-radius: 7px; cursor: pointer; color: var(--text-2); white-space: nowrap; font-weight: 500;
  transition: background-color .15s ease, color .15s ease; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); font-weight: 600; }
select, input[type=search], .watch-add input { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; height: 36px;
  transition: border-color .15s ease, box-shadow .15s ease; }
select { cursor: pointer; }
select:hover, input[type=search]:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
select#region { width: 230px; max-width: 100%; font-weight: 600; color: var(--accent); }
.search { position: relative; }
.search .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { width: 100%; padding-left: 32px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; box-shadow: inset 0 -1px 0 var(--border); overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tabs button { display: inline-flex; align-items: center; gap: 7px; background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 10px 12px; cursor: pointer; color: var(--text-2); white-space: nowrap; font-weight: 500; border-radius: 8px 8px 0 0;
  transition: color .15s ease, background-color .15s ease, border-color .15s ease; }
.tabs button:hover { color: var(--text); background: var(--surface-2); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.subbar { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; }
.subbar .chipbar { flex: 1; margin-top: 0; }
.subbar .help-btn { margin-left: auto; color: var(--muted); }
.btn.ghost { background: none; border-color: transparent; }
.btn.ghost:hover, .btn.ghost[aria-expanded="true"] { background: var(--surface-2); border-color: var(--border); color: var(--accent); }
.help-pop { margin: 8px 0 0; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 10px; color: var(--text-2); font-size: 13px; box-shadow: var(--shadow); max-width: 980px; }
#content { margin-top: 12px; }

/* ---------- chip ---------- */
.chipbar { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.chip { display: inline-flex; align-items: center; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); white-space: nowrap; font-weight: 500; }
button.chip { cursor: pointer; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
button.chip:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); color: var(--text); }
button.chip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
button.chip.more { background: none; border-style: dashed; }

/* ---------- bảng ---------- */
.tablewrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--grid); vertical-align: middle; }
th { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2);
  position: sticky; top: 0; z-index: 1; font-family: var(--sans); }
th.num, td.num { text-align: right; }
tbody tr { cursor: pointer; transition: background-color .15s ease; }
tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
tbody tr:last-child td { border-bottom: 0; }
td.num { font-size: 13px; white-space: nowrap; }
td .chip { display: inline-block; max-width: 110px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.idx { color: var(--muted); width: 32px; font-size: 12.5px; }
.app { display: flex; align-items: center; gap: 12px; min-width: 230px; }
.app img { width: 42px; height: 42px; border-radius: 11px; background: var(--surface-2); flex: none; box-shadow: 0 0 0 1px var(--border); }
.app .nm { font-weight: 600; max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app .dev { color: var(--muted); font-size: 12.5px; max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store { display: inline-block; font-family: var(--mono); font-size: 10px; font-weight: 600; padding: 0 5px; border-radius: 4px; border: 1px solid var(--border);
  color: var(--text-2); background: var(--surface-2); margin-right: 6px; vertical-align: 1px; line-height: 16px; }
.up { color: var(--good); font-weight: 600; }
.down { color: var(--bad); font-weight: 600; }
.newtag { display: inline-block; color: var(--hl-text); background: var(--hl-soft); border-radius: 4px; padding: 0 6px; font-weight: 700; font-size: 11px; font-family: var(--sans); letter-spacing: .02em; }
.sub { color: var(--muted); font-size: 12px; }
td.num .sub { font-size: 11.5px; }
.score { font-weight: 600; color: var(--accent); }
.spark { display: block; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }

/* ---------- thể loại ---------- */
.gbar-row { display: grid; grid-template-columns: 150px 1fr 100px 70px 70px; gap: 12px; align-items: center; padding: 7px 16px; cursor: pointer; transition: background-color .15s ease; }
.gbar-row:hover { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.gbar-row > span:not(:first-child) { font-family: var(--mono); font-size: 13px; }
.gbar-track { height: 14px; position: relative; }
.gbar { height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.gbar-prev { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text-2); border-radius: 1px; }
.gbar-head { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; border-bottom: 1px solid var(--grid); cursor: default;
  background: var(--surface-2); padding-top: 9px; padding-bottom: 9px; }
.gbar-head:hover { background: var(--surface-2); }
.gbar-head > span { font-family: var(--sans) !important; font-size: 11px !important; }

/* ---------- trang chi tiết (drawer) ---------- */
.drawer { position: fixed; inset: 0; background: rgb(15 23 42 / .45); z-index: 20; display: flex; justify-content: flex-end; animation: fade .18s ease; }
.drawer-panel { width: min(760px, 100%); height: 100%; overflow-y: auto; background: var(--surface); padding: 22px 26px 44px; position: relative;
  box-shadow: var(--shadow-lg); animation: slide .22s ease; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(24px); opacity: .6; } }
.close { position: absolute; top: 16px; right: 16px; }
.dhead { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; padding-right: 44px; }
.dhead img { width: 68px; height: 68px; border-radius: 16px; box-shadow: 0 0 0 1px var(--border); }
.dhead h2 { margin: 0 0 2px; font-size: 19px; line-height: 1.3; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 12px 0 18px; }
.kv div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; }
.kv b { display: block; font-size: 16px; font-weight: 600; }
.kv span { font-size: 12px; color: var(--muted); }
/* Ô số liệu có màu theo nhóm: thông tin / đánh giá / số thật Google Play / ước tính / độ phủ */
.kv div[data-tone] { --tone: var(--muted); position: relative; padding: 10px 12px 10px 14px; overflow: hidden;
  background: color-mix(in srgb, var(--tone) 7%, var(--surface)); border-color: color-mix(in srgb, var(--tone) 24%, var(--border)); }
.kv div[data-tone]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--tone); opacity: .85; }
.kv div[data-tone] > .ico { position: absolute; top: 10px; right: 10px; width: 16px; height: 16px; color: var(--tone); opacity: .75; }
.kv div[data-tone] b { color: color-mix(in srgb, var(--tone) 55%, var(--text)); padding-right: 20px; }
.kv div[data-tone] b small { font-size: 12px; color: var(--muted); font-weight: 500; }
.kv div[data-tone="info"] { --tone: #64748b; }
.kv div[data-tone="info"] b { color: var(--text); }
.kv div[data-tone="rating"] { --tone: var(--series-4); }
.kv div[data-tone="real"] { --tone: var(--series-3); }
/* điểm đánh giá: màu theo mức độ hài lòng */
.kv div[data-level="great"] { --tone: var(--good); }
.kv div[data-level="good"] { --tone: var(--series-3); }
.kv div[data-level="ok"] { --tone: var(--series-4); }
.kv div[data-level="meh"] { --tone: var(--series-2); }
.kv div[data-level="bad"] { --tone: var(--bad); }
.kv div[data-level] b { color: color-mix(in srgb, var(--tone) 80%, var(--text)); }
.kv div[data-level] em.lv { display: block; font-style: normal; font-size: 12px; font-weight: 600; color: color-mix(in srgb, var(--tone) 75%, var(--text)); }
.kv div[data-tone="est"] { --tone: var(--accent); }
.kv div[data-tone="reach"] { --tone: var(--series-7); }
.kv div[data-tone="rev"] { --tone: var(--series-2); }
.kv div.kv-main { background: color-mix(in srgb, var(--tone) 13%, var(--surface)); }
.kv div.kv-main b { font-size: 18px; }
h3 { font-size: 14px; margin: 20px 0 8px; font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--text-2); margin: 4px 0 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.chart-svg text { fill: var(--muted); font-size: 11px; font-family: var(--mono); }
.ranktable td, .ranktable th { padding: 6px 10px; font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }

/* download theo quốc gia */
.dl-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 4px 0 16px; }
.dl-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.dl-title { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.dl-total { font-size: 24px; font-weight: 600; }
.dl-total small { font-family: var(--sans); font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.dl-period { display: flex; gap: 6px; margin-top: 6px; }
.dl-bar { display: flex; gap: 2px; height: 12px; border-radius: 4px; overflow: hidden; margin: 14px 0 8px; }
.dl-bar span { height: 100%; min-width: 3px; cursor: default; }
.dl-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--text-2); }
.dl-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.dl-legend b { color: var(--text); font-family: var(--mono); font-weight: 600; margin-right: 3px; }
.dl-note { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* ảnh & mô tả */
.media { margin: 0 0 16px; }
.media summary { cursor: pointer; font-weight: 600; font-size: 14px; padding: 6px 0; }
.shots { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x proximity; }
.shots a, .shots .shot { flex: none; scroll-snap-align: start; border-radius: 10px; }
.shots img { height: 300px; width: auto; max-width: 520px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); display: block; }
.desc { white-space: pre-line; font-size: 13.5px; line-height: 1.6; color: var(--text); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; max-height: 420px; overflow-y: auto; }

/* ---------- đăng nhập / watchlist ---------- */
.auth-box { display: inline-flex; align-items: center; gap: 8px; }
.auth-box img { width: 28px; height: 28px; border-radius: 50%; box-shadow: 0 0 0 1px var(--border); }
.auth-box .email { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-card { text-align: center; padding: 44px 20px; }
.login-card h3 { display: inline-flex; gap: 8px; align-items: center; font-size: 16px; }
.login-card p { color: var(--text-2); max-width: 520px; margin: 8px auto 18px; }
/* nút sao theo dõi */
.star { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; border: 1px solid transparent; background: none;
  color: var(--muted); cursor: pointer; flex: none; transition: color .15s ease, background-color .15s ease, border-color .15s ease; }
.star .ico { width: 18px; height: 18px; }
.star { color: var(--text-2); }
.star:hover { color: var(--hl-text); background: var(--surface-2); }
.star.on { color: var(--hl); }             /* đã theo dõi: sao tô đặc màu vàng */
.star.on:hover { background: var(--hl-soft); }
/* Nút theo dõi nhà phát hành: dạng "☆ NPH" để không nhầm với sao của game */
.star.dev { width: auto; height: 24px; padding: 0 8px 0 6px; gap: 4px; display: inline-flex; align-items: center; border: 1px solid var(--border);
  border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .03em; margin-left: 6px; color: var(--text-2); }
.star.dev .ico { width: 14px; height: 14px; }
.star.dev.on { color: var(--hl-text); border-color: var(--hl); background: var(--hl-soft); }
.star.dev.on .ico { color: var(--hl); }
.star.dev.sm { height: 22px; }
.dhead h2 .star.dev { height: 28px; font-size: 12px; }
.star.sm { width: 24px; height: 24px; border-radius: 6px; }
.star.sm .ico { width: 15px; height: 15px; }
td.star-cell { width: 40px; padding-right: 0; }
.dhead h2 { display: flex; align-items: center; gap: 6px; }
.dev-line { display: inline-flex; align-items: center; gap: 2px; }

/* popup đăng nhập */
.modal { position: fixed; inset: 0; z-index: 30; background: rgb(15 23 42 / .5); display: grid; place-items: center; padding: 16px; animation: fade .18s ease; }
.modal-card { position: relative; width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 28px 24px 20px; text-align: center; animation: pop .2s ease; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.modal-card h2 { font-family: var(--mono); font-size: 18px; font-weight: 600; margin: 12px 0 6px; }
.modal-card p { color: var(--text-2); margin: 0 0 18px; }
.modal-card .sub { margin: 16px 0 0; font-size: 12px; }
.modal-logo { width: 44px; height: 44px; border-radius: 12px; margin: 0 auto; }
.modal-logo svg { width: 26px; height: 26px; }
.btn.google.big { width: 100%; justify-content: center; padding: 10px 14px; font-size: 15px; }
.avatar-btn { padding: 2px; border-radius: 50%; }
.avatar-btn img, .avatar-ph { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-weight: 600; }
/* tên nhà phát hành bấm được */
.pub-link { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 2px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pub-link:hover { color: var(--accent); text-decoration-color: currentColor; }
.btn.back { margin: 0 0 12px; }
.rot90 { transform: rotate(90deg); }
.pub-avatar { width: 68px; height: 68px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.pub-avatar .ico { width: 32px; height: 32px; }
.pub-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 10px; }
.lang-btn { font-family: var(--mono); font-size: 12px; font-weight: 600; padding: 6px 9px; }
a.brand { text-decoration: none; color: inherit; border-radius: 10px; }
/* nút tài khoản + menu */
.acct { position: relative; }
.acct-btn { position: relative; display: grid; place-items: center; padding: 2px; border: 2px solid transparent; border-radius: 50%; background: none; cursor: pointer; transition: border-color .15s ease; }
.acct-btn:hover, .acct-btn[aria-expanded="true"] { border-color: var(--accent); }
.acct-btn img, .avatar-ph { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-weight: 600; object-fit: cover; flex: none; }
.avatar-ph { font-family: var(--sans); font-size: 15px; line-height: 1; }
.acc-user .avatar-ph { font-size: 19px; }
.acct-dot { position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--bad); color: #fff; font-family: var(--mono);
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; border: 2px solid var(--surface); box-sizing: content-box; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); width: 260px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 15; animation: pop .15s ease; }
.menu-head { display: flex; gap: 10px; align-items: center; padding: 10px; border-bottom: 1px solid var(--grid); margin-bottom: 4px; }
.menu-head img, .menu-head .avatar-ph { width: 38px; height: 38px; }
.menu-head b { display: block; font-size: 14px; }
.menu-head > div span { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer;
  color: var(--text); text-decoration: none; font-weight: 500; text-align: left; transition: background-color .15s ease; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); color: var(--text); }
.menu-item .ico { color: var(--muted); }
/* chọn giao diện */
.theme-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; max-width: 640px; }
.theme-opt { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 2px solid var(--border); border-radius: 12px;
  background: var(--surface); cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
.theme-opt:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.theme-opt.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-opt input { position: absolute; opacity: 0; pointer-events: none; }
.theme-opt:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.theme-name { font-weight: 600; }
.theme-prev { display: grid; grid-template-columns: 1fr 2fr; grid-template-rows: 1fr 1fr; gap: 5px; height: 76px; padding: 8px; border-radius: 8px; border: 1px solid var(--border); }
.theme-prev i { border-radius: 4px; }
.theme-prev i:first-child { grid-row: span 2; }
.theme-prev.light { background: #f8fafc; } .theme-prev.light i { background: #e2e8f0; } .theme-prev.light i:nth-child(2) { background: #003ff7; }
.theme-prev.dark { background: #0b1120; } .theme-prev.dark i { background: #1e293b; } .theme-prev.dark i:nth-child(2) { background: #6b93ff; }
.theme-prev.system { background: linear-gradient(135deg, #f8fafc 50%, #0b1120 50%); } .theme-prev.system i { background: #94a3b8; opacity: .6; } .theme-prev.system i:nth-child(2) { background: #003ff7; opacity: 1; }
.menu-item /* trang quản trị */
.adm-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.adm-head h2 { font-size: 20px; margin: 0; display: flex; align-items: center; gap: 8px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.tile span { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tile b { display: block; font-family: var(--mono); font-size: 24px; font-weight: 600; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.tile small { display: block; font-size: 12px; color: var(--text-2); }
.adm-chart { padding: 12px 14px; }
.adm-tools { margin: 0 0 10px; max-width: 360px; }
.adm-user { display: inline-flex; align-items: center; gap: 8px; }
.adm-user img, .adm-user .avatar-ph { width: 24px; height: 24px; font-size: 12px; border-radius: 50%; }
tbody.static tr { cursor: default; }
tbody.static tr:hover { background: none; }
.warn { color: var(--hl-text); font-weight: 600; }
.brand-h1 { margin: 0; line-height: 0; }
.brand-logo { height: 30px; width: auto; display: block; }
.brand-logo.dark { display: none; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .brand-logo.light { display: none; } :root:where(:not([data-theme="light"])) .brand-logo.dark { display: block; } }
:root[data-theme="dark"] .brand-logo.light { display: none; }
:root[data-theme="dark"] .brand-logo.dark { display: block; }
.modal-logo-img { width: 48px; height: 48px; display: block; margin: 0 auto; }
@media (max-width: 420px) { .brand-logo { height: 24px; } }
.badge { margin-left: auto; }

/* trang tài khoản */
.account { display: grid; grid-template-columns: 240px 1fr; gap: 20px; align-items: start; }
.acc-nav { position: sticky; top: 72px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.acc-user { display: flex; gap: 10px; align-items: center; padding: 4px 4px 14px; border-bottom: 1px solid var(--grid); margin-bottom: 8px; }
.acc-user img, .acc-user .avatar-ph { width: 44px; height: 44px; font-size: 18px; }
.acc-user b { display: block; }
.acc-user > div span { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.acc-nav .menu-item.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.acc-nav .menu-item.on .ico { color: var(--accent); }
.acc-nav hr { border: 0; border-top: 1px solid var(--grid); margin: 8px 0; }
.acc-main h2 { font-size: 20px; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.acc-main > .help { margin-top: 0; }
.back-link { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 14px; color: var(--text-2); text-decoration: none; font-weight: 500; }
.back-link:hover { color: var(--accent); }
.profile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.profile-row { display: grid; grid-template-columns: 200px 1fr; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--grid); align-items: center; }
.profile-row:last-child { border-bottom: 0; }
.profile-row > span:first-child { color: var(--muted); font-size: 13px; }
@media (max-width: 860px) {
  .account { grid-template-columns: 1fr; }
  .acc-nav { position: static; }
  .profile-row { grid-template-columns: 1fr; gap: 2px; }
}
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--bad); color: #fff; font-family: var(--mono); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }
.watch-add { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.watch-add input { flex: 1 1 320px; min-width: 0; padding: 8px 12px; }
.section-title { font-size: 15px; margin: 24px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title .ico { color: var(--accent); width: 18px; height: 18px; }
.ev { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--grid); cursor: pointer; transition: background-color .15s ease; }
.ev:hover { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.ev:last-child { border-bottom: 0; }
.ev img { width: 38px; height: 38px; border-radius: 10px; flex: none; background: var(--surface-2); box-shadow: 0 0 0 1px var(--border); }
.ev .what { flex: 1; min-width: 0; }
.ev .when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.tag { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 4px; white-space: nowrap; letter-spacing: .02em; }
.tag.new { background: var(--hl-soft); color: var(--hl-text); }
.tag.chart { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.tag.old { background: var(--surface-2); color: var(--text-2); }
.dev-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; box-shadow: var(--shadow); overflow: hidden; }
.dev-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; flex-wrap: wrap; transition: background-color .15s ease; }
.dev-head:hover { background: var(--surface-2); }
.dev-head .nm { font-weight: 600; flex: 1; min-width: 160px; }
.dev-head .chev { color: var(--muted); transition: transform .2s ease; }
.dev-card.open .chev { transform: rotate(180deg); }
.dev-body { border-top: 1px solid var(--grid); }
.msg { font-size: 13px; margin: 4px 2px; }
.msg.err { color: var(--bad); }
.msg.ok { color: var(--good); }

/* ---------- tooltip & chân trang ---------- */
.tooltip { position: fixed; z-index: 40; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; max-width: 280px; }
.tooltip .t { color: var(--muted); font-size: 11.5px; margin-bottom: 3px; }
.tooltip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.tooltip b { font-family: var(--mono); }
.site-foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 0 16px 28px; }
.site-foot a { color: var(--text-2); }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .fgroup.grow { flex-basis: 100%; }
}
@media (max-width: 760px) {
  .top { padding: 8px 16px; }
  h1 span { display: none; }
  main { padding: 12px 16px 36px; }
  .filters { padding: 10px 12px; gap: 10px 12px; }
  .hide-sm { display: none; }
  .app { min-width: 0; }
  .app .nm, .app .dev { max-width: 170px; }
  th, td { padding: 8px 8px; }
  .gbar-row { grid-template-columns: 96px 1fr 72px; padding: 7px 12px; }
  .gbar-row .hide-sm { display: none; }
  .auth-box .email { display: none; }
  .shots img { height: 220px; }
  .drawer-panel { padding: 18px 16px 36px; }
}
@media (max-width: 420px) {
  .status .pill .txt { display: none; }
  .seg button { padding: 5px 9px; }
}

/* Tôn trọng cài đặt giảm chuyển động */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* nút NPH luôn đủ rộng cho chữ (ghi đè kích thước của sao nhỏ) */
.star.dev, .star.dev.sm { width: auto; min-width: 0; }
/* bảng trong khung bên phải: ẩn bớt cột cho vừa */
.drawer .hide-drawer { display: none; }
.drawer .app { min-width: 0; }
.drawer .app .nm, .drawer .app .dev { max-width: 230px; }
.drawer th, .drawer td { padding: 8px 8px; }
.drawer .app .nm, .drawer .app .dev { max-width: 210px; }
.acc-main h2 + .help { margin-top: -8px; }

/* nội dung render sẵn trên server (trước khi JavaScript vẽ dashboard) */
.seo-ssr h2 { font-size: 18px; margin: 4px 0 6px; }
.seo-ssr p { color: var(--text-2); max-width: 900px; }
.seo-ssr .seo-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-size: 13.5px; }
.seo-ssr .seo-table th, .seo-ssr .seo-table td { padding: 8px 10px; border-bottom: 1px solid var(--grid); text-align: left; }
.seo-ssr .seo-table .num { text-align: right; font-family: var(--mono); }
.seo-ssr .seo-links ul { display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; padding: 0; }

/* ---------- mạng xã hội ---------- */
.buzz { margin-top: 2px; color: var(--accent); font-weight: 600; }
.soc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.soc { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }
.soc-h { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
.soc b { font-family: var(--mono); font-size: 17px; }
.soc-top { display: block; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- chi tiết app: nút chia sẻ, trang riêng, xem ảnh lớn ---------- */
.dactions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dactions .btn { height: 30px; padding: 0 10px; font-size: 13px; gap: 6px; text-decoration: none; }
.dactions .btn.ok { color: var(--good); border-color: var(--good); }
.app-back { margin: 0 0 12px; }
#content.app-page { max-width: 900px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 26px 40px; }
@media (max-width: 640px) { #content.app-page { padding: 16px 14px 32px; border-radius: 0; border-left: 0; border-right: 0; } }
.shot { padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 10px; flex: none; }
.shot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgb(2 6 23 / .9); display: flex; align-items: center; justify-content: center; padding: 48px 64px; animation: fade .15s ease; }
.lightbox[hidden] { display: none; }
.lightbox img { width: 100%; height: 100%; object-fit: contain; }
.lb-btn { position: absolute; border: 0; background: rgb(255 255 255 / .12); color: #fff; width: 44px; height: 44px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 30px; line-height: 1; transition: background-color .15s ease; }
.lb-btn:hover { background: rgb(255 255 255 / .24); }
.lb-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lb-btn[hidden] { display: none; }
.lb-close { top: 14px; right: 14px; }
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
.lb-count { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); color: rgb(255 255 255 / .8); font: 13px var(--mono); }
body.no-scroll { overflow: hidden; }
@media (max-width: 640px) { .lightbox { padding: 56px 8px; } .lb-prev, .lb-next { top: auto; bottom: 8px; transform: none; } }

/* trang quản trị: mốc doanh thu */
.rev-form { display: grid; grid-template-columns: 2fr 150px 150px 1.3fr auto; gap: 8px; margin: 10px 0 4px; }
@media (max-width: 760px) { .rev-form { grid-template-columns: 1fr 1fr; } .rev-form input[name="input"], .rev-form input[name="note"] { grid-column: 1 / -1; } }

.reports-link { text-decoration: none; color: var(--text-2); gap: 6px; }
.reports-link:hover { color: var(--accent); }
@media (max-width: 640px) { .reports-link span { display: none; } }

/* ---------- ASO & khoá theo gói ---------- */
.aso-wrap { max-width: 1100px; }
.aso-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; } .aso-head h2 { margin: 0; font-size: 20px; display: flex; gap: 8px; align-items: center; }
.aso-tabs { margin: 12px 0 14px; } .aso-tabs a { display: inline-flex; padding: 10px 12px; color: var(--text-2); text-decoration: none; border-bottom: 2px solid transparent; font-weight: 500; }
.aso-tabs a.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.aso-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; } .aso-form input { flex: 1 1 260px; }
.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 6px 0 12px; }
.meter { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; overflow: hidden; }
.meter b { display: block; font: 600 24px var(--mono); } .meter span { font-size: 12.5px; color: var(--muted); }
.meter i { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--accent); }
.meter.hi i { background: var(--series-2); } .meter.mid i { background: var(--series-4); } .meter.lo i { background: var(--series-3); }
.rk { font-family: var(--mono); font-weight: 600; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); }
.rk.r1 { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); } .rk.r2 { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.rk.r3 { color: var(--text); }
.td-head { margin: 4px 0 8px; } .bar { height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin: 10px auto 6px; max-width: 360px; }
.bar i { display: block; height: 100%; background: var(--accent); transition: width .3s ease; }
.lock-card { padding: 22px 24px; } .lock-head { display: flex; gap: 14px; align-items: flex-start; } .lock-head > .ico { width: 34px; height: 34px; color: var(--accent); flex: none; }
.lock-head h3 { margin: 0 0 4px; } .lock-head p { margin: 0; color: var(--text-2); } .lock-feats { margin: 14px 0; color: var(--text-2); }
.plan-table { max-width: 560px; margin: 8px 0 14px; } .plan-table td, .plan-table th { padding: 7px 10px; }
.tier-sel { padding: 3px 6px; border-radius: 6px; } .tier-sel.saved { outline: 2px solid var(--good); } .tier-sel.err { outline: 2px solid var(--bad); }

.kv div .upd { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* game iOS mới phát hành */
.newrel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; }
.newrel summary { cursor: pointer; } .newrel > p { margin: 6px 0 10px; }
.nr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.nr { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border-radius: 10px; border: 1px solid var(--grid); text-decoration: none; color: var(--text); }
.nr:hover { background: var(--surface-2); }
.nr img { width: 40px; height: 40px; border-radius: 10px; flex: none; box-shadow: 0 0 0 1px var(--border); }
.nr div { min-width: 0; } .nr b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nr span { display: block; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nr .nr-hit { color: var(--good); font-weight: 600; } .nr .nr-hit .ico { width: 12px; height: 12px; vertical-align: -1px; }

.nr-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 12px; }
.nr-only { display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
.nr-grid.full .nr { background: var(--surface); border-color: var(--border); }
.nr.hit { border-color: color-mix(in srgb, var(--good) 45%, var(--border)); }

/* sắp xếp bảng theo cột */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sortable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
th.sortable .sort-ind { margin-left: 4px; font-size: 10px; opacity: .35; }
th.sortable.sorted { color: var(--accent); } th.sortable.sorted .sort-ind { opacity: 1; }

/* lịch sử xem gần đây */
.hist-list { list-style: none; padding: 0; margin: 6px 0 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.hist-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
.hist-item:hover { background: var(--surface-2); }
.hist-item img, .hist-ph { width: 38px; height: 38px; border-radius: 9px; flex: none; box-shadow: 0 0 0 1px var(--border); }
.hist-ph { display: grid; place-items: center; color: var(--muted); background: var(--surface-2); }
.hist-main { min-width: 0; flex: 1; } .hist-main b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-main span { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-time { white-space: nowrap; font-size: 12px; }

.hist-seg { margin: 4px 0 6px; }
