@charset "UTF-8";
/* ============================================================
   Audioplayer 面板样式
   顺序：变量 → 基础 → 顶栏 → 状态 → 卡片 → 控件 → 各模块 → 日志 → 响应式
   注意：JS 会用 hidden 属性控制显隐，任何布局规则都不能盖掉它。
   ============================================================ */

/* ---------- 变量 ---------- */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --surface-3: #edf1f8;
  --border: #e4e9f1;
  --border-strong: #d5dce7;
  --text: #1b2430;
  --text-2: #5d6878;
  --text-3: #8b95a6;
  --accent: #2f6df6;
  --accent-strong: #1f57d6;
  --accent-weak: #eaf1ff;
  --success: #157f3c;
  --success-weak: #e9f8ef;
  --danger: #d1242f;
  --danger-weak: #fdecee;
  --warning: #a45b00;
  --warning-weak: #fff6e5;
  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .05);
  --shadow-md: 0 10px 30px rgba(16, 24, 40, .10);
  --ring: 0 0 0 3px rgba(47, 109, 246, .16);
}

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

/* 统一兜底：JS 靠 hidden 控制显隐，不能被 display 规则覆盖 */
[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 24px 120px;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(900px 320px at 50% -140px, #e8efff 0%, rgba(232, 239, 255, 0) 70%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
}

/* ---------- 顶栏 ---------- */
.toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px 24px;
  padding: 20px 22px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.page-title h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -.01em;
}

.page-title .subtitle {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-3);
}

.toolbar-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  justify-self: end;
}

.toolbar-links a,
.linkish {
  padding: 6px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.toolbar-links a:hover,
.linkish:hover {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--accent);
  text-decoration: none;
}

/* 退出登录做成"链接样子"的按钮,不额外占一行 */
.linkish {
  background: transparent;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

/* ---------- 页签（分段控件） ---------- */
.tabs {
  display: inline-flex;
  gap: 4px;
  grid-column: 1 / -1;
  justify-self: start;
  margin-top: 4px;
  padding: 4px;
  border: none;
  border-radius: var(--radius);
  background: var(--surface-3);
}

.tabs .tab {
  padding: 7px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  box-shadow: none;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.tabs .tab:hover {
  background: rgba(255, 255, 255, .75);
  color: var(--text);
  border-color: transparent;
}

.tabs .tab.is-active {
  border-color: transparent;
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ---------- 网络提示 ---------- */
.net-banner {
  margin: 12px 0 0;
  padding: 9px 14px;
  border: 1px solid #f2d18b;
  border-left: 3px solid #e0a11b;
  border-radius: var(--radius-sm);
  background: var(--warning-weak);
  color: var(--warning);
  font-size: 13px;
}

/* ---------- 状态条 ---------- */
.status-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  margin: 14px 0 16px;
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text-2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c3ccda;
  transition: background-color .2s ease, box-shadow .2s ease;
}

.dot.ok {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .16);
}

.dot.bad {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .16);
}

/* ---------- 卡片（fieldset） ---------- */
.module {
  animation: module-in .18s ease both;
}

@keyframes module-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.module fieldset {
  min-width: 0;
  margin: 0 0 16px;
  padding: 18px 20px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.module legend {
  display: block;
  width: 100%;
  margin: 0 0 14px;
  padding: 0 0 0 10px;
  border-left: 3px solid var(--accent);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.module ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- 按钮 ---------- */
button {
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease,
    box-shadow .15s ease, transform .06s ease;
}

button:hover {
  border-color: #c3ccda;
  background: var(--surface-2);
}

button:active {
  transform: translateY(1px);
}

button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

/* 主操作 */
#uploadBtn,
#addMusicBtn {
  border-color: var(--accent);
  background: linear-gradient(180deg, #4a83ff, var(--accent));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(47, 109, 246, .3), inset 0 1px 0 rgba(255, 255, 255, .18);
}

#uploadBtn:hover,
#addMusicBtn:hover {
  border-color: var(--accent-strong);
  background: linear-gradient(180deg, #3d78ff, var(--accent-strong));
}

/* 危险操作 */
#deleteBtn {
  border-color: #f0c6cb;
  background: var(--surface);
  color: var(--danger);
}

#deleteBtn:hover {
  border-color: #e6a9b0;
  background: var(--danger-weak);
}

/* 停止类操作 */
#stopAllBtn {
  border-color: #f0dcc0;
  background: var(--surface);
  color: var(--warning);
}

#stopAllBtn:hover {
  border-color: #e5c9a8;
  background: var(--warning-weak);
}

/* ---------- 输入控件 ---------- */
input[type="text"],
input[type="search"],
input[type="number"],
select {
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

input[type="text"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

input[type="checkbox"],
input[type="radio"] {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

input[type="file"] {
  max-width: 100%;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
}

input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}

input[type="file"]::file-selector-button:hover {
  border-color: #c3ccda;
  background: var(--surface-2);
}

/* ---------- 上传模块 ---------- */
.upload-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.upload-controls label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 13px;
}

#upThreadCnt {
  width: 72px;
}

.drop-zone {
  margin-top: 14px;
  padding: 26px 16px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

.drop-zone.is-over {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: var(--accent);
}

#upFileList {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

#upFileList li {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px;
}

.progressBarContainer {
  width: 100%;
  height: 6px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.progressBar {
  width: 1%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #34d399, #16a34a);
  color: transparent;
  font-size: 0;
  transition: width .18s ease;
}

.progressInfo {
  margin-top: 6px;
  color: var(--text-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.progressTotal {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

/* ---------- 文件模块 ---------- */
.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.list-toolbar label {
  display: flex;
  flex: 1 1 240px;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 13px;
}

#searchBox {
  flex: 1;
  min-width: 0;
}

#fileList {
  margin-top: 12px;
}

#fileList li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  transition: background-color .12s ease;
}

#fileList li:hover {
  background: var(--surface-2);
}

/* display:flex 会让 hidden 属性失效，这里显式还原 */
#fileList li[hidden] {
  display: none;
}

#fileList li label {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  overflow-wrap: anywhere;
  cursor: pointer;
}

#fileList a {
  flex: none;
  padding: 4px 9px;
  border-radius: 7px;
  color: var(--accent);
  font-size: 12px;
  text-decoration: none;
  transition: background-color .12s ease;
}

#fileList a:hover {
  background: var(--accent-weak);
  text-decoration: none;
}

#delFileList {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

#delFileList li {
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--danger-weak);
  color: var(--danger);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.file-size {
  flex: none;
  color: var(--text-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* 列表为空时给一句提示，避免整张卡片只剩标题 */
#fileList:empty::after,
#delFileList:empty::after,
#upFileList:empty::after,
#upMusicList:empty::after,
#mappingsList:empty::after {
  display: block;
  padding: 4px 2px;
  color: var(--text-3);
  font-size: 12px;
}

#fileList:empty::after {
  content: "这个目录里没有文件";
}

#delFileList:empty::after {
  content: "勾选上面的文件后会列在这里";
}

#upFileList:empty::after {
  content: "还没有上传任务";
}

#upMusicList:empty::after {
  content: "没有可添加的音乐（支持 mp3 / wav / ogg / flac）";
}

#mappingsList:empty::after {
  content: "还没有注册音乐";
}

/* ---------- 音乐模块 ---------- */
#musicPlayer {
  display: block;
  width: 100%;
  max-width: 620px;
  margin-bottom: 12px;
}

.player-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.player-controls label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
}

.now-playing {
  max-width: 100%;
  margin-left: 2px;
  padding: 5px 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 可添加的音乐：单选卡片 */
#upMusicList {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

#upMusicList li {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
  transition: border-color .15s ease, background-color .15s ease;
}

#upMusicList li:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

#upMusicList li:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-weak);
}

#upMusicList label {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}

/* 已有音乐：每首一张行卡片 */
#mappingsList {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

#mappingsList li.music-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

#mappingsList li.music-item:hover {
  border-color: var(--border-strong);
}

#mappingsList li.is-playing {
  border-color: #bfe6cd;
  background: #f7fdf9;
  box-shadow: inset 3px 0 0 #22a35a;
}

/* 标题在左、按钮在右；窄屏时按钮整体换到下一行 */
.track-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
}

.track-title {
  flex: 1 1 200px;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 600;
}

.track-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.track-actions button {
  flex: none;
  padding: 5px 10px;
  border-color: var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
}

.track-actions button:hover {
  border-color: #bfd3fb;
  background: var(--accent-weak);
  color: var(--accent);
}

/* 最后一个按钮是"删除" */
.track-actions button:last-child {
  color: var(--danger);
}

.track-actions button:last-child:hover {
  border-color: #f0c2c7;
  background: var(--danger-weak);
  color: var(--danger);
}

.track-status {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* 同一首可能在多处同时播放,每处独占一行胶囊 */
.playing-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--success-weak);
  color: var(--success);
}

.playing-label {
  font-weight: 600;
}

.playing-cord {
  color: #4a7a60;
}

/* 条目内的操作表单 */
.module fieldset.item-form {
  width: 100%;
  margin: 6px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  box-shadow: none;
}

.item-form .form-title {
  margin-bottom: 8px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.item-form input[type="text"] {
  width: min(320px, 100%);
}

.item-form button {
  margin-right: 6px;
}

.play-form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.play-form-row input {
  width: 108px;
}

.play-form-row select {
  max-width: 240px;
}

.play-form-hint {
  color: var(--text-3);
  font-size: 12px;
}

/* ---------- 日志窗 ---------- */
.draggable-window {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  width: 320px;
  max-width: calc(100vw - 24px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.drag-handle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px 9px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  cursor: move;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.log-toggle {
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  font-size: 14px;
  line-height: 1;
}

.log-toggle:hover {
  background: var(--surface-3);
  color: var(--accent);
}

.window-content {
  width: 100%;
  height: 120px;
  padding: 6px 12px 8px;
  overflow: auto;
  resize: both;
}

#logList {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
}

#logList li {
  padding: 3px 0;
  border-bottom: 1px dashed #eef1f6;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
}

#logList li:last-child {
  border-bottom: none;
}

.log-info {
  color: var(--text-2);
}

.log-success {
  color: var(--success);
}

.log-error {
  color: var(--danger);
  font-weight: 600;
}

/* ---------- 响应式 ---------- */
@media (max-width: 820px) {
  body {
    padding: 16px 14px 150px;
  }

  .toolbar {
    grid-template-columns: 1fr;
    padding: 16px 16px 14px;
  }

  .toolbar-links {
    justify-self: start;
  }

  .tabs {
    display: flex;
    width: 100%;
  }

  .tabs .tab {
    flex: 1;
    padding: 8px 10px;
    text-align: center;
  }

  .module fieldset {
    padding: 16px 14px 16px;
  }

  .list-toolbar label {
    flex-basis: 100%;
  }
}

@media (max-width: 520px) {
  .page-title h1 {
    font-size: 18px;
  }

  /* 窄屏按钮改为两列网格，保证点击区域够大 */
  .track-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    margin-left: 0;
    gap: 6px;
  }

  .track-actions button {
    width: 100%;
    padding: 8px 6px;
  }

  .track-actions button:last-child {
    grid-column: 1 / -1;
  }

  .draggable-window {
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
  }

  .window-content {
    height: 96px;
  }
}

/* 尊重系统的减少动效设置 */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
