:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --line: #e9ecf3;
  --brand: #4f46e5;
  --brand-2: #0ea5e9;
  --ok: #15803d;
  --warn: #b45309;
  --err: #dc2626;
  --radius: 18px;
  --shadow: 0 18px 40px rgba(27, 39, 74, 0.08);
  --shadow-sm: 0 4px 14px rgba(27, 39, 74, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 6% -12%, #e2e8ff 0%, rgba(226, 232, 255, 0) 62%),
    radial-gradient(900px 460px at 102% -4%, #dff3ff 0%, rgba(223, 243, 255, 0) 58%),
    var(--bg);
  font: 15px/1.65 system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app {
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: 100%;
  max-width: 880px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 26px 18px 34px;
}

/* ---------- 顶部 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.brand__mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.28);
  color: #fff;
  font-size: 19px;
  font-weight: 700;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand__text strong {
  font-size: 17px;
  letter-spacing: 0.2px;
}

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

.topbar__tag {
  padding: 5px 11px;
  border: 1px solid rgba(79, 70, 229, 0.16);
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.07);
  color: var(--brand);
  font-size: 12px;
  white-space: nowrap;
}

/* ---------- 主体 ---------- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.view[hidden] {
  display: none;
}

.view--center {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
}

.card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

/* ---------- 启动 ---------- */
.bootcard {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 26px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  color: var(--muted);
}

.bootcard p {
  margin: 0;
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: none;
  border: 2px solid rgba(79, 70, 229, 0.2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- 登录 ---------- */
.logincard {
  max-width: 420px;
  padding: 30px 28px 24px;
  text-align: center;
}

.logincard__title {
  margin: 0 0 6px;
  font-size: 20px;
}

.logincard__sub {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 13px;
}

.qr {
  display: grid;
  width: 216px;
  height: 216px;
  margin: 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}

.qr__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr__img[hidden] {
  display: none;
}

.qr__skeleton {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.qr__skeleton[hidden] {
  display: none;
}

.qr__status {
  min-height: 22px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.qr__status[data-state="ok"] {
  color: var(--ok);
}

.qr__status[data-state="warn"] {
  color: var(--warn);
}

.qr__status[data-state="error"] {
  color: var(--err);
}

.logincard__actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}

.hint {
  margin: 18px 0 0;
  color: #98a1b3;
  font-size: 12.5px;
  line-height: 1.6;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s, color 0.16s, transform 0.16s;
}

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

.btn--ghost {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
}

.btn--ghost:hover:not(:disabled) {
  border-color: rgba(79, 70, 229, 0.35);
  color: var(--brand);
  text-decoration: none;
}

.btn--text {
  padding: 6px 10px;
  color: var(--muted);
  font-size: 13px;
}

.btn--text:hover:not(:disabled) {
  color: var(--brand);
  background: rgba(79, 70, 229, 0.07);
}

.btn--primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.24);
}

.btn--primary:hover:not(:disabled) {
  transform: translateY(-1px);
}

/* ---------- 数据列表 ---------- */
.userbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 20px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
}

.userbar__left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.userbar__right {
  display: flex;
  gap: 2px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}

.section-title {
  margin: 0 0 4px;
  font-size: 18px;
}

.section-sub {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: transform 0.16s, border-color 0.16s, box-shadow 0.16s;
}

.item:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(79, 70, 229, 0.3);
  box-shadow: 0 12px 26px rgba(27, 39, 74, 0.1);
}

.item:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.item__icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: none;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(14, 165, 233, 0.12));
  color: var(--brand);
  font-size: 14px;
  font-weight: 600;
}

.item--batch .item__icon {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
}

.item__body {
  display: block;
  min-width: 0;
  flex: 1;
}

.item__title {
  display: block;
  overflow: hidden;
  margin-bottom: 2px;
  font-size: 14.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item__meta {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item__badge {
  flex: none;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  white-space: nowrap;
}

.item__badge[data-kind="batch"] {
  background: rgba(79, 70, 229, 0.1);
  color: var(--brand);
}

.item__badge[data-kind="score"] {
  background: rgba(14, 165, 233, 0.12);
  color: #0369a1;
}

.item__badge[data-kind="info"] {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}

.item__badge[data-kind="member"] {
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
}

.item__badge[data-kind="muted"] {
  background: #eef1f6;
  color: #8a93a5;
}

.empty {
  padding: 26px;
  border: 1px dashed var(--line);
  border-radius: 15px;
  color: var(--muted);
  text-align: center;
  font-size: 13.5px;
}

/* ---------- 页脚 ---------- */
.footer {
  padding-top: 6px;
  color: #98a1b3;
  font-size: 11.5px;
  line-height: 1.7;
  text-align: center;
}

.footer p {
  margin: 0;
}

/* ---------- 进度弹窗 ---------- */
.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal__mask {
  position: absolute;
  inset: 0;
  background: rgba(21, 27, 43, 0.42);
  backdrop-filter: blur(3px);
}

.modal__card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 60px);
  padding: 22px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 26px 60px rgba(15, 23, 42, 0.24);
}

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

.modal__head h3 {
  margin: 0;
  font-size: 16px;
}

.modal__pct {
  color: var(--brand);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.modal__status {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef1f7;
}

.bar > i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width 0.25s ease;
}

.modal__log {
  flex: 1;
  min-height: 120px;
  max-height: 46vh;
  margin-top: 14px;
  padding: 10px 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  color: #475569;
  font: 12px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-all;
}

.modal__log:empty::before {
  content: "等待开始…";
  color: #a3adc0;
}

.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* ---------- Toast ---------- */
.toast[hidden] {
  display: none;
}

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  z-index: 60;
  max-width: min(90vw, 460px);
  padding: 11px 18px;
  transform: translateX(-50%);
  border-radius: 12px;
  background: rgba(29, 34, 48, 0.94);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.24);
  color: #fff;
  font-size: 13.5px;
  animation: toast-in 0.2s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

@media (max-width: 520px) {
  .app {
    padding: 18px 14px 26px;
  }

  .logincard {
    padding: 24px 18px 20px;
  }

  .qr {
    width: 190px;
    height: 190px;
  }

  .item {
    padding: 13px 13px;
  }

  .item__icon {
    width: 34px;
    height: 34px;
  }
}
