/* =========================================================
   CFID 直播看板 · 三套主题（浅色 / 深色 / 蓝粉渐变）
   ========================================================= */

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color .35s ease, color .35s ease;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ---------------- 主题变量 ---------------- */
[data-theme="light"] {
  --bg: #f4f7fd;
  --bg-soft: #eef2fb;
  --card: #ffffff;
  --card-border: rgba(24, 39, 75, .08);
  --card-shadow: 0 18px 40px -28px rgba(24, 39, 75, .45);
  --text: #16203a;
  --muted: #6b7893;
  --accent: #3b6ef6;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(59, 110, 246, .1);
  --ok: #17a673;
  --ok-soft: rgba(23, 166, 115, .12);
  --warn: #d9822b;
  --warn-soft: rgba(217, 130, 43, .12);
  --bad: #e0535a;
  --bad-soft: rgba(224, 83, 90, .12);
  --line: rgba(24, 39, 75, .08);
  --blob-a: rgba(59, 110, 246, .16);
  --blob-b: rgba(139, 92, 246, .14);
  --blob-c: rgba(56, 189, 248, .12);
  --login-card: rgba(255, 255, 255, .92);
  --topbar: rgba(255, 255, 255, .78);
}

[data-theme="dark"] {
  --bg: #070b18;
  --bg-soft: #0c1225;
  --card: rgba(255, 255, 255, .045);
  --card-border: rgba(255, 255, 255, .09);
  --card-shadow: 0 24px 60px -40px rgba(0, 0, 0, .9);
  --text: #e9eefc;
  --muted: #93a0be;
  --accent: #6d8dff;
  --accent-2: #b388ff;
  --accent-soft: rgba(109, 141, 255, .16);
  --ok: #3ddc97;
  --ok-soft: rgba(61, 220, 151, .14);
  --warn: #ffb454;
  --warn-soft: rgba(255, 180, 84, .14);
  --bad: #ff6b7a;
  --bad-soft: rgba(255, 107, 122, .14);
  --line: rgba(255, 255, 255, .09);
  --blob-a: rgba(76, 110, 245, .34);
  --blob-b: rgba(150, 90, 255, .28);
  --blob-c: rgba(35, 190, 255, .2);
  --login-card: rgba(14, 20, 38, .82);
  --topbar: rgba(9, 14, 28, .72);
}

[data-theme="gradient"] {
  --bg: #eef1ff;
  --bg-soft: #f6f0ff;
  --card: rgba(255, 255, 255, .72);
  --card-border: rgba(255, 255, 255, .75);
  --card-shadow: 0 24px 60px -34px rgba(99, 102, 241, .5);
  --text: #1d2340;
  --muted: #6a7191;
  --accent: #6366f1;
  --accent-2: #ec4899;
  --accent-soft: rgba(99, 102, 241, .12);
  --ok: #10b981;
  --ok-soft: rgba(16, 185, 129, .14);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, .14);
  --bad: #f43f5e;
  --bad-soft: rgba(244, 63, 94, .14);
  --line: rgba(99, 102, 241, .12);
  --blob-a: rgba(99, 102, 241, .42);
  --blob-b: rgba(236, 72, 153, .34);
  --blob-c: rgba(56, 189, 248, .3);
  --login-card: rgba(255, 255, 255, .7);
  --topbar: rgba(255, 255, 255, .55);
}

/* ---------------- 背景装饰 ---------------- */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .95;
  transition: background .4s ease;
}

.blob-a { width: 46vw; height: 46vw; left: -12vw; top: -14vw; background: var(--blob-a); }
.blob-b { width: 40vw; height: 40vw; right: -10vw; top: 6vh; background: var(--blob-b); }
.blob-c { width: 38vw; height: 38vw; left: 22vw; bottom: -18vw; background: var(--blob-c); }

[data-theme="light"] .blob { opacity: .6; }
[data-theme="dark"] .blob { opacity: .8; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
}

.login-card {
  width: min(440px, 100%);
  background: var(--login-card);
  border: 1px solid var(--card-border);
  border-radius: 26px;
  padding: 38px 34px 30px;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  text-align: center;
  animation: rise .5s ease both;
}

.brand-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 26px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 16px 32px -16px rgba(99, 102, 241, .8);
}

.brand-mark.small {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  font-size: 17px;
  margin: 0;
  box-shadow: 0 10px 22px -12px rgba(99, 102, 241, .8);
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 26px;
  letter-spacing: .5px;
}

.login-sub {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  height: 50px;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.field i { color: var(--muted); font-size: 15px; }

.field input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  letter-spacing: 1.2px;
  font-family: "JetBrains Mono", Consolas, "Courier New", monospace;
}

.field input::placeholder { color: var(--muted); opacity: .7; letter-spacing: .5px; }

.btn-primary {
  width: 100%;
  height: 50px;
  margin-top: 16px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 16px 30px -16px rgba(99, 102, 241, .9);
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 20px 36px -16px rgba(99, 102, 241, .95); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .65; cursor: default; transform: none; }

.login-msg {
  min-height: 20px;
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--bad);
}

.login-foot {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  text-align: left;
}

.login-foot i { margin-top: 2px; color: var(--accent); }

/* ---------------- 主界面 ---------------- */
.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  animation: fade .4s ease both;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px clamp(16px, 3vw, 40px);
  background: var(--topbar);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16px; letter-spacing: .3px; }
.brand-text span { font-size: 11.5px; color: var(--muted); }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 13px;
  max-width: 260px;
}

.user-chip i { color: var(--accent); }
.user-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip em { font-style: normal; color: var(--muted); font-size: 12px; }

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--card-border);
  flex: 0 0 26px;
  background: var(--bg-soft);
}

.pill-demo { background: var(--accent-soft); color: var(--accent); }

.top-actions { display: flex; align-items: center; gap: 10px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.pill i { font-size: 8px; }

.pill-live { background: var(--ok-soft); color: var(--ok); }
.pill-live i { animation: pulse 1.6s infinite; }

.pill-off { background: var(--bad-soft); color: var(--bad); }
.pill-off i { animation: none; }

.pill-idle { background: var(--warn-soft); color: var(--warn); }

.theme-switch {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}

.theme-switch button {
  width: 32px;
  height: 28px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  transition: background .2s ease, color .2s ease;
}

.theme-switch button:hover { color: var(--text); }

.theme-switch button.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 8px 18px -10px rgba(99, 102, 241, .9);
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--muted);
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease;
}

.icon-btn:hover { color: var(--text); border-color: var(--accent); }

/* ---------------- 看板 ---------------- */
.board {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(18px, 2.6vw, 34px) clamp(14px, 3vw, 40px) 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 20px 22px;
  transition: background .35s ease, border-color .35s ease, transform .2s ease;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}

.stat { display: flex; align-items: center; gap: 16px; }

.stat-icon {
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 19px;
  color: var(--accent);
  background: var(--accent-soft);
}

.stat-icon.ok { color: var(--ok); background: var(--ok-soft); }
.stat-icon.gen { color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 14%, transparent); }
.stat-icon.single { color: var(--warn); background: var(--warn-soft); }

.stat-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-label { font-size: 12.5px; color: var(--muted); letter-spacing: .3px; }
.stat-body strong { font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-body em { font-style: normal; font-size: 11.5px; color: var(--muted); }

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

.card-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .3px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.card-head h2 i { color: var(--accent); font-size: 14px; }

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

.progress {
  height: 12px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 18px -2px var(--accent);
  transition: width .5s cubic-bezier(.22, .8, .3, 1);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px solid var(--line);
}

.chip i { font-size: 11px; color: var(--accent); }
.chip b { color: var(--text); font-weight: 600; }

.split {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 18px;
}

.current-name {
  font-size: clamp(30px, 4.4vw, 46px);
  font-weight: 700;
  letter-spacing: 2px;
  line-height: 1.2;
  margin: 8px 0 14px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  word-break: break-all;
  min-height: 1.2em;
}

.current-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--muted);
  font-size: 12.5px;
}

.current-meta b { color: var(--text); font-weight: 600; }
.current-meta i { margin-right: 4px; }

.feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 210px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.feed li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-size: 13.5px;
  animation: slideIn .35s ease both;
}

.feed li .dot-ok {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px var(--ok-soft);
  flex: 0 0 7px;
}

.feed li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed li time { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.feed .empty { justify-content: center; color: var(--muted); font-size: 12.5px; }

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--bg-soft); }

td.empty { text-align: center; color: var(--muted); padding: 26px 12px; }

.res { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; }
.res i { font-size: 11px; }
.res.ok { color: var(--ok); }
.res.used { color: var(--bad); }
.res.invalid { color: var(--warn); }
.res.timeout { color: var(--muted); }
.res.error { color: var(--bad); }

.foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  padding: 8px 0 4px;
}

.foot i { margin-right: 5px; color: var(--accent); }
.foot .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); opacity: .6; }

/* ---------------- 动画 ---------------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------------- 响应式 ---------------- */
@media (max-width: 980px) {
  .split { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  .user-chip { margin-left: 0; order: 3; width: 100%; max-width: none; }
  .top-actions { margin-left: auto; }
}

@media (max-width: 640px) {
  .brand-text span { display: none; }
  .board { gap: 14px; }
  .card { padding: 16px 16px; border-radius: 16px; }
  .cards { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat { gap: 12px; }
  .stat-icon { width: 42px; height: 42px; flex-basis: 42px; border-radius: 13px; font-size: 16px; }
  .stat-body strong { font-size: 22px; }
  .theme-switch button { width: 28px; }
  .current-name { font-size: 28px; letter-spacing: 1px; }
}

@media (max-width: 400px) {
  .cards { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
