:root {
  --bg: #efefef;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #dddddd;
  --brand: #766EE9;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--text);
  background: var(--bg);
}

.app-layout { min-height: 100vh; display: grid; grid-template-columns: 230px 1fr; background-color: #f5f5f5;}

.sidebar {
  background: #ffffff;
  border-right: 1px solid #d8d8d8;
  padding: 0px 10px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-title { 
  font-size: 13px; 
  color: #2c2c2c;
  font-weight: bold;
  margin: 0px 10px; 
  display: flex;
  align-items: center;
  height: 66px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 8px; }
.side-link {
  position: relative;
  overflow: hidden;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #1f2937;
}
.side-link:hover { background: #ecebff; }
.side-link.active { background: #ecebff; color: var(--brand); font-weight: 600; }

.ripple {
  position: absolute;
  border-radius: 999px;
  background: rgba(118, 110, 233, 0.3);
  transform: scale(0);
  animation: ripple-effect 0.48s ease-out;
  pointer-events: none;
}

.main-panel { min-width: 0; display: flex; flex-direction: column; justify-content: space-between;}
.topbar {
  height: 66px; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { margin: 0; font-size: 42px; font-weight: 800; letter-spacing: .2px; color: var(--brand); }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.search-input {
  width: 280px; border: 1px solid #d1d5db; border-radius: 6px;
  background: #fafafa; padding: 10px 12px; font-size: 14px;
}
.btn {
  border: 1px solid #cfcdf8; color: var(--brand); background: #f3f2ff;
  border-radius: 6px; padding: 9px 10px; cursor: pointer;
}

.content { padding: 18px 28px 30px; background-color: #f5f5f5;}
.category-section { margin-bottom: 26px; }
.section-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px; border-bottom: 0px solid #d9d9d9; padding-bottom: 8px;
}
.section-header::before {
  content: ''; width: 4px; height: 22px; border-radius: 4px; background: var(--brand);
}
.section-header h2 { margin: 0; font-size: 18px; color: #202020; }

.card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.site-card {
  position: relative;
  background: #fff; border-radius: 12px; border: 1px solid #dedede;
  padding: 14px; display: flex; gap: 12px; align-items: flex-start;
  /* box-shadow: 0 2px 8px rgba(0, 0, 0, .05); */
}

.site-card.fade-in {
  animation: fade-in-card 0.28s ease-out;
}

.site-card.fade-out {
  animation: fade-out-card 0.24s ease-in forwards;
}

.fav-icon-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #bfbfbf;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  transform-origin: center;
}
.fav-icon-btn.active { color: var(--brand); }
.fav-icon-btn.fav-pop { animation: favorite-pop 0.52s ease-out; }

.site-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
}
.site-icon {
  width: 44px; height: 44px; border-radius: 10px; border: 1px solid #e5e7eb;
  background: #f8fafc; object-fit: cover;
}
.site-meta { min-width: 0; flex: 1; padding-right: 28px; }
.site-title {
  margin: 0 0 4px; font-size: 16px; font-weight: 700; line-height: 1.2;
}
.site-title-link {
  text-decoration: none;
  color: #202020;
}
.site-title-link:hover { color: var(--brand); }
.site-desc {
  margin: 0; color: #4b5563; font-size: 14px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.empty-tip { color: #9699a1; margin: 0; font-size: 15px;}

@keyframes ripple-effect {
  0% { transform: scale(0); opacity: 0.7; }
  100% { transform: scale(1); opacity: 0; }
}

@keyframes favorite-pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.35); }
  70% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

@keyframes fade-in-card {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes fade-out-card {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.94); }
}


.site-footer {
  display: flex;
  border-top: 1px solid var(--line);
  margin: 0 28px 18px;
  padding: 12px 0 4px;
  justify-content: center;
  color: #6b7280;
  background-color: #f5f5f5;
  gap: 20px;
  font-size: 13px;
  line-height: 1.7;
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--brand); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

@media (max-width: 1500px) { .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1200px) {
  .app-layout { grid-template-columns: 190px 1fr; }
  .topbar h1 { font-size: 30px; }
  .section-header h2 { font-size: 18px; }
  .site-title { font-size: 22px; }
  .site-desc { font-size: 18px; }
}
@media (max-width: 900px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid #d8d8d8; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .topbar { height: auto; padding: 12px; flex-direction: column; gap: 8px; align-items: flex-start; }
  .search-input { width: 100%; }
  .topbar-actions { width: 100%; }
  .card-grid { grid-template-columns: 1fr; }
  .content { padding: 12px; }
  .site-footer { margin: 0 12px 16px; }
}
