/* ===== 基础重置 ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0e1a;
  --card-bg: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.1);
  --card-hover: rgba(255, 255, 255, 0.1);
  --text: #f0f2f5;
  --text-dim: #8b92a5;
  --accent: #6c8cff;
  --accent-glow: rgba(108, 140, 255, 0.4);
  --green: #34d399;
  --green-glow: rgba(52, 211, 153, 0.4);
  --red: #f87171;
  --orange: #fbbf24;
  --radius: 18px;
  --blur: 20px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== 动态渐变背景 ===== */
.bg-gradient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: linear-gradient(135deg, #0a0e1a 0%, #111827 50%, #0f172a 100%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: float 20s ease-in-out infinite;
}

.orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #6c8cff, transparent 70%);
  top: -150px; left: -100px;
  animation-delay: 0s;
}

.orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #a78bfa, transparent 70%);
  bottom: -100px; right: -80px;
  animation-delay: -7s;
}

.orb-3 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, #22d3ee, transparent 70%);
  top: 40%; left: 50%;
  animation-delay: -14s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -40px) scale(1.05); }
  66% { transform: translate(-20px, 30px) scale(0.95); }
}

/* ===== 布局 ===== */
.container {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

/* ===== 顶部栏 ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 32px;
  filter: drop-shadow(0 0 12px var(--accent-glow));
}

.logo h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 100px;
  font-size: 13px;
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--orange);
  transition: all 0.3s;
}

.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 10px var(--green-glow);
  animation: pulse 2s ease-in-out infinite;
}

.status-dot.offline {
  background: var(--red);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== 卡片通用 ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  margin-bottom: 18px;
  transition: border-color 0.3s, background 0.3s;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

/* ===== 通知开关卡片 ===== */
.toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 28px;
}

.toggle-info h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}

.toggle-info p {
  font-size: 13px;
  color: var(--text-dim);
  max-width: 380px;
}

/* 开关 */
.switch {
  position: relative;
  display: inline-block;
  width: 64px;
  height: 36px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 36px;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.slider::before {
  content: "";
  position: absolute;
  height: 28px; width: 28px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.switch input:checked + .slider {
  background: linear-gradient(135deg, #6c8cff, #a78bfa);
  border-color: transparent;
  box-shadow: 0 0 20px var(--accent-glow);
}

.switch input:checked + .slider::before {
  transform: translateX(28px);
}

/* ===== 统计行 ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  text-align: center;
  padding: 20px 12px;
  margin-bottom: 0;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, #6c8cff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-dim);
}

/* ===== API 卡片 ===== */
.api-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.api-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.btn-copy {
  padding: 6px 16px;
  font-size: 13px;
  color: var(--text);
  background: rgba(108, 140, 255, 0.15);
  border: 1px solid rgba(108, 140, 255, 0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s;
}

.btn-copy:hover {
  background: rgba(108, 140, 255, 0.3);
  border-color: var(--accent);
}

.btn-copy.copied {
  background: rgba(52, 211, 153, 0.2);
  border-color: var(--green);
  color: var(--green);
}

.api-url {
  font-family: "SF Mono", "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 13px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  word-break: break-all;
  color: #a5b4fc;
  margin-bottom: 10px;
}

.api-hint {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
}

.api-hint code {
  padding: 2px 7px;
  background: rgba(108, 140, 255, 0.12);
  border-radius: 5px;
  font-size: 12px;
  color: #c4b5fd;
}

/* ===== 消息列表 ===== */
.messages-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.messages-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.btn-clear {
  padding: 5px 14px;
  font-size: 12px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s;
}

.btn-clear:hover {
  color: var(--red);
  border-color: var(--red);
  background: rgba(248, 113, 113, 0.08);
}

.messages-list {
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.messages-list::-webkit-scrollbar {
  width: 6px;
}

.messages-list::-webkit-scrollbar-track {
  background: transparent;
}

.messages-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-dim);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.6;
}

.empty-state p {
  font-size: 14px;
}

/* 消息项 */
.msg-item {
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transition: background 0.2s;
}

.msg-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.msg-item.new {
  border-color: rgba(108, 140, 255, 0.4);
  box-shadow: 0 0 16px rgba(108, 140, 255, 0.1);
}

.msg-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.msg-title .dot-new {
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-glow);
  animation: pulse 1.5s ease-in-out infinite;
}

.msg-body {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.5;
  word-break: break-word;
}

.msg-time {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 8px;
  opacity: 0.7;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ===== 页脚 ===== */
.footer {
  text-align: center;
  margin-top: 32px;
  font-size: 12px;
  color: var(--text-dim);
  opacity: 0.6;
}

/* ===== 响应式 ===== */
@media (max-width: 520px) {
  .container { padding: 20px 14px 36px; }
  .logo h1 { font-size: 22px; }
  .toggle-card { flex-direction: column; align-items: flex-start; gap: 18px; }
  .switch { align-self: flex-end; }
  .stats-row { gap: 10px; }
  .stat-value { font-size: 22px; }
  .stat-card { padding: 16px 8px; }
  .header { flex-direction: column; gap: 12px; align-items: flex-start; }
}
