/* Giao diện kiểu YouTube: nền trung tính; theme partner (services/branding.py) chỉ đổi MÀU NHẤN qua --rose / --gold /
   --accent-*; font partner chọn đổi qua --body-font (services/fonts.py). */
:root {
  color-scheme: dark;
  /* màu nhấn — backend đè theo theme partner */
  --rose: #ffb4c7; --gold: #f3c969; --accent-ink: #2a0a14; --accent-soft: #ffd3db; --accent-strong: #ff8fab;
  --body-font: Roboto, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  /* nền trung tính (không theo theme) */
  --bg: #2a2a2f; --bg-raised: #35353b; --chip: #3e3e45; --chip-hover: #4c4c54; --line: #45454c;
  --meta-gold: #d3cab2;   /* chữ dưới tiêu đề phim: vàng nhạt */
  --text: #f1f1f1; --text-2: #aaaaaa; --accent: var(--accent-strong); --live: #3ddc84; --red: #cc0000; --link: #3ea6ff;
  --r: 12px; --top: 56px; --side: 240px; --side-mini: 72px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 var(--body-font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }
button:disabled { cursor: default; opacity: .55; }
img { display: block; max-width: 100%; }
svg { width: 24px; height: 24px; flex: none; }
h1, h2, h3, h4, p { margin: 0; }
button, a, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; z-index: 99; top: 8px; left: 8px; padding: 8px 12px; background: var(--bg-raised); }
* { scrollbar-width: thin; scrollbar-color: #3a3a3a transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 8px; }
.meta { color: var(--text-2); font-size: 14px; line-height: 20px; }
.grow { flex: 1; }

/* ── nút chung ── */
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; position: relative; }
.icon-btn:hover { background: var(--chip); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 0 16px; border-radius: 18px; font-weight: 600; white-space: nowrap; }
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--text); color: #0f0f0f; } .btn.primary:hover { background: #d9d9d9; }
.btn.accent { background: var(--accent); color: var(--accent-ink); } .btn.accent:hover { background: var(--accent-soft); }
.btn.ghost { background: var(--chip); } .btn.ghost:hover { background: var(--chip-hover); }
.btn.wide { width: 100%; min-height: 40px; }

/* ── thanh trên ── */
.top { position: fixed; inset: 0 0 auto 0; height: var(--top); z-index: 30; display: flex; align-items: center; gap: 16px; padding: 0 16px; background: var(--bg); }
.logo { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 700; font-size: 18px; letter-spacing: -.2px; white-space: nowrap; }
.logo-mark { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--chip) center / cover no-repeat; }
.logo-name small { margin-left: 4px; font-weight: 500; font-size: 11px; color: var(--text-2); }
.top > .grow { display: none; }                 /* máy tính: ô tìm nằm giữa (như YouTube) */
.search { flex: 1; display: flex; justify-content: center; position: relative; margin: 0 24px; }
.search form { display: flex; align-items: center; width: min(600px, 100%); }
.s-back, #m-search { display: none; }
.s-box { position: relative; flex: 1; display: flex; }
.search input { flex: 1; min-width: 0; height: 40px; padding: 0 40px 0 16px; border: 1px solid var(--line); border-right: 0; border-radius: 40px 0 0 40px; background: #202025; font-size: 15px; outline: none; -webkit-appearance: none; }
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus { border-color: #1c62b9; }
.s-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; color: var(--text-2); font-size: 16px; }
.s-clear:hover { background: var(--chip); }
.s-go { width: 64px; height: 40px; border: 1px solid var(--line); border-radius: 0 40px 40px 0; background: #222; display: grid; place-items: center; }
.s-panel { position: absolute; top: 44px; left: 50%; transform: translateX(-50%); width: min(600px, 100%); max-height: 70vh; overflow-y: auto; padding: 8px 0; border-radius: 12px; background: var(--bg-raised); box-shadow: 0 8px 30px rgb(0 0 0 / .5); z-index: 45; }
.s-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 6px 16px; cursor: pointer; }
.s-row:hover { background: #3a3a3a; }
.s-row svg { width: 20px; height: 20px; color: var(--text-2); }
.s-row span { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .s-row span b { font-weight: 400; color: var(--text-2); }
.s-row .del { color: var(--link); font-size: 13px; padding: 4px 6px; }
.s-film { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: center; padding: 6px 16px; }
.s-film:hover { background: #3a3a3a; } .s-film .thumb { border-radius: 6px; }
.s-film h4 { font-size: 14px; line-height: 19px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.s-film mark { background: none; color: var(--accent); } .s-film small { color: var(--text-2); font-size: 12px; }
.s-sec { padding: 8px 16px 4px; color: var(--text-2); font-size: 12px; font-weight: 600; }
.s-empty { padding: 12px 16px; color: var(--text-2); }
.top-right { display: flex; align-items: center; gap: 8px; }
.coin-btn { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px 0 10px; border-radius: 18px; background: var(--chip); font-weight: 600; white-space: nowrap; }
.coin-btn:hover { background: var(--chip-hover); }
.coin-btn .gem { width: 18px; height: 18px; color: var(--gold); }
.coin-btn .plus { margin-left: 4px; padding: 1px 8px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 12px; }
.avatar { position: relative; flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #111;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent)); overflow: hidden; }
.avatar::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--ring, transparent); }
.avatar.framed { overflow: visible; } .avatar.framed::after { inset: -3px; box-shadow: 0 0 10px var(--ring); }
#account-open.guest { width: auto; height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line); background: none; color: var(--link); font-weight: 600; }
#account-open.guest::after { display: none; }
.avatar.big { width: 72px; height: 72px; font-size: 28px; }
.avatar.big.framed::after { inset: -5px; border-width: 3px; box-shadow: 0 0 18px var(--ring); }
/* biểu tượng cảnh giới (SVG) */
.em { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex: none; display: inline-block; }
.em.em-img { object-fit: contain; }
.avatar.realm-av img.av-em { width: 78%; height: 78%; filter: none; }
.em.em-text { width: auto; height: auto; vertical-align: baseline; }
.em.big { width: 34px; height: 34px; } .em.huge { width: 72px; height: 72px; filter: drop-shadow(0 0 16px currentColor); }
.avatar.realm-av { background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--ring) 38%, #2a2a2e), #1d1d20 75%); }
.avatar.realm-av .av-em { width: 64%; height: 64%; color: var(--ring); filter: drop-shadow(0 0 4px color-mix(in srgb, var(--ring) 60%, transparent)); }
.avatar.realm-av span.av-em { width: auto; height: auto; font-size: 18px; }
.realm-tag { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600;
  color: var(--rc); background: color-mix(in srgb, var(--rc) 16%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── chuông ── */
.bell-wrap { position: relative; }
.bell-wrap .dot { position: absolute; top: 4px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 16px; text-align: center; }
.bell-wrap .dot:empty { display: none; }
.bell-panel { position: absolute; right: 0; top: 46px; width: 420px; max-height: 70vh; display: flex; flex-direction: column; border-radius: 12px; background: #38383e; box-shadow: 0 8px 30px rgb(0 0 0 / .5); z-index: 40; overflow: hidden; }
.bp-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid #3a3a3a; }
.bp-head b { font-size: 16px; } .bp-all { color: var(--link); font-size: 13px; }
.bp-list { overflow-y: auto; padding: 4px 0; }
.bp-sec { padding: 10px 16px 4px; color: var(--text-2); font-size: 13px; font-weight: 600; }
/* bố cục cố định như YouTube: chấm · icon 40 · chữ · cột phải 86 (thumbnail hoặc nhãn kết quả) → mọi dòng thẳng hàng */
.bp-item { display: grid; grid-template-columns: 6px 40px minmax(0, 1fr) 86px; gap: 12px; align-items: start; padding: 10px 16px 10px 8px; }
a.bp-item:hover { background: #3a3a3a; }
.bp-item .unread { width: 6px; height: 6px; margin-top: 17px; border-radius: 50%; background: var(--link); }
.bp-item.read .unread { visibility: hidden; }
.bp-item .ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; overflow: hidden;
  background: color-mix(in srgb, var(--tone) 22%, transparent); color: var(--tone); }
.bp-item .ic.logo-ic { background: var(--chip) center / cover no-repeat; }
.bp-item p { margin: 0 0 4px; font-size: 14px; line-height: 20px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bp-item small { color: var(--text-2); font-size: 12px; }
.bp-item .th { width: 86px; margin-top: 2px; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: var(--chip); } .bp-item .th img { width: 100%; height: 100%; object-fit: cover; }
.bp-item .val { width: 86px; margin-top: 8px; padding: 4px 6px; border-radius: 8px; text-align: center; font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--tone); background: color-mix(in srgb, var(--tone) 16%, transparent); }
.bp-more { display: block; width: calc(100% - 32px); margin: 2px 16px 6px; padding: 8px; border-radius: 18px; background: #333; color: var(--link); font-size: 13px; font-weight: 600; }
.bp-more:hover { background: var(--chip-hover); }

/* ── thanh bên ── */
.side { position: fixed; top: var(--top); bottom: 0; left: 0; width: var(--side); padding: 12px; overflow-y: auto; z-index: 20; background: var(--bg); }
.side > a, .side > button { display: flex; align-items: center; gap: 24px; width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; text-align: left; }
.side > a:hover, .side > button:hover { background: var(--chip); } .side > a[aria-current="page"] { background: var(--chip); font-weight: 600; }
.side hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.nav-dot { width: 6px; height: 6px; margin-left: auto; border-radius: 50%; background: var(--link); }
.side-tuvi { display: block; margin: 4px 4px 12px; padding: 12px; border-radius: var(--r); background: var(--bg-raised); }
.side-tuvi:hover { background: var(--chip); }
.side-tuvi b { display: block; margin-bottom: 6px; } .side-tuvi p { margin-top: 6px; color: var(--text-2); font-size: 12px; }
.bar { height: 6px; border-radius: 6px; background: #3a3a3a; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--rc, var(--accent)), color-mix(in srgb, var(--rc, var(--accent)) 60%, #fff)); }
.side-live { display: flex; align-items: center; gap: 6px; margin: 0 12px 10px; color: var(--text-2); font-size: 13px; }
.side-live b { color: var(--text); }
.side-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: live-pulse 2s infinite; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 #3ddc8466; } 70% { box-shadow: 0 0 0 7px #3ddc8400; } 100% { box-shadow: 0 0 0 0 #3ddc8400; } }
.side-foot { padding: 4px 12px 16px; color: #717171; font-size: 12px; line-height: 1.5; }
body.mini .side { width: var(--side-mini); padding: 4px; }
body.mini .side > a, body.mini .side > button { flex-direction: column; gap: 4px; height: 74px; justify-content: center; font-size: 10px; padding: 0; }
body.mini .side .full, body.mini .side hr.full { display: none; }
body.mini .nav-dot { position: absolute; margin: 0 0 30px 26px; }

main { padding: calc(var(--top) + 8px) 24px 40px calc(var(--side) + 24px); }
body.mini main { padding-left: calc(var(--side-mini) + 24px); }

/* ── chip + lưới ── */
.chips { position: sticky; top: var(--top); z-index: 10; display: flex; gap: 12px; padding: 12px 0; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; background: var(--bg); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 32px; padding: 0 12px; border-radius: 8px; background: var(--chip); font-weight: 500; white-space: nowrap; }
.chip:hover { background: var(--chip-hover); } .chip[aria-pressed="true"] { background: var(--text); color: #0f0f0f; }
.shelf-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 16px; }
.shelf-head h2 { font-size: 20px; }
.grid { display: grid; gap: 32px 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 40px; }   /* máy tính: 4 cột */
.grid.one-row { grid-auto-rows: 0; grid-template-rows: auto; row-gap: 0; overflow: hidden; margin-bottom: 32px; }
.card { display: block; min-width: 0; }
.thumb { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r); overflow: hidden; background: #222; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.card:hover .thumb img { transform: scale(1.03); }
.badge { position: absolute; right: 8px; bottom: 8px; padding: 1px 6px; border-radius: 4px; background: rgb(0 0 0 / .8); color: #fff; font-size: 12px; font-weight: 600; }
.badge.free { background: #1e7d3a; } .badge.lock { color: var(--gold); }
.vip { position: absolute; right: 8px; top: 8px; padding: 2px 8px; border-radius: 5px; font-size: 12px; font-weight: 900; letter-spacing: 1px; line-height: 16px;
  color: #2b1a00; background: linear-gradient(135deg, #fff1b8, #f6c945 45%, #d99a1e); box-shadow: 0 2px 10px rgb(0 0 0 / .55), 0 0 0 1px rgb(255 230 150 / .6) inset; }
.pl-item .vip, .mini-card .vip { right: 4px; top: 4px; padding: 1px 6px; font-size: 10px; }
.new-tag { position: absolute; left: 8px; top: 8px; padding: 2px 6px; border-radius: 4px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .3px; }
.new-tag.follow { background: var(--accent); color: var(--accent-ink); }
.progress { position: absolute; inset: auto 0 0 0; height: 4px; background: rgb(255 255 255 / .3); } .progress i { display: block; height: 100%; background: #f00; }
.card-body { padding-top: 10px; }
/* tiêu đề luôn chừa đủ 2 dòng → dòng phụ (số phần · thời gian) thẳng hàng giữa các thẻ */
.card-body h3 { min-height: 44px; margin-bottom: 4px; font-size: 16px; line-height: 22px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-body .meta, .mini-card .meta { color: var(--meta-gold); }
.meta .fresh { color: #ff4e45; font-weight: 600; }
.empty { padding: 40px 0; color: var(--text-2); text-align: center; }

/* ── trang xem ── */
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 402px; gap: 24px; max-width: 1754px; margin: 0 auto; }
.watch > * { min-width: 0; }
.player { overflow: hidden; border-radius: var(--r); background: #000; }
.player-frame { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; isolation: isolate; background: #000; }
.player-frame img, .player-frame video, .player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; }
.player-frame iframe { border: 0; }
.player-frame img { z-index: -1; object-fit: cover; filter: brightness(.45); }
.player-message { display: grid; justify-items: center; gap: 12px; padding: 16px; color: #fff; text-align: center; text-shadow: 0 1px 10px #000; }
.player-icon svg { width: 56px; height: 56px; }
.player-message p { font-size: 16px; }
#unlock-feedback { max-width: 25rem; color: var(--gold); }
.player-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 8px 12px; background: var(--bg-raised); }
.player-sources { display: flex; flex-wrap: wrap; gap: 8px; }
.player-sources button { --tone: 255 180 199; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px 0 10px; border: 1px solid rgb(var(--tone) / .35); border-radius: 16px; background: rgb(var(--tone) / .1); color: rgb(var(--tone)); font-size: 13px; font-weight: 700; }
.player-sources button[data-source="youtube"] { --tone: 255 92 92; }
.player-sources svg { width: 18px; height: 18px; }
.player-sources [aria-pressed="true"] { background: rgb(var(--tone) / .24); border-color: rgb(var(--tone)); }
.player-sources button:disabled { --tone: 160 160 160; border-style: dashed; background: transparent; opacity: .6; }
.player-sources small { padding: 0 6px; border-radius: 999px; background: rgb(var(--tone) / .15); font-size: 11px; font-weight: 600; }
.playback-tools { display: flex; align-items: center; gap: 8px; }
.bar-select { position: relative; display: inline-flex; align-items: center; }
.bar-select svg { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--text-2); pointer-events: none; }
.bar-select select { appearance: none; min-height: 32px; padding: 0 12px 0 32px; border: 1px solid var(--line); border-radius: 16px; background: var(--chip); font-size: 13px; font-weight: 600; cursor: pointer; }
.bar-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 50%; background: var(--chip); }
.bar-icon svg { width: 16px; height: 16px; }
.bar-dup { display: none !important; }
#playback-feedback { font-size: 12px; color: var(--text-2); }
.w-title { margin: 12px 0 8px; font-size: 20px; line-height: 28px; font-weight: 700; overflow-wrap: anywhere; }
.w-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.w-genres { color: var(--text-2); font-size: 13px; }
.desc { margin-top: 12px; padding: 12px; border-radius: var(--r); background: var(--bg-raised); }
.desc b { font-size: 14px; } .desc p { margin-top: 6px; white-space: pre-line; }
.desc-more { margin-top: 4px; font-weight: 600; }
.live-watching { color: var(--gold); font-size: 13px; font-weight: 600; }
.playlist { margin-bottom: 16px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; }
.pl-head { position: relative; display: flex; align-items: flex-start; gap: 8px; padding: 12px 8px 8px 16px; background: var(--bg-raised); }
.pl-head > div { flex: 1; min-width: 0; }
.pl-head h2 { margin-bottom: 4px; font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-head .meta { font-size: 12px; }
.pl-head .grab { display: none; position: absolute; left: 50%; top: 6px; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: #555; }
.pl-close { display: none; }
.pl-list { max-height: 400px; overflow-y: auto; padding: 4px 0; }
.pl-item { display: grid; grid-template-columns: 24px 100px minmax(0, 1fr); gap: 8px; align-items: center; width: 100%; padding: 6px 12px 6px 4px; text-align: left; }
button.pl-item:hover { background: var(--chip); } .pl-item[aria-current="true"] { background: color-mix(in srgb, var(--accent) 14%, var(--bg-raised)); }
.pl-item .n { text-align: center; font-size: 12px; color: var(--text-2); }
.pl-item .thumb { border-radius: 8px; } .pl-item .badge { right: 4px; bottom: 4px; font-size: 11px; }
.pl-item h4 { margin-bottom: 2px; font-size: 14px; line-height: 20px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pl-item .meta { font-size: 12px; }
.pl-item.soon { cursor: default; } .pl-item.soon .thumb img { filter: brightness(.35); }
.pl-item.soon .thumb b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 700; text-align: center; }
.pl-item.soon .meta { color: var(--gold); }
.new-mini { display: inline-block; margin-right: 6px; padding: 0 5px; border-radius: 3px; background: var(--red); color: #fff; font-size: 10px; font-weight: 800; line-height: 16px; vertical-align: 1px; }
.pl-bar { display: none; align-items: center; gap: 10px; width: 100%; margin-top: 12px; padding: 10px 12px; border-radius: var(--r); background: var(--bg-raised); text-align: left; }
.pl-bar svg { width: 20px; height: 20px; } .pl-bar > span:first-of-type { flex: 1; min-width: 0; }
.pl-bar b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .pl-bar small { color: var(--text-2); font-size: 12px; }
.next-chips { display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.mini-card { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 8px; margin-bottom: 8px; }
.mini-card .thumb { border-radius: 8px; } .mini-card h4 { margin-bottom: 4px; font-size: 14px; line-height: 20px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-card .meta { font-size: 12px; line-height: 18px; }
@keyframes sheet-up { from { transform: translateY(40%); opacity: .4; } }

/* ── tu vi ── */
.page { max-width: 1100px; margin: 0 auto; }
.section-title { margin: 24px 0 12px; font-size: 18px; }
.hero-tuvi { display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center; padding: 24px; border-radius: 16px;
  background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--rc) 22%, transparent), transparent 60%), var(--bg-raised); }
.hero-tuvi h1 { margin: 4px 0 6px; font-size: 26px; }
.hero-tuvi .bar { height: 10px; margin: 10px 0 6px; max-width: 520px; }
.hero-tuvi p { color: var(--text-2); }
.hero-tuvi .wallet { display: grid; gap: 8px; justify-items: end; }
.hero-tuvi .wallet b { font-size: 22px; }
.realms { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.realm { position: relative; padding: 16px; border-radius: var(--r); background: var(--bg-raised); border: 1px solid transparent; }
.realm.now { border-color: var(--rc); box-shadow: 0 0 0 1px var(--rc) inset; }
.realm.locked { opacity: .55; }
.realm .ico { font-size: 28px; } .realm h3 { margin: 8px 0 2px; color: var(--rc); font-size: 16px; }
.realm small { color: var(--text-2); } .realm ul { margin: 10px 0 0; padding-left: 18px; color: var(--text-2); font-size: 13px; } .realm li { margin: 3px 0; }
.realm .state { position: absolute; top: 12px; right: 12px; font-size: 12px; color: var(--text-2); }
.stages { display: flex; flex-wrap: wrap; gap: 6px; }
.stage { padding: 4px 10px; border-radius: 14px; font-size: 12px; background: var(--chip); color: var(--text-2); }
.stage.done { color: var(--rc); background: color-mix(in srgb, var(--rc) 14%, transparent); } .stage.now { color: #111; background: var(--rc); font-weight: 700; }
.note { margin-top: 12px; color: var(--text-2); font-size: 12px; }
.me-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.guest-box { display: grid; justify-items: center; gap: 12px; padding: 48px 16px; border-radius: 16px; background: var(--bg-raised); text-align: center; }

/* ── bảng phong thần ── */
.board-page { max-width: 820px; }
.board { border-radius: 14px; overflow: hidden; background: var(--bg-raised); }
.board-row { display: grid; grid-template-columns: 36px 36px minmax(0, 1fr) 150px; gap: 12px; align-items: center; padding: 8px 16px; border-top: 1px solid var(--line); }
.board-row:first-child { border-top: 0; }
.board-row .rank { font-size: 16px; font-weight: 800; text-align: center; color: var(--text-2); }
.board-row.top1 .rank { color: #ffd54a; } .board-row.top2 .rank { color: #d7dde5; } .board-row.top3 .rank { color: #e0a36a; }
.board-row.me { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.board-row .avatar { width: 32px; height: 32px; font-size: 13px; }
.board-row .who { min-width: 0; } .board-row .who b { display: block; font-size: 14px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-row .who small { color: var(--text-2); font-size: 12px; }
.board-row .lv { display: grid; justify-items: end; gap: 5px; min-width: 0; }
.board-row .lv .realm-tag { font-size: 11px; } .board-row .lv .bar { width: 100%; height: 4px; }
.podium { display: grid; grid-template-columns: 1fr 1.1fr 1fr; gap: 10px; align-items: end; margin-bottom: 12px; }
.pod { min-width: 0; text-align: center; padding: 14px 8px; border-radius: 14px; background: var(--bg-raised); }
.pod .avatar { margin: 0 auto 8px; } .pod.first { padding-top: 24px; background: linear-gradient(180deg, rgb(255 213 74 / .14), var(--bg-raised)); }
.pod .avatar.big { width: 56px; height: 56px; font-size: 22px; } .pod.first .avatar.big { width: 68px; height: 68px; }
.pod b { display: block; margin: 2px 0 4px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── hộp thoại ── */
dialog { width: min(440px, 100% - 24px); max-height: 92dvh; padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--bg-raised); color: var(--text); box-shadow: 0 16px 60px #000a; }
dialog::backdrop { background: rgb(0 0 0 / .7); }
body:has(dialog[open]) { overflow: hidden; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 8px; }
.dlg-head h2 { font-size: 18px; } .dlg-head .meta { font-size: 13px; margin-top: 2px; }
.account-body { display: grid; gap: 14px; padding: 4px 16px 18px; }
.segmented { display: flex; width: fit-content; margin-bottom: 12px; padding: 3px; border-radius: 10px; background: var(--chip); }
.segmented button { min-height: 32px; padding: 0 14px; border-radius: 8px; color: var(--text-2); font-weight: 600; }
.segmented button[aria-pressed="true"] { background: var(--text); color: #0f0f0f; }
.account-form { display: grid; gap: 10px; }
.account-form label { display: grid; gap: 4px; color: var(--text-2); font-size: 13px; }
.account-form input, #video-request-content { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #202025; color: var(--text); font-size: 15px; outline: none; }
.account-form input:focus, #video-request-content:focus { border-color: #1c62b9; }
#video-request-content { resize: vertical; }
.account-status { padding: 10px 12px; border-radius: 10px; color: var(--gold); background: var(--chip); white-space: pre-line; }
#auth-member { display: grid; justify-items: start; gap: 12px; }
.switch { display: flex; align-items: center; gap: 8px; cursor: pointer; } .switch input { width: 18px; height: 18px; accent-color: var(--accent); }
details summary { cursor: pointer; padding: 4px 0; color: var(--text-2); }
.ledger-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; max-height: 16rem; overflow: auto; width: 100%; }
.ledger-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 8px 10px; border-radius: 10px; background: var(--chip); font-size: 13px; }
.ledger-list li b { text-align: right; color: #ff9b8f; } .ledger-list li.plus b { color: #82e3ad; }
.ledger-list li small { grid-column: 2; text-align: right; color: var(--text-2); }
#ledger-box, #password-box { width: 100%; }
.video-request-fee { color: var(--gold); } .free-left { margin-left: 6px; padding: 2px 8px; border-radius: 10px; background: #1e7d3a; color: #fff; font-size: 12px; }
#video-request-list { display: grid; gap: 6px; margin: 6px 0 0; padding: 0; list-style: none; }
#video-request-list li { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--chip); overflow-wrap: anywhere; white-space: pre-wrap; }
#video-request-list small { color: var(--text-2); }
.quick-amounts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.quick-amounts button { min-height: 34px; border-radius: 8px; background: var(--chip); font-size: 13px; font-weight: 600; }
.quick-amounts button:hover { background: var(--chip-hover); }
.wallet-tuvi { color: var(--text-2); font-size: 13px; }
.wallet-rates { display: grid; gap: 6px; padding: 12px; margin: 0; list-style: none; border-radius: 10px; background: #202025; }
.wallet-rates li { display: flex; justify-content: space-between; gap: 8px; }
.wallet-result, .wallet-rates b { color: var(--gold); }
.wallet-qr { justify-items: center; text-align: center; overflow-wrap: anywhere; }
.wallet-qr img { width: min(15rem, 100%); background: #fff; border-radius: 10px; }
.bank-card { display: grid; gap: 10px; padding: 14px; border: 1px solid #4a4a4a; border-radius: 14px; background: linear-gradient(145deg, #2a2a2a, #1a1a1a); }
.bank-brand { display: flex; align-items: center; gap: 8px; }
.bank-brand span:not(:empty) { padding: 4px 6px; border-radius: 6px; color: #e6fbe9; background: #20563b; font-weight: 750; font-size: 12px; }
.bank-number-row, .bank-owner-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bank-number-row { padding: 6px 8px; border-radius: 8px; background: #202025; }
.bank-number-row strong { font-family: ui-monospace, monospace; letter-spacing: .08em; }
.bank-number-row button, .bank-owner-row button { margin-left: auto; min-height: 32px; padding: 0 10px; border-radius: 16px; background: var(--chip); font-size: 13px; font-weight: 600; }
.bank-chip { width: 24px; height: 18px; border-radius: 4px; background: linear-gradient(#f2c96d, #a66b27); }
.bank-owner-row p { display: grid; gap: 2px; font-size: 14px; } .bank-owner-row p span, #bank-copy-status { color: var(--text-2); font-size: 12px; }
.bank-qr-details { display: grid; width: 100%; gap: 6px; margin: 0; padding: 12px; border-radius: 10px; text-align: left; background: #202025; }
.bank-qr-details div { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; } .bank-qr-details dt { color: var(--text-2); } .bank-qr-details dd { margin: 0; font-weight: 650; }
.bank-qr-details div:last-child dd { color: var(--gold); font-family: ui-monospace, monospace; }
#wallet-reference { width: 100%; padding: 10px 12px; border-radius: 10px; background: var(--chip); line-height: 1.45; }
#wallet-reference strong { display: block; color: var(--gold); font-size: 18px; } #wallet-reference small { display: block; margin-top: 4px; color: var(--text-2); }

/* ── đột phá ── */
dialog.breakthrough { width: auto; max-width: calc(100% - 24px); border: 0; background: none; box-shadow: none; overflow: visible; }
.bt-core { position: relative; text-align: center; padding: 32px 40px; border-radius: 20px; background: var(--bg-raised); border: 1px solid var(--rc); box-shadow: 0 0 60px color-mix(in srgb, var(--rc) 50%, transparent); animation: bt-pop .5s cubic-bezier(.3,1.6,.5,1); }
.bt-ico { font-size: 56px; animation: bt-float 2s ease-in-out infinite; }
.bt-core h2 { margin: 8px 0 4px; color: var(--rc); font-size: 26px; }
.bt-core p { margin: 0 0 16px; color: var(--text-2); }
.bt-core::before { content: ""; position: absolute; inset: -30px; border-radius: 30px; border: 2px solid var(--rc); opacity: 0; animation: bt-ring 1.4s .1s ease-out; }
@keyframes bt-pop { from { transform: scale(.6); opacity: 0; } } @keyframes bt-ring { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.2); opacity: 0; } }
@keyframes bt-float { 50% { transform: translateY(-6px); } }

/* ── hoạt động trên web + thông báo Hệ Thống + hiệu ứng mở khoá ── */
.live-feed { position: fixed; left: 16px; bottom: 16px; z-index: 50; max-width: min(22rem, calc(100vw - 32px)); padding: 10px 14px; border-radius: 12px;
  background: var(--bg-raised); box-shadow: 0 8px 24px #0008; font-size: 13px; line-height: 1.35; transition: opacity .35s, transform .35s; }
.live-feed.is-out { opacity: 0; transform: translateY(10px); } .live-feed em { color: var(--accent); font-style: normal; font-weight: 650; }
.system-notice { position: fixed; inset: 12px auto auto 50%; margin: 0; z-index: 80; align-items: center; gap: 12px; width: min(30rem, calc(100vw - 24px)); padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--gold) 55%, var(--line)); border-radius: 14px; color: var(--text); background: #282828;
  box-shadow: 0 18px 50px rgb(0 0 0 / .55); opacity: 0; transform: translate(-50%, -12px); transition: opacity .3s ease, transform .3s ease; }
.system-notice:not([hidden]) { display: flex; }
.system-notice.is-visible { opacity: 1; transform: translate(-50%, 0); }
.system-notice[data-tone="deduct"] { border-color: color-mix(in srgb, #ff6b6b 60%, var(--line)); }
.system-notice-badge { flex: none; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--accent-ink); background: linear-gradient(135deg, var(--gold), var(--accent)); }
.system-notice[data-tone="deduct"] .system-notice-badge { background: #ff6b6b; }
.system-notice p { flex: 1; font-size: 14px; line-height: 1.4; }
.system-notice-close { flex: none; width: 32px; height: 32px; border-radius: 8px; color: var(--text-2); font-size: 20px; }
.system-notice-close:hover { background: var(--chip); }
.unlock-burst { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; pointer-events: none;
  background: radial-gradient(circle at center, color-mix(in srgb, var(--gold) 28%, transparent) 0, transparent 62%); animation: unlock-fade 1.7s ease forwards; }
.unlock-burst::before, .unlock-burst::after { content: ""; position: absolute; left: 50%; top: 50%; width: 9rem; height: 9rem; margin: -4.5rem 0 0 -4.5rem;
  border-radius: 50%; border: 2px solid var(--gold); box-shadow: 0 0 30px var(--gold); animation: unlock-ring 1.2s cubic-bezier(.2,.7,.3,1) forwards; }
.unlock-burst::after { animation-delay: .18s; border-color: var(--accent); box-shadow: 0 0 30px var(--accent); }
.unlock-burst-core { display: grid; justify-items: center; gap: 8px; color: #fff; text-shadow: 0 2px 14px #000; animation: bt-pop .5s cubic-bezier(.3,1.6,.5,1) both; }
.unlock-burst svg { width: 54px; height: 54px; filter: drop-shadow(0 0 14px var(--gold)); }
.unlock-burst .shackle { transform-origin: 70% 100%; animation: unlock-shackle .45s .25s ease-out forwards; }
.unlock-burst b { font-size: 17px; } .unlock-burst small { color: var(--gold); font-weight: 650; }
@keyframes unlock-ring { from { transform: scale(.2); opacity: 1; } to { transform: scale(2.6); opacity: 0; } }
@keyframes unlock-shackle { to { transform: translateY(-5px) rotate(-28deg); } }
@keyframes unlock-fade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

/* ── màn hẹp ── */
.bottom-nav { display: none; }
@media (max-width: 1100px) { .watch { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  :root { --top: 48px; }
  .side, .search, .top .menu, .coin-btn .label, .logo-name small { display: none !important; }
  #m-search { display: grid; }
  .top > .grow { display: block; }               /* điện thoại: đẩy nút sang phải (ô tìm ẩn) */
  .top { gap: 8px; padding: 0 12px; } .top-right { gap: 4px; } .coin-btn { padding: 0 10px 0 8px; }
  main, body.mini main { padding: calc(var(--top) + 4px) 0 76px; overflow-x: clip; }
  .chips { padding: 8px 12px; gap: 8px; }
  /* điện thoại: 2 cột */
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 10px; padding: 0 12px; }
  .card .thumb { border-radius: 8px; } .card-body { padding: 6px 0 0; }
  .card-body h3 { min-height: 36px; font-size: 13px; line-height: 18px; margin-bottom: 2px; } .card-body .meta { font-size: 12px; line-height: 16px; }
  .badge { right: 4px; bottom: 4px; font-size: 10px; padding: 0 4px; }
  .vip { right: 4px; top: 4px; padding: 1px 6px; font-size: 10px; letter-spacing: .5px; line-height: 14px; }
  .new-tag { left: 4px; top: 4px; padding: 1px 4px; font-size: 9px; }
  .shelf-head { padding: 0 12px; }
  .grid.one-row { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: calc(50% - 17px); grid-auto-rows: auto; overflow-x: auto; gap: 10px; padding: 0 12px; scrollbar-width: none; }
  .player { border-radius: 0; position: sticky; top: var(--top); z-index: 5; }
  .watch-main > :not(.player) { margin-left: 12px; margin-right: 12px; }
  .up-next { padding: 0 12px; } .mini-card { grid-template-columns: 150px minmax(0, 1fr); }
  .pl-bar:not([hidden]) { display: flex; }
  .up-next .playlist { display: none; }
  body.sheet .up-next .playlist:not([hidden]) { display: flex; position: fixed; z-index: 35; left: 0; right: 0; bottom: 0; top: calc(var(--top) + 56.25vw);
    margin: 0; border: 0; border-radius: 16px 16px 0 0; background: var(--bg-raised); animation: sheet-up .25s ease-out; }
  body.sheet .pl-list { max-height: none; flex: 1; } body.sheet .bottom-nav { display: none; }
  .pl-head .grab, body.sheet .pl-close { display: grid; }
  .page { padding: 0 12px; } .hero-tuvi { grid-template-columns: 1fr; justify-items: start; gap: 12px; padding: 16px; }
  .hero-tuvi .wallet { justify-items: start; grid-template-columns: auto auto; align-items: center; }
  .board-row { grid-template-columns: 22px 32px minmax(0, 1fr) 124px; gap: 8px; padding: 8px 10px; }
  .board-row .lv .realm-tag { font-size: 10px; padding: 1px 6px; }
  .pod { padding: 10px 6px; } .pod .realm-tag { font-size: 10px; padding: 1px 6px; } .pod .avatar.big { width: 48px; height: 48px; } .pod.first .avatar.big { width: 58px; height: 58px; }
  .bell-panel { position: fixed; inset: 48px 0 60px 0; width: auto; max-height: none; border-radius: 0; }
  body.searching .search { display: block !important; position: fixed; inset: 0; z-index: 50; background: var(--bg); }
  body.searching .search form { width: 100%; height: 56px; gap: 4px; padding: 0 8px; }
  body.searching .s-back { display: grid; }
  body.searching .search input { border: 0; border-radius: 20px; background: var(--chip); }
  body.searching .s-go { display: none; }
  body.searching .s-panel { position: static; transform: none; width: 100%; height: calc(100% - 56px); max-height: none; border-radius: 0; box-shadow: none; background: var(--bg); }
  body.searching .s-row { padding: 12px 16px; border-bottom: 1px solid #222; }
  .bottom-nav { position: fixed; inset: auto 0 0 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); height: 60px; padding-bottom: env(safe-area-inset-bottom);
    background: var(--bg); border-top: 1px solid var(--line); }
  .bottom-nav > * { display: grid; place-items: center; align-content: center; gap: 2px; font-size: 10px; color: var(--text-2); }
  .bottom-nav [aria-current="page"] { color: var(--text); }
  .bottom-nav .nap span { display: grid; place-items: center; width: 40px; height: 28px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); }
  .bottom-nav .nap svg { width: 20px; height: 20px; }
  .live-feed { bottom: 72px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation-duration: .01s !important; }
}
