:root {
  --bg: #0d0f14;
  --panel: #151923;
  --panel-2: #1b202c;
  --border: #262d3d;
  --text: #e8eaf0;
  --muted: #8b93a7;
  --accent: #f44d8a;
  --accent-2: #7c5cff;
  --green: #34d399;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: radial-gradient(1200px 600px at 80% -10%, #241a33 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", sans-serif;
  overflow: hidden;
}

button { font-family: inherit; }

/* 主题化滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #2b3347;
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #3d4a68; background-clip: content-box; }
* { scrollbar-width: thin; scrollbar-color: #2b3347 transparent; }

.hidden { display: none !important; }

.btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  transition: background .15s, transform .05s;
}
.btn:hover { background: #232a3a; }
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #fff;
}
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 3px 8px; font-size: 12px; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.icon { width: 38px; height: 38px; padding: 0; font-size: 15px; }
.btn.icon.big { width: 46px; height: 46px; font-size: 18px; }
.btn.on { border-color: var(--accent); color: var(--accent); }
.btn.danger { background: transparent; border-color: #e5484d; color: #ffb3b5; }
.btn.danger:hover { background: rgba(229, 72, 77, .12); }

.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 15, 20, .8);
}
.logo { font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.logo span { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 8px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-left { display: flex; align-items: center; gap: 10px; }
.menu-btn { display: none; }
.topbar .btn {
  height: 34px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.badge { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }

.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: calc(100vh - 56px - 92px);
}

.sidebar {
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  overflow-y: auto;
  background: rgba(13, 15, 20, .5);
}
.sidebar-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 85;
}
.panel-title {
  font-size: 12px;
  color: var(--muted);
  margin: 12px 6px 8px;
  letter-spacing: 2px;
}
.panel-title:first-child { margin-top: 0; }

.list { list-style: none; }
.list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.list li:hover { background: var(--panel-2); }
.list li.active { background: rgba(244, 77, 138, .15); color: #fff; }
.list li.empty { cursor: default; color: var(--muted); font-size: 12px; }
.list img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; flex: none; }
.daily-icon {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.list .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .meta { color: var(--muted); font-size: 11px; margin-top: 2px; }
.local-item { justify-content: space-between; }
.local-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.content { overflow-y: auto; padding: 20px 24px 40px; display: flex; gap: 20px; align-items: flex-start; }
.content-main { flex: 1; min-width: 0; }

.lyric-panel {
  width: 320px;
  flex: none;
  position: sticky;
  top: 20px;
  margin-bottom: 40px;
  max-height: calc(100vh - 56px - 92px - 60px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(13, 15, 20, .6);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.lyric-panel .panel-title { margin: 0 0 10px; }
.lyric-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  line-height: 1.5;
  font-size: 14px;
  position: relative;
  text-align: center;
  padding: 6px 0;
  scroll-behavior: smooth;
}
.lyric-line {
  color: var(--muted);
  font-size: 20px; /* 统一排版字号：所有状态换行布局一致 */
  line-height: 1.5;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  border-radius: 8px;
  opacity: .45;
  transform-origin: center;
  transform: scale(.6); /* 最远行最小（约 12px），随接近当前行逐级放大 */
  transition: transform .25s, opacity .25s, color .25s;
}
.lyric-line.far { transform: scale(.72); opacity: .6; }
.lyric-line.near { transform: scale(.88); opacity: .8; }
.lyric-line.active {
  color: #fff;
  font-weight: 600;
  opacity: 1;
  transform: scale(1);
}
.lyric-empty { color: var(--muted); font-size: 12px; line-height: 1.8; }
.lyric-script { color: var(--text); white-space: pre-wrap; line-height: 1.9; font-size: 13px; }
.range-row { display: flex; align-items: center; gap: 10px; }
.range-row input[type="range"] { flex: 1; }
.range-value {
  flex: none;
  min-width: 34px;
  text-align: center;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}
.form-grid select:disabled { opacity: .5; cursor: not-allowed; }
.lyric-line .dj-name,
.lyric-script-line .dj-name {
  flex: none;
  display: inline-block;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(244, 77, 138, .22);
  color: var(--accent);
}
.lyric-script-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  text-align: left;
  padding: 6px 4px;
  color: var(--text);
  line-height: 1.7;
}
.lyric-script-line .dj-text { flex: 1; min-width: 0; }

.playlist-header {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.playlist-header img {
  width: 140px;
  height: 140px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .45);
}
.playlist-info { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.playlist-info h2 { font-size: 24px; }
.playlist-info p { color: var(--muted); font-size: 13px; line-height: 1.6; max-width: 640px; }
.playlist-actions { display: flex; gap: 10px; margin-top: 8px; }

.track-list table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.track-list col.col-idx { width: 52px; }
.track-list col.col-album { width: 220px; }
.track-list col.col-dur { width: 76px; }
.track-list col.col-op { width: 88px; }
.track-list th {
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.track-list td { padding: 8px 10px; border-bottom: 1px solid rgba(38, 45, 61, .5); font-size: 13px; }
.track-list tr { cursor: default; }
.track-list tbody tr:hover { background: rgba(27, 32, 44, .6); }
.track-list .idx { color: var(--muted); text-align: center; }
.track-list th.idx { text-align: center; }
.track-list td.song { display: flex; align-items: center; gap: 10px; }
.track-list .song img { width: 36px; height: 36px; border-radius: 5px; object-fit: cover; flex: none; }
.track-list .tname { font-size: 13px; }
.track-list .tartist { color: var(--muted); font-size: 12px; margin-top: 2px; }
.track-list .album { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-list .dur { color: var(--muted); text-align: center; }
.track-list th.dur { text-align: center; }
.track-list .op { text-align: center; }
.track-list th.op { text-align: center; }

.tts-fields { margin-top: 12px; }
.field-tip { font-size: 11px; color: var(--muted); margin-top: 6px; }

.playerbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 92px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  background: rgba(13, 15, 20, .92);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.now { display: flex; align-items: center; gap: 12px; min-width: 0; }
.now img { width: 54px; height: 54px; border-radius: 8px; object-fit: cover; }
.now-text { min-width: 0; }
.now-title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-artist { color: var(--muted); font-size: 12px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.controls { display: flex; align-items: center; gap: 10px; }
.playerbar-right { display: flex; align-items: center; justify-content: flex-end; }

/* 网易云式顶部进度条：已播彩色、未播灰色，悬停显示滑块与时间小窗 */
.seek-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 14px;
  display: flex;
  align-items: center;
  cursor: pointer;
  z-index: 5;
}
.seek-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--accent) var(--seek-pct, 0%),
    rgba(255, 255, 255, .16) var(--seek-pct, 0%)
  );
  transition: height .15s ease;
}
.seek-bar:hover::before { height: 5px; }
/* 透明交互层：捕获点击与拖动，视觉滑块由 seek-thumb 驱动 */
.seek-bar input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 100%;
  margin: 0;
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  opacity: 0;
  touch-action: none;
}
.seek-bar input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1px;
  height: 1px;
}
.seek-thumb {
  position: absolute;
  top: 2px;
  left: var(--seek-pct, 0%);
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}
.seek-bar:hover .seek-thumb { opacity: 1; }
.seek-tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: var(--seek-pct, 0%);
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 6;
}
.seek-bar:hover .seek-tip { opacity: 1; }

.volume { position: relative; display: flex; align-items: center; }
.play-mode-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
}
.play-mode-btn:hover { background: var(--panel-2); }
.volume-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
}
.volume-btn:hover { background: var(--panel-2); }
.volume-panel {
  position: absolute;
  left: 50%;
  width: 52px;
  bottom: calc(100% + 12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(6px);
  transition: opacity .15s, transform .15s, visibility .15s;
  z-index: 30;
}
.volume:hover .volume-panel,
.volume:focus-within .volume-panel {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.volume-panel #volumePct { font-size: 12px; color: var(--text); min-width: 36px; text-align: center; }
.volume-panel input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  writing-mode: vertical-lr;
  direction: rtl;
  width: 4px;
  height: 92px;
  margin: 0;
  border-radius: 2px;
  background: linear-gradient(
    to top,
    var(--accent) var(--vol-pct, 50%),
    rgba(255, 255, 255, .16) var(--vol-pct, 50%)
  );
  cursor: pointer;
}
.volume-panel input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
}
.volume-panel input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
}

input[type="range"] { width: 100%; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 10, .72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.modal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  max-height: 90vh;
  overflow-y: auto;
  width: min(680px, calc(100vw - 40px));
}
.modal-card.narrow { width: min(380px, calc(100vw - 40px)); }
.modal-card.wide { width: min(780px, calc(100vw - 40px)); }
.modal-card h2 { font-size: 19px; margin-bottom: 16px; }
.qr-box { text-align: center; }
.qr-box img { width: 260px; height: 260px; border-radius: 10px; background: #fff; }
.qr-box img.dim { opacity: .35; }
.qr-box p { color: var(--muted); font-size: 13px; margin-top: 12px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.settings-section { border-top: 1px solid var(--border); padding: 16px 0; }
.settings-section h3 { font-size: 14px; margin-bottom: 12px; color: var(--accent); }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.form-grid input, .form-grid select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  width: 100%;
}
.form-grid label.check-row {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.form-grid label.check-row input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.form-grid label.check-row span { flex: 1; }
.tts-settings-disabled { opacity: .45; pointer-events: none; }
.test-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.test-result {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  white-space: pre-wrap;
  max-width: 100%;
  color: var(--green);
}

.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 9999;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
  max-width: 80vw;
}
.toast.show { opacity: 1; }
.toast.error { border-color: #e5484d; color: #ffb3b5; }
.toast.ok { border-color: var(--green); color: var(--green); }

/* 首次登录配置引导悬浮窗 */
.setup-tip {
  position: fixed;
  top: 72px;
  right: 20px;
  z-index: 150;
  width: min(340px, calc(100vw - 40px));
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--panel);
  border: 1px solid rgba(244, 77, 138, .45);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .5);
  animation: tip-in .3s ease;
}
@keyframes tip-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.setup-tip-icon { font-size: 22px; line-height: 1.2; flex: none; }
.setup-tip-body { flex: 1; min-width: 0; }
.setup-tip-title { font-size: 14px; font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.setup-tip-body p { font-size: 12px; color: var(--muted); line-height: 1.6; }
.setup-tip-actions { display: flex; flex-direction: column; gap: 6px; flex: none; }

/* 播放列表悬浮窗 */
.playlist-panel {
  position: fixed;
  right: 20px;
  bottom: calc(92px + 12px);
  width: min(340px, calc(100vw - 40px));
  max-height: min(440px, calc(100vh - 180px));
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  z-index: 120;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .5);
  display: flex;
  flex-direction: column;
}
.playlist-panel-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.playlist-panel-body { overflow-y: auto; }
.pp-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.pp-item:hover { background: var(--panel-2); }
.pp-item.active { background: rgba(244, 77, 138, .15); color: #fff; }
.pp-idx { color: var(--muted); font-size: 11px; width: 22px; text-align: right; flex: none; }
.pp-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-artist { color: var(--muted); font-size: 11px; flex: none; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-empty { color: var(--muted); font-size: 12px; padding: 10px; }

.app-version { text-align: right; color: var(--muted); font-size: 11px; margin: 12px 0 -6px; }

/* PC 端右键菜单 */
.context-menu {
  position: fixed;
  z-index: 300;
  min-width: 180px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
.ctx-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.ctx-item:hover { background: var(--panel-2); }

@media (max-width: 900px) {
  .topbar .logo {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    line-height: 1.15;
  }
  .topbar .logo span { margin-left: 0; font-size: 11px; }
  .badge span:first-child {
    max-width: 88px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar .btn { white-space: nowrap; }
  .content { display: block; }
  .lyric-panel { display: none; }
  .track-list col.col-album,
  .track-list col.col-op { display: none; }
  .track-list .album,
  .track-list .op,
  .track-list th.album,
  .track-list th.op { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .playerbar { grid-template-columns: 1fr auto; }
  .playlist-actions .btn { white-space: nowrap; font-size: 12px; padding: 8px 10px; }
  .progress, .volume { display: none; }
  .playerbar-right { display: none; }
  .seek-bar { height: 24px; }
}
/* 仅触摸设备（手机/平板）：布局单列、显示汉堡按钮、侧边栏改为抽屉 */
@media (max-width: 900px) and (hover: none) {
  .layout { grid-template-columns: 1fr; }
  .menu-btn { display: inline-flex; }
  .sidebar {
    display: block;
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 92px;
    width: 280px;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform .25s ease;
    background: rgba(13, 15, 20, .98);
  }
  .sidebar.open { transform: translateX(0); }
}
