/* ============ 基础 ============ */
:root {
  --title-color: #3a2b20;
  --subtitle-color: #8a7768;
  --sum-color: #c0392b;
  --card-bg: rgba(255, 255, 255, 0.9);
  --line: rgba(58, 43, 32, 0.08);
  --text: #33281f;
  --muted: #8a7768;
  --accent: #e2734a;
  --accent-soft: rgba(226, 115, 74, 0.12);
  --radius: 18px;
  --shadow: 0 18px 50px rgba(80, 55, 35, 0.14);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  background: #f6e7d7;
  -webkit-font-smoothing: antialiased;
}

.bg-fixed {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  transition: background-image 0.3s ease;
}

.bg-fixed::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.42));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.bg-fixed.has-image::after { opacity: 1; }

/* ============ 主卡片 ============ */
.card {
  width: min(1080px, calc(100% - 32px));
  margin: 40px auto 56px;
  padding: 26px 28px 18px;
  border-radius: var(--radius);
  background: var(--card-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid rgba(255, 255, 255, 0.65);
  animation: card-in 0.35s ease both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ============ 头部 ============ */
.head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--line);
}

.face {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 4px 14px rgba(80, 55, 35, 0.18);
}

.head-text { flex: 1 1 auto; min-width: 0; }

.head-text h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--title-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.head-text p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--subtitle-color);
}

.head-side {
  flex: 0 0 auto;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.sum {
  font-size: 13px;
  font-weight: 600;
  color: var(--sum-color);
  background: rgba(255, 255, 255, 0.6);
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.links { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.links a {
  font-size: 12px;
  color: var(--subtitle-color);
  text-decoration: none;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  transition: 0.2s;
  white-space: nowrap;
}

.links a:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* ============ 工具栏 ============ */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 0 12px;
}

.ctl {
  height: 36px;
  padding: 0 12px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: 0.18s;
  cursor: pointer;
}

.ctl:hover { border-color: rgba(226, 115, 74, 0.5); }

.ctl:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

select.ctl { appearance: none; -webkit-appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a7768' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }

.search { position: relative; flex: 1 1 180px; min-width: 150px; max-width: 280px; }

.search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 32px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: 0.18s;
}

.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  stroke: var(--muted);
  fill: none;
  pointer-events: none;
}

.btn {
  height: 36px;
  padding: 0 16px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #f08a5d, #e2734a);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.18s;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(226, 115, 74, 0.28);
}

.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(226, 115, 74, 0.36); }
.btn:active { transform: none; }

.btn.ghost {
  color: var(--accent);
  background: transparent;
  border: 1px solid rgba(226, 115, 74, 0.45);
  box-shadow: none;
}

.btn.ghost:hover { background: var(--accent-soft); }

/* ============ 多选下拉 ============ */
.ms { position: relative; }

.ms-btn {
  height: 36px;
  padding: 0 30px 0 12px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.85) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a7768' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 11px center;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: 0.18s;
  white-space: nowrap;
}

.ms-btn:hover { border-color: rgba(226, 115, 74, 0.5); }
.ms-btn.active { color: var(--accent); border-color: rgba(226, 115, 74, 0.6); background-color: var(--accent-soft); font-weight: 600; }

.ms-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  min-width: 168px;
  max-height: 320px;
  overflow: auto;
  padding: 6px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(50, 30, 15, 0.2);
  border: 1px solid var(--line);
}

.ms-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-size: 13px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}

.ms-opt:hover { background: #faf4ee; }
.ms-opt input { accent-color: var(--accent); width: 14px; height: 14px; margin: 0; }
.ms-empty { padding: 8px; font-size: 12px; color: var(--muted); }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.songs {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.songs thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 9px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.4px;
  color: var(--muted);
  background: rgba(255, 252, 248, 0.98);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.songs td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.songs tbody tr { cursor: pointer; transition: background 0.15s; }

.songs tbody tr:hover { background: rgba(255, 255, 255, 0.75); }

.songs tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.songs tbody tr.pay { background: rgba(255, 245, 240, 0.55); }
.songs tbody tr.pay:hover { background: rgba(255, 240, 232, 0.85); }

.songs tbody tr.flash { animation: flash 1.2s ease; }

@keyframes flash {
  0%, 100% { background: transparent; }
  20%, 60% { background: rgba(255, 214, 153, 0.75); }
}

.col-num { width: 44px; }
.col-bv, .col-lang, .col-style { white-space: nowrap; }

td.col-num { color: var(--muted); font-variant-numeric: tabular-nums; }

.song-name { font-weight: 600; font-size: 14px; }

.badges { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-left: 6px; vertical-align: middle; }

.badge {
  display: inline-block;
  padding: 0 7px;
  font-size: 11px;
  line-height: 18px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.guard-1 { color: #0f7fae; background: rgba(35, 173, 229, 0.16); }
.badge.guard-2 { color: #a54bb5; background: rgba(190, 90, 210, 0.15); }
.badge.guard-3 { color: #b97b00; background: rgba(245, 166, 35, 0.2); }
.badge.pay { color: #c0392b; background: rgba(192, 57, 43, 0.11); }
.badge.gift { color: #d4557f; background: rgba(230, 120, 160, 0.15); }

.bv-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid rgba(226, 115, 74, 0.35);
  white-space: nowrap;
}

.bv-link:hover { background: var(--accent-soft); }

.muted { color: var(--muted); }
.remark { color: var(--muted); font-size: 12.5px; }

/* ============ 空状态 / 加载 ============ */
.empty {
  padding: 56px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

.empty::before { content: "♪"; display: block; font-size: 34px; margin-bottom: 8px; opacity: 0.35; }

.state {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  background: rgba(255, 250, 245, 0.7);
  backdrop-filter: blur(4px);
  z-index: 40;
}

.state[hidden] { display: none; }

/* ============ 分页 ============ */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 0 6px;
  flex-wrap: wrap;
}

.pager button {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  transition: 0.16s;
}

.pager button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }
.pager button.current { color: #fff; background: var(--accent); border-color: var(--accent); font-weight: 600; }
.pager .ellipsis { padding: 0 4px; color: var(--muted); font-size: 12px; }

/* ============ 底部 ============ */
.foot {
  margin: 0;
  padding: 8px 0 4px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 36px;
  transform: translate(-50%, 16px);
  max-width: min(90vw, 520px);
  padding: 10px 18px;
  font-size: 13.5px;
  color: #fff;
  background: rgba(43, 32, 24, 0.92);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
  text-align: center;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============ 移动端 ============ */
@media (max-width: 760px) {
  .card { width: calc(100% - 16px); margin: 12px auto 32px; padding: 18px 14px 12px; border-radius: 16px; }
  .head { gap: 12px; flex-wrap: wrap; }
  .face { width: 48px; height: 48px; }
  .head-text h1 { font-size: 19px; }
  .head-side { width: 100%; flex-direction: row; align-items: center; justify-content: space-between; }
  .links { justify-content: flex-start; }
  .toolbar { gap: 8px; padding: 12px 0 8px; }
  .ctl, .ms-btn, .search input, .btn { height: 34px; }
  .search { flex: 1 1 100%; max-width: none; order: 9; }
  .songs { font-size: 13px; }
  .songs th, .songs td { padding: 8px 6px; }
  .col-lang, .col-style, .col-remark, .col-bv { display: none; }
  .col-num { width: 30px; }
  .song-name { font-size: 13.5px; }
  .toast { bottom: 20px; }
}
