/* 简单修仙 - 二次元灵域主题 (深色/浅色可切换) */
:root {
  --bg-deep: #0d0a1f;
  --bg-mid: #1a1433;
  --card-bg: rgba(30, 22, 58, 0.82);
  --card-border: rgba(167, 139, 250, 0.25);
  --text: #ece7ff;
  --text-dim: #a99fd0;
  --purple: #8b5cf6;
  --purple-light: #c4b5fd;
  --gold: #fbbf24;
  --pink: #f472b6;
  --green: #34d399;
  --red: #f87171;
  --bg-grad: linear-gradient(160deg, #0d0a1f 0%, #1a0f35 40%, #241348 70%, #0d0a1f 100%);
  --overlay-grad: radial-gradient(ellipse at 50% 30%, rgba(88, 52, 168, 0.35), rgba(13, 10, 31, 0.92));
  --hero-grad: linear-gradient(120deg, rgba(139, 92, 246, 0.14), rgba(244, 114, 182, 0.08), rgba(251, 191, 36, 0.08));
  --input-bg: rgba(13, 10, 31, 0.7);
  --log-bg: rgba(8, 5, 20, 0.85);
  --cloud-color: rgba(255, 255, 255, 0.09);
  --title-grad: linear-gradient(90deg, #c4b5fd, #fbbf24, #f472b6);
  --pill-ok-bg: rgba(52, 211, 153, 0.14);
  --pill-ok-border: rgba(52, 211, 153, 0.4);
  --pill-ok-text: var(--green);
  --pill-run-bg: rgba(251, 191, 36, 0.16);
  --pill-run-border: rgba(251, 191, 36, 0.55);
  --pill-run-text: var(--gold);
  --particle-gold: 251, 191, 36;
  --particle-purple: 167, 139, 250;
  --shadow-card: 0 4px 18px rgba(13, 10, 31, 0.5);
}

:root[data-theme="light"] {
  --bg-deep: #f6f1ff;
  --bg-mid: #ede4ff;
  --card-bg: rgba(255, 255, 255, 0.88);
  --card-border: rgba(124, 58, 237, 0.22);
  --text: #332b52;
  --text-dim: #6d6390;
  --purple: #7c3aed;
  --purple-light: #6d28d9;
  --gold: #b45309;
  --pink: #db2777;
  --green: #059669;
  --red: #dc2626;
  --bg-grad: linear-gradient(160deg, #f6f1ff 0%, #efe6ff 40%, #f9f4ff 70%, #f4edff 100%);
  --overlay-grad: radial-gradient(ellipse at 50% 30%, rgba(124, 58, 237, 0.16), rgba(246, 241, 255, 0.95));
  --hero-grad: linear-gradient(120deg, rgba(124, 58, 237, 0.10), rgba(219, 39, 119, 0.05), rgba(180, 83, 9, 0.07));
  --input-bg: rgba(255, 255, 255, 0.92);
  --log-bg: rgba(250, 247, 255, 0.95);
  --cloud-color: rgba(124, 58, 237, 0.09);
  --title-grad: linear-gradient(90deg, #6d28d9, #b45309, #db2777);
  --pill-ok-bg: rgba(5, 150, 105, 0.12);
  --pill-ok-border: rgba(5, 150, 105, 0.45);
  --pill-ok-text: #047857;
  --pill-run-bg: rgba(180, 83, 9, 0.12);
  --pill-run-border: rgba(180, 83, 9, 0.5);
  --pill-run-text: #b45309;
  --particle-gold: 180, 83, 9;
  --particle-purple: 109, 40, 217;
  --shadow-card: 0 4px 18px rgba(124, 58, 237, 0.10);
}

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

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-grad);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .35s ease, color .35s ease;
}

/* ============ 主题切换按钮 ============ */
.theme-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s, box-shadow .2s;
  backdrop-filter: blur(8px);
}
.theme-btn:hover { transform: scale(1.12) rotate(12deg); box-shadow: 0 0 16px rgba(139, 92, 246, 0.35); }
.theme-btn.abs { position: absolute; top: 14px; right: 14px; }

/* ============ 灵气粒子背景 ============ */
#spiritCanvas {
  position: fixed; inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* 云层 */
.cloud {
  position: fixed;
  border-radius: 50%;
  background: radial-gradient(ellipse, var(--cloud-color), transparent 70%);
  filter: blur(8px);
  z-index: 0;
  pointer-events: none;
  animation: cloudDrift linear infinite;
}
.cloud-1 { width: 420px; height: 140px; top: 8%; left: -200px; animation-duration: 80s; }
.cloud-2 { width: 560px; height: 180px; top: 45%; left: 40%; animation-duration: 110s; animation-delay: -30s; }
.cloud-3 { width: 380px; height: 120px; top: 70%; left: -150px; animation-duration: 95s; animation-delay: -60s; }

@keyframes cloudDrift {
  from { transform: translateX(0); }
  to { transform: translateX(120vw); }
}

/* ============ 布局 ============ */
.container {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px;
}

/* ============ 卡密登录层 ============ */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--overlay-grad);
  backdrop-filter: blur(6px);
  padding: 20px;
}
.login-card {
  position: relative;
  width: 400px;
  max-width: 100%;
  background: linear-gradient(160deg, rgba(40, 28, 80, 0.95), rgba(24, 16, 50, 0.97));
  border: 1px solid rgba(196, 181, 253, 0.35);
  border-radius: 20px;
  padding: 34px 30px;
  text-align: center;
  box-shadow: 0 0 60px rgba(139, 92, 246, 0.35), 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: fadeIn .45s ease;
}
:root[data-theme="light"] .login-card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.97), rgba(245, 240, 255, 0.98));
  border-color: rgba(124, 58, 237, 0.25);
  box-shadow: 0 0 50px rgba(124, 58, 237, 0.18), 0 20px 60px rgba(124, 58, 237, 0.12);
}
.login-emoji { font-size: 44px; margin-bottom: 8px; animation: pearlGlow 2s ease-in-out infinite; }
.login-title {
  font-size: 24px;
  font-weight: 800;
  background: var(--title-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 3px;
  margin-bottom: 6px;
}
.login-sub { color: var(--text-dim); font-size: 13px; margin-bottom: 20px; }
.login-input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid rgba(167, 139, 250, 0.35);
  border-radius: 10px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 15px;
  letter-spacing: 0.5px;
  text-align: center;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  margin-bottom: 14px;
}
.login-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.25);
}
.login-device {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px dashed rgba(139, 92, 246, 0.3);
  border-radius: 10px;
  padding: 9px 12px;
  margin-bottom: 12px;
}
.dev-label { color: var(--text-dim); font-size: 12px; flex-shrink: 0; }
.dev-value {
  font-family: Consolas, monospace;
  font-size: 11px;
  color: var(--purple-light);
  word-break: break-all;
  text-align: left;
}
.login-error { color: var(--red); font-size: 13px; min-height: 20px; margin-bottom: 8px; }
.login-foot { color: var(--text-dim); font-size: 11px; margin-top: 14px; line-height: 1.6; }

/* ============ 顶部横幅 ============ */
.hero {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--hero-grad);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  padding: 14px 26px;
  margin-bottom: 16px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(139, 92, 246, 0.16);
}

.hero-left { flex-shrink: 0; }
.hero-right { flex: 1; }

.waifu {
  width: 130px;
  height: 170px;
  filter: drop-shadow(0 0 18px rgba(251, 191, 36, 0.35));
  animation: waifuFloat 4s ease-in-out infinite;
}

@keyframes waifuFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

.aura { animation: auraPulse 3s ease-in-out infinite; transform-origin: center; }
@keyframes auraPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.pearl { animation: pearlGlow 2.4s ease-in-out infinite; }
@keyframes pearlGlow {
  0%, 100% { filter: drop-shadow(0 0 3px #fbbf24); }
  50% { filter: drop-shadow(0 0 12px #fbbf24); }
}

.cloudFloat { animation: cloudBob 5s ease-in-out infinite; }
@keyframes cloudBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.spirit-dot { animation: dotFloat 3.5s ease-in-out infinite; }
.dot1 { animation-delay: 0s; }
.dot2 { animation-delay: -1.2s; }
.dot3 { animation-delay: -2.1s; }
.dot4 { animation-delay: -0.7s; }
@keyframes dotFloat {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-14px); }
}

.hero-title {
  font-size: 30px;
  font-weight: 800;
  background: var(--title-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 2px;
  margin-bottom: 6px;
}
.hero-sub { color: var(--text-dim); font-size: 14px; margin-bottom: 10px; }

.status-pill {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 999px;
  background: var(--pill-ok-bg);
  border: 1px solid var(--pill-ok-border);
  color: var(--pill-ok-text);
  font-size: 14px;
  font-weight: 600;
}
.status-pill.running {
  background: var(--pill-run-bg);
  border-color: var(--pill-run-border);
  color: var(--pill-run-text);
  animation: pillGlow 1.6s ease-in-out infinite;
}
@keyframes pillGlow {
  0%, 100% { box-shadow: 0 0 6px rgba(251,191,36,0.25); }
  50% { box-shadow: 0 0 20px rgba(251,191,36,0.6); }
}

/* ============ 用户信息条 ============ */
.user-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 8px 16px;
  margin-bottom: 14px;
  backdrop-filter: blur(10px);
  font-size: 13px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-card);
}
.ub-item { color: var(--text-dim); }
.ub-item b { color: var(--gold); }
.ub-dev {
  font-family: Consolas, monospace;
  font-size: 11px;
  color: var(--purple-light);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-bar .btn { margin-left: auto; }

/* ============ 统计仪表盘 ============ */
.dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 14px 16px;
  text-align: center;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-card);
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.22);
}
.stat-icon { font-size: 24px; margin-bottom: 4px; }
.stat-label { color: var(--text-dim); font-size: 12px; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--text); margin: 3px 0; }
.stat-value.gold { color: var(--gold); text-shadow: 0 0 14px rgba(251, 191, 36, 0.5); }
.stat-sub { color: var(--text-dim); font-size: 11px; }

/* ============ 主布局 ============ */
.main-grid {
  display: grid;
  grid-template-columns: 430px 1fr;
  gap: 16px;
  align-items: start;
}
.left-panel { display: flex; flex-direction: column; gap: 14px; }
.right-panel { position: sticky; top: 16px; }

/* ============ 卡片 ============ */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 16px;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-card);
  transition: border-color .25s, box-shadow .25s;
}
.card:hover {
  border-color: rgba(196, 181, 253, 0.5);
  box-shadow: 0 6px 26px rgba(139, 92, 246, 0.22);
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--purple-light);
}
.badge {
  background: linear-gradient(135deg, #8b5cf6, #f472b6);
  color: #fff;
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 12px;
}
.hint { color: var(--text-dim); font-size: 12px; margin-bottom: 8px; }
.hint.center { text-align: center; margin-top: 8px; margin-bottom: 0; }

/* ============ 表单 ============ */
.form-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.form-row label {
  flex-shrink: 0;
  width: 74px;
  color: var(--text-dim);
  font-size: 13px;
}
.form-row select, .form-row input {
  flex: 1;
  background: var(--input-bg);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 8px;
  color: var(--text);
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
  transition: border-color .2s;
}
.form-row select:focus, .form-row input:focus {
  border-color: var(--purple);
}

/* ============ 按钮 ============ */
.btn {
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  transition: transform .15s, box-shadow .2s, filter .2s;
  color: #fff;
}
.btn:active { transform: scale(0.96); }
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35);
}
.btn-primary:hover {
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.6);
  filter: brightness(1.1);
}
.btn-danger {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.35);
}
.btn-danger:hover { box-shadow: 0 6px 24px rgba(239, 68, 68, 0.6); }
.btn-small {
  background: rgba(139, 92, 246, 0.18);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: var(--purple-light);
  padding: 7px 12px;
  font-size: 13px;
  margin: 3px 4px 3px 0;
}
.btn-small:hover { background: rgba(139, 92, 246, 0.3); }
.btn.ghost {
  background: transparent;
  border: 1px solid rgba(167,139,250,0.3);
  color: var(--text-dim);
  padding: 4px 10px;
  font-size: 12px;
  margin-left: auto;
}

/* ============ 账号池 ============ */
.acc-add-row { display: flex; gap: 8px; margin-bottom: 10px; }
.acc-add-row input {
  flex: 1;
  background: var(--input-bg);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 8px;
  color: var(--text);
  padding: 7px 10px;
  font-size: 12px;
  outline: none;
}
.acc-list { max-height: 170px; overflow-y: auto; }
.acc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.22);
  border-radius: 8px;
  padding: 7px 10px;
  margin-bottom: 6px;
  font-size: 12px;
  word-break: break-all;
}
.acc-item .ak-text { flex: 1; margin-right: 8px; color: var(--purple-light); }
.acc-item .del-btn {
  background: transparent;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 15px;
  flex-shrink: 0;
}
.acc-item .del-btn:hover { filter: brightness(1.4); }

/* ============ 日志 ============ */
.log-card { display: flex; flex-direction: column; height: calc(100vh - 150px); }
.log-area {
  flex: 1;
  overflow-y: auto;
  background: var(--log-bg);
  border: 1px solid rgba(167, 139, 250, 0.15);
  border-radius: 10px;
  padding: 12px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.65;
}
.log-line { margin-bottom: 3px; word-break: break-all; }
.log-line .t { color: var(--text-dim); margin-right: 6px; opacity: .8; }
.log-line.info { color: var(--text); }
.log-line.success { color: var(--green); }
.log-line.error { color: var(--red); }
.log-line.warn { color: var(--gold); }

/* ============ 底部 ============ */
.footer {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 4px;
}
.footer-hint { color: var(--text-dim); font-size: 12px; }

.hidden { display: none; }
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

/* ============ 滚动条 ============ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139, 92, 246, 0.7); }

/* ============ 响应式 ============ */
@media (max-width: 960px) {
  .main-grid { grid-template-columns: 1fr; }
  .right-panel { position: static; }
  .log-card { height: 480px; }
  .dashboard { grid-template-columns: repeat(2, 1fr); }
  .hero { flex-direction: column; text-align: center; }
}
