* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    sans-serif;
}

body {
  background-color: #f5f7fa;
  color: #1e293b;
  transition:
    background-color 0.3s,
    color 0.3s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 暗色模式 */
body.dark-mode {
  background-color: #0f172a;
  color: #e2e8f0;
}

body.dark-mode .link-card {
  background-color: #1e293b;
  border-color: #334155;
}

body.dark-mode .link-card:hover {
  background-color: #263445;
  border-color: #5f6b7a;
}

body.dark-mode .nav-header {
  background-color: #1e293bcc;
  border-bottom-color: #334155;
}

body.dark-mode .theme-toggle {
  background: #2d3748;
  color: #fbbf24;
}

body.dark-mode .link-title {
  color: #f1f5f9;
}

body.dark-mode .link-description {
  color: #cbd5e1;
}

body.dark-mode .link-url {
  color: #94a3b8;
  border-top-color: #334155;
}

body.dark-mode .url-badge {
  background: #334155;
  color: #cbd5e1;
}

body.dark-mode .nav-footer {
  border-top-color: #334155;
  color: #94a3b8;
}

body.dark-mode .nav-footer code {
  background: #1e293b;
  color: #cbd5e1;
}

body.dark-mode .empty-state {
  color: #64748b;
}

/* 头部 */
.nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background-color: #ffffffcc;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 10;
  transition: background-color 0.3s;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-emoji {
  font-size: 2rem;
}

h1 {
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

/* 主题切换按钮 */
.theme-toggle {
  font-size: 1.8rem;
  cursor: pointer;
  padding: 0.3rem 0.8rem;
  border-radius: 30px;
  background: #eef2f6;
  user-select: none;
  transition: all 0.2s;
  line-height: 1;
}

.theme-toggle:hover {
  background: #e2e8f0;
  transform: scale(1.05);
}

/* 主容器 */
.container {
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  flex: 1;
  width: 100%;
}

/* 加载提示 */
.loading {
  text-align: center;
  font-size: 1.2rem;
  padding: 3rem;
  color: #64748b;
  background: #ffffff;
  border-radius: 24px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

body.dark-mode .loading {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

/* 链接网格 - 每个卡片独立显示 */
.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.8rem;
  padding: 0.5rem 0;
}

/* 链接卡片 - 每个{}都是一个独立的卡片 */
.link-card {
  background: white;
  border-radius: 24px;
  padding: 1.5rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.02);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* 卡片悬停效果 */
.link-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.15);
  border-color: #94a3b8;
  background: #fafdff;
}

/* 卡片点击波纹效果 */
.link-card:active {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -8px rgba(0, 0, 0, 0.2);
}

/* 链接标题 */
.link-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.3;
  transition: color 0.2s;
  word-break: break-word;
}

.link-card:hover .link-title {
  color: #2563eb;
}

body.dark-mode .link-card:hover .link-title {
  color: #60a5fa;
}

/* 链接描述 */
.link-description {
  font-size: 0.95rem;
  color: #475569;
  line-height: 1.6;
  flex: 1;
  word-break: break-word;
}

/* 链接URL区域 */
.link-url {
  font-size: 0.85rem;
  color: #64748b;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed #cbd5e1;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  transition: border-color 0.2s;
}

.link-card:hover .link-url {
  border-top-color: #94a3b8;
}

/* 域名部分 */
.url-domain {
  flex: 1;
  word-break: break-all;
  opacity: 0.9;
}

/* 自动生成徽章 */
.url-badge {
  font-size: 0.7rem;
  background: #e2e8f0;
  color: #475569;
  padding: 0.2rem 0.6rem;
  border-radius: 30px;
  margin-left: 0.3rem;
  white-space: nowrap;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 450;
  letter-spacing: 0.02em;
  transition: background-color 0.2s;
}

.link-card:hover .url-badge {
  background: #cbd5e1;
}

body.dark-mode .link-card:hover .url-badge {
  background: #4a5568;
  color: #e2e8f0;
}

/* 页脚 */
.nav-footer {
  text-align: center;
  padding: 1.5rem;
  border-top: 1px solid #e2e8f0;
  margin-top: 2.5rem;
  color: #64748b;
  font-size: 0.9rem;
  transition: border-color 0.3s;
}

.nav-footer code {
  background: #e2e8f0;
  padding: 0.2rem 0.6rem;
  border-radius: 30px;
  font-size: 0.85rem;
  font-family: "JetBrains Mono", monospace;
  transition: background-color 0.2s;
}

/* 空状态提示 */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: #94a3b8;
  font-size: 1.1rem;
  grid-column: 1 / -1;
  background: #ffffff;
  border-radius: 24px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

/* 响应式设计 */

/* 平板设备 */
@media (max-width: 1024px) {
  .container {
    max-width: 960px;
  }

  .links-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
  }
}

/* 手机设备 */
@media (max-width: 768px) {
  .nav-header {
    padding: 0.8rem 1.2rem;
  }

  h1 {
    font-size: 1.3rem;
  }

  .logo-emoji {
    font-size: 1.8rem;
  }

  .theme-toggle {
    font-size: 1.6rem;
    padding: 0.2rem 0.6rem;
  }

  .container {
    margin: 1.5rem auto;
    padding: 0 1.2rem;
  }

  .links-grid {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }

  .link-card {
    padding: 1.2rem;
  }

  .link-title {
    font-size: 1.3rem;
  }

  .link-description {
    font-size: 0.9rem;
  }

  .loading,
  .empty-state {
    padding: 2.5rem 1.5rem;
  }
}

/* 小手机设备 */
@media (max-width: 480px) {
  .nav-header {
    padding: 0.6rem 1rem;
  }

  h1 {
    font-size: 1.2rem;
  }

  .logo-emoji {
    font-size: 1.6rem;
  }

  .theme-toggle {
    font-size: 1.4rem;
    padding: 0.2rem 0.5rem;
  }

  .container {
    margin: 1rem auto;
    padding: 0 1rem;
  }

  .links-grid {
    gap: 1rem;
  }

  .link-card {
    padding: 1rem;
    border-radius: 20px;
  }

  .link-title {
    font-size: 1.2rem;
  }

  .link-description {
    font-size: 0.85rem;
    line-height: 1.5;
  }

  .link-url {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    flex-direction: column;
    align-items: flex-start;
  }

  .url-badge {
    margin-left: 0;
    margin-top: 0.3rem;
  }

  .nav-footer {
    padding: 1rem;
    font-size: 0.85rem;
  }

  .nav-footer code {
    font-size: 0.8rem;
    padding: 0.15rem 0.4rem;
  }
}

/* 超小设备 */
@media (max-width: 360px) {
  .logo-wrap {
    gap: 0.3rem;
  }

  h1 {
    font-size: 1.1rem;
  }

  .logo-emoji {
    font-size: 1.4rem;
  }

  .link-card {
    padding: 0.9rem;
  }

  .link-title {
    font-size: 1.1rem;
  }
}

/* 动画效果 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.links-grid {
  animation: fadeIn 0.5s ease-out;
}

/* 打印样式 */
@media print {
  .nav-header,
  .theme-toggle,
  .nav-footer {
    display: none;
  }

  .link-card {
    break-inside: avoid;
    border: 1px solid #000;
    box-shadow: none;
  }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
  .link-card {
    border-width: 2px;
  }

  .link-url {
    border-top-width: 2px;
  }

  .url-badge {
    border: 1px solid currentColor;
  }
}

/* 减少动效 */
@media (prefers-reduced-motion: reduce) {
  .link-card,
  .theme-toggle,
  .links-grid {
    animation: none;
    transition: none;
  }

  .link-card:hover {
    transform: none;
  }
}
