:root {
  --bg: #0f1117;
  --bg2: #151923;
  --fg: #e6e6e6;
  --muted: #a7a7a7;
  --primary: #4ea1ff;
  --accent: #7bd389;
  --danger: #ff6b6b;
  --border: #2a2f3a;
  --overlay: rgba(0,0,0,0.55);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
}
.brand { display: flex; flex-direction: column; gap: 2px; }
.brand-title { font-weight: 700; color: var(--primary); }
.version-badge {
  display: inline-block;
  font-size: 12px;
  color: var(--muted);
  background: #0d1120;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
  width: fit-content;
}

.auth { display: flex; align-items: center; gap: 12px; }
.login-form { display: flex; gap: 8px; }
.login-form input { padding: 6px 8px; background: #0d1120; border: 1px solid var(--border); color: var(--fg); border-radius: 6px; }
.login-form button { padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--primary); color: #fff; cursor: pointer; }
.login-info.hidden, .hidden { display: none; }
.login-info button { padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border); background: #333; color: #fff; cursor: pointer; }

.page { padding: 12px; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.toolbar .left { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#song-filter, #song-sort {
  padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border);
  background: #0d1120; color: var(--fg);
}

.status { color: var(--muted); min-height: 20px; }

.song-grid {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.song-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0c1020;
  overflow: hidden;
  cursor: pointer;
  display: flex; flex-direction: column;
}
.song-card:hover { border-color: var(--primary); }
.song-thumb {
  width: 100%; padding-top: 100%;
  background: #222; background-size: cover; background-position: center;
}
.card-body { padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.card-title { font-weight: 600; font-size: 14px; }
.card-artist { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-time { color: var(--muted); font-size: 11px; }

/* Modal */
.modal.hidden { display: none; }
.modal { position: fixed; inset: 0; z-index: 1000; }
.modal-backdrop { position: absolute; inset: 0; background: var(--overlay); }
.modal-dialog {
  position: relative; margin: 5vh auto; width: min(1100px, 94vw);
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  display: flex; flex-direction: column; max-height: 90vh;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px; border-bottom: 1px solid var(--border); background: #121523;
}
.song-head { display: flex; align-items: center; gap: 12px; }
.cover { width: 64px; height: 64px; border-radius: 8px; background: #222; background-size: cover; background-position: center; border: 1px solid var(--border); }
.title { display: flex; flex-direction: column; gap: 4px; }
.btn-close {
  padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; background: #2b2f3e; color: #fff; cursor: pointer;
}
.modal-actions {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 10px; border-bottom: 1px solid var(--border);
}
.modal-actions input, .modal-actions button {
  padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border); background: #0d1120; color: var(--fg);
}
.modal-actions button { background: #22324d; cursor: pointer; }
.modal-actions .inline { display: inline-flex; align-items: center; gap: 8px; }

.table-wrap { overflow: auto; border-top: 0; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  border-bottom: 1px solid var(--border);
  padding: 8px;
  text-align: left;
}
.table th { background: #121523; position: sticky; top: 0; z-index: 1; }
.table tr:hover td { background: #0f1426; }

/* “分数”（DX 百分比）放大显示 */
.table td.cell-dx {
  font-size: 1.2em;
  font-weight: 700;
}

/* 隐藏“详情”列的“查看”按钮，但保留展开功能 */
.table td.cell-details summary { display: none; }
.table td.cell-details { cursor: pointer; }

.json {
  white-space: pre-wrap; word-break: break-all; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #0d1120; border: 1px solid var(--border); border-radius: 6px; padding: 8px; color: #cfd8ff;
}

.footer { padding: 10px 16px; border-top: 1px solid var(--border); background: var(--bg2); color: var(--muted); }

@media (max-width: 640px) {
  .card-title { font-size: 13px; }
}