/* ==========================================================================
   Exomaly Deck - Live Event Audio Console Stylesheet (dựa trên SoundDeck v6.0, thiết kế HoangPham)
   100% Offline • High-Contrast Dark Studio Theme • Responsive Multi-View Grid
   ========================================================================== */

:root {
  color-scheme: dark;
  --ink: #06080d;
  --bg-deep: #090c13;
  --panel: rgba(16, 21, 30, 0.92);
  --panel-2: rgba(23, 30, 42, 0.9);
  --panel-3: rgba(34, 43, 58, 0.88);
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #f3f6fa;
  --muted: #94a3b8;
  /* Màu nhấn (thương hiệu, nút, mục đang chọn): hồng hành tinh Exomaly Deck */
  --accent: #ed4cc2;
  --accent-rgb: 237, 76, 194;
  --accent-soft: #fbd5f0;
  --accent-ink: #22061b;
  --accent-2: #9b5cf6;
  --accent-2-rgb: 155, 92, 246;
  /* Màu trạng thái deck: tách khỏi màu nhấn để nút đang chọn không lẫn với deck đang phát */
  --st-playing: #34d399;
  --st-playing-rgb: 52, 211, 153;
  --st-playing-soft: #d1fae5;
  --st-fade-in: #38e8ff;
  --st-fade-in-rgb: 56, 232, 255;
  --st-fade-in-soft: #cffafe;
  --st-fade-out: #fbbf24;
  --st-fade-out-rgb: 251, 191, 36;
  --st-paused: #93c5fd;
  --st-paused-rgb: 147, 197, 253;
  --emerald: #34d399;
  --emerald-soft: #d1fae5;
  --violet: #c084fc;
  --violet-soft: #f3e8ff;
  --amber: #fbbf24;
  --amber-soft: #fef3c7;
  --red: #ef4444;
  --red-dark: #991b1b;
  --red-soft: #fecaca;
  --green: #4ade80;
  --radius: 18px;
  --card-radius: 20px;
  /* Khung sân khấu: ray điều hướng trái, cột điều khiển tổng phải, ngăn kéo bảng phụ */
  --rail-w: 76px;
  --console-w: 300px;
  --drawer-w: 360px;
  --tap: 46px;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--ink);
  color: var(--text);
  overflow: hidden;
  accent-color: var(--accent);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.text-cyan { color: var(--accent) !important; }
.text-green { color: var(--green) !important; }
.text-amber { color: var(--amber) !important; }
.text-muted { color: var(--muted) !important; }

/* Custom Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.4) rgba(255, 255, 255, 0.04);
}
*::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
*::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}
*::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.32);
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--accent-rgb), 0.55);
  border: 2px solid transparent;
  background-clip: padding-box;
}

button, input, select {
  font: inherit;
}

svg {
  display: block;
  flex: 0 0 auto;
}

button {
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

kbd {
  display: inline-block;
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  color: var(--accent-soft);
  font-family: inherit;
  font-weight: 800;
  font-size: 11px;
  line-height: 1.3;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
}

/* ==========================================================================
   Macro Console Grid: Sidebar + Main (Topbar / Workspace / Master Bar)
   ========================================================================== */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  height: 100dvh;
  min-height: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(var(--accent-rgb), 0.09), transparent 34%),
    radial-gradient(circle at 88% 100%, rgba(var(--accent-2-rgb), 0.08), transparent 36%),
    linear-gradient(180deg, #15111f 0%, #0a0810 55%, #05070b 100%);
}

/* ==========================================================================
   Left Sidebar
   ========================================================================== */
.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: rgba(11, 14, 21, 0.88);
  border-right: 1px solid var(--line);
  z-index: 20;
}

/* Khối thương hiệu nằm đầu thanh trên (logo, tên, ghi công tác giả gốc) */
.brand {
  flex: 0 0 auto;
  min-width: 0;
  padding-right: 6px;
}

.brand-copy {
  min-width: 0;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

/* Logo hành tinh Exomaly Deck (brand/logo-deck-320.png, nền trong suốt): ảnh tròn, không thêm khung hay quầng sáng */
.brand-logo-img {
  width: 40px;
  height: 40px;
  display: block;
  object-fit: contain;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  white-space: nowrap;
  font-weight: 850;
  line-height: 1.1;
  background: linear-gradient(135deg, #ffffff 15%, var(--accent-soft), #93c5fd 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand p {
  display: none;
}

.brand-credit {
  display: block;
  margin-top: 1px;
  color: var(--accent-soft);
  opacity: 0.78;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

/* Ray điều hướng: biểu tượng trên, chữ nhỏ dưới */
.nav {
  padding: 10px 7px 6px;
  display: grid;
  gap: 6px;
}

.nav button {
  position: relative;
  min-height: 58px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 2px;
  font-size: 10px;
  line-height: 1.15;
  text-align: center;
  font-weight: 700;
  transition: all 0.16s ease;
}

.nav button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.nav button.active {
  color: var(--accent-soft);
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.16), rgba(var(--accent-rgb), 0.04));
  border-color: rgba(var(--accent-rgb), 0.28);
  box-shadow: inset 3px 0 0 var(--accent);
  font-weight: 800;
}

.symbol {
  width: 20px;
  height: 20px;
}

.nav-badge {
  position: absolute;
  top: 3px;
  right: 5px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 850;
  display: inline-grid;
  place-items: center;
}

/* Bảng phụ (Thư viện, Nhật ký, Cài đặt) là ngăn kéo trượt ra cạnh ray; đóng bằng nút Bàn điều khiển.
   Mở/đóng chỉ bằng CSS theo nút điều hướng đang active (app.js đã đặt lớp này). */
.side-panel {
  display: none;
  position: fixed;
  z-index: 30;
  top: 0;
  bottom: 0;
  left: var(--rail-w);
  width: min(var(--drawer-w), calc(100vw - var(--rail-w)));
  padding: 12px 14px 16px;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(12, 10, 19, 0.985);
  border-right: 1px solid var(--line-strong);
  box-shadow: 24px 0 48px rgba(0, 0, 0, 0.55);
}

.sidebar:has(#navLibrary.active, #navRecent.active, #navSettings.active) .side-panel {
  display: block;
}

.drawer-hint {
  margin-bottom: 10px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 11.5px;
}

.side-panel-tab {
  display: none;
}

.side-panel-tab.active {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-header-title {
  color: var(--accent-soft);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.panel-desc {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.queue-list, .panel-list {
  display: grid;
  gap: 8px;
}

.panel-card {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.045);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.panel-card.empty-hint small {
  color: var(--muted);
  line-height: 1.45;
  font-size: 12px;
}

.queue-item {
  border-radius: 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.11), rgba(255, 255, 255, 0.03));
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.queue-item-info {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.queue-item-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-sub {
  font-size: 10.5px;
  color: var(--accent-soft);
  font-weight: 700;
}

.queue-mini-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: var(--amber);
  display: grid;
  place-items: center;
  font-size: 12px;
  flex: 0 0 auto;
  transition: all 0.15s ease;
}

.queue-mini-btn:hover {
  background: rgba(251, 191, 36, 0.25);
  border-color: var(--amber);
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.sidebar-footer-text {
  display: none;
}

.offline-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

/* Sidebar Settings Controls */
.settings-card {
  gap: 11px;
}

.settings-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 2px 0;
}

.settings-subtitle {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-soft);
}

.settings-field {
  width: 100%;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.settings-field label {
  font-weight: 650;
  color: #cbd5e1;
}

.settings-field span {
  color: var(--accent-soft);
  font-weight: 800;
}

.settings-field select,
.modal-input {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 11px;
  background: rgba(15, 20, 30, 0.9);
  color: var(--text);
  padding: 0 11px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.settings-field select:focus,
.modal-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.2);
}

.default-fade-row {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  padding: 8px 10px;
  display: grid;
  gap: 7px;
}

.default-fade-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.default-fade-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.default-fade-input-wrap input {
  width: 78px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 0 8px;
  font-weight: 750;
  text-align: center;
  outline: none;
}

.default-fade-input-wrap input:focus {
  border-color: var(--accent);
}

.setting-toggle-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(0, 0, 0, 0.2);
}

.setting-toggle-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.setting-toggle-copy strong {
  font-size: 12.5px;
  color: var(--text);
}

.setting-toggle-copy small {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}

/* Toggle Switch */
.switch {
  width: 42px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: #283040;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  transition: background 0.18s ease, border-color 0.18s ease;
  flex: 0 0 auto;
}

.switch span {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f8fafc;
  transition: transform 0.18s ease;
  pointer-events: none;
}

.switch.on {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border-color: var(--accent);
}

.switch.on span {
  transform: translateX(18px);
  background: #041318;
}

.panel-action {
  width: 100%;
  min-height: 38px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  transition: all 0.15s ease;
}

.panel-action:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(var(--accent-rgb), 0.45);
}

.danger-outline-btn {
  color: var(--red-soft);
  background: rgba(239, 68, 68, 0.11);
  border-color: rgba(239, 68, 68, 0.32);
}

.danger-outline-btn:hover {
  background: rgba(239, 68, 68, 0.26);
  border-color: rgba(239, 68, 68, 0.65);
  color: #fff;
}

/* ==========================================================================
   Right Main Area: 3-Row Studio Layout
   ========================================================================== */
/* Màn rộng: thanh trên trải hết; lưới deck bên trái; cột điều khiển tổng (Fade/Cắt hết, master, đang phát) bên phải */
.main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--console-w);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "top top" "deck console";
  position: relative;
}

.topbar { grid-area: top; }
.workspace { grid-area: deck; }
.master { grid-area: console; }

/* -------------------- ROW 1: TOP TOOLBAR -------------------- */
.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 10px 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 13, 20, 0.86);
  backdrop-filter: blur(16px);
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 320px;
  min-width: 0;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 240px;
  max-width: 380px;
  min-width: 170px;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--muted);
  pointer-events: none;
}

.search {
  width: 100%;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 0 32px 0 35px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.search:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.09);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

.search-clear {
  position: absolute;
  right: 7px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
  font-size: 14px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.crossfade-pill {
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  padding: 0 13px;
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.crossfade-pill .cf-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
}

.crossfade-pill.active {
  border-color: rgba(74, 222, 128, 0.45);
  background: rgba(74, 222, 128, 0.13);
  color: #dcfce7;
}

.crossfade-pill.active .cf-dot {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.view-switch,
.lang-switch {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px;
  white-space: nowrap;
}

.lang-switch {
  flex: 0 0 auto;
}

.view-switch > span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  padding: 0 7px 0 9px;
}

.view-switch button,
.lang-switch button {
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 750;
  transition: all 0.15s ease;
}

.view-switch button:hover,
.lang-switch button:hover {
  color: var(--text);
}

.view-switch button.active,
.lang-switch button.active {
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), #f6a6dd);
  font-weight: 850;
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.35);
}

.toolbar-btn {
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.04));
  color: var(--text);
  padding: 0 13px;
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.toolbar-btn:hover {
  border-color: rgba(var(--accent-rgb), 0.55);
  background: rgba(var(--accent-rgb), 0.14);
  color: #fff;
}

.toolbar-btn.primary-tint {
  border-color: rgba(var(--accent-rgb), 0.38);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.2), rgba(var(--accent-2-rgb), 0.12));
  color: var(--accent-soft);
}

.toolbar-btn.icon-only {
  width: 36px;
  padding: 0;
  font-size: 15px;
}

.live-clock {
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  color: var(--accent-soft);
  font-size: 12.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
}

/* -------------------- ROW 2: WORKSPACE & DECK GRID -------------------- */
.workspace {
  position: relative;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 14px 18px 20px;
}

.workspace-drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 18, 0.78);
  backdrop-filter: blur(6px);
  z-index: 40;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}

.workspace-drop-overlay.active {
  opacity: 1;
}

.workspace-drop-box {
  border: 2px dashed var(--accent);
  border-radius: 24px;
  background: rgba(14, 24, 38, 0.92);
  padding: 32px 48px;
  text-align: center;
  display: grid;
  gap: 8px;
  box-shadow: 0 0 40px rgba(var(--accent-rgb), 0.25);
}

.workspace-drop-box strong {
  font-size: 20px;
  color: #fff;
}

.workspace-drop-box span {
  font-size: 13.5px;
  color: var(--accent-soft);
}

/* Compact Status Strip */
/* Thống kê nhanh (trong cột điều khiển tổng) */
.status-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.stat {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border-radius: 11px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.stat .label {
  font-size: 10px;
  letter-spacing: 0.04em;
}

/* Ô Crossfade có chữ dài ("TẮT • Song song"): chiếm cả hàng */
.stat.clickable {
  grid-column: 1 / -1;
}

.stat.clickable {
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.stat.clickable:hover {
  border-color: rgba(var(--accent-rgb), 0.45);
  background: rgba(var(--accent-rgb), 0.08);
}

.label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stat strong {
  font-size: 14px;
  font-weight: 850;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Lưới deck theo 3 chế độ: Dàn dựng (view-large), Biểu diễn (view-medium), Lưới (view-compact) */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.app.view-large .grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.app.view-medium .grid {
  grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
  gap: 12px;
}

.app.view-compact .grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 7px;
}

/* ==========================================================================
   Individual Deck Card (.channel)
   ========================================================================== */
.channel {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--card-radius);
  background: linear-gradient(180deg, rgba(28, 36, 50, 0.86) 0%, rgba(16, 21, 31, 0.94) 100%);
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 10px 24px rgba(0, 0, 0, 0.35);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.15s ease;
  min-width: 0;
}

.channel:hover {
  border-color: rgba(var(--accent-rgb), 0.38);
}

.channel.is-empty {
  background: linear-gradient(180deg, rgba(22, 27, 38, 0.65), rgba(13, 17, 25, 0.8));
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.12);
}

.channel.playing {
  border-color: rgba(var(--st-playing-rgb), 0.85);
  background: linear-gradient(180deg, rgba(12, 46, 38, 0.9) 0%, rgba(14, 24, 34, 0.96) 100%);
  box-shadow:
    0 0 0 1px rgba(var(--st-playing-rgb), 0.35),
    0 0 24px rgba(var(--st-playing-rgb), 0.2),
    0 12px 28px rgba(0, 0, 0, 0.45);
}

.channel.is-fading-in {
  border-color: var(--st-fade-in);
  background: linear-gradient(180deg, rgba(14, 44, 58, 0.9) 0%, rgba(14, 22, 32, 0.96) 100%);
  box-shadow:
    0 0 0 1px rgba(var(--st-fade-in-rgb), 0.5),
    0 0 28px rgba(var(--st-fade-in-rgb), 0.28);
}

.channel.is-fading-out {
  border-color: rgba(var(--st-fade-out-rgb), 0.85);
  background: linear-gradient(180deg, rgba(58, 39, 14, 0.82) 0%, rgba(17, 21, 30, 0.96) 100%);
  box-shadow:
    0 0 0 1px rgba(var(--st-fade-out-rgb), 0.35),
    0 0 24px rgba(var(--st-fade-out-rgb), 0.18);
}

.channel.paused {
  border-color: rgba(var(--st-paused-rgb), 0.7);
  background: linear-gradient(180deg, rgba(22, 34, 58, 0.88) 0%, rgba(15, 20, 31, 0.96) 100%);
}

/* Dải màu trạng thái ở mép trên thẻ: liếc là biết deck nào đang phát, fade hay tạm dừng (không đổi kích thước thẻ) */
.channel::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 14px;
  right: 14px;
  height: 4px;
  border-radius: 0 0 4px 4px;
  background: transparent;
  pointer-events: none;
}

.channel.playing::before { background: var(--st-playing); box-shadow: 0 0 10px rgba(var(--st-playing-rgb), 0.7); }
.channel.is-fading-in::before { background: var(--st-fade-in); box-shadow: 0 0 10px rgba(var(--st-fade-in-rgb), 0.7); }
.channel.is-fading-out::before { background: var(--st-fade-out); box-shadow: 0 0 10px rgba(var(--st-fade-out-rgb), 0.7); }
.channel.paused::before {
  background: repeating-linear-gradient(90deg, var(--st-paused) 0 10px, transparent 10px 16px);
}

@keyframes channel-hotkey-flash {
  0% { transform: scale(1); }
  45% { transform: scale(1.018); filter: brightness(1.25); box-shadow: 0 0 28px rgba(var(--accent-rgb), 0.55); }
  100% { transform: scale(1); }
}

.channel.hotkey-triggered {
  animation: channel-hotkey-flash 0.26s ease;
}

.channel-drop-overlay {
  position: absolute;
  inset: 0;
  border-radius: var(--card-radius);
  border: 2px dashed var(--accent);
  background: rgba(30, 10, 28, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--accent-soft);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.14s ease;
  z-index: 12;
}

.channel.drag-over .channel-drop-overlay {
  opacity: 1;
}

/* Row 1: Card Header */
.channel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.channel-head-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.hotkey {
  height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.11);
  color: #fff;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex: 0 0 auto;
}

.channel.playing .hotkey {
  background: var(--st-playing);
  border-color: var(--st-playing);
  color: #03161b;
}

.channel.is-fading-in .hotkey {
  background: var(--st-fade-in);
  border-color: var(--st-fade-in);
}

/* Nhãn trạng thái chiếm hết phần còn lại của đầu thẻ, chữ căn giữa: đủ chữ, bề rộng không đổi theo trạng thái */
.status-pill {
  flex: 1 1 auto;
  min-width: 0;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 850;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.status-pill.st-ready {
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.28);
}

.status-pill.st-playing {
  color: #d1fae5;
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(52, 211, 153, 0.55);
}

.status-pill.st-fading-in {
  color: var(--st-fade-in-soft);
  background: rgba(var(--st-fade-in-rgb), 0.26);
  border-color: rgba(var(--st-fade-in-rgb), 0.65);
}

.status-pill.st-fading-out {
  color: #fef3c7;
  background: rgba(245, 158, 11, 0.25);
  border-color: rgba(var(--st-fade-out-rgb), 0.65);
}

.status-pill.st-paused {
  color: #dbeafe;
  background: rgba(59, 130, 246, 0.22);
  border-color: rgba(var(--st-paused-rgb), 0.5);
}

.channel-head-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.mini-tag-btn {
  height: 32px;
  min-width: 32px;
  padding: 0 7px;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  font-size: 10.5px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.mini-tag-btn:hover {
  border-color: rgba(var(--accent-rgb), 0.45);
  color: #fff;
}

.mini-tag-btn.is-sfx {
  border-color: rgba(192, 132, 252, 0.5);
  background: rgba(168, 85, 247, 0.2);
  color: #f3e8ff;
}

.mini-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 12px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  transition: all 0.14s ease;
}

.mini-icon-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
}

.mini-icon-btn.is-on {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.35);
}

/* Row 2: Track Name */
.track-name {
  min-height: 21px;
  color: #f1f5f9;
  font-size: 14.5px;
  font-weight: 750;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.track-name:hover {
  color: var(--accent-soft);
}

.track-name.empty-track {
  color: #64748b;
  font-weight: 600;
  font-style: italic;
}

/* Row 2.5: Rekordbox-Style Tempo (BPM) & Musical Key Badges */
.deck-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 24px;
}

.meta-pill {
  height: 22px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.meta-pill:hover {
  border-color: rgba(var(--accent-rgb), 0.45);
  color: #fff;
}

.meta-pill.is-analyzing {
  color: var(--accent-soft);
  border-color: rgba(var(--accent-rgb), 0.35);
  background: rgba(var(--accent-rgb), 0.1);
}

.bpm-pill.has-value {
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(148, 163, 184, 0.25);
}

.bpm-pill.is-bpm-match {
  border-color: rgba(var(--accent-rgb), 0.6);
  color: var(--accent-soft);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.2);
}

.key-pill.has-value {
  color: var(--key-text, #f8fafc);
  background: var(--key-bg, rgba(var(--accent-rgb), 0.16));
  border-color: var(--key-border, rgba(var(--accent-rgb), 0.45));
}

.key-pill.is-key-match {
  box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.85), 0 0 12px rgba(74, 222, 128, 0.42);
}

.channel.is-harmonic-match:not(.playing) {
  border-color: rgba(74, 222, 128, 0.48);
}

.match-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  flex: 0 0 auto;
}

/* Row 3: Time, Interactive Seek Bar & Live Output Gain Meter */
.meter {
  display: grid;
  gap: 5px;
}

.time {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.live-gain-label {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--st-fade-in-soft);
}

.channel.is-fading-out .live-gain-label {
  color: var(--amber);
}

.seek-bar {
  position: relative;
  height: 8px;
  background: rgba(255, 255, 255, 0.11);
  border-radius: 999px;
  overflow: hidden;
  cursor: pointer;
  transition: background 0.15s ease;
}

.seek-bar:hover {
  background: rgba(255, 255, 255, 0.2);
}

.seek-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.6);
  transition: width 0.12s linear;
}

.gain-meter-track {
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.gain-meter-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: var(--emerald);
  transition: width 0.06s linear;
}

.gain-meter-fill.gain-in {
  background: var(--st-fade-in);
}

.gain-meter-fill.gain-out {
  background: var(--st-fade-out);
}

/* ==========================================================================
   Row 4: Per-Track Independent Fade In & Fade Out Control Box
   ========================================================================== */
.deck-fade-box {
  background: rgba(6, 9, 15, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  padding: 6px 8px;
  display: grid;
  gap: 5px;
}

.fade-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.fade-toggle {
  height: 26px;
  padding: 0 9px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
  transition: all 0.14s ease;
}

.fade-toggle .compact-label {
  display: none;
}

/* Fade In ON: Smooth Cyan */
.fade-toggle.on-in {
  background: rgba(var(--st-fade-in-rgb), 0.18);
  border: 1px solid rgba(var(--st-fade-in-rgb), 0.48);
  color: var(--st-fade-in-soft);
}
.fade-toggle.on-in:hover {
  background: rgba(var(--st-fade-in-rgb), 0.32);
  color: #fff;
}

/* Fade In OFF: Punchy Instant Amber */
.fade-toggle.off-in {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(251, 191, 36, 0.5);
  color: #fde68a;
}
.fade-toggle.off-in:hover {
  background: rgba(245, 158, 11, 0.32);
  color: #fff;
}

/* Fade Out ON: Smooth Emerald/Teal */
.fade-toggle.on-out {
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.45);
  color: #a7f3d0;
}
.fade-toggle.on-out:hover {
  background: rgba(16, 185, 129, 0.3);
  color: #fff;
}

/* Fade Out OFF: Instant Cut Slate/Red */
.fade-toggle.off-out {
  background: rgba(239, 68, 68, 0.13);
  border: 1px solid rgba(248, 113, 113, 0.38);
  color: #fecaca;
}
.fade-toggle.off-out:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fff;
}

/* Custom Duration Stepper (- [2.0] s +) */
.fade-stepper {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
  transition: opacity 0.15s ease;
}

.fade-stepper.is-off {
  opacity: 0.45;
}

.fade-stepper.is-off:hover,
.fade-stepper.is-off:focus-within {
  opacity: 0.95;
}

.step-btn {
  width: 22px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.07);
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  padding: 0;
  display: grid;
  place-items: center;
  transition: all 0.12s ease;
}

.step-btn:hover {
  background: rgba(var(--accent-rgb), 0.22);
  border-color: var(--accent);
  color: #fff;
}

.fade-num-input {
  width: 42px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
  padding: 0 2px;
  outline: none;
  -moz-appearance: textfield;
}

.fade-num-input::-webkit-outer-spin-button,
.fade-num-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.fade-num-input:focus {
  border-color: var(--accent);
  background: rgba(15, 25, 38, 0.95);
}

.fade-stepper .unit {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin: 0 1px;
}

/* Row 5: Deck Volume Slider */
.volume-line {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 8px;
  min-height: 24px;
}

.vol-reset-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  padding: 0;
  display: grid;
  place-items: center;
}

.vol-reset-btn:hover {
  color: var(--accent-soft);
}

input[type="range"] {
  width: 100%;
  height: 18px;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -4.5px;
  border: 1.5px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.55);
}

input[type="range"]::-moz-range-track {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 1.5px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.55);
}

.volume-value {
  color: #e2e8f0;
  font-size: 11.5px;
  font-weight: 750;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Row 6: Unified Ergonomic Transport & File Bar */
.deck-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 2px;
}

.deck-btn-play {
  flex: 1.05 1 0;
  min-width: 0;
  height: var(--tap);
  border-radius: 11px;
  border: 1px solid rgba(var(--accent-rgb), 0.42);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.22), rgba(var(--accent-2-rgb), 0.12));
  color: var(--accent-soft);
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 8px;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.deck-btn-play:hover {
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.36), rgba(var(--accent-2-rgb), 0.22));
  border-color: var(--accent);
  color: #fff;
}

.deck-btn-play.is-playing {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: #fff;
  color: var(--accent-ink);
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.4);
}

.deck-btn-play.is-paused {
  border-color: rgba(96, 165, 250, 0.6);
  background: rgba(59, 130, 246, 0.24);
  color: #dbeafe;
}

.deck-btn-play.is-empty-load {
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
}

.deck-btn-stop {
  flex: 1.2 1 0;
  min-width: 0;
  height: var(--tap);
  border-radius: 11px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(245, 158, 11, 0.13);
  color: #fde68a;
  font-size: 12.5px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 8px;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.deck-btn-stop:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.28);
  border-color: var(--amber);
  color: #fff;
}

.deck-btn-stop.is-hard-mode {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(239, 68, 68, 0.13);
  color: var(--red-soft);
}

.deck-btn-stop.is-hard-mode:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.3);
  border-color: var(--red);
  color: #fff;
}

.deck-btn-stop.is-urgent-cut {
  border-color: #f87171;
  background: rgba(220, 38, 38, 0.45);
  color: #fff;
}

.deck-btn-cut,
.deck-btn-file {
  width: var(--tap);
  height: var(--tap);
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  font-size: 13px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.14s ease;
}

.deck-btn-cut {
  color: var(--red-soft);
  border-color: rgba(239, 68, 68, 0.28);
  background: rgba(239, 68, 68, 0.1);
}

.deck-btn-cut:hover:not(:disabled) {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* Nút nạp file đứng tách khỏi nút Cắt để không bấm nhầm khi đang diễn */
.deck-btn-file {
  margin-left: 6px;
}

.deck-btn-file:hover {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.16);
  color: #fff;
}

/* ==========================================================================
   Ba chế độ thẻ (khoá lưu giữ nguyên: view-large | view-medium | view-compact)
   - Dàn dựng (view-large): đủ nút chỉnh fade, âm lượng, lặp, nạp file.
   - Biểu diễn (view-medium): Phát/Dừng 54 px, thời gian còn lại chữ to, fade chỉ đọc; ẩn nút dễ bấm nhầm khi diễn.
   - Lưới (view-compact): ô nhỏ cho 24–32 deck; nhãn trạng thái ngắn lấy từ data-short.
   Chiều cao tên bài cố định theo chế độ nên thẻ không đổi cỡ khi đổi bài hay đổi trạng thái.
   ========================================================================== */
.mini-tag-btn span.tag-word {
  display: none;
}

.time-left {
  margin-left: auto;
  color: var(--text);
  font-weight: 850;
}

.time-total {
  opacity: 0.75;
}

/* Dàn dựng */
.app.view-large .channel {
  padding: 15px;
  gap: 10px;
}

.app.view-large .track-name {
  font-size: 15.5px;
}

/* Biểu diễn */
.app.view-medium .fade-stepper,
.app.view-medium .volume-line,
.app.view-medium .gain-meter-track,
.app.view-medium .deck-btn-cut,
.app.view-medium .deck-btn-file,
.app.view-medium .mini-tag-btn,
.app.view-medium .mini-icon-btn[data-action="toggle-loop"],
.app.view-medium .time-total {
  display: none;
}

.app.view-medium .deck-fade-box {
  grid-template-columns: 1fr 1fr;
  padding: 0;
  gap: 6px;
  background: transparent;
  border: 0;
}

.app.view-medium .fade-row {
  display: contents;
}

.app.view-medium .fade-toggle {
  justify-content: center;
  height: 26px;
  pointer-events: none;
}

.app.view-medium .fade-toggle .full-label {
  display: none;
}

.app.view-medium .fade-toggle .compact-label {
  display: inline;
}

.app.view-medium .track-name {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.25;
  height: 2.5em;
  font-size: 15.5px;
}

.app.view-medium .time {
  font-size: 13px;
}

.app.view-medium .time-left {
  font-size: 21px;
}

.app.view-medium .seek-bar {
  height: 10px;
}

.app.view-medium .deck-btn-play,
.app.view-medium .deck-btn-stop {
  height: 54px;
  font-size: 14px;
}

/* Lưới */
.app.view-compact .deck-meta-bar,
.app.view-compact .deck-fade-box,
.app.view-compact .volume-line,
.app.view-compact .gain-meter-track,
.app.view-compact .deck-btn-cut,
.app.view-compact .deck-btn-file,
.app.view-compact .mini-tag-btn,
.app.view-compact .mini-icon-btn,
.app.view-compact .time-current,
.app.view-compact .time-total,
.app.view-compact .live-gain-label {
  display: none;
}

.app.view-compact .channel {
  padding: 8px 9px 9px;
  gap: 6px;
  border-radius: 13px;
}

.app.view-compact .channel::before {
  left: 10px;
  right: 10px;
}

.app.view-compact .channel-head-left {
  gap: 5px;
}

.app.view-compact .hotkey {
  height: 24px;
  padding: 0 7px;
}

.app.view-compact .status-pill {
  height: 24px;
  padding: 0 5px;
  font-size: 0;
}

.app.view-compact .status-pill::after {
  content: attr(data-short);
  font-size: 11px;
}

.app.view-compact .track-name {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.25;
  height: 2.5em;
  font-size: 12.5px;
}

.app.view-compact .time {
  margin-top: -2px;
}

.app.view-compact .time-left {
  font-size: 13px;
}

.app.view-compact .seek-bar {
  height: 6px;
}

.app.view-compact .deck-controls {
  gap: 5px;
}

.app.view-compact .deck-btn-play,
.app.view-compact .deck-btn-stop {
  height: 36px;
  padding: 0 4px;
  font-size: 11.5px;
  border-radius: 9px;
}

/* ==========================================================================
   Row 3: Docked Master Console Bar (.master)
   ========================================================================== */
/* Màn rộng: cột dọc bên phải. Thứ tự trong DOM = thứ tự trên màn: Fade/Cắt hết, master, đang phát, thống kê, kênh đang hoạt động */
.master {
  min-height: 0;
  overflow-y: auto;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, rgba(22, 18, 32, 0.96), rgba(9, 10, 17, 0.98));
  padding: 12px;
  z-index: 15;
  box-shadow: -12px 0 32px rgba(0, 0, 0, 0.45);
}

.master-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 12px;
}

.master-queue {
  display: grid;
  gap: 8px;
  min-width: 0;
}

/* Master Now Playing Monitor */
.master-now-playing {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 12px;
  display: grid;
  gap: 4px;
}

.master-now-playing.is-playing {
  border-color: rgba(var(--accent-rgb), 0.45);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.11), rgba(255, 255, 255, 0.03));
}

.master-np-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.master-np-top .label {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.master-np-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.master-meta-pill {
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  background: rgba(15, 23, 42, 0.78);
  color: var(--accent-soft);
  font-size: 10.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.master-playing-chip {
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(52, 211, 153, 0.5);
  background: rgba(16, 185, 129, 0.2);
  color: #d1fae5;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.master-playing-chip.stopped {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
}

.master-playing-chip.fading {
  border-color: rgba(251, 191, 36, 0.6);
  background: rgba(245, 158, 11, 0.22);
  color: #fef3c7;
}

.master-np-mid {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.master-np-mid strong {
  font-size: 13.5px;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.master-np-time {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.master-np-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.master-np-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 0.15s linear;
}

/* Center: Master Volume Fader */
.master-fader-box {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  padding: 8px 13px;
  display: grid;
  gap: 5px;
}

.master-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.volume-val {
  color: var(--accent-soft);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.master-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mute-btn {
  height: 32px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.mute-btn:hover {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
}

.mute-btn.is-muted {
  background: var(--red);
  border-color: #fca5a5;
  color: #fff;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.5);
}

.chip-btn {
  height: 32px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.07);
  color: var(--accent-soft);
  font-size: 11.5px;
  font-weight: 800;
  transition: all 0.15s ease;
}

.chip-btn:hover {
  background: rgba(var(--accent-rgb), 0.18);
  border-color: var(--accent);
}

/* Right: Emergency / Stage Fade Buttons */
/* Dính đầu cột: cuộn danh sách kênh vẫn thấy nút khẩn */
.master-stage-actions {
  position: sticky;
  top: -12px;
  z-index: 2;
  margin: -12px -12px 0;
  padding: 12px;
  background: rgba(20, 16, 29, 0.97);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.stage-btn {
  height: 72px;
  padding: 0 15px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: left;
  transition: all 0.15s ease;
}

.stage-btn svg {
  width: 22px;
  height: 22px;
}

.stage-btn .stage-btn-copy strong {
  font-size: 16px;
}

.stage-btn-copy {
  display: grid;
  gap: 1px;
}

.stage-btn-copy strong {
  font-size: 12.5px;
  font-weight: 850;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.stage-btn-copy small {
  font-size: 10.5px;
  opacity: 0.85;
  white-space: nowrap;
}

.stage-fade-btn {
  border: 1px solid rgba(251, 191, 36, 0.48);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(217, 119, 6, 0.1));
  color: #fde68a;
}

.stage-fade-btn:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.38), rgba(217, 119, 6, 0.22));
  border-color: var(--amber);
  color: #fff;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.28);
}

.stage-stop-btn {
  border: 1px solid rgba(239, 68, 68, 0.48);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.22), rgba(153, 27, 27, 0.14));
  color: #fecaca;
}

.stage-stop-btn:hover {
  background: linear-gradient(135deg, #dc2626, #991b1b);
  border-color: #fca5a5;
  color: #fff;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.35);
}

/* ==========================================================================
   Modals (Deck Settings & Keyboard Shortcuts)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 11, 0.82);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
  padding: 18px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(160deg, #161d2b 0%, #0d121c 100%);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.75);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-card.modal-large {
  max-width: 740px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.modal-head h3 {
  margin: 0;
  color: #fff;
  font-size: 19px;
  font-weight: 850;
}

.modal-sub {
  color: var(--muted);
  font-size: 12px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.modal-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.modal-grid-2 {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 12px;
}

.modal-grid-2:has(.compact-card) {
  grid-template-columns: 1fr 1fr;
}

.hotkey-input {
  color: var(--accent-soft) !important;
  font-weight: 850;
  text-transform: uppercase;
  text-align: center;
}

/* Modal Rekordbox-Style Tone & Tempo Analysis Box */
.modal-analysis-box {
  border: 1px solid rgba(var(--accent-rgb), 0.24);
  border-radius: 15px;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.08), rgba(15, 23, 42, 0.65));
  padding: 12px;
  display: grid;
  gap: 10px;
}

.modal-analysis-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-analysis-head strong {
  font-size: 13px;
  color: var(--accent-soft);
}

.reanalyze-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.45);
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--accent-soft);
  font-size: 11.5px;
  font-weight: 750;
  transition: all 0.14s ease;
}

.reanalyze-btn:hover:not(:disabled) {
  background: rgba(var(--accent-rgb), 0.28);
  color: #fff;
}

.modal-analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.bpm-edit-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.bpm-edit-row .modal-input {
  text-align: center;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.bpm-mult-btn {
  height: 38px;
  min-width: 36px;
  padding: 0 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 800;
  transition: all 0.14s ease;
}

.bpm-mult-btn:hover {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.2);
  color: #fff;
}

@media (max-width: 640px) {
  .modal-analysis-grid {
    grid-template-columns: 1fr;
  }
}

/* Modal Per-Track Fade In & Fade Out Cards */
.modal-fade-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-fade-card {
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 15px;
  background: rgba(7, 10, 17, 0.6);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.modal-fade-card.is-disabled .modal-fade-time-row {
  opacity: 0.45;
}

.modal-fade-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.modal-fade-header strong {
  display: block;
  font-size: 13.5px;
  color: #fff;
}

.modal-fade-header small {
  font-size: 11px;
  color: var(--accent-soft);
}

.modal-fade-time-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #cbd5e1;
}

.modal-sec-input {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.modal-sec-input input {
  width: 72px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  outline: none;
}

.modal-sec-input input:focus {
  border-color: var(--accent);
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.preset-chips button {
  height: 25px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 700;
  transition: all 0.13s ease;
}

.preset-chips button:hover {
  border-color: var(--accent);
  color: #fff;
}

.preset-chips button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 850;
}

.modal-sync-fade-btn {
  min-height: 34px;
  border-radius: 10px;
  border: 1px dashed rgba(var(--accent-rgb), 0.35);
  background: rgba(var(--accent-rgb), 0.07);
  color: var(--accent-soft);
  font-size: 12px;
  font-weight: 700;
  padding: 0 12px;
  transition: all 0.15s ease;
}

.modal-sync-fade-btn:hover {
  background: rgba(var(--accent-rgb), 0.18);
  border-color: var(--accent);
  color: #fff;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.save-primary-btn {
  flex: 1;
  min-height: 42px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: var(--accent-ink);
  font-size: 13.5px;
  font-weight: 850;
}

.save-primary-btn:hover {
  filter: brightness(1.08);
  color: var(--accent-ink);
}

/* Shortcuts Table */
.shortcuts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.shortcuts-table th,
.shortcuts-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.shortcuts-table th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-tip-banner {
  padding: 11px 14px;
  background: rgba(var(--accent-rgb), 0.1);
  border-left: 3px solid var(--accent);
  border-radius: 9px;
  font-size: 12.5px;
  color: var(--accent-soft);
  line-height: 1.45;
}

/* Toast Notification */
.toast-notice {
  position: fixed;
  bottom: 92px;
  right: 22px;
  background: rgba(12, 19, 31, 0.96);
  border: 1px solid rgba(var(--accent-rgb), 0.5);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 750;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.65), 0 0 20px rgba(var(--accent-rgb), 0.22);
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast-notice.show {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Responsive Breakpoints (Laptops, Tablets & Small Screens)
   ========================================================================== */
/* Thanh trên gọn còn một hàng: nút công cụ chỉ còn biểu tượng (chữ vẫn ở title) */
@media (max-width: 1360px) {
  .topbar .toolbar-btn span,
  .view-switch > span {
    display: none;
  }
  .topbar .toolbar-btn {
    width: 36px;
    padding: 0;
  }
  .search-wrap {
    min-width: 120px;
  }
}

/* Máy tính bảng ngang: cột điều khiển tổng xuống đáy thành một hàng (đang phát | master | Fade/Cắt hết) */
@media (max-width: 1100px) {
  .main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "top" "deck" "console";
  }
  /* Bàn master nằm trên ngăn kéo: mở Thư viện/Cài đặt vẫn bấm được Fade hết/Cắt hết */
  .master {
    position: relative;
    z-index: 25;
    overflow: visible;
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    padding: 8px 12px;
    box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.45);
  }
  .side-panel {
    padding-bottom: 200px;
  }
  .master-inner {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto;
    grid-template-areas: "np fader stage";
    align-items: center;
    gap: 10px;
  }
  .master-now-playing { grid-area: np; }
  .master-fader-box { grid-area: fader; }
  .master-stage-actions {
    grid-area: stage;
    position: static;
    margin: 0;
    padding: 0;
    background: transparent;
    grid-template-columns: auto auto;
  }
  .stage-btn {
    height: 56px;
  }
  .stage-btn .stage-btn-copy strong {
    font-size: 13px;
  }
  .status-strip,
  .master-queue {
    display: none;
  }
  .crossfade-pill > span:not(.cf-dot) {
    font-size: 12px;
  }
}

/* Máy tính bảng dọc và điện thoại: ray thành hàng điều hướng trên cùng; ngăn kéo phủ toàn bề rộng dưới hàng đó */
@media (max-width: 920px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .sidebar-footer {
    display: none;
  }
  .nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 5px 8px;
    gap: 4px;
  }
  .nav button {
    min-height: 50px;
  }
  .nav button.active {
    box-shadow: inset 0 -3px 0 var(--accent);
  }
  .side-panel {
    top: 61px;
    left: 0;
    width: 100%;
    border-right: 0;
    border-top: 1px solid var(--line-strong);
  }
  .topbar {
    flex-wrap: wrap;
  }
  .topbar-left {
    display: contents;
  }
  .search-wrap {
    order: 2;
    flex: 1 1 160px;
    max-width: none;
  }
  .brand { order: 1; }
  .crossfade-pill,
  .lang-switch { order: 3; }
  .topbar-actions { order: 4; }
  .modal-fade-grid,
  .modal-grid-2,
  .modal-grid-2:has(.compact-card) {
    grid-template-columns: 1fr;
  }
}

/* Điện thoại: bàn master hai hàng (âm lượng tổng; Fade/Cắt hết), ẩn bảng đang phát (đã có trên thẻ) */
@media (max-width: 600px) {
  .topbar {
    padding: 6px 10px;
    gap: 6px 8px;
  }
  .brand-logo,
  .brand-logo-img {
    width: 32px;
    height: 32px;
  }
  .brand h1 {
    font-size: 16px;
  }
  .live-clock {
    display: none;
  }
  .topbar-actions {
    flex: 1 1 100%;
    justify-content: space-between;
  }
  .workspace {
    padding: 10px 10px 14px;
  }
  .master {
    padding: 8px 10px;
  }
  .master-inner {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "fader" "stage";
    gap: 8px;
  }
  .master-now-playing,
  .master-title {
    display: none;
  }
  .master-fader-box {
    padding: 6px 10px;
  }
  .master-stage-actions {
    grid-template-columns: 1fr 1fr;
  }
  .stage-btn {
    height: 54px;
    padding: 0 10px;
  }
}

/* ==========================================================================
   Thu/mở hai cột (ray trái, cột điều khiển phải) để lưới deck rộng hết màn hình.
   Chỉ màn ≥ 1101 px (dưới đó cột điều khiển đã xuống đáy, ray thành thanh ngang). panels.js bật tắt lớp trên #app.
   ========================================================================== */
.edge-tab,
.stagebar {
  display: none;
}

@media (min-width: 1101px) {
  .edge-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 50%;
    width: 18px;
    height: 56px;
    margin-top: -28px;
    padding: 0;
    z-index: 18;
    color: var(--accent-soft);
    background: rgba(11, 14, 21, 0.95);
    border: 1px solid var(--line-strong);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
  }
  .edge-tab:hover,
  .edge-tab:focus-visible {
    background: rgba(var(--accent-rgb), 0.28);
    color: #fff;
  }
  .edge-tab-left {
    left: calc(var(--rail-w) - 1px);
    border-left: 0;
    border-radius: 0 10px 10px 0;
  }
  .edge-tab-right {
    right: calc(var(--console-w) - 1px);
    border-right: 0;
    border-radius: 10px 0 0 10px;
  }
  .rail-hidden .edge-tab-left { left: 0; }
  .console-hidden .edge-tab-right { right: 0; }
  .rail-hidden .edge-tab-left svg,
  .console-hidden .edge-tab-right svg {
    transform: rotate(180deg);
  }

  /* Ray thu: ẩn hẳn, lưới chiếm cột đầu */
  .app.rail-hidden {
    grid-template-columns: minmax(0, 1fr);
  }
  .rail-hidden .sidebar {
    display: none;
  }

  /* Cột phải thu: lưới rộng hết, Fade hết/Cắt hết xuống thanh mỏng ở đáy */
  .console-hidden .main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "top" "deck" "stagebar";
  }
  .console-hidden .master {
    display: none;
  }
  .console-hidden .stagebar {
    grid-area: stagebar;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 8px 28px 8px 14px;
    border-top: 1px solid var(--line);
    background: rgba(10, 13, 20, 0.86);
    z-index: 15;
  }
  .stagebar .stage-btn {
    height: 44px;
    padding: 0 18px;
  }
  .stagebar .stage-btn .stage-btn-copy strong {
    font-size: 13px;
  }
  .stagebar-open {
    margin-right: auto;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent-soft);
    font: inherit;
    font-weight: 700;
    font-size: 12.5px;
    cursor: pointer;
  }
  .stagebar-open:hover {
    background: rgba(var(--accent-rgb), 0.22);
    color: #fff;
  }
}
