:root {
  --bg: #0e1220;
  --bg-2: #141a2e;
  --card: #1a2138;
  --card-2: #212a47;
  --border: #2c3658;
  --text: #e8ecf7;
  --muted: #9aa3c0;
  --accent: #4fd1ff;
  --accent-2: #7a5cff;
  --gold: #ffd75e;
  --danger: #ff6b81;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 80% -10%, #1c2b52 0%, transparent 60%),
              radial-gradient(900px 500px at -10% 20%, #251a45 0%, transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

/* Header */
.site-header {
  padding: 34px 0 10px;
}
.site-header h1 {
  margin: 0 0 6px;
  font-size: 30px;
  letter-spacing: 0.5px;
}
.site-header .accent {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.subtitle { margin: 0; color: var(--muted); font-size: 15px; }

/* Cards */
.card {
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin: 18px 0;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-head .opt { font-style: normal; font-weight: 400; font-size: 13px; color: var(--muted); }

.step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #08101f;
  font-size: 13px;
  font-weight: 800;
}

.badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(79, 209, 255, 0.12);
  color: var(--accent);
  border: 1px solid rgba(79, 209, 255, 0.3);
}

.row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

.btn {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 14px;
  transition: border-color .15s, background .15s;
}
.btn:hover { border-color: var(--accent); background: #28335a; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 次级按钮：透明底 + 描边 */
.btn-ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--border);
}
.btn-ghost:hover { background: rgba(79, 209, 255, 0.08); border-color: var(--accent); }

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 26px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone.over { border-color: var(--accent); background: rgba(79, 209, 255, 0.06); }
.dropzone p { margin: 2px 0; }
.dropzone p:first-child { font-size: 15px; }

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
select, input[type="number"], .search {
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 10px;
  font-size: 14px;
  width: 100%;
}
select:focus, input:focus { outline: none; border-color: var(--accent); }
input[type="number"] { width: 100%; }

.search, #searchInput {
  font-size: 16px;
  padding: 12px 14px;
}

/* Suggestions */
.suggestions { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.suggest-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  width: 100%;
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 12px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.suggest-item:hover { border-color: var(--accent); background: #28335a; }
.s-title { font-size: 15px; font-weight: 600; }
.s-meta { font-size: 12px; color: var(--muted); }
.suggest-none { padding: 10px; color: var(--muted); font-size: 14px; }

/* Result */
.result-head { display: flex; gap: 14px; align-items: center; }
.jacket {
  width: 72px; height: 72px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--card-2);
  border: 1px solid var(--border);
  flex: 0 0 auto;
}
.r-title { font-size: 22px; font-weight: 800; }
.r-sub { font-size: 14px; color: var(--muted); margin-top: 2px; }
.r-meta { font-size: 13px; color: var(--muted); margin-top: 4px; }

.diffs { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.diff-badge {
  --c: #ccc;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--c);
  color: var(--text);
  background: color-mix(in srgb, var(--c) 12%, transparent);
}
.diff-badge.chosen { box-shadow: 0 0 0 1px var(--c), 0 0 14px color-mix(in srgb, var(--c) 55%, transparent); font-weight: 700; }
.diff-badge .il { color: var(--muted); font-style: normal; font-size: 11px; }

.score { margin: 6px 0 12px; font-size: 15px; }
.rate {
  color: #08101f;
  font-weight: 800;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  margin-left: 4px;
}
.tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--card-2);
  border: 1px solid var(--border);
  margin-left: 4px;
}

.pos-box {
  background: linear-gradient(135deg, rgba(79, 209, 255, 0.10), rgba(122, 92, 255, 0.10));
  border: 1px solid rgba(79, 209, 255, 0.28);
  border-radius: 12px;
  padding: 16px 18px;
  margin-top: 6px;
}
.pos-main { font-size: 20px; font-weight: 700; }
.pos-main b { color: var(--accent); font-size: 24px; }
.pos-sub { color: var(--muted); font-size: 13px; margin-top: 6px; }

.warn {
  background: rgba(255, 107, 129, 0.12);
  border: 1px solid rgba(255, 107, 129, 0.4);
  color: #ffc2cc;
  border-radius: 10px;
  padding: 12px 14px;
}

/* Grid preview */
.grid-preview { margin-top: 18px; }
.grid {
  display: grid;
  gap: 8px;
}
.grid-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  justify-content: flex-end;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  min-height: 96px;
  transition: transform .1s, border-color .1s;
}
.grid-cell:hover { transform: translateY(-2px); border-color: var(--accent); }
.grid-cell.target {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent), 0 0 22px rgba(79, 209, 255, 0.45);
}
.grid-cell.target::after {
  content: "▼ 目标";
  position: absolute;
  top: 4px; right: 4px;
  font-size: 10px;
  color: #08101f;
  background: var(--accent);
  border-radius: 5px;
  padding: 1px 5px;
  font-weight: 700;
}
.cell-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  background: #0b0f1c;
}
.cell-title {
  font-size: 11px;
  line-height: 1.25;
  width: 100%;
  text-align: center;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
}
.cell-level { font-size: 11px; color: var(--muted); }
.cell-ach {
  position: absolute;
  top: 4px; left: 4px;
  font-size: 10px;
  font-weight: 800;
  color: #08101f;
  border-radius: 5px;
  padding: 1px 5px;
}

/* Footer */
.site-footer {
  margin-top: 20px;
  padding: 18px 0 34px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  border-top: 1px solid var(--border);
}
.site-footer p { margin: 4px 0; }

@media (max-width: 640px) {
  .site-header h1 { font-size: 24px; }
  .r-title { font-size: 18px; }
  .jacket { width: 56px; height: 56px; }
}

/* ======================================================================
   以下为定位器 UI 补充样式
   ====================================================================== */

/* 文本输入 / 文本域 */
input[type="text"], textarea {
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 14px;
  width: 100%;
  font-family: inherit;
}
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
input[type="text"]:focus, textarea:focus { outline: none; border-color: var(--accent); }

.btn-sm { padding: 5px 10px; font-size: 12.5px; }

.row-tight { margin-top: 0; align-items: center; }
.row-tight input { flex: 1 1 220px; }
.row-tight .btn { flex: 0 0 auto; }

.panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.warn-inline { color: var(--gold); }
.bad { color: var(--danger); }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  padding: 0 4px;
  font-family: inherit;
}
.link-btn:hover { text-decoration: underline; }

.jacket-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
}

.sub-h { font-size: 15px; margin: 22px 0 10px; font-weight: 700; }

/* CSV 列映射面板 */
.form-grid-sm { grid-template-columns: repeat(auto-fill, minmax(126px, 1fr)); gap: 10px; }
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--muted);
  margin: 12px 0 4px;
}
.check input { width: auto; }

.csv-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.csv-table th, .csv-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.csv-table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.csv-table-wrap { max-height: 340px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.csv-table-wrap .csv-table { margin-top: 0; }
.csv-table-wrap thead th { position: sticky; top: 0; background: var(--bg-2, #141a2e); }
.csv-table td.csv-idx { color: var(--muted); width: 44px; max-width: 44px; font-variant-numeric: tabular-nums; }
.csv-table td:first-child { max-width: 280px; }
.csv-table td:first-child, .csv-table td:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 没匹配上的曲名清单（成绩导入摘要里可展开） */
.unmatched { margin-top: 8px; border-top: none; padding: 0; }
.unmatched summary { font-size: 13px; font-weight: 400; color: var(--accent); }
.unmatched-list {
  margin-top: 6px;
  max-height: 220px;
  overflow: auto;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
}

/* 各分类维度下的位置对照表 */
.dim-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dim-table th, .dim-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.dim-table th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.dim-table tr.cur td { background: rgba(79, 209, 255, 0.10); }
.dim-table tr.cur td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

/* 目标附近的曲目列表 */
.near-list {
  /* position: relative 是必须的：app.js 用 row.offsetTop 做自动滚动定位 */
  position: relative;
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
}
.near-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px 88px;
  gap: 8px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid rgba(44, 54, 88, 0.6);
  color: var(--text);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13.5px;
  font-family: inherit;
}
.near-row:hover { background: rgba(79, 209, 255, 0.08); }
.near-row.target {
  background: rgba(79, 209, 255, 0.16);
  box-shadow: inset 3px 0 0 var(--accent);
  font-weight: 700;
}
.n-idx { color: var(--muted); font-variant-numeric: tabular-nums; }
.n-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.n-lv { color: var(--muted); text-align: right; }
.n-ach { color: var(--gold); text-align: right; font-variant-numeric: tabular-nums; }
.near-more { padding: 8px 12px; color: var(--muted); font-size: 12.5px; text-align: center; }

.cell-idx {
  position: absolute;
  bottom: 4px;
  right: 5px;
  font-size: 10px;
  color: var(--muted);
}

/* 说明区 */
details { border-top: 1px solid var(--border); padding: 10px 0; }
details:first-of-type { border-top: none; padding-top: 0; }
summary { cursor: pointer; font-weight: 600; font-size: 14.5px; }
summary::marker { color: var(--accent); }
.doc-p, .doc-list { color: var(--muted); font-size: 13.5px; line-height: 1.75; }
.doc-list { padding-left: 20px; }
.doc-p code, .doc-list code, .hint code, .subtitle code {
  background: rgba(0, 0, 0, 0.35);
  padding: 1px 5px;
  border-radius: 5px;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 12.5px;
  color: #bcd8ff;
}

@media (max-width: 640px) {
  .near-row { grid-template-columns: 40px minmax(0, 1fr) 48px; }
  .n-ach { display: none; }
  .form-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
  .dim-table { font-size: 13px; }
  .dim-table th, .dim-table td { padding: 6px; }
}
