:root {
  --bg: #0b1026;
  --card: #18213f;
  --accent: #ff4fa3;
  --accent-light: #ff8ac5;
  --text: #ffffff;
  --text-2: #9aa6c8;
  --gold: #ffd54f;
  --bottom-h: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

/* 手机竖屏 App 布局：顶部(房间/在线) -> 播放器 -> 内容区(滚动) -> 底部菜单 */
body {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; font-size: 13px; color: var(--text-2);
  padding-top: calc(12px + env(safe-area-inset-top));
  flex: none;
}
.topbar b { color: var(--accent-light); }

/* 连接状态提示条（未连接/电视离线/房间关闭） */
.notice {
  display: none; margin: 0 12px 10px; padding: 9px 12px; border-radius: 8px; flex: none;
  background: #3a2440; color: var(--gold); font-size: 12px; text-align: center;
}
.notice.show { display: block; }

.now { margin: 0 12px; padding: 14px; background: var(--card); border-radius: 12px; flex: none; }
.now-title { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-sub { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.progress { height: 4px; background: #2a3560; border-radius: 2px; margin-top: 10px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--gold)); transition: width .5s linear; }

.ctrl-row { display: flex; gap: 8px; margin-top: 12px; }
.ctrl-row button {
  flex: 1; border: 0; border-radius: 8px; padding: 9px 0;
  background: #232e57; color: var(--text); font-size: 13px;
}
.ctrl-row button:active { opacity: .7; }

/* 内容区：占据剩余空间并独立滚动 */
main {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  margin-top: 12px;
  padding-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom) + 12px);
}
.panel { display: none; padding: 0 12px; }
.panel.active { display: block; }

/* 点歌台工具条：搜索 / 歌手 / 语言 / 标签 四等分（各占 25%），点击弹出对话框 */
.toolbar { display: flex; gap: 8px; margin-bottom: 10px; }
.tool-btn {
  flex: 1 1 0; min-width: 0;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 10px; padding: 11px 8px;
  background: var(--card); color: var(--text-2); font-size: 13px;
}
.tool-btn:active { opacity: .7; }
.tool-btn > span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-all; line-height: 1.3; text-align: center; }
.tool-btn.on { color: var(--accent-light); }

/* 底部菜单：两栏 */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; background: var(--card);
  border-top: 1px solid #232e57;
  padding-bottom: env(safe-area-inset-bottom);
  height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
}
.bottombar .tab {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 0; background: transparent; color: var(--text-2); font-size: 11px;
}
.bottombar .tab-ico { font-size: 18px; line-height: 1; }
.bottombar .tab.active { color: var(--accent); font-weight: 700; }
.tab-badge {
  position: absolute; top: 6px; left: calc(50% + 8px);
  min-width: 16px; height: 16px; line-height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px;
}

.songlist, .quelist { list-style: none; }
.songlist li, .quelist li {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px;
}
.song-name { font-size: 15px; }
.song-singer { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.pick-btn { border: 0; border-radius: 16px; padding: 8px 16px; background: var(--accent); color: #fff; font-size: 13px; }
.pick-btn:active { opacity: .7; }
/* 已在已点队列中：置灰不可再点 */
.pick-btn.picked { background: #232e57; color: var(--text-2); }

.q-name { font-size: 14px; }
.q-from { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.q-acts { display: flex; gap: 6px; }
.q-acts button { border: 0; border-radius: 8px; padding: 7px 10px; background: #232e57; color: var(--text); font-size: 12px; }

.empty { text-align: center; color: var(--text-2); font-size: 13px; padding: 30px 0; display: none; }
.empty.show { display: block; }

/* 弹出式对话框 */
.dialog-mask {
  position: fixed; inset: 0; z-index: 20; display: none;
  background: rgba(0, 0, 0, .6);
  align-items: center; justify-content: center; padding: 24px;
}
.dialog-mask.show { display: flex; }
.dialog {
  width: 100%; max-width: 360px; max-height: 78vh;
  display: flex; flex-direction: column;
  background: var(--card); border-radius: 14px; padding: 14px;
}
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dialog-title { font-size: 15px; font-weight: 700; }
.dialog-x { border: 0; background: transparent; color: var(--text-2); font-size: 15px; padding: 4px 8px; }
.dialog-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.dialog-foot { display: flex; gap: 8px; margin-top: 14px; }
.dlg-btn { flex: 1; border: 0; border-radius: 10px; padding: 11px 0; font-size: 14px; }
.dlg-btn.ghost { background: #232e57; color: var(--text); }
.dlg-btn.primary { background: var(--accent); color: #fff; font-weight: 700; }
.dlg-btn:active { opacity: .7; }

.search {
  width: 100%; border: 0; border-radius: 10px; background: #232e57;
  color: var(--text); padding: 12px 14px; font-size: 15px; outline: none;
}

/* 筛选弹层内流式（flex wrap）选项 */
.f-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 0; border-radius: 14px; padding: 6px 14px;
  background: #232e57; color: var(--text-2); font-size: 13px;
  max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.chip.active { background: var(--accent); color: #fff; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--bottom-h) + 20px); transform: translateX(-50%);
  background: rgba(0, 0, 0, .8); color: #fff; font-size: 13px;
  padding: 10px 18px; border-radius: 20px; opacity: 0; pointer-events: none;
  transition: opacity .25s; z-index: 30;
}
.toast.show { opacity: 1; }
