:root {
  --bg: #f2f3f5;
  --card: #ffffff;
  --text: #1a1d24;
  --muted: #8b909a;
  --soft: #9aa0ab;
  --line: #eceef1;
  --accent: #1fa3b5;
  --accent-2: #2b8fd6;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #e05252;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 0; height: 0; }
* { scrollbar-width: none; }

.hidden { display: none !important; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 10px;
}

.brand { display: flex; align-items: center; gap: 11px; }

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(31, 163, 181, .28);
  overflow: hidden;
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.brand-title { font-size: 16px; font-weight: 700; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--soft); margin-top: 2px; }

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12px;
  color: var(--muted);
  box-shadow: 0 1px 4px rgba(20, 30, 50, .06);
}

.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #c4c9d1; }
.status-pill.on .dot { background: var(--ok); }
.status-pill.on { color: var(--ok); }
.status-pill.run .dot { background: var(--accent); }
.status-pill.run { color: var(--accent); }

.topbar-right { display: flex; align-items: center; }
.bell-btn {
  position: relative; width: 36px; height: 36px; border: 0; background: var(--card);
  border-radius: 50%; font-size: 17px; cursor: pointer; margin-right: 10px;
  box-shadow: 0 1px 4px rgba(20, 30, 50, .06);
  display: flex; align-items: center; justify-content: center;
}
.bell-dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--err); }

/* ---------- 布局 ---------- */
.wrap {
  max-width: 400px;
  margin: 0 auto;
  padding: 6px 14px 26px;
  display: flex;
  flex-direction: column;
}

.wrap > .page + .page { margin-top: 14px; }

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 2px 12px rgba(20, 30, 50, .06);
}

.card-title { font-size: 14px; font-weight: 600; margin-bottom: 13px; }

/* ---------- 二维码 ---------- */
.qr-box { display: flex; flex-direction: column; align-items: center; }

.qr-img-wrap {
  position: relative;
  width: 168px;
  height: 168px;
  border-radius: 14px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #fff;
}

.qr-img-wrap img { width: 100%; height: 100%; object-fit: cover; }

.qr-mask {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f6f7f9;
  font-size: 12px;
  color: var(--muted);
}

.qr-mask.retry { cursor: pointer; }
.qr-mask.retry:hover { background: #eef0f3; }

.qr-spin {
  width: 20px;
  height: 20px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: qr-rot 0.8s linear infinite;
}

.qr-mask.retry .qr-spin { display: none; }
.qr-mask > span + span { margin-top: 9px; }

@keyframes qr-rot { to { transform: rotate(360deg); } }

.qr-status { margin-top: 11px; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- 按钮 ---------- */
.btn {
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: opacity .15s, transform .1s;
}

.btn:active { transform: scale(.98); }
.btn.ghost { background: #f2f3f5; color: #374151; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.btn.danger-ghost { background: #fdecec; color: var(--err); }
.btn.big { height: 46px; margin-top: 14px; }
.btn.stop { background: linear-gradient(135deg, #f06262, #e05252); }

/* ---------- 分隔线 / 表单 ---------- */
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--soft);
  font-size: 11px;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.field { display: block; margin-bottom: 12px; }
.field.inline { flex: 1; margin-bottom: 0; }
.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }

.field input, .field select {
  width: 100%;
  height: 40px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0 12px;
  background: #fff;
  font-size: 13px;
  color: var(--text);
  outline: none;
}

.field textarea {
  width: 100%;
  min-height: 76px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  font-size: 13px;
  color: var(--text);
  outline: none;
  resize: vertical;
  font-family: inherit;
}

.field input:focus, .field select:focus { border-color: var(--accent); }

/* ---------- 账号 ---------- */
.account-row { display: flex; gap: 14px; align-items: center; }

.avatar {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: #eef1f5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--muted);
  overflow: hidden;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.account-meta { flex: 1; min-width: 0; }
.account-name { font-size: 17px; font-weight: 700; }
.account-id { font-size: 12px; color: var(--muted); margin: 3px 0 8px; }

.acc-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { font-size: 11.5px; padding: 4px 10px; border-radius: 999px; background: rgba(31, 163, 181, .12); color: #168396; }
.tag.soft { background: #f2f3f5; color: var(--muted); }

.account-sub { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.6; }

#btnLogout { margin-top: 14px; }

/* ---------- 统计 ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

.stat-card { background: #f7f8fa; border-radius: 14px; padding: 14px; }
.stat-label { font-size: 11px; color: var(--muted); }
.stat-value { font-size: 24px; font-weight: 700; margin: 6px 0 2px; }
.stat-value.sm { font-size: 16px; }
.stat-unit { font-size: 11px; color: var(--soft); }
.stat-sub { font-size: 11px; color: var(--soft); margin-top: 3px; }

/* ---------- 控制 ---------- */
.control-row { margin-bottom: 14px; }

.control-meta { margin-top: 14px; }
.meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 9px 0;
  border-top: 1px solid var(--bg);
}
.muted { color: var(--muted); }

/* ---------- 日志 ---------- */
.log-box {
  height: 150px;
  overflow-y: auto;
  background: #f7f8fa;
  border-radius: 12px;
  padding: 10px 12px;
}

.log-box .line { font-size: 11.5px; margin-bottom: 6px; line-height: 1.5; }
.log-box .t { color: var(--soft); margin-right: 8px; }
.log-box .info { color: #374151; }
.log-box .ok { color: var(--ok); }
.log-box .warn { color: var(--warn); }
.log-box .err { color: var(--err); }

/* ---------- 歌单 / 目标 ---------- */
.source-info { margin-top: 12px; font-size: 12px; color: var(--muted); line-height: 1.6; }

.progress-row { margin-top: 14px; }
.progress-meta { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 8px; }
.progress-track { height: 8px; border-radius: 999px; background: #eef1f5; overflow: hidden; }
.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .4s ease;
}
.progress-hint { font-size: 11px; color: var(--soft); margin-top: 6px; }

/* ---------- 开关 / 乐签 ---------- */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.switch-label { display: flex; flex-direction: column; }
.switch-label > * + * { margin-top: 2px; }
.switch-name { font-size: 13px; font-weight: 600; }
.switch-desc { font-size: 11px; color: var(--soft); }

.switch { position: relative; width: 44px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: #d7dbe1; border-radius: 999px; transition: .2s; cursor: pointer; }
.slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }

.sign-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--bg);
  margin-top: 6px;
}
#startTimeWrap { margin-top: 10px; }

/* ---------- 历史记录 ---------- */
.hist-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.hist-mini {
  background: #f7f8fa;
  border-radius: 12px;
  padding: 11px 12px;
}

.hist-mini-label { font-size: 11px; color: var(--muted); }
.hist-mini-value { font-size: 13px; font-weight: 700; margin-top: 5px; line-height: 1.4; }

.history-list {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding-right: 4px;
}
.history-list > * + * { margin-top: 12px; }

.history-item {
  background: #f7f8fa;
  border-radius: 14px;
  padding: 13px;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.history-date {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

.history-date::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.history-badge {
  font-size: 10.5px;
  color: var(--accent);
  background: rgba(31, 163, 181, .12);
  border-radius: 999px;
  padding: 3px 9px;
  flex-shrink: 0;
}

.history-sub { font-size: 11.5px; color: var(--muted); margin: 7px 0 11px; }

.history-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.h-tile {
  background: #fff;
  border-radius: 11px;
  padding: 10px 6px;
  text-align: center;
}

.h-tile .v { font-size: 15px; font-weight: 700; }
.h-tile .v.exp { color: var(--ok); }
.h-tile .v.min { color: var(--accent); }
.h-tile .v.tot { color: var(--accent-2); }
.h-tile .k { font-size: 10px; color: var(--soft); margin-top: 4px; }

.history-detail { margin-top: 10px; }

.history-detail-toggle {
  width: 100%;
  border: 0;
  background: #fff;
  color: var(--muted);
  font-size: 11.5px;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.history-detail-body {
  margin-top: 8px;
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 11.5px;
  color: #374151;
  line-height: 1.7;
}

.history-detail-body .song-line { color: var(--muted); }

.history-empty {
  text-align: center;
  color: var(--soft);
  font-size: 12px;
  padding: 26px 0;
}

/* ---------- 已记录账号 ---------- */
.account-list {
  display: flex;
  flex-direction: column;
}
.account-list > * + * { margin-top: 10px; }

.account-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f7f8fa;
  border-radius: 14px;
  padding: 12px;
}

.account-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  background: #e5e7eb;
  flex-shrink: 0;
}

.account-main { flex: 1; min-width: 0; }

.account-name {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-id { font-size: 11px; color: var(--muted); font-weight: 400; }

.account-meta {
  font-size: 11.5px;
  color: var(--soft);
  margin-top: 5px;
  line-height: 1.5;
}

.account-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

.account-tag {
  font-size: 10.5px;
  color: var(--accent);
  background: rgba(31, 163, 181, .12);
  border-radius: 999px;
  padding: 2px 8px;
}

.account-empty {
  text-align: center;
  color: var(--soft);
  font-size: 12px;
  padding: 22px 0;
}

/* ========== 菜单分页 ========== */
.tabs { display: flex; gap: 6px; padding: 0 18px 12px; }
.tab {
  border: 0; background: #eef0f3; color: var(--soft); border-radius: 10px;
  padding: 8px 14px; font-size: 13px; cursor: pointer;
}
.tab.active { background: var(--accent); color: #fff; font-weight: 600; }
.page { display: flex; flex-direction: column; animation: fadeIn .15s ease; }
.page > .card + .card { margin-top: 14px; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ========== 点卡 ========== */
.plans-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.plan-card { background: #f7f8fa; border-radius: 12px; padding: 14px 10px; text-align: center; }
.plan-name { font-size: 14px; font-weight: 700; }
.plan-days { font-size: 20px; font-weight: 700; color: var(--accent); margin: 6px 0 4px; }
.plan-desc { font-size: 11px; color: var(--soft); }
.msg { font-size: 13px; margin-top: 10px; min-height: 18px; }
.msg.err { color: var(--err); }
.msg.ok { color: var(--ok); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ========== 歌单队列 ========== */
.queue-list { display: flex; flex-direction: column; margin-bottom: 14px; }
.queue-list > * + * { margin-top: 10px; }
.queue-item { display: flex; align-items: center; background: #f7f8fa; border-radius: 12px; padding: 11px 12px; }
.queue-item > * + * { margin-left: 10px; }
.queue-item.current { background: rgba(31, 163, 181, .1); border: 1px solid rgba(31, 163, 181, .3); }
.queue-main { flex: 1; min-width: 0; }
.queue-label { font-size: 13px; font-weight: 600; }
.queue-meta { font-size: 11px; color: var(--soft); margin-top: 3px; }
.queue-remove { width: auto; height: 32px; padding: 0 12px; background: #fdecec; color: var(--err); border-radius: 9px; font-size: 12px; flex-shrink: 0; }
.queue-add-row { display: flex; flex-direction: column; }
.queue-add-row > * + * { margin-top: 10px; }
.queue-type-row { display: flex; }
.queue-type-row > * + * { margin-left: 10px; }
.queue-type-row select { flex: 1; }
.query-result { margin-top: 14px; }

/* ========== 公告 / 更新弹窗 ========== */
.modal-mask {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(20, 28, 40, .45);
  display: flex; align-items: center; justify-content: center; padding: 22px; z-index: 100;
}
.modal-box {
  background: var(--card); border-radius: 18px; width: 100%; max-width: 360px;
  max-height: 78vh; display: flex; flex-direction: column; overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; font-weight: 700; font-size: 15px; border-bottom: 1px solid var(--line);
}
.modal-close {
  border: 0; background: #f0f2f5; width: 28px; height: 28px; border-radius: 50%;
  font-size: 16px; cursor: pointer; color: var(--muted);
}
.modal-body { padding: 14px 18px; overflow-y: auto; }
.ann-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.ann-item:first-child { padding-top: 0; }
.ann-item:last-child { border-bottom: 0; }
.ann-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; }
.ann-tag { font-size: 11px; border-radius: 8px; padding: 2px 8px; margin-right: 8px; flex-shrink: 0; }
.ann-tag.update { background: #e8f6ef; color: var(--ok); }
.ann-tag.notice { background: #fdecec; color: var(--err); }
.ann-time { font-size: 11px; color: var(--soft); margin: 4px 0 6px; }
.ann-content { font-size: 13px; color: var(--text); line-height: 1.6; white-space: pre-wrap; }
.update-ver { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.update-notes { font-size: 13px; color: var(--muted); line-height: 1.6; white-space: pre-wrap; margin-bottom: 16px; }
