/* màu & token dùng chung nằm trong theme.css (nạp trước file này) */
:root {
  --top-h: 56px;
  --tab-h: 56px;
  --mini-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --rail-w: 80px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 14px/1.4 var(--font);
  min-height: 100dvh;
  overscroll-behavior-y: contain;
}
body.has-mini { --mini-space: var(--mini-h); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { width: 24px; height: 24px; fill: currentColor; flex: none; }
img { display: block; }
[hidden] { display: none !important; }
.grow { flex: 1; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  flex: none;
}
.icon-btn:active { background: var(--press); }
@media (hover: hover) { .icon-btn:hover { background: var(--hover); } }
.icon-btn.big svg { width: 34px; height: 34px; }
.icon-btn.huge { width: 64px; height: 64px; background: rgba(0,0,0,.45); }
.icon-btn.huge svg { width: 42px; height: 42px; }

/* ---------- thanh trên ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) 12px 0;
  display: flex; align-items: center; gap: 8px;
  background: var(--glass); backdrop-filter: blur(12px);
}
.logo { display: flex; align-items: center; gap: 8px; font-size: 19px; letter-spacing: -.3px; margin-right: auto; }
.logo svg { width: 28px; height: 28px; }
.logo b { color: var(--accent); }
.searchbox {
  position: relative; display: flex; align-items: center;
  flex: 0 1 560px; height: 40px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 20px; padding: 0 2px 0 14px;
}
.searchbox:focus-within { border-color: var(--accent); }
.searchbox input {
  flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0;
  color: var(--text); font: inherit; font-size: 16px;
}
.searchbox input::-webkit-search-cancel-button { filter: invert(1); }
.searchbox .only-open { display: none; }
.only-mobile { display: none; }
.only-wide { display: none; }
@media (min-width: 768px) { .only-wide { display: inline-grid; } }
#micBtn.rec { color: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .4; } }
.suggest {
  position: absolute; left: 0; right: 0; top: 46px; margin: 0; padding: 6px 0; list-style: none;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px var(--shadow); max-height: 60vh; overflow: auto;
}
.suggest:empty { display: none; }
.suggest li { display: flex; align-items: center; gap: 12px; padding: 10px 16px; cursor: pointer; }
.suggest li svg { width: 20px; height: 20px; color: var(--muted); }
.suggest li.active, .suggest li:hover { background: var(--bg3); }

@media (max-width: 640px) {
  .searchbox { display: none; }
  .only-mobile { display: inline-grid; }
  body.searching .logo, body.searching #searchOpen { display: none; }
  body.searching .searchbox { display: flex; flex: 1; }
  body.searching .searchbox .only-open { display: inline-grid; margin-left: -12px; }
  .suggest { position: fixed; left: 0; right: 0; top: calc(var(--top-h) + var(--safe-t)); border-radius: 0; border-width: 1px 0; max-height: none; bottom: 0; }
}

/* ---------- nội dung ---------- */
main {
  padding: 8px 16px calc(var(--tab-h) + var(--mini-space, 0px) + var(--safe-b) + 16px);
  max-width: 1600px; margin: 0 auto;
}
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: none; position: sticky; top: calc(var(--top-h) + var(--safe-t)); z-index: 5; background: var(--bg); margin: 0 -16px; padding-inline: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 7px 14px; border-radius: 8px; background: var(--bg3); font-weight: 500; white-space: nowrap; }
.chip.active { background: var(--text); color: var(--bg); }

h2.section { font-size: 18px; margin: 20px 0 10px; display: flex; align-items: center; gap: 8px; }
h2.section .grow + a, h2.section button.link { font-size: 14px; color: var(--accent); font-weight: 500; }

.grid { display: grid; gap: 16px 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; gap: 18px; margin: 0 -16px; } .grid .card .meta { padding: 0 12px; } .grid .card .thumb { border-radius: 0; } }

.row-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 280px); gap: 12px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.row-scroll::-webkit-scrollbar { display: none; }

.card { display: flex; flex-direction: column; gap: 10px; cursor: pointer; min-width: 0; }
.thumb { position: relative; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: var(--bg3); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .dur {
  position: absolute; right: 6px; bottom: 6px; padding: 1px 5px; border-radius: 4px;
  background: rgba(0,0,0,.8); color: #fff; font-size: 12px; font-weight: 600;
}
.thumb .dur.live { background: #cc0000; }
.thumb .prog { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); }
.card .meta { display: flex; gap: 12px; align-items: flex-start; }
.ch-link { cursor: pointer; }
@media (hover: hover) { .ch-link:hover { color: var(--text); } }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--bg3); object-fit: cover; flex: none; }
.card .text { flex: 1; min-width: 0; }
.title { font-size: 15px; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .icon-btn { margin: -6px -8px 0 0; color: var(--muted); }

/* danh sách dạng hàng ngang (related, queue, history) */
.list { display: flex; flex-direction: column; gap: 4px; }
.item { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; border-radius: 10px; }
.item .thumb { width: 168px; flex: none; border-radius: 8px; }
.item .text { flex: 1; min-width: 0; }
.item .title { font-size: 14px; }
.item .icon-btn { color: var(--muted); margin-top: -6px; }
.item.now { background: color-mix(in srgb, var(--accent) 14%, transparent); padding-inline: 6px; }
@media (max-width: 400px) { .item .thumb { width: 140px; } }

.channel-item { display: flex; align-items: center; gap: 16px; padding: 8px 0; cursor: pointer; }
.channel-item img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: var(--bg3); }

.empty { color: var(--muted); text-align: center; padding: 48px 16px; }
.empty svg { width: 56px; height: 56px; opacity: .5; display: block; margin: 0 auto 12px; }
.error { color: var(--danger); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 20px; background: var(--bg3); font-weight: 500; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn svg { width: 20px; height: 20px; }

.loader { display: grid; place-items: center; padding: 28px; }
.loader i, .player-spinner i {
  width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--ring); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton .thumb, .skeleton .sk { background: linear-gradient(90deg, var(--bg2), var(--bg3), var(--bg2)); background-size: 200% 100%; animation: sh 1.2s infinite; }
.skeleton .sk { height: 12px; border-radius: 6px; margin: 6px 0; }
@keyframes sh { to { background-position: -200% 0; } }

.tabs { display: flex; gap: 8px; margin: 8px 0 16px; }

.channel-head { margin: 0 -16px 16px; }
.channel-head .banner { width: 100%; aspect-ratio: 6/1; object-fit: cover; background: var(--bg3); }
.channel-head .who { display: flex; align-items: center; gap: 16px; padding: 16px; }
.channel-head .who img { width: 72px; height: 72px; border-radius: 50%; }
.channel-head h1 { font-size: 22px; margin: 0; }

/* ---------- thanh tab dưới ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; background: var(--glass); border-top: 1px solid var(--line); backdrop-filter: blur(12px);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--muted); }
.tabbar a.active { color: var(--text); }
.tabbar a.active svg { color: var(--accent); }

/* ---------- mini player ---------- */
.mini {
  position: fixed; left: 0; right: 0; z-index: 29;
  bottom: calc(var(--tab-h) + var(--safe-b)); height: var(--mini-h);
  display: flex; align-items: center; gap: 4px; padding: 0 4px 0 0;
  background: var(--bg2); border-top: 1px solid var(--line);
}
.mini img { width: calc(var(--mini-h) * 16 / 9); height: 100%; object-fit: cover; background: #000; }
.mini-text { flex: 1; min-width: 0; padding: 0 8px; cursor: pointer; }
.mini-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-progress { position: absolute; left: 0; right: 0; top: -2px; height: 2px; background: var(--track); }
.mini-progress i { display: block; height: 100%; width: 0; background: var(--accent); }
@media (min-width: 640px) { .mini { left: auto; right: 16px; bottom: calc(var(--tab-h) + var(--safe-b) + 16px); width: 420px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); } .mini-progress { top: 0; } }

/* ---------- trang xem ---------- */
.watch {
  position: fixed; inset: 0; z-index: 40; background: var(--bg);
  transform: translateY(100%); visibility: hidden;
  transition: transform .28s cubic-bezier(.2,.8,.2,1), visibility 0s .28s;
  overflow-y: auto; overscroll-behavior: contain;
}
.watch.open { transform: none; visibility: visible; transition: transform .28s cubic-bezier(.2,.8,.2,1); }
.watch-inner { max-width: 1700px; margin: 0 auto; padding-bottom: calc(24px + var(--safe-b)); }
.player-col { min-width: 0; }
.player {
  position: sticky; top: 0; z-index: 3;
  aspect-ratio: 16/9; max-height: 75vh; width: 100%; background: #000; overflow: hidden; user-select: none;
  color: #fff; --ring: rgba(255,255,255,.18); --track: rgba(255,255,255,.25); --track-buf: rgba(255,255,255,.55);
  padding-top: 0;
}
@media (max-width: 899px) { .player { margin-top: var(--safe-t); } .watch { background: var(--bg); } }
.player video, .player .poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.player .poster { object-fit: cover; filter: blur(0); }
.player.audio-only .poster { object-fit: contain; }
.player:not(.audio-only) .poster.hide { display: none; }
.player-spinner { position: absolute; inset: 0; display: none; place-items: center; pointer-events: none; z-index: 1; }
.player.loading .player-spinner { display: grid; }

.controls {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; justify-content: space-between;
  background: rgba(0,0,0,.45); opacity: 0; transition: opacity .2s; pointer-events: none;
}
.player.show-ctl .controls, .player.paused .controls { opacity: 1; pointer-events: auto; }
.ctl-top, .ctl-bottom { display: flex; align-items: center; gap: 4px; padding: 6px 8px; }
.ctl-center { display: flex; align-items: center; justify-content: center; gap: 36px; }
.ctl-bottom { flex-wrap: wrap; position: relative; padding-bottom: 14px; }
.time { font-size: 12.5px; font-variant-numeric: tabular-nums; padding-left: 6px; text-shadow: 0 0 4px #000; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 16px; background: rgba(0,0,0,.55); font-size: 12.5px; font-weight: 600; }
.pill svg { width: 18px; height: 18px; }
.pill.on { background: var(--accent); color: var(--accent-ink); }

input[type=range]#seek {
  position: absolute; left: 8px; right: 8px; bottom: 2px; width: calc(100% - 16px);
  -webkit-appearance: none; appearance: none; height: 20px; background: transparent; margin: 0; cursor: pointer;
  --p: 0%; --b: 0%;
}
#seek::-webkit-slider-runnable-track, .seekbar::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--accent) var(--p), var(--track-buf) var(--p), var(--track-buf) var(--b), var(--track) var(--b)); }
#seek::-moz-range-track, .seekbar::-moz-range-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--accent) var(--p), var(--track-buf) var(--p), var(--track-buf) var(--b), var(--track) var(--b)); }
#seek::-webkit-slider-thumb, .seekbar::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); margin-top: -5px; border: 0; }
#seek::-moz-range-thumb, .seekbar::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 0; }

.seek-flash { position: absolute; top: 50%; transform: translateY(-50%); padding: 10px 16px; border-radius: 24px; background: rgba(0,0,0,.6); font-weight: 600; opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 3; }
.seek-flash.left { left: 12%; } .seek-flash.right { right: 12%; }
.seek-flash.show { opacity: 1; transition: none; }

.player:fullscreen { max-height: none; aspect-ratio: auto; }
.player:-webkit-full-screen { max-height: none; }

.info { padding: 12px 16px 0; }
.info h1 { font-size: 18px; line-height: 1.35; margin: 0 0 6px; font-weight: 600; }
.info .stats { color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 8px; overflow-x: auto; margin: 12px -16px 4px; padding: 0 16px 4px; scrollbar-width: none; }
.actions::-webkit-scrollbar { display: none; }
.actions .btn { flex: none; font-size: 13px; padding: 7px 14px; }
.actions .btn.on { background: var(--accent); color: var(--accent-ink); }
.owner { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.owner .avatar { width: 40px; height: 40px; }
.owner .name { font-weight: 600; }
.desc { background: var(--bg2); border-radius: 12px; padding: 10px 12px; margin: 8px 0 12px; font-size: 13.5px; cursor: pointer; }
.desc-text { white-space: pre-wrap; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.desc-more { display: block; margin-top: 4px; font-weight: 600; }
.desc.open { cursor: auto; }
.desc.open .desc-text { display: block; }
.desc.open .desc-more { display: none; }
.desc a { color: var(--accent); }

.upnext { padding: 0 16px; }
.upnext h3 { font-size: 16px; margin: 14px 0 8px; display: flex; align-items: center; gap: 8px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 400; cursor: pointer; }
.switch i { width: 36px; height: 20px; border-radius: 10px; background: var(--bg3); position: relative; transition: background .2s; }
.switch i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #ddd; transition: transform .2s; }
.switch.on i { background: var(--accent); }
.switch.on i::after { transform: translateX(16px); background: #fff; }

@media (min-width: 900px) {
  .watch-inner { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; padding: 24px; }
  .player { position: relative; border-radius: 12px; }
  .info { padding: 12px 0 0; }
  .actions { margin-inline: 0; padding-inline: 0; }
  .upnext { padding: 0; }
  .upnext h3 { margin-top: 0; }
  .watch .ctl-top #watchMin { transform: none; }
}

/* ---------- bottom sheet & toast ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.55); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; max-height: 80vh; overflow: auto;
  background: var(--bg2); border-radius: 16px 16px 0 0; padding: 8px 0 calc(8px + var(--safe-b));
  animation: up .2s ease-out;
}
@media (min-width: 640px) { .sheet { left: 50%; right: auto; bottom: 50%; transform: translate(-50%, 50%); width: 380px; border-radius: 16px; animation: none; } }
@keyframes up { from { transform: translateY(100%); } }
.sheet h4 { margin: 8px 20px 8px; font-size: 15px; color: var(--muted); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet button.opt { display: flex; width: 100%; align-items: center; gap: 16px; padding: 13px 20px; text-align: left; }
.sheet button.opt:active, .sheet button.opt:hover { background: var(--bg3); }
.sheet button.opt .chk { margin-left: auto; color: var(--accent); }
.sheet .handle { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 6px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--mini-space, 0px) + var(--safe-b) + 16px); z-index: 70;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .2s;
  background: var(--toast-bg); color: var(--toast-ink); padding: 10px 16px; border-radius: 8px; font-weight: 500; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- tối ưu hiển thị ---------- */
/* chỉ vẽ những thẻ đang ở gần màn hình -> cuộn danh sách dài vẫn mượt */
.grid > .card { content-visibility: auto; contain-intrinsic-size: auto 320px; }
.list > .item { content-visibility: auto; contain-intrinsic-size: auto 104px; }
.thumb img { background: var(--bg3); }

/* chế độ danh sách gọn ở trang chính */
main .list { gap: 2px; }
main .list .item { padding: 6px 0; }
@media (min-width: 900px) {
  main .list { display: grid; grid-template-columns: repeat(auto-fill, minmax(520px, 1fr)); gap: 8px 24px; }
  main .list .item .thumb { width: 240px; }
}

/* thanh tiến trình mảnh luôn thấy ở đáy player (ẩn khi hiện bộ điều khiển) */
.pbar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.2); z-index: 2; pointer-events: none; transition: opacity .2s; }
.pbar i { display: block; height: 100%; width: 0; background: var(--accent); }
.player.show-ctl .pbar, .player.paused .pbar { opacity: 0; }

/* xoay ngang điện thoại -> player chiếm toàn màn hình (không cần cú chạm như Fullscreen API) */
@media (orientation: landscape) and (max-height: 500px) {
  .watch.open .player {
    position: fixed; inset: 0; z-index: 45; margin: 0;
    width: 100vw; height: 100dvh; max-height: none; aspect-ratio: auto; border-radius: 0;
  }
  .watch.open .player .ctl-top, .watch.open .player .ctl-bottom { padding-inline: max(8px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-right)); }
}

/* ---------- tablet & màn ô tô ---------- */
.car-now { display: none; }

/* màn cảm ứng cỡ tablet trở lên: vùng chạm lớn hơn */
@media (pointer: coarse) and (min-width: 640px) {
  .icon-btn { width: 48px; height: 48px; }
  .icon-btn.big { width: 60px; height: 60px; }
  .icon-btn.big svg { width: 44px; height: 44px; }
  .icon-btn.huge { width: 80px; height: 80px; }
  .icon-btn.huge svg { width: 52px; height: 52px; }
  .chip { padding: 10px 18px; }
  .pill { padding: 8px 14px; }
  .actions .btn { padding: 10px 16px; }
  .searchbox { height: 46px; border-radius: 23px; }
  .ctl-bottom { padding-bottom: 20px; }
  input[type=range]#seek { height: 32px; }
  #seek::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; }
  #seek::-moz-range-track { height: 6px; border-radius: 3px; }
  #seek::-webkit-slider-thumb { width: 20px; height: 20px; margin-top: -7px; }
  #seek::-moz-range-thumb { width: 20px; height: 20px; }
  .sheet button.opt { padding: 16px 22px; }
}

/* thanh điều hướng dọc bên trái thay cho thanh tab dưới (tablet cảm ứng, ô tô) */
html.rail { --tab-h: 0px; }
html.rail .tabbar {
  top: calc(var(--top-h) + var(--safe-t)); right: auto; width: var(--rail-w); height: auto;
  flex-direction: column; justify-content: flex-start; gap: 8px; padding: 8px 0 var(--safe-b);
  border-top: 0; border-right: 1px solid var(--line);
}
html.rail .tabbar a { flex: none; height: 72px; font-size: 12px; gap: 4px; }
html.rail main { padding-left: calc(var(--rail-w) + 16px); }
html.rail .chips { margin-left: -16px; }

/* tablet dọc: video trên cùng, bên dưới chia đôi thông tin | tiếp theo (mỗi cột tự cuộn) */
@media (min-width: 640px) and (max-width: 899px) and (min-height: 700px) {
  .watch { overflow: hidden; }
  .watch-inner {
    display: grid; height: 100dvh; padding: var(--safe-t) 0 0;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 0 16px;
  }
  .player-col { display: contents; }
  .player { grid-column: 1 / -1; position: relative; margin-top: 0; max-height: 50dvh; }
  .info, .upnext { overflow-y: auto; overscroll-behavior: contain; padding-bottom: calc(24px + var(--safe-b)); }
  .info { padding-right: 0; }
  .upnext { padding-left: 0; }
  .actions { flex-wrap: wrap; overflow: visible; margin-right: 0; }
}

/* màn ngang thấp (tablet ngang, laptop, ô tô): video vừa chiều cao màn, cột "Tiếp theo" co giãn */
@media (min-width: 900px) and (max-height: 800px) {
  .watch-inner { grid-template-columns: minmax(0, 1fr) clamp(300px, 30vw, 560px); gap: 16px; padding: 12px; }
  .player { max-height: none; width: min(100%, calc((100dvh - 24px) * 16 / 9)); margin-inline: auto; }
}

/* ---------- chế độ ô tô ---------- */
html.car {
  --top-h: 64px; --rail-w: 104px; --mini-h: 84px;
  --muted: var(--muted-strong);
}
html.car body { font-size: 17px; }
html.car .icon-btn { width: 56px; height: 56px; }
html.car .icon-btn svg { width: 30px; height: 30px; }
html.car .searchbox { height: 52px; border-radius: 26px; flex-basis: 640px; }
html.car .searchbox input { font-size: 20px; }
html.car .suggest li { padding: 16px 20px; font-size: 19px; }
html.car .chip { padding: 12px 22px; font-size: 17px; border-radius: 12px; }
html.car .tabbar a { height: 88px; font-size: 14px; }
html.car .tabbar a svg { width: 32px; height: 32px; }
html.car h2.section { font-size: 22px; }
html.car .title { font-size: 18px; }
html.car .sub { font-size: 15px; }
html.car .grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
html.car .grid .avatar { display: none; }
html.car .card .icon-btn, html.car .item .icon-btn { width: 48px; height: 48px; margin: -8px -8px 0 0; }
html.car .item .thumb { width: 220px; }
html.car .sheet { width: 480px; }
html.car .sheet h4 { font-size: 18px; }
html.car .sheet button.opt { padding: 18px 24px; font-size: 19px; }
html.car .toast { font-size: 18px; padding: 14px 20px; }
html.car .btn { padding: 12px 20px; font-size: 17px; }
html.car .mini { width: 520px; }
html.car .mini-title { font-size: 18px; }
html.car .mini-sub { font-size: 15px; }

/* trang xem ở chế độ ô tô: [video | bảng điều khiển lớn] trên, danh sách tiếp theo dưới */
html.car .watch { overflow: hidden; }
html.car .watch-inner {
  display: grid; height: 100dvh; max-width: none; padding: 16px; gap: 16px 24px;
  grid-template-columns: min(58%, calc(56dvh * 16 / 9)) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
}
html.car .player-col { display: contents; }
html.car .watch.open .player {
  grid-column: 1; grid-row: 1; position: relative; inset: auto; z-index: 3; margin: 0;
  width: 100%; height: auto; max-height: none; aspect-ratio: 16/9; border-radius: 16px;
}
html.car .player .controls, html.car .seek-flash { display: none; }
/* toàn màn hình (khi đỗ xe): hiện lại bộ điều khiển trên video, có nút thoát */
html.car .watch.open .player:fullscreen { aspect-ratio: auto; width: 100%; height: 100%; border-radius: 0; }
html.car .player:fullscreen .controls { display: flex; }
html.car .player:fullscreen .ctl-top #watchMin { display: none; }
html.car .player:fullscreen .pbar { opacity: 0; }
html.car .player:fullscreen .icon-btn { width: 64px; height: 64px; }
html.car .player:fullscreen .icon-btn.big svg { width: 48px; height: 48px; }
html.car .player:fullscreen .icon-btn.huge { width: 96px; height: 96px; }
html.car .player:fullscreen .icon-btn.huge svg { width: 60px; height: 60px; }
html.car .pbar { height: 5px; }
html.car .player.show-ctl .pbar, html.car .player.paused .pbar { opacity: 1; }
html.car .info { display: none; }
html.car .car-now {
  grid-column: 2; grid-row: 1; min-width: 0;
  display: flex; flex-direction: column; justify-content: center; gap: 14px;
}
html.car .upnext { grid-column: 1 / -1; grid-row: 2; overflow-y: auto; overscroll-behavior: contain; padding: 0; }
html.car .upnext h3 { font-size: 20px; margin: 4px 0 10px; }
html.car .upnext .switch { font-size: 16px; }
.un-tabs { gap: 10px; }
.un-tabs .chip { font-size: 17px; }
html.car .upnext .link { font-size: 16px; color: var(--accent); font-weight: 500; padding: 8px 4px; }
html.car .upnext .list { flex-direction: row; gap: 16px; overflow-x: auto; scrollbar-width: none; padding-bottom: 8px; }
html.car .upnext .list::-webkit-scrollbar { display: none; }
html.car .upnext .item { flex: none; width: 260px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 4px; padding: 0; contain-intrinsic-size: auto 240px; }
html.car .upnext .item.now { padding: 0; }
html.car .upnext .item .thumb { width: 100%; grid-column: 1 / -1; border-radius: 12px; }
html.car .upnext .item .sub + .sub { display: none; }
html.car .upnext .loader { justify-content: start; }

.cn-title { font-size: 26px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cn-sub { font-size: 19px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cn-seek .seekbar { width: 100%; height: 36px; margin: 0; -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; --p: 0%; --b: 0%; }
.cn-seek .seekbar::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; }
.cn-seek .seekbar::-moz-range-track { height: 8px; border-radius: 4px; }
.cn-seek .seekbar::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -9px; }
.cn-seek .seekbar::-moz-range-thumb { width: 26px; height: 26px; }
.cn-time { display: flex; justify-content: space-between; font-size: 17px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cn-ctl { display: flex; align-items: center; justify-content: space-between; max-width: 560px; width: 100%; margin: 0 auto; }
html.car .cn-ctl .icon-btn { width: 76px; height: 76px; position: relative; }
html.car .cn-ctl .icon-btn svg { width: 44px; height: 44px; }
.cn-ctl small { position: absolute; bottom: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
html.car .cn-ctl .cn-play { width: 96px; height: 96px; background: var(--accent); color: var(--accent-ink); }
html.car .cn-ctl .cn-play svg { width: 56px; height: 56px; }
.cn-opts { display: flex; gap: 8px; max-width: 640px; width: 100%; margin: 0 auto; }
.cn-tile {
  flex: 1 1 0; min-width: 0; min-height: 68px; padding: 8px 4px; border-radius: 14px; background: var(--bg3);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 14px; font-weight: 500;
}
.cn-tile span { font-size: 13px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cn-tile svg { width: 28px; height: 28px; }
.cn-tile:active { background: var(--line); }
.cn-tile.on { background: var(--accent); color: var(--accent-ink); }
/* bảng điều khiển hẹp (màn ~1024px): chữ nhỏ lại để 6 ô vẫn đọc đủ */
html.car .car-now { container-type: inline-size; }
@container (max-width: 460px) {
  .cn-opts { gap: 6px; }
  .cn-tile { padding: 8px 2px; }
  .cn-tile span { font-size: 12px; }
}

/* thẻ "Tiếp tục nghe" ở trang chủ (chế độ ô tô) */
.resume {
  display: flex; align-items: center; gap: 20px; margin: 4px 0 8px; padding: 12px; cursor: pointer;
  border-radius: 18px; background: color-mix(in srgb, var(--accent) 16%, var(--bg2)); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.resume img { width: 200px; aspect-ratio: 16/9; object-fit: cover; border-radius: 12px; flex: none; background: var(--bg3); }
.resume-text { flex: 1; min-width: 0; }
.resume-label { color: var(--accent); font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.resume .title { font-size: 21px; }
.resume .sub { font-size: 16px; }
.resume-play { width: 80px; height: 80px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.resume-play svg { width: 48px; height: 48px; }

/* màn ô tô rất thấp (~600px): thu gọn bảng điều khiển */
@media (max-height: 640px) {
  html.car .car-now { gap: 8px; }
  .cn-title { font-size: 22px; -webkit-line-clamp: 1; }
  .cn-sub { font-size: 16px; }
  html.car .cn-ctl .icon-btn { width: 64px; height: 64px; }
  html.car .cn-ctl .cn-play { width: 80px; height: 80px; }
  .cn-tile { min-height: 58px; font-size: 13px; }
  .cn-tile svg { width: 24px; height: 24px; }
  .resume img { width: 160px; }
  .resume-play { width: 64px; height: 64px; }
  html.car .upnext .item { width: 200px; }
  html.car .upnext h3 { margin-bottom: 6px; }
}

/* nút sáng/tối/theo hệ thống */
#themeBtn svg { width: 22px; height: 22px; }
html.car #themeBtn svg { width: 28px; height: 28px; }
