/* ===== 用户端样式（原生 CSS，无外部依赖） ===== */

:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #6b7280;
  --line: #e6e8eb;
  --soft: #fafbfc;
  --primary: #c20c0c;
  --primary-2: #e5484d;
  --primary-soft: #fdeced;
  --ok: #1a7f37;
  --warn: #b45309;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: 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;
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
img { max-width: 100%; display: block; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ===== 通用卡片与文字 ===== */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .2px;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
}

.artist-title {
  color: var(--primary);
  font-weight: 600;
  margin-left: 6px;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  background: #fff;
  color: var(--text);
  transition: background-color .15s ease, border-color .15s ease, opacity .15s ease;
}

.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) { background: #a70a0a; border-color: #a70a0a; }

.btn-ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}
.btn-ghost:hover:not(:disabled) { border-color: #cfd3d8; background: var(--soft); }

.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-lg { height: 46px; padding: 0 26px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }

/* ===== 输入框 ===== */
.input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  font-size: 16px; /* 手机上不触发自动放大 */
  line-height: 1.4;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: #9aa1a9; }
.input:focus {
  border-color: var(--primary-2);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.field { margin-bottom: 14px; }
.field-label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.row-inline {
  display: flex;
  gap: 8px;
  align-items: center;
}
.row-inline .input { flex: 1 1 auto; min-width: 0; }
.row-inline .btn { flex: 0 0 auto; }

.search-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.search-row .input { flex: 1 1 auto; min-width: 0; }
.search-row .btn { flex: 0 0 auto; }

/* ===== 未登录 ===== */
.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  background:
    radial-gradient(1200px 400px at 50% -10%, #fde8e9 0%, rgba(253, 232, 233, 0) 70%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 420px;
  margin-bottom: 0;
  padding: 26px 24px 22px;
}

.login-title { font-size: 21px; font-weight: 600; }

.login-sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.login-foot {
  color: #9aa1a9;
  font-size: 12px;
  margin-top: 18px;
  text-align: center;
  line-height: 1.5;
}

.tabs {
  display: flex;
  gap: 6px;
  background: #f1f2f4;
  border-radius: 12px;
  padding: 5px;
  margin: 18px 0 16px;
}
.tab {
  flex: 1 1 0;
  min-width: 0;
  height: 36px;
  padding: 0 6px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color .15s ease, color .15s ease;
}
.tab.is-active {
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .1);
}

/* 二维码 */
.qr-box {
  position: relative;
  width: 190px;
  height: 190px;
  margin: 4px auto 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  overflow: hidden;
}
.qr-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}
.qr-holder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  background: var(--soft);
}
.qr-status {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  min-height: 22px;
}
#btnQrRefresh {
  display: flex;
  margin: 12px auto 0;
}

/* ===== 顶栏 ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  flex: 0 0 auto;
}
.brand-name {
  font-weight: 600;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.userbox {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: #eceef0;
  flex: 0 0 auto;
}
.avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}
.uname {
  font-size: 14px;
  max-width: 8em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== 已登录主体 ===== */
.app { min-height: 100vh; min-height: 100dvh; }

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 16px 16px 56px;
}

.panel { padding-top: 2px; }

/* 授权条 */
.license-bar { padding: 18px 20px; }
.license-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.license-text {
  font-size: 15px;
  font-weight: 500;
  flex: 1 1 200px;
  min-width: 0;
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
  flex: 0 0 auto;
}
.dot.is-ok { background: var(--ok); }
.dot.is-warn { background: var(--warn); }
.dot.is-bad { background: var(--primary); }

.bar {
  height: 8px;
  margin-top: 12px;
  background: #eef0f2;
  border-radius: 999px;
  overflow: hidden;
}
.bar-lg { height: 12px; margin-top: 4px; }
.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width .3s ease;
}
.bar-fill.is-warn { background: linear-gradient(90deg, #b45309, #f59e0b); }

/* 每张票自己的额度列表 */
.license-list {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}
.license-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
  font-size: 13px;
}
.license-list .lic-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.license-list .lic-meta {
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 12px;
  text-align: right;
}
.license-list li.is-warn { background: #fff8ec; border-color: #f7e0b5; }
.license-list li.is-bad { background: var(--primary-soft); border-color: #f6cdcf; }

/* 激活结果提示条 */
.notice {
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid #d6ebd9;
  border-radius: var(--radius);
  background: #f3f9f4;
  color: #14532d;
}
.notice-text { font-size: 15px; font-weight: 600; }
.notice-sub {
  margin-top: 6px;
  font-size: 13px;
  color: #2f6b43;
  line-height: 1.55;
}
.notice.is-warn {
  background: #fff8ec;
  border-color: #f7e0b5;
  color: #7c4a03;
}
.notice.is-warn .notice-sub { color: #8a5a10; }

/* 自动转存标题 */
.auto-title {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.5;
}

/* 暂停提示 */
.pause-note {
  margin-top: 10px;
  padding: 11px 13px;
  border: 1px solid #f7e0b5;
  border-radius: 10px;
  background: #fff8ec;
  color: #7c4a03;
  font-size: 14px;
  line-height: 1.55;
}

/* 歌手卡片 */
.artist-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.artist-list:empty { margin-top: 0; }

.artist-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.artist-card:hover { border-color: var(--primary-2); background: #fffafa; }
.artist-card.is-active { border-color: var(--primary); background: var(--primary-soft); }
.artist-card.is-denied { opacity: .62; }
.artist-card.is-denied:hover { border-color: var(--line); background: #fff; }
.artist-card.is-denied.is-active { border-color: var(--warn); background: #fff8ec; opacity: .85; }

.artist-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: #eceef0;
  flex: 0 0 auto;
}
.artist-avatar-ph {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #9aa1a9, #6b7280);
}
.artist-meta { min-width: 0; }
.artist-name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.artist-sub {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 歌曲表 */
.song-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.sel-count {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
}
.sel-count b { color: var(--primary); font-size: 15px; }

.table-wrap {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.song-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 14px;
}
.song-table th,
.song-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.song-table th {
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3px;
}
.song-table tbody tr:last-child td { border-bottom: 0; }
.song-table tbody tr { cursor: pointer; }
.song-table tbody tr:hover { background: #fbfbfc; }
.song-table tbody tr.is-checked { background: var(--primary-soft); }

.song-name { font-weight: 500; color: var(--text); }

.col-check { width: 38px; padding-right: 0 !important; }
.col-ar { width: 28%; }
.col-dur { width: 58px; text-align: right !important; color: var(--muted); }

.chk {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
  cursor: pointer;
  margin: 0;
  vertical-align: middle;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
}
.pager .hint { margin: 0; }

.start-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}
.start-row .hint { margin: 0; }

/* 进度区 */
.progress-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.progress-line b { font-size: 18px; color: var(--text); }

.task-summary {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f3f9f4;
  border: 1px solid #d6ebd9;
  color: #14532d;
  font-size: 14px;
}
.task-summary.is-warn {
  background: #fff8ec;
  border-color: #f7e0b5;
  color: #7c4a03;
}
.task-summary.is-bad {
  background: var(--primary-soft);
  border-color: #f6cdcf;
  color: #8a1114;
}

.missing {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--soft);
}
.missing > summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  outline: none;
  list-style: none;
}
.missing > summary::-webkit-details-marker { display: none; }
.missing > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  transition: transform .15s ease;
}
.missing[open] > summary::before { transform: rotate(90deg); }
.missing-list {
  margin-top: 10px;
  max-height: 240px;
  overflow-y: auto;
  font-size: 13px;
}
.missing-list li {
  padding: 6px 0;
  border-top: 1px dashed var(--line);
  color: var(--text);
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: baseline;
}
.missing-list li:first-child { border-top: 0; }
.missing-list .m-ar {
  color: var(--muted);
  font-size: 12px;
  flex: 0 0 auto;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== 提示条 ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(8px);
  z-index: 60;
  max-width: min(92vw, 460px);
  padding: 11px 16px;
  border-radius: 10px;
  background: rgba(31, 35, 40, .94);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .18);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  word-break: break-word;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.is-error { background: #b42318; }
.toast.is-success { background: #166534; }

/* ===== 窄屏适配 ===== */
@media (max-width: 560px) {
  body { font-size: 14px; }
  .container { padding: 12px 12px 48px; }
  .card { padding: 16px 14px; }
  .login-card { padding: 22px 16px 18px; }
  .topbar-inner { padding: 8px 12px; }
  .brand-name { font-size: 15px; }
  .uname { max-width: 5em; }
  .tab { font-size: 13px; height: 34px; padding: 0 4px; }
  .tabs { gap: 4px; padding: 4px; }
  .qr-box { width: 170px; height: 170px; }
  .artist-list { grid-template-columns: 1fr 1fr; gap: 8px; }
  .song-table th, .song-table td { padding: 9px 6px; font-size: 13px; }
  .col-ar { width: 30%; }
  .col-dur { width: 46px; }
  .col-check { width: 32px; }
  .search-row .btn, .row-inline .btn { padding: 0 12px; }
  .start-row { gap: 8px; }
  .start-row .btn-lg { width: 100%; }
  .start-row .hint { width: 100%; }
  .progress-line b { font-size: 16px; }
  .toast { bottom: 18px; font-size: 13px; }
}

@media (max-width: 360px) {
  .artist-list { grid-template-columns: 1fr; }
  .tab { font-size: 12px; padding: 0 2px; letter-spacing: -.3px; }
  .license-list li { flex-direction: column; align-items: flex-start; gap: 2px; }
  .license-list .lic-meta { text-align: left; }
}
