/* 小窝音乐盒 —— 浮动播放器样式（跟随主题 .dark 深色模式） */
.sam-music-root {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 99990;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
.sam-music-root * { box-sizing: border-box; }

.smb-card {
  width: 300px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(74, 124, 111, 0.18);
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(30, 50, 45, 0.16);
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.sam-music-root.dark .smb-card {
  background: rgba(32, 38, 36, 0.94);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

.smb-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: linear-gradient(135deg, #4a7c6f, #6aa88f);
  color: #fff;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.smb-head:active { cursor: grabbing; }
.smb-logo { font-size: 15px; }
.smb-title { font-weight: 600; font-size: 13px; flex: 1; letter-spacing: 0.5px; }
.smb-toggle {
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.smb-toggle:hover { background: rgba(255, 255, 255, 0.32); }

.smb-body { padding: 12px; display: none; }
.smb-card:not(.smb-collapsed) .smb-body { display: block; }
.smb-card.smb-collapsed .smb-body { display: none; }

.smb-now { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.smb-cover {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  background: linear-gradient(135deg, #dfeee8, #bcd8cc);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4a7c6f;
  font-size: 20px;
}
.sam-music-root.dark .smb-cover { background: linear-gradient(135deg, #2c3a35, #22302b); color: #8fc4b2; }
.smb-meta { min-width: 0; flex: 1; }
.smb-track {
  font-weight: 600;
  font-size: 14px;
  color: #2c3a35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.smb-artist {
  font-size: 12px;
  color: #8a9a94;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sam-music-root.dark .smb-track { color: #e6efeb; }
.sam-music-root.dark .smb-artist { color: #93a89f; }

.smb-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(74, 124, 111, 0.14);
  color: #4a7c6f;
  margin-left: 6px;
  vertical-align: 1px;
}
.sam-music-root.dark .smb-badge { background: rgba(143, 196, 178, 0.16); color: #8fc4b2; }

.smb-progress {
  height: 5px;
  background: rgba(74, 124, 111, 0.15);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  margin: 4px 0 2px;
}
.sam-music-root.dark .smb-progress { background: rgba(255, 255, 255, 0.12); }
.smb-progress-cur {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: linear-gradient(90deg, #4a7c6f, #6aa88f);
  border-radius: 3px;
}
.smb-progress-cur::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #4a7c6f;
  opacity: 0;
  transition: opacity 0.15s;
}
.smb-progress:hover .smb-progress-cur::after { opacity: 1; }

.smb-times {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #9aAAA4;
  font-variant-numeric: tabular-nums;
  margin-bottom: 8px;
}

.smb-controls { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.smb-btn {
  border: none;
  background: rgba(74, 124, 111, 0.1);
  color: #3d6a5f;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex: none;
  transition: background 0.15s, transform 0.1s;
}
.smb-btn:hover { background: rgba(74, 124, 111, 0.22); }
.smb-btn:active { transform: scale(0.92); }
.sam-music-root.dark .smb-btn { background: rgba(143, 196, 178, 0.14); color: #a8d4c3; }
.sam-music-root.dark .smb-btn:hover { background: rgba(143, 196, 178, 0.26); }
.smb-btn.smb-play {
  background: #4a7c6f;
  color: #fff;
  width: 38px;
  height: 38px;
  font-size: 15px;
}
.smb-btn.smb-play:hover { background: #3d6a5f; }

.smb-volume {
  flex: 1;
  min-width: 40px;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: rgba(74, 124, 111, 0.2);
  outline: none;
  cursor: pointer;
}
.smb-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #4a7c6f;
  cursor: pointer;
}
.smb-volume::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #4a7c6f;
  border: none;
  cursor: pointer;
}

.smb-resume {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(74, 124, 111, 0.1);
  border: 1px dashed rgba(74, 124, 111, 0.4);
  color: #3d6a5f;
  border-radius: 8px;
  padding: 6px;
  font-size: 12px;
  cursor: pointer;
  margin-bottom: 8px;
}
.smb-resume:hover { background: rgba(74, 124, 111, 0.18); }
.sam-music-root.dark .smb-resume { color: #a8d4c3; border-color: rgba(143, 196, 178, 0.4); }
.smb-resume[hidden] { display: none; }

.smb-list { max-height: 168px; overflow-y: auto; margin: 0 -4px; }
.smb-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  color: #46554f;
  transition: background 0.12s;
}
.smb-item:hover { background: rgba(74, 124, 111, 0.08); }
.smb-item.active { background: rgba(74, 124, 111, 0.14); color: #2f5f52; font-weight: 600; }
.sam-music-root.dark .smb-item { color: #c3d2cc; }
.sam-music-root.dark .smb-item:hover { background: rgba(255, 255, 255, 0.06); }
.sam-music-root.dark .smb-item.active { background: rgba(143, 196, 178, 0.16); color: #d8efe6; }
.smb-item-idx {
  width: 18px;
  text-align: center;
  font-size: 11px;
  color: #9aAAA4;
  flex: none;
  font-variant-numeric: tabular-nums;
}
.smb-item.active .smb-item-idx { color: #4a7c6f; }
.smb-item-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.smb-item-dur { font-size: 11px; color: #9aAAA4; flex: none; }
.smb-playing-icon { color: #4a7c6f; font-size: 11px; flex: none; }

.smb-iframe-wrap { margin-bottom: 8px; border-radius: 8px; overflow: hidden; }
.smb-iframe-wrap iframe { display: block; width: 100%; border: none; }
.smb-audio { display: none; }

/* 工具行 + 导入面板 */
.smb-tools { display: flex; gap: 6px; margin-bottom: 8px; }
.smb-add {
  flex: 1;
  border: 1px dashed rgba(74, 124, 111, 0.45);
  background: rgba(74, 124, 111, 0.06);
  color: #3d6a5f;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.smb-add:hover { background: rgba(74, 124, 111, 0.16); }
.sam-music-root.dark .smb-add { color: #a8d4c3; border-color: rgba(143, 196, 178, 0.4); }
.smb-add-file { flex: 0 0 auto; }
.smb-file-input { display: none; }
.sam-music-root.smb-drop .smb-card {
  outline: 2px dashed #4a7c6f;
  outline-offset: 2px;
}
.sam-music-root.smb-drop::after {
  content: "松手即可播放本地音乐";
  position: absolute;
  left: 50%;
  top: -30px;
  transform: translateX(-50%);
  background: #4a7c6f;
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  white-space: nowrap;
}

.smb-import {
  background: rgba(74, 124, 111, 0.06);
  border: 1px solid rgba(74, 124, 111, 0.2);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
}
.sam-music-root.dark .smb-import { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.12); }
.smb-import[hidden] { display: none; }
.smb-import-tip {
  font-size: 11px;
  color: #6d7f78;
  white-space: pre-line;
  margin-bottom: 6px;
  line-height: 1.6;
}
.sam-music-root.dark .smb-import-tip { color: #93a89f; }
.smb-import-ta {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(74, 124, 111, 0.3);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
  resize: vertical;
  background: #fff;
  color: #2c3a35;
  outline: none;
}
.smb-import-ta:focus { border-color: #4a7c6f; }
.sam-music-root.dark .smb-import-ta { background: #22302b; color: #e6efeb; border-color: rgba(255, 255, 255, 0.16); }
.smb-import-row { display: flex; gap: 6px; margin-top: 6px; }
.smb-mini-btn {
  border: none;
  background: rgba(74, 124, 111, 0.12);
  color: #3d6a5f;
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}
.smb-mini-btn:hover { background: rgba(74, 124, 111, 0.24); }
.smb-mini-btn.smb-mini-primary { background: #4a7c6f; color: #fff; }
.smb-mini-btn.smb-mini-primary:hover { background: #3d6a5f; }
.sam-music-root.dark .smb-mini-btn { background: rgba(143, 196, 178, 0.16); color: #a8d4c3; }

.smb-badge-me { background: rgba(240, 150, 60, 0.16); color: #c07b28; }
.sam-music-root.dark .smb-badge-me { background: rgba(240, 170, 80, 0.18); color: #edb678; }
.smb-badge-local { background: rgba(74, 124, 111, 0.16); color: #3d6a5f; }
.sam-music-root.dark .smb-badge-local { background: rgba(143, 196, 178, 0.18); color: #a8d4c3; }
.smb-item-del {
  border: none;
  background: transparent;
  color: #9aa8a2;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  flex: none;
  padding: 0;
}
.smb-item-del:hover { background: rgba(220, 80, 80, 0.14); color: #c05050; }
.smb-empty {
  text-align: center;
  font-size: 12px;
  color: #9aa8a2;
  padding: 14px 8px;
}
.sam-music-root.dark .smb-empty { color: #7d918a; }

.smb-toast {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 8px);
  background: rgba(40, 56, 50, 0.92);
  color: #fff;
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 8px;
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  animation: smb-toast-in 0.2s;
  z-index: 2;
}
@keyframes smb-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (max-width: 480px) {
  .sam-music-root { right: 10px; bottom: 10px; left: 10px; }
  .smb-card { width: auto; }
  .smb-toast { bottom: auto; top: calc(100% + 8px); }
}
