:root {
  /* 🔴 确保这里是你的本地图片路径 */
  --bg-image: url('./background.jpg');

  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.6);
  --glass-hover: rgba(255, 255, 255, 0.95);

  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.02);
  --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.08);

  --text-main: #333;
  --text-sub: #666;
  --accent: #007aff;
  --radius: 18px;

  --bg-body: #f2f2f6;
  --bg-overlay: rgba(255, 255, 255, 0.15);
  --profile-bg: rgba(255, 255, 255, 0.7);
  --search-bg: rgba(255, 255, 255, 0.85);
  --chip-bg: rgba(255, 255, 255, 0.6);
  --chip-active-bg: #333;
  --chip-active-text: #fff;
  --modal-bg: #fff;
  --input-bg: #f7f7f9;
  --dock-bg: rgba(255, 255, 255, 0.9);
}

/* 深色模式 */
[data-theme="dark"] {
  --glass-bg: rgba(30, 30, 30, 0.85);
  --glass-border: rgba(60, 60, 60, 0.6);
  --glass-hover: rgba(50, 50, 50, 0.95);

  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.5);

  --text-main: #e0e0e0;
  --text-sub: #a0a0a0;
  --accent: #0a84ff;

  --bg-body: #1c1c1e;
  --bg-overlay: rgba(0, 0, 0, 0.3);
  --profile-bg: rgba(30, 30, 30, 0.8);
  --search-bg: rgba(40, 40, 40, 0.85);
  --chip-bg: rgba(60, 60, 60, 0.6);
  --chip-active-bg: #e0e0e0;
  --chip-active-text: #1c1c1e;
  --modal-bg: #2c2c2e;
  --input-bg: #3a3a3c;
  --dock-bg: rgba(40, 40, 40, 0.9);
}

* { box-sizing: border-box; outline: none; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-body) var(--bg-image) no-repeat center center fixed;
  background-size: cover;
  color: var(--text-main);
  min-height: 100vh;
  transition: background-color 0.3s ease;
}

body::before {
  content: ""; position: fixed; inset: 0;
  background: var(--bg-overlay);
  pointer-events: none; z-index: -1;
}

/* --- 布局容器 --- */
.layout {
  width: 90%;          /* PC端宽度 90% */
  max-width: 1600px;   /* 限制最大宽度 */
  margin: 0 auto;
  padding: 60px 20px 140px;
  display: flex; flex-direction: column; align-items: stretch;
}

/* 顶部时钟 */
.header-section { text-align: center; margin-bottom: 20px; align-self: center; }
.clock {
  font-size: 4rem; font-weight: 600; color: var(--text-main);
  letter-spacing: -2px; line-height: 1;
  text-shadow: 0 2px 10px rgba(255,255,255,0.5);
}
.date { font-size: 1rem; color: var(--text-sub); margin-top: 5px; font-weight: 500; }

/* 深色模式时钟阴影调整 */
[data-theme="dark"] .clock {
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

/* 个人信息区 */
.profile-section {
  text-align: center;
  margin-bottom: 30px;
  padding: 30px;
  background: var(--profile-bg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
  max-width: 600px;
  width: 100%;
  align-self: center;
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  margin-bottom: 16px;
}

.profile-name {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 8px 0;
  letter-spacing: -0.5px;
}

.profile-bio {
  font-size: 1.1rem;
  color: var(--text-sub);
  margin: 0 0 12px 0;
  line-height: 1.6;
}

.profile-location {
  font-size: 0.95rem;
  color: var(--text-sub);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.social-links {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.social-link {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 10px 20px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-main);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.social-link:hover {
  background: var(--glass-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  border-color: var(--accent);
}

.social-link .icon {
  font-size: 1.2rem;
}

/* 搜索框 */
.search-wrapper { width: 100%; max-width: 500px; margin-bottom: 20px; position: relative; z-index: 10; align-self: center; }
.search-glass {
  background: var(--search-bg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 99px;
  height: 54px;
  display: flex; align-items: center; padding: 0 24px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  transition: all 0.3s ease;
}
.search-glass:focus-within {
  transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.1); background: var(--glass-hover);
}
.search-icon { font-size: 18px; margin-right: 12px; opacity: 0.5; }
.search-input {
  flex: 1; background: transparent; border: none; font-size: 16px; color: var(--text-main); height: 100%;
}

/* 标签栏 */
.chips-row {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin-bottom: 40px; width: 100%; max-width: 1200px; align-self: center;
}
.chip {
  background: var(--chip-bg); border: 1px solid var(--glass-border);
  padding: 6px 16px; border-radius: 20px; font-size: 14px; color: var(--text-sub);
  cursor: pointer; transition: 0.2s; backdrop-filter: blur(4px); white-space: nowrap;
}
.chip:hover { background: var(--glass-hover); color: var(--text-main); }
.chip.active { background: var(--chip-active-bg); color: var(--chip-active-text); border-color: var(--chip-active-bg); }

/* 内容区域 */
.content-area {
  width: 100%;
  max-width: 1200px; /* 限制内容区宽度 */
  margin: 0 auto; /* 居中 */
}

.content-area section {
  width: 100%;
}

/* 分组标题 */
.group-title {
  width: 100%;
  font-size: 18px; font-weight: 700; color: var(--text-main);
  margin: 30px 0 16px 4px; display: flex; align-items: center; gap: 8px;
}
.group-title::before { content:""; width: 4px; height: 16px; background: var(--accent); border-radius: 2px; }

/* 🔴 核心修复：网格布局 */
.cards-grid {
  display: grid;
  width: 100%;
  /* 使用 auto-fit 让卡片自动拉伸填满整行 */
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

/* 卡片样式 */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  position: relative;
  box-shadow: var(--shadow-card);
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card:hover {
  transform: translateY(-4px);
  background: var(--glass-hover);
  box-shadow: var(--shadow-hover);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.card-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  font-weight: bold;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.card-icon-img {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  object-fit: contain;
}

.card-info {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-desc {
  font-size: 12px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 状态标签 */
.card-status {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 122, 255, 0.1);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(0, 122, 255, 0.2);
}

/* GitHub 来源标签 */
.card-github-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.05);
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0.7;
}

/* Stars 显示 */
.card-stars {
  font-size: 12px;
  color: #f59e0b;
  font-weight: 500;
  margin-left: 8px;
}


/* 技术栈标签 */
.card-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tech-tag {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-sub);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .tech-tag {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

/* 编辑按钮 */
.card-edit {
  position: absolute; top: 10px; right: 10px;
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(0,0,0,0.05); color: var(--text-sub);
  border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: 0.2s; font-size: 12px;
}
.card:hover .card-edit { opacity: 1; }
.card-edit:hover { background: var(--accent); color: #fff; }

[data-theme="dark"] .card-edit {
  background: rgba(255,255,255,0.1);
}

/* 底部 Dock */
.dock {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: var(--dock-bg); backdrop-filter: blur(20px);
  padding: 8px 16px; border-radius: 99px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  display: flex; gap: 12px; border: 1px solid var(--glass-border);
  z-index: 100;
}
.dock-btn {
  background: transparent; border: none; font-size: 18px; color: var(--text-sub);
  width: 40px; height: 40px; border-radius: 50%;
  cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center;
}
.dock-btn:hover { background: var(--chip-bg); color: var(--text-main); transform: scale(1.1); }
.divider { width: 1px; background: var(--glass-border); margin: 0 4px; }

/* 模态框 */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(5px);
  z-index: 200; display: none; align-items: center; justify-content: center;
  opacity: 0; animation: fadeIn 0.2s forwards;
}
.modal-overlay:not([hidden]) { display: flex; }

.modal-box {
  background: var(--modal-bg); width: 90%; max-width: 420px;
  border-radius: 24px; padding: 24px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.2);
  transform: scale(0.95); animation: popUp 0.3s forwards;
}
.modal-title { margin: 0 0 20px; font-size: 18px; color: var(--text-main); }
.input-field {
  width: 100%; padding: 12px; background: var(--input-bg); border: 1px solid transparent;
  border-radius: 10px; font-size: 14px; margin-bottom: 16px; color: var(--text-main);
}
.input-label { color: var(--text-sub); }
.modal-btns { display: flex; gap: 10px; margin-top: 10px; align-items: center; }
.btn-submit { background: var(--accent); color: #fff; border: none; padding: 10px 20px; border-radius: 10px; flex: 1; cursor: pointer; }
.btn-close { background: var(--chip-bg); color: var(--text-sub); border: none; padding: 10px 20px; border-radius: 10px; cursor: pointer; }
.btn-delete { background: transparent; color: #ff3b30; border: 1px solid rgba(255,59,48,0.3); padding: 8px 16px; border-radius: 10px; cursor: pointer; }
.btn-test { background: transparent; color: var(--accent); border: 1px solid var(--accent); padding: 8px 16px; border-radius: 10px; cursor: pointer; }

@keyframes fadeIn { to { opacity: 1; } }
@keyframes popUp { to { transform: scale(1); } }


/* --- 📱 移动端深度优化 --- */
@media (max-width: 768px) {
  .layout {
    width: 100% !important;
    max-width: none !important;
    padding: 30px 16px 100px;
  }

  .content-area {
    width: 100% !important;
    max-width: none !important; /* 移动端取消最大宽度限制 */
  }

  .content-area section {
    display: block;
    width: 100% !important;
  }

  .chips-row {
    max-width: none; /* 移动端取消最大宽度限制 */
  }

  .clock { font-size: 3rem; }
  .header-section { margin-bottom: 16px; }

  /* 个人信息区移动端优化 */
  .profile-section {
    padding: 20px;
    margin-bottom: 20px;
  }

  .profile-avatar {
    width: 90px;
    height: 90px;
  }

  .profile-name {
    font-size: 1.5rem;
  }

  .profile-bio {
    font-size: 0.95rem;
  }

  .social-links {
    gap: 8px;
  }

  .social-link {
    padding: 8px 14px;
    font-size: 0.85rem;
  }

  /* 标签横向滚动 */
  .chips-row {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 4px;
    margin-bottom: 20px;
    scrollbar-width: none; -ms-overflow-style: none;
  }
  .chips-row::-webkit-scrollbar { display: none; }
  .chip { flex-shrink: 0; }

  /* 卡片双列 */
  .cards-grid {
    display: grid !important;
    width: 100% !important;
    min-width: 100% !important;
    box-sizing: border-box !important;
    /* 手机端改为单列，提供更好的阅读体验 */
    grid-template-columns: 1fr !important;
    gap: 16px;
  }
  .card {
    min-height: 120px;
    padding: 12px;
  }
  .card-header {
    margin-bottom: 8px;
  }
  .card-icon-box {
    width: 36px; height: 36px; font-size: 18px;
  }
  .card-name { font-size: 13px; }
  .card-desc { font-size: 11px; }
  .card-status {
    font-size: 10px;
    padding: 3px 8px;
    top: 8px;
    right: 8px;
  }
  .tech-tag {
    font-size: 10px;
    padding: 2px 6px;
  }

  /* 强制显示编辑按钮 */
  .card-edit {
    opacity: 1 !important;
    background: rgba(0, 0, 0, 0.03);
  }

  /* 底部弹窗 */
  .modal-box {
    width: 100%; max-width: none;
    border-radius: 24px 24px 0 0;
    position: fixed; bottom: 0; margin: 0;
    animation: slideUp 0.3s forwards;
    max-height: 85vh;
    overflow-y: auto;
  }
  @keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
}

/* ����״ָ̬ʾ�� */
.ping-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 6px;
  background-color: #ccc; /* Ĭ�ϻ�ɫ */
  vertical-align: middle;
  transition: background-color 0.3s;
}

.ping-dot.pending {
  background-color: #9ca3af;
  animation: pulse 1.5s infinite;
}

.ping-dot.online {
  background-color: #10b981; /* ��ɫ */
  box-shadow: 0 0 4px #10b981;
}

.ping-dot.offline {
  background-color: #ef4444; /* ��ɫ */
}

@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

/* ��̬״̬��ǩ */
.status-checking { background-color: #f3f4f6; color: #6b7280; animation: pulse 1.5s infinite; }
.status-online { background-color: #d1fae5; color: #059669; }
.status-offline { background-color: #fee2e2; color: #ef4444; }
