* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f4f6f9; color: #333; }

/* Header */
header { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); padding: 16px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.header-inner { max-width: 1200px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 24px; }
.logo { font-size: 24px; font-weight: bold; color: #fff; white-space: nowrap; letter-spacing: 1px; }
.search-box { flex: 1; display: flex; gap: 8px; }
.search-box input { flex: 1; padding: 10px 16px; border: none; border-radius: 24px; font-size: 14px; outline: none; background: rgba(255,255,255,0.12); color: #fff; }
.search-box input::placeholder { color: rgba(255,255,255,0.5); }
.search-box button { padding: 10px 20px; background: #4f8ef7; color: #fff; border: none; border-radius: 24px; cursor: pointer; font-size: 14px; transition: background .2s; }
.search-box button:hover { background: #3a7de8; }

/* Ad Banner Top */
.ad-banner-top { max-width: 1200px; margin: 16px auto 0; padding: 0 20px; }
.ad-banner-top .ad-item { background: #fff; border: 1px dashed #ccc; border-radius: 8px; text-align: center; padding: 12px; color: #999; font-size: 13px; }

/* Layout */
.main-layout { max-width: 1200px; margin: 16px auto; padding: 0 20px; display: flex; gap: 20px; }

/* Sidebar */
.sidebar { width: 160px; flex-shrink: 0; }
.cat-list { background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.cat-item { padding: 12px 16px; cursor: pointer; font-size: 14px; display: flex; align-items: center; gap: 8px; transition: background .15s; border-left: 3px solid transparent; }
.cat-item:hover { background: #f0f4ff; }
.cat-item.active { background: #f0f4ff; border-left-color: #4f8ef7; color: #4f8ef7; font-weight: 600; }
.cat-item .cat-icon { font-size: 18px; }

/* Ad Sidebar */
.ad-sidebar { margin-top: 16px; }
.ad-sidebar .ad-item { background: #fff; border: 1px dashed #ccc; border-radius: 8px; padding: 12px; text-align: center; color: #999; font-size: 12px; }

/* Main content */
main { flex: 1; min-width: 0; }
.section-title { font-size: 15px; font-weight: 600; color: #555; margin-bottom: 12px; padding-left: 4px; display: flex; align-items: center; gap: 6px; }
.section-title::before { content: ''; display: block; width: 4px; height: 16px; background: #4f8ef7; border-radius: 2px; }

/* Site grid */
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 24px; }
.site-card { background: #fff; border-radius: 10px; padding: 16px; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,0.06); transition: transform .15s, box-shadow .15s; text-decoration: none; display: block; position: relative; border: 1px solid #eee; }
.site-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.site-card.sponsored { border-color: #f5c518; }
.sponsored-badge { position: absolute; top: 8px; right: 8px; background: #f5c518; color: #333; font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.site-icon { width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, #4f8ef7, #7c3aed); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 20px; margin-bottom: 10px; overflow: hidden; }
.site-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.site-name { font-size: 14px; font-weight: 600; color: #222; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-desc { font-size: 12px; color: #888; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Footer */
footer { text-align: center; padding: 20px; font-size: 12px; color: #999; background: #fff; margin-top: 20px; border-top: 1px solid #eee; }
footer a { color: #999; text-decoration: none; }
footer a:hover { color: #4f8ef7; }

/* Search highlight */
.site-card.hidden { display: none; }

@media (max-width: 768px) {
  .main-layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .cat-list { display: flex; overflow-x: auto; }
  .cat-item { white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; }
  .cat-item.active { border-bottom-color: #4f8ef7; border-left-color: transparent; }
  .site-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
