:root {
  --bg: #0e0f13;
  --panel: #171920;
  --panel-2: #1f222b;
  --line: #2a2e3a;
  --text: #eceef3;
  --muted: #8b91a1;
  --accent: #ff3d5a;
  --accent-2: #ff7a45;
  --ok: #2ecc8f;
  --radius: 14px;
  --r-sm: 10px;
  --r-item: 12px;
  --r-pill: 999px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-size: 15px;
  --body-bg: radial-gradient(1200px 600px at 10% -10%, #2a1420 0%, transparent 60%), var(--bg);
  --topbar-bg: rgba(14, 15, 19, .9);
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  --on-accent: #fff;
  --mine-bg: var(--grad);
  --mine-text: #fff;
  --shadow: rgba(0, 0, 0, .6);
  --player-shadow: 0 20px 60px rgba(0, 0, 0, .45);
  --idle-bg: linear-gradient(135deg, #1b1c24, #12131a);
  --danger-bg: #5a1520;
  --admin-line: #5a3a14;
  --error: #ff8a9a;
  --name-l: 70%; /* độ sáng màu tên người trong chat */
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--body-bg);
  color: var(--text);
  font: var(--font-size)/1.45 var(--font);
  min-height: 100vh;
}
button, input { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error-text { color: var(--error); }

/* ---------- Top bar ---------- */
.topbar {
  display: grid; grid-template-columns: 1fr minmax(0, 640px) 1fr; align-items: center; gap: 20px;
  padding: 12px 24px; border-bottom: 1px solid var(--line); height: 66px;
  background: var(--topbar-bg);
}
/* Cả khối đầu trang (menu giả + thanh tìm kiếm + hàng cột) dính ở đỉnh khi cuộn */
.header-stack { position: sticky; top: 0; z-index: 10; background: var(--topbar-bg); backdrop-filter: blur(10px); }
.brand { font-weight: 800; font-size: 18px; letter-spacing: .2px; white-space: nowrap; }
.topbar .chip { justify-self: end; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); flex-shrink: 0; }
.chip {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 6px 12px; cursor: pointer; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip:hover { border-color: var(--muted); }

/* ---------- Layout ---------- */
.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; align-items: start;
  max-width: 1500px; margin: 0 auto; padding: 24px;
}
/* Chat luôn hiện bên phải, cao hết màn hình, không cuộn theo trang */
/* --header-h do JS đo từ chiều cao thật của khối đầu trang (khác nhau theo theme) */
.side {
  position: sticky; top: calc(var(--header-h, 66px) + 24px);
  height: calc(100vh - var(--header-h, 66px) - 48px - var(--footer-h, 0px)); min-height: 420px;
}
.section { margin-top: 16px; padding: 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head h3 { margin: 0; font-size: 16px; }
.seg { display: flex; gap: 4px; flex-wrap: wrap; }
.seg-btn {
  background: none; border: 0; padding: 7px 12px; border-radius: var(--r-sm); cursor: pointer;
  color: var(--muted); font-weight: 700; white-space: nowrap;
}
.seg-btn.active { background: var(--panel-2); color: var(--text); }
.seg-btn:hover { color: var(--text); }

@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 16px; gap: 16px; }
  .side { position: static; height: 75vh; }
  .topbar {
    grid-template-columns: 1fr auto; grid-template-areas: "brand me" "search search";
    height: auto; padding: 10px 16px; gap: 10px;
  }
  .brand { grid-area: brand; }
  .topbar .chip { grid-area: me; }
  .add-wrap { grid-area: search; }
  .hint-inline { display: none; }
}
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }

/* ---------- Player ---------- */
.player-wrap {
  position: relative; aspect-ratio: 16 / 9; background: #000;
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
  box-shadow: var(--player-shadow);
}
.player-wrap iframe, #player { position: absolute; inset: 0; width: 100%; height: 100%; }
.shield { position: absolute; inset: 0; z-index: 1; }
.idle {
  position: absolute; inset: 0; z-index: 3; display: grid; place-content: center; text-align: center;
  background: var(--idle-bg); color: var(--muted);
}
.idle div { font-size: 56px; }
.unmute {
  position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%); z-index: 2;
  border: 0; border-radius: var(--r-pill); padding: 10px 18px; cursor: pointer; font-weight: 700; color: var(--on-accent);
  background: var(--grad); box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}

.now { display: flex; align-items: center; gap: 16px; padding: 16px 18px; margin-top: 16px; }
.now-info { flex: 1; min-width: 0; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--accent); font-weight: 700; }
.now h2 { margin: 2px 0; font-size: 20px; line-height: 1.3; overflow-wrap: anywhere; }

.progress { height: 4px; background: var(--line); border-radius: 4px; margin: 14px 2px 6px; overflow: hidden; }
#progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 1s linear; }
.controls { display: flex; align-items: center; gap: 8px; padding: 0 2px; }
.controls .times { flex: 1; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.controls .icon { font-size: 16px; padding: 4px 6px; }
#volume { width: 110px; padding: 0; accent-color: var(--accent); background: none; border: 0; }
.player-wrap:fullscreen { border-radius: 0; border: 0; }

/* ---------- Buttons & inputs ---------- */
.btn {
  border: 1px solid var(--line); background: var(--panel-2); border-radius: var(--r-sm);
  padding: 9px 14px; cursor: pointer; white-space: nowrap; transition: .15s;
}
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--grad); border: 0; font-weight: 700; color: var(--on-accent); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.ghost.on { border-color: var(--accent); color: var(--accent); }
.btn.danger.confirm { background: var(--danger-bg); border-color: var(--accent); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.big { padding: 13px; font-size: 16px; width: 100%; }

input {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; outline: none; min-width: 0;
}
input:focus { border-color: var(--accent); }

.add { display: flex; gap: 8px; }
.add input { flex: 1; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.admin { padding: 12px; margin-top: 16px; border-color: var(--admin-line); }
.admin input { flex: 1; }

.badge { background: var(--accent); color: var(--on-accent); border-radius: var(--r-pill); padding: 0 7px; font-size: 12px; margin-left: 4px; }
.hint { font-size: 13px; margin: 4px 4px 10px; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-item); width: 100%; text-align: left;
}
.item img { width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; flex-shrink: 0; background: #000; }
.item .info { flex: 1; min-width: 0; }
.item .title { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank { width: 18px; text-align: center; color: var(--muted); font-weight: 700; flex-shrink: 0; }
.list li:first-child .rank { color: var(--accent); }
.empty { padding: 24px; text-align: center; border: 1px dashed var(--line); border-radius: var(--r-item); }

.vote {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 46px; padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.1;
  transition: .15s;
}
.vote b { font-size: 15px; color: var(--text); }
.vote:hover { border-color: var(--accent); }
.vote.on { background: var(--grad); border-color: transparent; color: var(--on-accent); }
.vote.on b { color: var(--on-accent); }

.icon {
  background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; flex-shrink: 0;
}
.icon:hover { color: var(--text); background: var(--panel-2); }

.pl { cursor: pointer; }
.pl:hover { border-color: var(--muted); }
.pl-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.pl-head .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#queue .item, #panel-playlists .item { background: var(--panel-2); }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px;
  background: rgba(5, 5, 8, .75); backdrop-filter: blur(8px);
}
.modal-box {
  width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  padding: 28px; display: flex; flex-direction: column; gap: 12px; text-align: center;
  box-shadow: 0 30px 80px var(--shadow);
}
.modal-box .logo { font-size: 44px; }
.modal-box h1 { margin: 0; }
.modal-box p { margin: 0 0 8px; }
.modal-box input { padding: 12px 14px; text-align: center; font-size: 16px; }

/* ---------- Toasts ---------- */
#toasts {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 30;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(480px, calc(100% - 32px));
}
.toast {
  background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4); animation: in .25s ease; transition: opacity .4s, transform .4s; text-align: center;
}
.toast.error { border-color: var(--accent); color: var(--error); }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Mọi người (hiện khi rê chuột / bấm vào số người trên khung chat) ---------- */
.people-wrap { position: relative; }
.people-btn {
  display: flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 5px 12px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.people-btn:hover { border-color: var(--muted); }
.people-pop {
  display: none; position: absolute; right: 0; top: 100%; z-index: 6; margin-top: 0;
  width: 280px; max-height: 360px; overflow-y: auto; padding: 10px;
  background: var(--panel); box-shadow: 0 20px 50px var(--shadow);
}
/* khoảng đệm vô hình để chuột đi từ nút xuống danh sách không bị mất hover */
.people-pop::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
.people-wrap:hover .people-pop, .people-wrap.open .people-pop { display: block; }
@media (hover: none) { .people-wrap:hover:not(.open) .people-pop { display: none; } }
.pop-title { margin: 0 4px 8px; }
.people-pop .list { gap: 6px; }
.people-pop .item { background: var(--panel-2); }
.avatar {
  --h: 0;
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 70% 50%), hsl(calc(var(--h) + 40) 70% 42%));
}
.person { padding: 10px 14px 10px 10px; }
.person .title { -webkit-line-clamp: 1; }
.tag {
  font-size: 11px; font-weight: 700; color: var(--accent); border: 1px solid var(--accent);
  border-radius: 999px; padding: 0 6px; margin-left: 4px; vertical-align: 1px;
}

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; height: 100%; }
.chat-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.chat-list { list-style: none; margin: 0; padding: 14px; flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.chat-list .empty { margin: auto 0; }
.msg { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; max-width: 88%; }
.msg.grouped { margin-top: 2px; padding-left: 44px; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg.mine.grouped { padding-left: 0; }
.msg .avatar { width: 32px; height: 32px; font-size: 14px; align-self: flex-start; margin-top: 18px; }
.bubble-wrap { min-width: 0; display: flex; flex-direction: column; }
.msg.mine .bubble-wrap { align-items: flex-end; }
.msg-head { font-size: 12px; margin: 0 4px 3px; }
.bubble {
  background: var(--panel-2); border: 1px solid var(--line); padding: 7px 12px; border-radius: 16px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.mine .bubble { background: var(--mine-bg); border-color: transparent; color: var(--mine-text); }
.bubble a { color: inherit; text-decoration: underline; }
.bubble .btn { margin-top: 6px; display: inline-block; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; }


.modal-box h2 { margin: 0 0 4px; }
.modal-actions { justify-content: flex-end; margin-top: 4px; }
.modal-actions .btn { flex: 1; }

/* ---------- Tìm kiếm ---------- */
.add-wrap { position: relative; }
.search-box {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); padding: 8px;
  background: var(--panel); box-shadow: 0 24px 60px var(--shadow);
}
.search-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 8px; gap: 8px; }
#search-results { max-height: min(560px, calc(100vh - 140px)); overflow-y: auto; }
#search-results .item { background: var(--panel-2); }
input[type="search"]::-webkit-search-cancel-button { filter: invert(.6); }

/* ---------- Điện thoại: thu gọn danh sách để tên bài có chỗ hiển thị ---------- */
@media (max-width: 960px) {
  .section { padding: 10px; }
  .item { gap: 8px; padding: 6px; }
  .item img { width: 64px; }
  .rank { width: 12px; }
  .vote { min-width: 40px; padding: 5px 6px; }
}

/* ---------- Sticker ---------- */
.chat-form { position: relative; align-items: center; }
.sticker-btn { font-size: 20px; padding: 4px 6px; }
.sticker-pop {
  position: absolute; left: 10px; right: 10px; bottom: calc(100% + 6px); z-index: 6; padding: 10px;
  background: var(--panel); box-shadow: 0 -10px 40px var(--shadow);
}
.sticker-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 4px;
  max-height: 240px; overflow-y: auto;
}
.sticker-pick {
  background: none; border: 0; border-radius: 10px; padding: 6px; cursor: pointer; aspect-ratio: 1;
  display: grid; place-items: center; transition: transform .12s, background .12s;
}
.sticker-pick:hover { background: var(--panel-2); transform: scale(1.15); }
.sticker-pick img { width: 100%; height: 100%; object-fit: contain; }
.sticker img { width: 96px; height: 96px; object-fit: contain; display: block; }
.sticker-fallback { font-size: 64px; line-height: 1.1; }
.sticker-pick .sticker-fallback { font-size: 28px; }
.msg.mine .sticker { align-self: flex-end; }

/* ---------- Kéo đổi kích thước video ---------- */
.player-wrap { width: var(--player-w, 100%); max-width: 100%; margin: 0 auto; }
.player-wrap.resizing iframe { pointer-events: none; }
.player-wrap:fullscreen { width: 100%; }
.resize-handle {
  position: absolute; right: 0; bottom: 0; z-index: 4; width: 26px; height: 26px; cursor: nwse-resize;
  touch-action: none; opacity: .55; transition: opacity .15s;
  background: linear-gradient(135deg, transparent 0 55%, rgba(255, 255, 255, .85) 55% 62%, transparent 62% 72%, rgba(255, 255, 255, .85) 72% 79%, transparent 79%);
}
.player-wrap:hover .resize-handle, .player-wrap.resizing .resize-handle { opacity: 1; }
.player-wrap:fullscreen .resize-handle { display: none; }

/* ---------- Chọn theme ---------- */
.top-right { display: flex; align-items: center; gap: 8px; justify-self: end; min-width: 0; }
.theme-wrap { position: relative; }
.theme-pop {
  display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 12; min-width: 180px; padding: 6px;
  background: var(--panel); box-shadow: 0 20px 50px var(--shadow);
}
.theme-wrap.open .theme-pop { display: block; }
.theme-opt {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-radius: var(--r-sm);
  background: none; cursor: pointer; text-align: left;
}
.theme-opt:hover { background: var(--panel-2); }
.theme-opt.active { color: var(--accent); font-weight: 700; }
.theme-opt.active::after { content: "✓"; margin-left: auto; }

/* Các phần trang trí của theme Bảng tính / Tài liệu: mặc định ẩn */
.app-chrome, .sheet-cols, .sheet-tabs, .doc-ruler { display: none; }

@media (max-width: 960px) {
  .topbar { grid-template-areas: "brand right" "search search"; }
  .top-right { grid-area: right; }
  #theme-name { display: none; }
}

/* =====================================================================
   Theme: Sáng
   ===================================================================== */
[data-theme="light"] {
  --bg: #f3f4f7;
  --panel: #ffffff;
  --panel-2: #f1f2f5;
  --line: #e0e3e9;
  --text: #17181c;
  --muted: #697080;
  --body-bg: radial-gradient(1200px 600px at 10% -10%, #ffe0e6 0%, transparent 60%), var(--bg);
  --topbar-bg: rgba(255, 255, 255, .9);
  --shadow: rgba(30, 30, 60, .18);
  --player-shadow: 0 16px 40px rgba(30, 30, 60, .15);
  --idle-bg: linear-gradient(135deg, #eef0f4, #e2e5eb);
  --danger-bg: #ffe1e6;
  --admin-line: #f0c48a;
  --error: #d0334b;
  --name-l: 40%;
}
[data-theme="light"] input[type="search"]::-webkit-search-cancel-button { filter: none; }

/* =====================================================================
   Theme chung cho Bảng tính / Tài liệu: thanh tiêu đề + menu kiểu ứng dụng văn phòng
   ===================================================================== */
[data-theme="sheets"], [data-theme="docs"] {
  --text: #202124;
  --muted: #5f6368;
  --on-accent: #fff;
  --font: Arial, Roboto, Helvetica, sans-serif;
  --font-size: 13px;
  --shadow: rgba(60, 64, 67, .3);
  --player-shadow: none;
  --idle-bg: #f8f9fa;
  --danger-bg: #fce8e6;
  --admin-line: #dadce0;
  --error: #d93025;
  --name-l: 35%;
}
[data-theme="sheets"] .app-chrome, [data-theme="docs"] .app-chrome {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px 2px;
}
.doc-icon {
  width: 24px; height: 32px; flex-shrink: 0; border-radius: 3px;
  clip-path: polygon(0 0, 67% 0, 100% 25%, 100% 100%, 0 100%);
}
[data-theme="sheets"] .doc-icon {
  background:
    linear-gradient(#fff, #fff) 5px 19px / 14px 2px no-repeat,
    linear-gradient(#fff, #fff) 11px 13px / 2px 12px no-repeat,
    linear-gradient(#1e8e3e, #1e8e3e) 7px 15px / 10px 8px no-repeat,
    linear-gradient(#fff, #fff) 5px 13px / 14px 12px no-repeat,
    #1e8e3e;
}
[data-theme="docs"] .doc-icon {
  background: repeating-linear-gradient(#fff 0 2px, transparent 2px 4px) 6px 14px / 12px 12px no-repeat, #1a73e8;
}
.doc-title { font-size: 18px; color: #1f1f1f; line-height: 1.3; }
.doc-menu { display: flex; gap: 2px; flex-wrap: wrap; font-size: 14px; color: #1f1f1f; }
.doc-menu span { padding: 2px 7px; border-radius: 4px; cursor: default; }
.doc-menu span:hover { background: rgba(60, 64, 67, .08); }
[data-theme="docs"] .sheets-only { display: none; }
[data-theme="sheets"] .brand, [data-theme="docs"] .brand { display: none; }
[data-theme="sheets"] .topbar, [data-theme="docs"] .topbar {
  grid-template-columns: minmax(0, 1fr) auto; height: auto; padding: 6px 16px; gap: 12px;
  border-bottom: 0;
}
[data-theme="sheets"] .chip, [data-theme="docs"] .chip { font-size: 13px; }

/* =====================================================================
   Theme: Bảng tính (giống Google Sheets)
   ===================================================================== */
[data-theme="sheets"] {
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-2: #ffffff;
  --line: #e1e3e1;
  --accent: #188038;
  --accent-2: #188038;
  --ok: #188038;
  --grad: #188038;
  --mine-bg: #e6f4ea;
  --mine-text: #202124;
  --body-bg: #ffffff;
  --topbar-bg: #f9fbfd;
  --radius: 0;
  --r-sm: 4px;
  --r-item: 0;
  --r-pill: 4px;
}
[data-theme="sheets"] .app-chrome { background: #f9fbfd; }
/* ô tìm kiếm thành thanh công thức "fx" */
[data-theme="sheets"] .topbar { background: #fff; border-top: 1px solid #e1e3e1; border-bottom: 1px solid #c4c7c5; padding: 2px 16px; }
[data-theme="sheets"] .add { align-items: center; gap: 0; }
[data-theme="sheets"] .add::before {
  content: "fx"; font: italic 15px Georgia, serif; color: #5f6368; padding: 0 12px 0 4px;
  border-right: 1px solid #e1e3e1; margin-right: 8px;
}
[data-theme="sheets"] .add input { border: 0; padding: 6px 4px; background: transparent; }
[data-theme="sheets"] .add .btn { padding: 5px 12px; }
[data-theme="sheets"] .sheet-cols {
  display: flex; overflow: hidden; background: #f8f9fa; border-bottom: 1px solid #c4c7c5;
  font-size: 11px; color: #5f6368;
}
[data-theme="sheets"] .sheet-cols span { flex: 0 0 100px; text-align: center; padding: 3px 0; border-right: 1px solid #e1e3e1; }
[data-theme="sheets"] .sheet-cols .corner { flex-basis: 46px; border-right: 1px solid #c4c7c5; }
/* lưới ô tính phía sau nội dung + cột số dòng bên trái */
[data-theme="sheets"] .layout {
  max-width: none; margin: 0; padding: 16px 16px 48px 62px; gap: 16px;
  grid-template-columns: minmax(0, 1fr) 380px; min-height: calc(100vh - 120px);
  background:
    linear-gradient(90deg, #f8f9fa 0 46px, #c4c7c5 46px 47px, transparent 47px),
    linear-gradient(#e1e3e1 1px, transparent 1px) 0 0 / 100% 21px,
    linear-gradient(90deg, #e1e3e1 1px, transparent 1px) 47px 0 / 100px 100%;
}
[data-theme="sheets"] { --footer-h: 38px; }
[data-theme="sheets"] .card { border-color: #c4c7c5; }
[data-theme="sheets"] .player-wrap { border-radius: 0; border: 2px solid #188038; }
[data-theme="sheets"] .now h2 { font-size: 15px; }
[data-theme="sheets"] .label { letter-spacing: .4px; }
[data-theme="sheets"] .section-head { margin-bottom: 0; padding-bottom: 8px; border-bottom: 1px solid #c4c7c5; }
[data-theme="sheets"] .seg-btn.active { background: #e6f4ea; color: #188038; }
/* danh sách thành các dòng của bảng */
[data-theme="sheets"] .list { gap: 0; }
[data-theme="sheets"] .item { border: 0; border-bottom: 1px solid var(--line); padding: 3px 6px 3px 0; }
[data-theme="sheets"] .item img { width: 56px; border-radius: 0; }
[data-theme="sheets"] .item .title { -webkit-line-clamp: 1; font-weight: 400; }
[data-theme="sheets"] .rank {
  align-self: stretch; display: grid; place-items: center; width: 34px; margin: -3px 0;
  background: #f8f9fa; border-right: 1px solid #c4c7c5; color: #5f6368; font-weight: 400; font-size: 11px;
}
[data-theme="sheets"] .list li:first-child .rank { color: #188038; font-weight: 700; }
[data-theme="sheets"] .vote { flex-direction: row; gap: 4px; min-width: 52px; padding: 3px 8px; }
[data-theme="sheets"] .people-pop .item, [data-theme="sheets"] #search-results .item { background: #fff; }
[data-theme="sheets"] .chat-head { background: #f8f9fa; }
[data-theme="sheets"] .bubble { border-radius: 2px; }
[data-theme="sheets"] .sheet-tabs {
  display: flex; align-items: center; gap: 4px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 9;
  height: 38px; padding: 0 12px; background: #f9fbfd; border-top: 1px solid #c4c7c5; color: #5f6368; font-size: 16px;
}
[data-theme="sheets"] .sheet-tabs span { padding: 4px 10px; }
[data-theme="sheets"] .sheet-tab {
  font-size: 13px; font-weight: 700; color: #188038; background: #e6f4ea; border-radius: 4px 4px 0 0; margin-left: 8px;
}
[data-theme="sheets"] .resize-handle { opacity: .8; }

/* =====================================================================
   Theme: Tài liệu (giống Google Docs)
   ===================================================================== */
[data-theme="docs"] {
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-2: #f1f3f4;
  --line: #dadce0;
  --accent: #1a73e8;
  --accent-2: #1a73e8;
  --ok: #1e8e3e;
  --grad: #1a73e8;
  --mine-bg: #e8f0fe;
  --mine-text: #202124;
  --body-bg: #f9fbfd;
  --topbar-bg: #f9fbfd;
  --font-size: 14px;
  --radius: 8px;
  --r-sm: 6px;
  --r-item: 6px;
  --r-pill: 999px;
}
/* thanh công cụ bo tròn màu xanh nhạt chứa ô tìm kiếm */
[data-theme="docs"] .topbar { margin: 4px 12px 6px; border-radius: 24px; background: #edf2fa; padding: 4px 8px 4px 16px; }
[data-theme="docs"] .add input { background: #fff; border-color: transparent; border-radius: 18px; padding: 7px 14px; }
[data-theme="docs"] .add input:focus { border-color: #1a73e8; }
[data-theme="docs"] .add .btn { border-radius: 18px; padding: 7px 16px; }
[data-theme="docs"] .chip { background: #fff; border-color: transparent; }
[data-theme="docs"] .layout { max-width: 1240px; grid-template-columns: minmax(0, 860px) 340px; justify-content: center; gap: 28px; padding-top: 20px; }
/* cột trái là một trang giấy */
[data-theme="docs"] .stage {
  background: #fff; padding: 0 64px 56px; min-height: calc(100vh - 140px);
  box-shadow: 0 1px 3px 1px rgba(60, 64, 67, .15), 0 1px 2px rgba(60, 64, 67, .3);
}
[data-theme="docs"] .doc-ruler {
  display: block; height: 22px; margin: 0 -64px 40px; border-bottom: 1px solid #dadce0; background-color: #fff;
  background-image:
    repeating-linear-gradient(90deg, #80868b 0 1px, transparent 1px 48px),
    repeating-linear-gradient(90deg, #bdc1c6 0 1px, transparent 1px 12px);
  background-size: 100% 9px, 100% 5px; background-position: 64px bottom, 64px bottom; background-repeat: no-repeat;
}
[data-theme="docs"] .stage .card { border: 0; background: transparent; }
[data-theme="docs"] .now { padding: 0; margin-top: 24px; }
[data-theme="docs"] .now h2 { font: 400 26px/1.25 Arial, sans-serif; }
[data-theme="docs"] .label { text-transform: none; letter-spacing: 0; font-size: 14px; color: #5f6368; font-weight: 400; }
[data-theme="docs"] .section { padding: 0; margin-top: 28px; }
[data-theme="docs"] .section-head h3, [data-theme="docs"] .seg-btn { font: 400 18px Arial, sans-serif; }
[data-theme="docs"] .seg-btn { padding: 4px 8px; }
[data-theme="docs"] .seg-btn.active { background: none; color: #202124; text-decoration: underline; text-underline-offset: 6px; }
[data-theme="docs"] .badge { font-size: 11px; }
[data-theme="docs"] .list { gap: 2px; }
[data-theme="docs"] .stage .item, [data-theme="docs"] #queue .item { background: none; border-color: transparent; }
[data-theme="docs"] .stage .item:hover { background: #f1f3f4; }
[data-theme="docs"] .item .title { font-weight: 400; }
[data-theme="docs"] .vote:not(.on) { background: #fff; }
[data-theme="docs"] .empty { border: 0; color: #80868b; font-style: italic; text-align: left; padding: 4px 8px; }
/* khung chat thành cột bình luận bên lề */
[data-theme="docs"] .side .chat { background: transparent; border: 0; }
[data-theme="docs"] .chat-head { border-bottom: 0; padding: 4px 4px 8px; }
[data-theme="docs"] .chat-list { padding: 4px; }
[data-theme="docs"] .bubble {
  background: #fff; border: 0; border-radius: 8px; padding: 10px 14px;
  box-shadow: 0 1px 2px rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15);
}
[data-theme="docs"] .msg.mine .bubble { background: #e8f0fe; box-shadow: none; }
[data-theme="docs"] .chat-form { border-top: 0; background: #fff; border-radius: 8px; box-shadow: 0 1px 2px rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15); margin: 8px 4px 4px; }
[data-theme="docs"] .chat-form input { border-color: transparent; }

@media (max-width: 960px) {
  [data-theme="sheets"] .layout { grid-template-columns: minmax(0, 1fr); padding-left: 56px; }
  [data-theme="sheets"] .side { position: static; height: 75vh; }
  [data-theme="docs"] .layout { grid-template-columns: minmax(0, 1fr); }
  [data-theme="docs"] .stage { padding: 0 20px 32px; }
  [data-theme="docs"] .doc-ruler { margin: 0 -20px 24px; }
  [data-theme="docs"] .side { position: static; height: 75vh; }
  .doc-menu span:nth-child(n+5) { display: none; }
}

/* ---------- Trả lời tin nhắn ---------- */
.bubble-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.msg.mine .bubble-row { flex-direction: row-reverse; }
.bubble-row > .bubble, .bubble-row > .sticker { min-width: 0; }
.reply-btn {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--panel-2); color: var(--muted); font-size: 14px; opacity: 0; transition: opacity .12s;
}
.reply-btn:hover { color: var(--text); }
.msg:hover .reply-btn, .reply-btn:focus-visible { opacity: 1; }
@media (hover: none) { .reply-btn { opacity: .55; } }
/* Trích dẫn kiểu Messenger: dòng nhãn nhỏ + bong bóng mờ của tin gốc nằm lót dưới tin trả lời */
.quote {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; max-width: 100%;
  margin: 2px 0 -10px; padding: 0; border: 0; background: none; color: var(--muted); text-align: left; cursor: pointer;
}
.msg.mine .quote { align-items: flex-end; align-self: flex-end; }
.quote-label { font-size: 12px; padding: 0 6px; }
.quote-text {
  max-width: 240px; padding: 7px 12px 15px; border-radius: 16px; font-size: 13px;
  background: var(--panel-2); border: 1px solid var(--line); opacity: .6;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: opacity .12s;
}
.quote:hover .quote-text { opacity: .85; }
/* tin trả lời nằm đè lên phần dưới của bong bóng mờ */
.quote + .bubble-row { position: relative; }
.reply-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-top: 1px solid var(--line);
}
.reply-bar-text { flex: 1; min-width: 0; }
.reply-snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.msg.flash .bubble, .msg.flash .sticker { animation: flash 1.6s ease; }
@keyframes flash {
  0%, 30% { box-shadow: 0 0 0 3px var(--accent); }
  100% { box-shadow: 0 0 0 3px transparent; }
}
[data-theme="docs"] .reply-bar { margin: 8px 4px 0; border-top: 0; }

/* ---------- Ẩn / hiện khung chat ---------- */
.chat-hide { order: 3; font-size: 16px; padding: 2px 8px; }
.chat-head .people-wrap { margin-left: auto; }
#chat-toggle .badge { margin-left: 6px; }
#chat-toggle.on { border-color: var(--accent); }
html.chat-hidden .side { display: none; }
html.chat-hidden[data-theme] .layout { grid-template-columns: minmax(0, 1fr); }
html.chat-hidden[data-theme="docs"] .layout { grid-template-columns: minmax(0, 960px); }
@media (max-width: 960px) {
  #chat-toggle-text { display: none; }
}

/* =====================================================================
   Theme: Rạp phim 3D. Rạp được vẽ trên canvas phủ toàn trang (cinema.js),
   các khung giao diện nổi bên trên, video nằm dưới canvas và lộ qua màn chiếu.
   ===================================================================== */
.cinema-only { display: none; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) {
  --bg: #090506;
  --panel: rgba(22, 12, 14, .74);
  --panel-solid: #1a0e11;
  --panel-2: rgba(255, 232, 205, .07);
  --line: rgba(255, 220, 170, .15);
  --text: #f6ecdf;
  --muted: #b3a394;
  --accent: #e8b64c;
  --accent-2: #f3cf78;
  --ok: #7be3a5;
  --radius: 12px;
  --r-sm: 8px;
  --r-item: 8px;
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-size: 14px;
  --body-bg: #090506;
  --topbar-bg: transparent;
  --grad: linear-gradient(135deg, #f3cf78, #dca43a);
  --on-accent: #1d1206;
  --mine-bg: #8f1a2b;
  --mine-text: #fff4e6;
  --shadow: rgba(0, 0, 0, .65);
  --player-shadow: none;
  --idle-bg: #000;
  --danger-bg: #5a1520;
  --admin-line: rgba(232, 182, 76, .45);
  --error: #ff9aa8;
  --name-l: 72%;
  --panel-w: 330px;
  --gap: 12px;
  height: 100%;
  overflow: hidden;
}
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) body { height: 100%; overflow: hidden; touch-action: none; overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) input, :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .bubble { -webkit-user-select: text; user-select: text; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .cinema-only { display: block; }
#cinema-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; display: block; }

/* ---------- Video đặt đúng vào màn chiếu ---------- */
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .layout, :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .stage { display: contents; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .player-wrap {
  position: fixed; left: 0; top: 0; z-index: 0; margin: 0;
  width: 1280px; height: 720px; max-width: none; aspect-ratio: auto;
  border: 0; border-radius: 0; box-shadow: none; transform-origin: 0 0; visibility: hidden;
}
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]).cinema-ready .player-wrap { visibility: visible; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .player-wrap:fullscreen { transform: none !important; width: 100%; height: 100%; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .resize-handle, :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .idle { display: none; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .unmute { bottom: 42%; padding: 22px 42px; font-size: 34px; }

/* ---------- Thanh trên cùng ---------- */
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .header-stack { backdrop-filter: none; background: linear-gradient(rgba(5, 2, 3, .82), rgba(5, 2, 3, .45) 70%, transparent); }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .topbar {
  grid-template-columns: auto minmax(180px, 1fr) auto; gap: 16px; border: 0; height: 60px; padding: 10px var(--gap);
}
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .brand {
  font: 600 22px/1 Oswald, var(--font); letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent);
  text-shadow: 0 0 16px rgba(232, 182, 76, .55);
}
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .add input { background: rgba(0, 0, 0, .45); border-color: var(--line); }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .add-wrap { max-width: 560px; width: 100%; justify-self: center; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .search-box { background: var(--panel-solid); }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .chip { background: rgba(20, 11, 13, .75); }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .chip.on { border-color: var(--accent); color: var(--accent); }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .theme-pop { background: var(--panel-solid); }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .people-pop { background: var(--panel-solid); }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .sticker-pop { background: var(--panel-solid); }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) input { background: rgba(0, 0, 0, .4); }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .modal-box { background: var(--panel-solid); }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .modal-box h1 { font: 600 34px Oswald, var(--font); letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent); }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .toast { background: var(--panel-solid); }
#seat-btn { font-weight: 600; }

/* ---------- Hàng chờ bên trái, chat bên phải ---------- */
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .panels, :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .side {
  position: fixed; z-index: 5; width: var(--panel-w); height: auto; min-height: 0;
  top: calc(var(--header-h, 60px) + 4px); bottom: var(--gap);
}
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .panels {
  left: var(--gap); display: flex; flex-direction: column; gap: var(--gap);
  overflow-y: auto; touch-action: pan-y;
}
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .side { right: var(--gap); touch-action: pan-y; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .card { backdrop-filter: blur(14px) saturate(1.2); }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .panels .section { margin: 0; padding: 12px; flex-shrink: 0; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .panels .section:first-of-type { flex-shrink: 1; min-height: 240px; display: flex; flex-direction: column; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) #panel-queue, :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) #panel-playlists { overflow-y: auto; min-height: 0; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .panels .admin { margin: 0; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .hint-inline { display: none; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]).queue-hidden .panels { display: none; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]).chat-hidden .side { display: none; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .section-head h3 { font: 500 15px Oswald, var(--font); letter-spacing: .6px; text-transform: uppercase; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .seg-btn { padding: 6px 8px; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .item img { width: 68px; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .item .title { font-weight: 500; font-size: 13px; line-height: 1.3; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .small { font-size: 12px; }
/* mỗi bài trong hàng chờ là một tấm vé: hai khía tròn ở mép và đường xé nét đứt */
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) #queue .item {
  --notch: radial-gradient(circle 6px at 33px 0, transparent 98%, #000), radial-gradient(circle 6px at 33px 100%, transparent 98%, #000);
  -webkit-mask: var(--notch); -webkit-mask-composite: source-in;
  mask: var(--notch); mask-composite: intersect;
  border: 0; padding-left: 0; gap: 10px;
  background: rgba(255, 232, 205, .09);
}
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) #queue .rank {
  align-self: stretch; display: grid; place-items: center; width: 33px; margin: -8px 0; color: var(--accent);
  font: 600 16px Oswald, var(--font); border-right: 1px dashed rgba(255, 220, 170, .32);
}
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .vote b { font-family: Oswald, var(--font); }

/* ---------- Bệ điều khiển ở đáy ---------- */
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .console {
  position: fixed; z-index: 5; bottom: var(--gap);
  left: calc(var(--panel-w) + var(--gap) * 2); right: calc(var(--panel-w) + var(--gap) * 2);
  margin: 0 auto; max-width: 780px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  column-gap: 12px; padding: 10px 14px 12px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel); backdrop-filter: blur(14px) saturate(1.2); touch-action: manipulation;
}
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]).queue-hidden .console { left: var(--gap); }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]).chat-hidden .console { right: var(--gap); }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .now { background: none; border: 0; padding: 0; margin: 0; backdrop-filter: none; gap: 12px; min-width: 0; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .now h2 {
  margin: 1px 0; font: 500 17px/1.25 Oswald, var(--font); letter-spacing: .3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .label { font: 500 11px Oswald, var(--font); letter-spacing: 1.6px; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) #now-meta { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .progress { grid-column: 1 / -1; grid-row: 2; margin: 8px 0 0; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) #progress-bar { box-shadow: 0 0 8px var(--accent); }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .controls { padding: 0; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .controls .times { flex: none; min-width: 78px; }
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) #volume { width: 84px; }

/* ---------- Tên, bong bóng chat, gợi ý trong không gian 3D ---------- */
#cinema-labels { position: fixed; inset: 0; z-index: 2; overflow: hidden; pointer-events: none; }
.seat-label { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; will-change: transform; }
.seat-tag {
  --h: 0;
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; color: #fff;
  background: hsl(var(--h) 55% 30% / .88); border: 1px solid hsl(var(--h) 60% 62% / .7);
}
.seat-tag.me { background: #e8b64c; color: #1d1206; border-color: #f3cf78; }
.seat-bubble {
  max-width: 220px; padding: 6px 11px; border-radius: 12px 12px 12px 3px; font-size: 13px; line-height: 1.35;
  overflow-wrap: anywhere; text-align: left; color: #1d1206; background: #fff4e0;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .55); animation: bubble-in .2s ease;
}
.seat-bubble.sticker-bubble { font-size: 36px; line-height: 1; padding: 4px 8px; }
@keyframes bubble-in { from { opacity: 0; transform: translateY(6px) scale(.92); } }
#seat-tip {
  position: fixed; left: 0; top: 0; z-index: 6; pointer-events: none; padding: 4px 10px; border-radius: 8px;
  font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--text); background: var(--panel-solid); border: 1px solid var(--line);
}
#cinema-hint {
  display: none; position: fixed; z-index: 6; left: 50%; top: calc(var(--header-h, 60px) + 8px); transform: translateX(-50%);
  padding: 7px 16px; border-radius: 999px; pointer-events: none; font-weight: 600; font-size: 13px; white-space: nowrap;
  color: #1d1206; background: var(--grad); box-shadow: 0 8px 26px rgba(0, 0, 0, .5);
}
:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]).cinema-overview #cinema-hint { display: block; }
[data-theme]:not(:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"])) #cinema-canvas,
[data-theme]:not(:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"])) #cinema-labels,
[data-theme]:not(:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"])) #cinema-hint,
[data-theme]:not(:is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"])) #seat-tip { display: none !important; }

/* Màn hình vừa: thu hẹp khung để màn chiếu còn chỗ, chip chỉ còn biểu tượng */
@media (max-width: 1320px) {
  :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) { --panel-w: 280px; }
  :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .chip-text, :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) #chat-toggle-text, :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) #theme-name { display: none; }
  :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) #me { max-width: 110px; }
}

/* ---------- Điện thoại: hàng chờ và chat là ngăn trượt, 3D chiếm phần còn lại ---------- */
@media (max-width: 960px) {
  :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .topbar {
    grid-template-columns: minmax(0, 1fr); grid-template-areas: "right" "search";
    height: auto; gap: 6px; padding: 6px 8px;
  }
  :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .brand { display: none; }
  :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .add-wrap { max-width: none; }
  :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .top-right { justify-self: stretch; justify-content: flex-end; gap: 4px; flex-wrap: nowrap; }
  :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .chip { padding: 4px 9px; font-size: 13px; }
  :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .add .btn { padding: 8px 12px; }
  :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .add input { padding: 8px 10px; }
  :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) #me { flex-shrink: 1; min-width: 0; }
  :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .panels, :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .side {
    position: fixed; left: 8px; right: 8px; width: auto; height: auto;
    top: 34%; bottom: calc(var(--console-h, 110px) + 16px);
  }
  :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .console { left: 8px !important; right: 8px !important; bottom: 8px; padding: 8px 10px 10px; max-width: none; grid-template-columns: minmax(0, 1fr); }
  :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .now h2 { font-size: 15px; }
  :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .progress { grid-row: auto; margin: 6px 0; }
  :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .controls { grid-row: 3; }
  :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .controls .times { flex: 1; }
  :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) #volume { flex: 0 1 110px; }
  :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .side .card, :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .panels .card { background: rgba(22, 12, 14, .92); }
  :is([data-theme="cinema"], [data-theme="concert"], [data-theme="club"]) .section:first-of-type { min-height: 0; }
  .seat-tag { font-size: 10px; max-width: 80px; }
  .seat-bubble { max-width: 160px; font-size: 12px; }
}

/* =====================================================================
   Theme: Concert ở SVĐ Đình Thôn (concert.js). Bố cục dùng chung với rạp phim
   ở trên, phần này chỉ đổi màu và thêm bộ điều khiển di chuyển.
   ===================================================================== */
:is([data-theme="concert"], [data-theme="club"]) {
  --bg: #05060f;
  --panel: rgba(11, 12, 30, .72);
  --panel-solid: #0e1026;
  --panel-2: rgba(190, 205, 255, .08);
  --line: rgba(170, 190, 255, .18);
  --text: #eef1ff;
  --muted: #a3a9c9;
  --accent: #ff4d9d;
  --accent-2: #5ee7ff;
  --body-bg: #05060f;
  --grad: linear-gradient(135deg, #ff4d9d, #8f5bff);
  --on-accent: #fff;
  --mine-bg: #5b2bd1;
  --mine-text: #fff;
  --danger-bg: #5a1533;
  --admin-line: rgba(255, 77, 157, .45);
}
:is([data-theme="concert"], [data-theme="club"]) .header-stack { background: linear-gradient(rgba(3, 4, 14, .82), rgba(3, 4, 14, .42) 70%, transparent); }
:is([data-theme="concert"], [data-theme="club"]) .brand { color: #fff; text-shadow: 0 0 14px rgba(255, 77, 157, .95), 0 0 34px rgba(143, 91, 255, .8); }
:is([data-theme="concert"], [data-theme="club"]) .chip { background: rgba(10, 11, 30, .76); }
:is([data-theme="concert"], [data-theme="club"]) #queue .rank { border-right-color: rgba(170, 190, 255, .34); }
:is([data-theme="concert"], [data-theme="club"]) #queue .item { background: rgba(190, 205, 255, .09); }
@media (max-width: 960px) {
  :is([data-theme="concert"], [data-theme="club"]) .side .card, :is([data-theme="concert"], [data-theme="club"]) .panels .card { background: rgba(11, 12, 30, .92); }
  :is([data-theme="concert"], [data-theme="club"]) #seat-btn { max-width: 44vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
:is([data-theme="concert"], [data-theme="club"]) #cinema-hint { color: #fff; max-width: calc(100vw - 24px); white-space: normal; text-align: center; width: max-content; }

/* Cần điều khiển để đi lại trên màn hình cảm ứng */
#roam-pad { display: none; position: fixed; z-index: 4; left: 16px; bottom: calc(var(--console-h, 110px) + 22px); align-items: flex-end; gap: 12px; }
@media (hover: none) { :is([data-theme="concert"], [data-theme="club"]).cinema-ready #roam-pad { display: flex; } }
.roam-stick {
  position: relative; width: 104px; height: 104px; border-radius: 50%; touch-action: none;
  background: rgba(11, 12, 30, .5); border: 1px solid rgba(170, 190, 255, .4); backdrop-filter: blur(6px);
}
.roam-knob {
  position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%;
  background: var(--grad); box-shadow: 0 2px 14px rgba(255, 77, 157, .6); pointer-events: none;
}
.roam-fly { display: flex; flex-direction: column; gap: 8px; }
.roam-fly button {
  width: 44px; height: 44px; border-radius: 50%; padding: 0; font-size: 16px; color: #fff; touch-action: none;
  background: rgba(11, 12, 30, .6); border: 1px solid rgba(170, 190, 255, .4);
}
#roam-pad.walking [data-fly="-1"] { display: none; }

/* Thanh đi lại và chọn điệu nhảy, nằm ngay trên bệ điều khiển */
#avatar-dock {
  position: fixed; z-index: 4; left: 50%; transform: translateX(-50%); bottom: calc(var(--console-h, 110px) + 20px);
  display: flex; gap: 8px; align-items: center;
}
.dock-btn {
  padding: 7px 14px; border-radius: 999px; font: 600 13px var(--font); color: var(--text); cursor: pointer; white-space: nowrap;
  background: rgba(10, 11, 30, .78); border: 1px solid var(--line); backdrop-filter: blur(8px);
}
.dock-btn:hover { border-color: var(--accent); }
.dock-btn.on { color: #fff; background: var(--grad); border-color: transparent; }
.dance-pop {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: 300px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px; border-radius: 14px;
  background: var(--panel-solid); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .55);
}
.dance-pop.hidden { display: none; }
.dance-opt {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 10px;
  font: 500 12px var(--font); color: var(--text); cursor: pointer; background: var(--panel-2); border: 1px solid transparent;
}
.dance-opt:hover { border-color: var(--accent); }
.dance-opt.on { color: #fff; background: var(--grad); }
.dance-emoji { font-size: 22px; line-height: 1.2; }
.dance-opt kbd { position: absolute; top: 3px; right: 5px; font: 600 10px var(--font); opacity: .6; }
@media (max-width: 960px) {
  #avatar-dock { left: auto; right: 12px; transform: none; bottom: calc(var(--console-h, 110px) + 22px); flex-direction: column; align-items: flex-end; }
  .dance-pop { left: auto; right: 0; transform: none; width: min(300px, calc(100vw - 24px)); }
  .dance-pop { bottom: calc(100% + 8px); }
}

/* Bảng thay đồ: máy tính nằm bên phải, điện thoại là tấm trượt ở đáy màn hình */
#closet {
  position: fixed; z-index: 7; right: 12px; top: 76px; bottom: 12px; width: 320px;
  display: flex; flex-direction: column; border-radius: 16px; overflow: hidden;
  background: var(--panel-solid); border: 1px solid var(--line); box-shadow: 0 14px 40px rgba(0, 0, 0, .6);
}
#closet.hidden { display: none; }
.closet-open #avatar-dock, .closet-open #roam-pad { display: none !important; }
.closet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.closet-head h3 { margin: 0; font: 700 15px var(--font); color: var(--text); }
.closet-close { width: 30px; height: 30px; border-radius: 50%; border: 0; cursor: pointer; color: var(--text); background: var(--panel-2); font-size: 13px; }
.closet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 14px 12px; }
.closet-row { padding-top: 12px; }
.closet-row[hidden] { display: none; }
.closet-row h4 { margin: 0 0 7px; font: 600 12px var(--font); color: var(--muted); }
.closet-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.closet-opt {
  padding: 7px 11px; min-height: 34px; border-radius: 10px; font: 500 13px var(--font); color: var(--text); cursor: pointer;
  background: var(--panel-2); border: 1px solid transparent;
}
.closet-opt:hover { border-color: var(--accent); }
.closet-opt.on { color: #fff; background: var(--grad); }
.closet-swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.closet-swatch {
  aspect-ratio: 1; min-height: 28px; padding: 0; border-radius: 50%; cursor: pointer; background: var(--c);
  border: 2px solid rgba(255, 255, 255, .22);
}
.closet-swatch:hover { border-color: #fff; }
.closet-swatch.on { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.closet-foot { display: flex; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--line); }
.closet-btn {
  flex: 1; padding: 9px 4px; min-height: 38px; border-radius: 10px; font: 600 12.5px var(--font); color: var(--text); cursor: pointer; white-space: nowrap;
  background: var(--panel-2); border: 1px solid transparent;
}
.closet-btn:hover { border-color: var(--accent); }
.closet-btn.primary { color: #fff; background: var(--grad); }
@media (max-width: 960px) {
  #closet { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; height: 50vh; height: 50dvh; }
}

/* Đánh nhau: chọn vũ khí, thanh máu, thông báo hạ gục */
.weapon-pop { width: 330px; }
.weapon-opt small { font: 500 10px var(--font); opacity: .7; }
.seat-hp { width: 54px; height: 5px; border-radius: 3px; overflow: hidden; background: rgba(0, 0, 0, .65); border: 1px solid rgba(255, 255, 255, .35); }
.seat-hp.hidden { display: none; }
.seat-tag.ko::before { content: '😵 '; }
.seat-hp i { display: block; height: 100%; width: 100%; background: #4ade80; transition: width .15s; }
.seat-hp.low i { background: #f87171; }
.seat-hp.safe { opacity: .55; }
#fight-hud {
  position: fixed; z-index: 4; left: 50%; transform: translateX(-50%); bottom: calc(var(--console-h, 110px) + 66px);
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; color: var(--text); font: 600 12.5px var(--font); white-space: nowrap; pointer-events: none;
  background: rgba(10, 11, 30, .78); border: 1px solid var(--line);
}
#fight-hud.hidden { display: none; }
.fight-bar { width: 120px; height: 8px; border-radius: 4px; overflow: hidden; background: rgba(255, 255, 255, .14); }
.fight-bar i { display: block; height: 100%; width: 100%; background: #4ade80; transition: width .15s; }
.fight-bar.low i { background: #f87171; }
.fight-tip { font-weight: 500; color: var(--muted); }
#fight-feed { position: fixed; z-index: 4; left: 50%; transform: translateX(-50%); top: 112px; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
.fight-news { padding: 4px 12px; border-radius: 999px; font: 600 12.5px var(--font); color: #fff; background: rgba(160, 25, 45, .85); animation: fight-news 3.4s forwards; max-width: 86vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes fight-news { 0% { opacity: 0; transform: translateY(-6px); } 8%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }
#fight-hurt { position: fixed; inset: 0; z-index: 3; pointer-events: none; opacity: 0; box-shadow: inset 0 0 120px 30px rgba(230, 30, 50, .75); }
#fight-hurt.on { animation: fight-hurt .35s ease-out; }
@keyframes fight-hurt { from { opacity: 1; } to { opacity: 0; } }
.dmg-float { position: absolute; left: 0; top: 0; font: 800 20px var(--font); color: #ffd66b; text-shadow: 0 2px 4px rgba(0, 0, 0, .9); pointer-events: none; will-change: transform, opacity; }
.dmg-float.mine { color: #ff6b81; }
.roam-attack {
  display: none; width: 62px; height: 62px; border-radius: 50%; padding: 0; font-size: 26px; touch-action: none; color: #fff;
  background: rgba(190, 30, 60, .78); border: 1px solid rgba(255, 190, 200, .6);
}
#roam-pad.fighting .roam-attack { display: block; }
@media (max-width: 960px) {
  .weapon-pop { width: min(330px, calc(100vw - 24px)); }
  #fight-hud { left: 8px; transform: none; top: 92px; bottom: auto; }
  .fight-tip { display: none; }
  #fight-feed { top: 134px; }
}
@media (max-width: 1280px) { .fight-tip { display: none; } }
@media (prefers-reduced-motion: reduce) { #fight-hurt.on { animation-duration: .01s; } }

/* =====================================================================
   Thanh cuộn đồng màu với từng giao diện
   ===================================================================== */
:root {
  --scroll-thumb: color-mix(in srgb, var(--accent) 55%, transparent);
  --scroll-thumb-hover: var(--accent);
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb) padding-box; border: 2px solid transparent; border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover) padding-box; }
/* Firefox không có các phần tử giả ở trên */
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
}

/* Thẻ trong bảng thay đồ và thư viện model */
.closet-tabs { display: flex; gap: 4px; flex: 1; min-width: 0; }
.closet-tab { flex: 0 1 auto; padding: 7px 12px; border: 0; border-radius: 999px; cursor: pointer; font: 600 13px var(--font); color: var(--muted); background: transparent; }
.closet-tab:hover { color: var(--text); }
.closet-tab.on { color: #fff; background: var(--grad); }
.closet-body.hidden, .closet-foot.hidden { display: none; }
.closet-worn { margin-top: 12px; padding: 9px 10px; border-radius: 10px; background: var(--panel-2); font: 500 12px/1.5 var(--font); color: var(--text); }
.closet-worn.hidden { display: none; }
.closet-worn .closet-opt { margin-top: 6px; display: block; }
.model-tab { display: flex; flex-direction: column; gap: 14px; padding-top: 12px; }
.model-tab h4 { margin: 0 0 7px; font: 600 12px var(--font); color: var(--muted); }
.model-file { display: block; text-align: center; cursor: pointer; }
.model-file input:focus-visible + *, .model-file:focus-within { outline: 2px solid var(--accent); }
.model-note { margin: 8px 0 0; font: 400 12px/1.5 var(--font); color: var(--muted); }
.model-note a { color: var(--accent); }
.model-error { margin: 8px 0 0; padding: 8px 10px; border-radius: 10px; background: rgba(226, 64, 80, .16); color: #ffb3bb; font: 500 12px/1.5 var(--font); }
.model-error.hidden, .model-draft.hidden, .model-off.hidden, .model-placed-wrap.hidden { display: none; }
.model-draft { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding: 10px; border-radius: 12px; background: var(--panel-2); }
.model-draft label { display: flex; flex-direction: column; gap: 4px; font: 500 12px var(--font); color: var(--muted); }
.model-draft input[name] { font: 500 16px var(--font); color: var(--text); background: var(--panel-solid); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; min-width: 0; }
.model-draft input[type="checkbox"] { width: 16px; height: 16px; padding: 0; flex: none; margin: 1px 0 0; }
.model-draft .model-rights { flex-direction: row; align-items: flex-start; gap: 7px; line-height: 1.45; color: var(--text); }
.model-kind { margin: 0; font: 500 12px/1.5 var(--font); color: var(--text); }
.model-draft-btns { display: flex; gap: 6px; }
.model-draft-btns .closet-btn { flex: 1; }
.model-list, .model-placed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.model-card { padding: 10px; border-radius: 12px; background: var(--panel-2); border: 1px solid transparent; }
.model-card.on { border-color: var(--accent); }
.model-card-title { font: 600 14px/1.35 var(--font); color: var(--text); overflow-wrap: anywhere; }
.model-card-title em { font: 600 11px var(--font); color: var(--accent); font-style: normal; }
.model-card-sub { margin-top: 3px; font: 400 11.5px/1.5 var(--font); color: var(--muted); overflow-wrap: anywhere; }
.model-card-sub b { color: #ffb3bb; font-weight: 600; }
.model-card-btns { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.closet-opt.danger:hover { border-color: #e24050; }
.closet-opt:disabled { opacity: .45; cursor: default; }
.model-off { width: 100%; margin-bottom: 8px; }
.model-empty { padding: 12px; text-align: center; border-radius: 12px; background: var(--panel-2); font: 400 12.5px/1.5 var(--font); color: var(--muted); }
.model-placed li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 10px; background: var(--panel-2); font: 500 12.5px var(--font); color: var(--text); overflow-wrap: anywhere; }
.model-placed small { color: var(--muted); font-weight: 400; }
.model-hide { display: flex; align-items: center; gap: 7px; padding-bottom: 4px; font: 500 12px var(--font); color: var(--muted); cursor: pointer; }

/* Thanh đặt vật vào sân */
#place-bar {
  position: fixed; z-index: 7; left: 50%; transform: translateX(-50%); bottom: calc(var(--console-h, 110px) + 74px);
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; width: max-content; max-width: calc(100vw - 24px);
  padding: 8px 10px; border-radius: 14px; background: var(--panel-solid); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
#place-bar.hidden { display: none; }
#place-bar .closet-btn { flex: none; min-width: 40px; }
#place-bar kbd { font: 600 10px var(--font); opacity: .7; }
.place-info { font: 600 13px var(--font); color: var(--text); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
@media (max-width: 960px) {
  #place-bar { bottom: auto; top: 76px; }
}

.closet-opt[hidden] { display: none; }

/* Quán bar dùng chung giao diện với sân khấu, chỉ đổi màu nhấn và tên cho hợp đèn neon */
[data-theme="club"] { --accent: #ff5ab4; --accent-2: #ff93cf; --grad: linear-gradient(135deg, #ff5ab4, #8f5bff); --on-accent: #fff; }
[data-theme="club"] .brand { text-shadow: 0 0 14px rgba(255, 90, 180, .95), 0 0 34px rgba(94, 231, 255, .8); }

/* ---------- Bàn DJ trong quán bar ---------- */
.dj-open .panels, .dj-open .side, .dj-open .console, .dj-open #roam-pad, .dj-open #cinema-hint { display: none !important; }
.dj-open:has(.dj-panel:not(.minimized)) #avatar-dock { display: none !important; }
.dj-panel {
  position: fixed; z-index: 8; left: 8px; right: 8px; bottom: 8px; max-height: calc(100dvh - var(--header-h, 60px) - 16px); overflow-y: auto;
  padding: 8px 10px 10px; border-radius: 14px; background: rgba(9, 8, 18, .94); border: 1px solid rgba(255, 90, 180, .4);
  box-shadow: 0 -8px 40px rgba(143, 91, 255, .25); color: #f3f1ff; font: 500 12px var(--font);
  -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
.dj-panel.hidden { display: none; }
.dj-panel.minimized { left: 50%; right: auto; transform: translateX(-50%); width: min(820px, calc(100vw - 16px)); top: calc(var(--header-h, 60px) + 6px); bottom: auto; padding: 6px 10px; }
.dj-panel.minimized .dj-top { margin-bottom: 4px; }
.dj-panel.minimized .dj-body, .dj-panel.minimized .dj-note { display: none; }
.dj-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.dj-title { font: 600 15px Oswald, var(--font); letter-spacing: 1px; }
.dj-note { color: #a7a3c2; font-size: 11px; }
.dj-spacer { flex: 1; }
.dj-btn {
  appearance: none; border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .07); color: #f3f1ff; border-radius: 8px;
  padding: 6px 10px; font: 600 12px var(--font); cursor: pointer; white-space: nowrap;
}
.dj-btn:hover { border-color: rgba(255, 255, 255, .4); }
.dj-btn.danger { color: #ff9aa8; }
.dj-mini { padding: 3px 7px; font-size: 11px; }
.dj-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(400px, 460px) minmax(0, 1fr); gap: 10px; }
.dj-deck, .dj-mixer { min-width: 0; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, .04); }
.dj-deck { --deck: #ff5ab4; display: flex; flex-direction: column; gap: 6px; border: 1px solid transparent; }
.dj-deck.dropping { border-color: var(--deck); background: rgba(255, 255, 255, .1); }
.dj-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dj-cover { position: relative; flex: none; width: 42px; height: 42px; border-radius: 6px; display: grid; place-items: center; font: 600 20px Oswald, var(--font); color: #0a0a0f; background: var(--deck); overflow: hidden; }
.dj-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dj-names { flex: 1; min-width: 0; }
.dj-song { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dj-artist { color: #c5c1dd; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 13px; }
.dj-status { color: #a7a3c2; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dj-status[data-kind="busy"] { color: #ffd23c; }
.dj-status[data-kind="error"] { color: #ff9aa8; white-space: normal; }
.dj-file { flex: none; }
.dj-wave { position: relative; height: 26px; border-radius: 6px; background: rgba(0, 0, 0, .45); overflow: hidden; cursor: pointer; touch-action: none; }
.dj-wave canvas { width: 100%; height: 100%; display: block; }
.dj-cursor, .dj-cue-mark { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: #fff; pointer-events: none; }
.dj-cue-mark { background: #ffd23c; opacity: .9; }
.dj-times { display: flex; justify-content: space-between; color: #c5c1dd; font-variant-numeric: tabular-nums; }
.dj-waves { display: grid; gap: 3px; margin-bottom: 6px; }
.dj-live { --deck: #ff5ab4; position: relative; height: 38px; border-radius: 6px; overflow: hidden; background: rgba(0, 0, 0, .55); border-left: 3px solid var(--deck); }
.dj-live canvas { width: 100%; height: 100%; display: block; }
.dj-live-name { position: absolute; top: 2px; left: 5px; font: 600 11px Oswald, var(--font); color: var(--deck); pointer-events: none; }
.dj-deck-main { display: flex; gap: 10px; align-items: center; justify-content: center; }
.dj-side { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 6px; }
.dj-platter { flex: 0 1 140px; aspect-ratio: 1; min-width: 100px; border-radius: 50%; background: #17161f; border: 3px solid var(--deck); box-shadow: 0 0 18px color-mix(in srgb, var(--deck) 45%, transparent); cursor: grab; touch-action: none; overflow: hidden; }
.dj-platter.scratching { cursor: grabbing; box-shadow: 0 0 26px var(--deck); }
.dj-platter canvas { width: 100%; height: 100%; display: block; will-change: transform; }
.dj-pitch { display: flex; align-items: stretch; gap: 6px; }
.dj-pitch-tools { display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.dj-bpm-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dj-bpm-box { display: inline-flex; align-items: center; gap: 4px; color: #a7a3c2; }
.dj-bpm { width: 62px; padding: 3px 5px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(0, 0, 0, .4); color: #fff; font: 600 12px var(--font); -webkit-user-select: text; user-select: text; }
.dj-bpm-now { text-align: right; font: 600 18px Oswald, var(--font); color: var(--deck); font-variant-numeric: tabular-nums; }
.dj-transport { display: grid; grid-template-columns: 1fr 2fr; gap: 6px; }
.dj-play, .dj-cue { padding: 9px 6px; font-size: 13px; touch-action: none; }
.dj-cue { color: #ffd23c; border-color: rgba(255, 210, 60, .5); }
.dj-play { color: #46e68a; border-color: rgba(70, 230, 138, .5); }
.dj-play.on { background: #46e68a; color: #06240f; }
.dj-mixer { display: flex; flex-direction: column; gap: 6px; }
.dj-channels { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dj-channel { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 6px; row-gap: 2px; align-items: center; min-width: 0; }
.dj-channel > .dj-ch-head, .dj-channel > .dj-ctl, .dj-channel > .dj-btn { grid-column: 1; }
.dj-channel > .dj-fader-row { grid-column: 2; grid-row: 1 / span 6; }
.dj-ch-head { text-align: center; font: 600 13px Oswald, var(--font); }
.dj-channel-A .dj-ch-head { color: #ff5ab4; }
.dj-channel-B .dj-ch-head { color: #5ee7ff; }
.dj-ctl { display: grid; grid-template-columns: 30px minmax(0, 1fr) 36px; align-items: center; gap: 4px; color: #c5c1dd; font-size: 10px; }
.dj-ctl input[type="range"] { width: 100%; min-width: 0; margin: 0; accent-color: #ff5ab4; cursor: pointer; }
.dj-channel-B input[type="range"], .dj-deck-B input[type="range"] { accent-color: #5ee7ff; }
.dj-ctl-val { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dj-vert { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.dj-vert input[type="range"] { writing-mode: vertical-lr; direction: rtl; width: 22px; height: 92px; }
.dj-fader-row { display: flex; justify-content: center; align-items: center; gap: 5px; }
.dj-vu { width: 12px; height: 112px; border-radius: 3px; }
.dj-spectrum { width: 100%; height: 30px; border-radius: 6px; background: rgba(0, 0, 0, .4); }
.dj-cross { grid-template-columns: 72px minmax(0, 1fr) 72px; font-weight: 600; }
.dj-master { display: flex; align-items: center; gap: 6px; }
.dj-master .dj-ctl { flex: 1; grid-template-columns: 46px minmax(0, 1fr) 24px; }
.dj-vu-h { width: 100%; height: 10px; border-radius: 3px; }
.dj-mute.on { background: #ff3b3b; border-color: #ff3b3b; }
.dj-air { color: #ff8a8a; border-color: rgba(255, 90, 90, .55); }
.dj-air.on { background: #ff3b3b; border-color: #ff3b3b; color: #fff; }
@media (max-width: 1100px) {
  .dj-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dj-mixer { grid-column: 1 / -1; order: 3; }
}
@media (max-width: 640px) {
  .dj-body { grid-template-columns: minmax(0, 1fr); }
  .dj-note { display: none; }
}
@media (max-height: 820px) and (min-width: 1101px) {
  .dj-platter { flex-basis: 110px; }
  .dj-live { height: 30px; }
}

/* Báo DJ đang phát cho cả phòng, có ở mọi giao diện */
#dj-air-chip {
  position: fixed; z-index: 7; left: 50%; top: calc(var(--header-h, 60px) + 6px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 16px); padding: 5px 6px 5px 12px; border-radius: 999px;
  background: rgba(14, 10, 26, .92); border: 1px solid rgba(255, 90, 180, .55); box-shadow: 0 8px 26px rgba(0, 0, 0, .45);
  color: #fff; font: 600 13px var(--font);
}
#dj-air-chip.hidden { display: none; }
.dj-air-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #ff3b3b; box-shadow: 0 0 8px #ff3b3b; }
.dj-air-text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dj-air-btn { flex: none; appearance: none; border: 0; border-radius: 999px; padding: 4px 11px; background: rgba(255, 255, 255, .14); color: #fff; font: 600 12px var(--font); cursor: pointer; }
.dj-air-btn:hover { background: rgba(255, 255, 255, .26); }
#dj-air-chip[data-status="blocked"] .dj-air-btn, #dj-air-chip[data-status="failed"] .dj-air-btn { background: #ff5ab4; }
#dj-air-chip[data-status="failed"] .dj-air-dot, #dj-air-chip[data-status="off"] .dj-air-dot { background: #8a8799; box-shadow: none; }
.dj-on-air #cinema-hint { top: calc(var(--header-h, 60px) + 48px); }
.dj-on-air .dj-panel.minimized { top: calc(var(--header-h, 60px) + 48px); }
