body.screen {
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(320px, 26vw, 420px);
}

/* ================= Sân khấu ================= */
.stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  padding: 24px 28px 22px;
  gap: 18px;
  min-width: 0;
}
.player {
  position: relative;
  min-height: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
}
.yt,
.yt iframe,
.beat-view,
.empty-view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.yt[hidden],
.beat-view[hidden],
.empty-view[hidden] {
  display: none;
}

/* Beat: không có hình, nên tên bài là sân khấu */
.beat-view {
  display: grid;
  align-content: center;
  padding: 6%;
  background:
    radial-gradient(120% 90% at 15% 110%, color-mix(in srgb, var(--brass) 22%, transparent), transparent 60%),
    radial-gradient(90% 80% at 100% 0%, color-mix(in srgb, var(--rose) 18%, transparent), transparent 55%),
    var(--plum);
}
.beat-kind {
  margin: 0 0 0.4em;
  color: var(--brass);
  font-weight: 600;
  font-size: clamp(1rem, 1.6vw, 1.5rem);
}
.beat-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(3rem, 8vw, 9rem);
  line-height: 0.92;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

.empty-view {
  display: grid;
  align-content: center;
  justify-items: start;
  padding: 6%;
  background: var(--plum);
}
.empty-view h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(3rem, 6vw, 6.5rem);
  line-height: 0.95;
}
.empty-view p {
  max-width: 34ch;
  font-size: clamp(1.1rem, 1.5vw, 1.4rem);
  color: var(--mute);
}

/* thanh thông tin bài */
.np {
  display: grid;
  gap: 10px;
}
.np-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2rem, 3.4vw, 3.6rem);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* beat đã có tên bài cỡ lớn trên sân khấu */
.mode-beat .np-title {
  display: none;
}
.np-meta {
  margin: 4px 0 0;
  min-height: 1.4em;
  color: var(--mute);
}
.progress {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--mute);
  --track: var(--brass);
}
.transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.transport button {
  border: 0;
  border-radius: 10px;
  padding: 10px 18px;
  background: var(--plum-2);
  font-weight: 600;
}
.transport button:hover {
  background: var(--line);
}
#btnPlay {
  background: var(--brass);
  color: var(--velvet);
  min-width: 7.5em;
}
.vol {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 14px;
  color: var(--mute);
  font-size: 0.92rem;
  --track: var(--brass);
}
.vol input {
  width: 130px;
}
.vol-mic {
  --track: var(--rose);
}

/* ================= Cột bên ================= */
.side {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 18px;
  min-height: 0;
  padding: 24px 22px 22px 4px;
}
.side h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.join {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: var(--plum);
}
.join img {
  width: 112px;
  height: 112px;
  border-radius: 8px;
  background: #fff;
}
.join h2 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.9rem;
  line-height: 1;
}
.join p {
  margin: 4px 0 0;
  color: var(--mute);
  font-size: 0.88rem;
}
.join .join-url {
  color: var(--ink);
  font-weight: 600;
  word-break: break-all;
}

/* làn micro: mỗi người một màu, thanh đèn nhảy theo giọng */
.count {
  min-width: 1.6em;
  padding: 0 0.4em;
  border-radius: 999px;
  background: var(--plum-2);
  text-align: center;
  font-size: 0.85rem;
}
.mic-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 34vh;
  overflow-y: auto;
}
.lane {
  --lvl: 0;
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--plum);
  border-left: 4px solid var(--c);
}
.lane-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.lane-name {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lane-lat {
  flex: none;
  font-size: 0.8rem;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
}
.lane-meter {
  height: 8px;
  border-radius: 4px;
  background: var(--velvet);
  overflow: hidden;
}
.lane-meter i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 4px;
  background: var(--c);
  transform-origin: left;
  transform: scaleX(var(--lvl));
  box-shadow: 0 0 12px var(--c);
}
.lane-ctl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.lane-ctl input {
  --track: var(--c);
  height: 22px;
}
.lane-off {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 8px;
  padding: 3px 10px;
  font-size: 0.82rem;
}
.lane.is-muted {
  opacity: 0.55;
}
.lane.is-muted .lane-meter i {
  transform: scaleX(0);
}

/* hàng chờ / thư viện */
.lists {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--plum-2);
}
.tabs button {
  border: 0;
  background: transparent;
  padding: 8px 12px;
  color: var(--mute);
  font-weight: 600;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}
.tabs button[aria-selected="true"] {
  color: var(--ink);
  border-color: var(--brass);
}
.panel {
  overflow-y: auto;
  min-height: 0;
  padding-top: 8px;
}
.queue,
.lib {
  list-style: none;
  margin: 0;
  padding: 0;
}
.queue {
  counter-reset: q;
}
.queue li,
.lib li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--plum-2);
}
.queue li:not(.empty)::before {
  counter-increment: q;
  content: counter(q);
  flex: none;
  width: 1.3em;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--brass);
}
.q-title {
  flex: 1;
  min-width: 0;
  display: grid;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.q-title small {
  color: var(--mute);
  font-size: 0.78rem;
}
.queue button,
.lib button {
  flex: none;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.82rem;
}
.lib [data-sing] {
  border-color: var(--brass);
  color: var(--brass);
  font-weight: 600;
}
.queue [data-remove]:hover,
.lib [data-del]:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.add-row,
.add-beat {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}
.add-row {
  grid-template-columns: 1fr auto;
}
.add-row input,
.add-beat input[type="text"],
.lib-search {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--velvet);
  padding: 8px 10px;
}
.add-row button,
.add-beat button {
  border: 0;
  border-radius: 9px;
  padding: 8px 14px;
  background: var(--plum-2);
  font-weight: 600;
}
.add-beat button {
  background: var(--brass);
  color: var(--velvet);
}
.file-pick {
  display: block;
  position: relative;
  border: 1.5px dashed var(--line);
  border-radius: 9px;
  padding: 10px;
  color: var(--mute);
  font-size: 0.9rem;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.file-pick:hover,
.file-pick:focus-within {
  border-color: var(--brass);
  color: var(--ink);
}
.file-pick input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
progress {
  width: 100%;
  height: 6px;
  accent-color: var(--brass);
}
.lib-msg {
  margin: 0 0 8px;
  min-height: 1.3em;
  font-size: 0.85rem;
  color: var(--aqua);
}
.lib-msg.bad {
  color: var(--danger);
}
.lib-search {
  margin-bottom: 4px;
}
.empty {
  color: var(--mute);
  font-size: 0.92rem;
}

/* ================= Cổng mở phòng ================= */
.gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--velvet) 92%, transparent);
  backdrop-filter: blur(6px);
  z-index: 10;
}
.gate-box {
  max-width: 560px;
}
.gate h1 {
  margin: 0 0 0.2em;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(3.5rem, 7vw, 6.5rem);
  line-height: 0.92;
}
.gate p {
  color: var(--mute);
  font-size: 1.1rem;
}
.gate button {
  margin: 12px 0 8px;
  border: 0;
  border-radius: 14px;
  padding: 16px 34px;
  background: var(--rose);
  color: var(--velvet);
  font-size: 1.25rem;
  font-weight: 700;
}
.gate .gate-hint {
  font-size: 0.9rem;
}

/* màn hình hẹp (tablet dọc): xếp chồng */
@media (max-width: 900px) {
  body.screen {
    height: auto;
    overflow: auto;
    grid-template-columns: 1fr;
  }
  .stage {
    grid-template-rows: auto auto;
    padding: 16px;
  }
  .player {
    aspect-ratio: 16 / 9;
  }
  .side {
    padding: 0 16px 24px;
  }
  .vol {
    margin-left: 0;
  }
}
