:root { 
  --red: #ff4d4f; 
  --blue: #4facfe;
  --glass: rgba(255, 255, 255, 0.05); 
  --shadow: 0 12px 40px rgba(0,0,0,0.6); 
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'PingFang SC', system-ui, sans-serif; color: #fff; background: #0a0a0a; min-height: 100vh; overflow-x: hidden; }
#bg-canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; background-size: cover; background-position: center; transition: 1s ease; }
.wrapper { max-width: 1100px; margin: 0 auto; padding: 20px; }

/* 头部 */
header h1 { text-align: center; font-weight: 300; font-size: 40px; color: #ffffff; margin: 40px 0 30px; }
.logo-link { text-decoration: none; display: block; }

/* 搜索 */
.search-area { max-width: 650px; margin: 0 auto; text-align: center; }
.search-tabs { display: flex; justify-content: center; gap: 20px; margin-bottom: 12px; }
.tab { cursor: pointer; opacity: 0.5; font-size: 15px; transition: 0.3s; padding-bottom: 5px; }
.tab.active { opacity: 1; border-bottom: 2px solid #fff; font-weight: bold; }
.search-pill { display: flex; background: rgba(35, 35, 35, 0.95); border-radius: 50px; padding: 5px 5px 5px 20px; border: 1px solid rgba(255,255,255,0.1); box-shadow: var(--shadow); backdrop-filter: blur(20px); }
.search-pill input { flex: 1; background: transparent; border: none; color: #fff; font-size: 16px; outline: none; }
.search-trigger-btn { background: var(--red); border: none; color: #fff; width: 44px; height: 44px; border-radius: 50px; cursor: pointer; transition: 0.3s; }
.search-trigger-btn:hover { transform: scale(1.05); filter: brightness(1.1); }

/* 引擎 */
.search-engines { display: flex; justify-content: center; gap: 15px; margin-top: 15px; font-size: 13px; min-height: 20px; }
.engine { cursor: pointer; opacity: 0.5; padding: 2px 8px; border-radius: 4px; transition: 0.3s; }
.engine.active { opacity: 1; font-weight: bold; background: rgba(255,255,255,0.1); }

/* 导航分类 Hover */
#sticky-nav { 
    position: sticky; 
    top: 10px; 
    z-index: 9999; 
    background: rgba(15, 15, 15, 0.35); 
    backdrop-filter: blur(20px); 
    border-radius: 12px; 
    margin: 70px 0 70px 0; 
    border: 1px solid rgba(255,255,255,0.05); 
}

#category-ul { display: flex; justify-content: center; list-style: none; padding: 10px; flex-wrap: wrap; gap: 10px; }
#category-ul a { color: #ccc !important; text-decoration: none; font-size: 16px; padding: 6px 12px; border-radius: 8px; transition: all 0.3s ease; display: inline-block; }
#category-ul a:hover { color: #fff !important; background: rgba(255, 255, 255, 0.15); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }

/* 站点展示 分类跳转间距 */
section { 
    margin-top: 50px; 
    scroll-margin-top: 80px; 
    transition: 0.3s; 
}

/* 二级分类标题栏布局 */
.category-header { display: flex; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 15px; }
.category-title { border-left: 4px solid var(--red); padding-left: 12px; font-weight: 500; font-size: 22px; margin-bottom: 0; }

/* 二级分类筛选标签 */
.sub-cat-filter { display: flex; gap: 8px; font-size: 13px; color: rgba(255,255,255,0.4); align-items: center; border-left: 1px solid rgba(255,255,255,0.1); padding-left: 15px; }
.sub-cat-item { cursor: pointer; padding: 2px 8px; border-radius: 4px; transition: 0.2s; }
.sub-cat-item:hover { color: #fff; }
.sub-cat-item.active { background: var(--blue); color: #fff; }

.link-grid {
    display: grid !important; 
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)) !important; 
    gap: 20px;
    min-height: 5px; 
    padding: 10px; 
    margin-left: -10px;                                    
    margin-right: -10px; 
    border-radius: 12px;
    border: 2px dashed transparent; 
    transition: all 0.3s ease;
}

.link-grid.drag-over { 
    background: rgba(79, 172, 254, 0.08) !important; 
    border-color: var(--blue) !important;            
    transform: scale(1.01);                          
}

body.is-searching .category-header, body.is-searching #sticky-nav { display: none !important; }

.link-card { position: relative; background: var(--glass); backdrop-filter: blur(15px); border: 1px solid rgba(255,255,255,0.08); border-radius: 18px; padding: 25px 10px; text-align: center; cursor: pointer; transition: 0.3s; }

.link-card:hover {
    transform: translateY(-8px);
    border-color: var(--blue);
    z-index: 1001; 
}
.link-card img { width: 40px; height: 40px; border-radius: 10px; margin-bottom: 10px; }
.link-card h3 { font-size: 13px; font-weight: 300; }
.card-del { position: absolute; top: -5px; right: -5px; background: #444; width: 24px; height: 24px; border-radius: 50%; display: none; align-items: center; justify-content: center; font-size: 12px; z-index: 100; transition: 0.2s; }
.link-card:hover .card-del { display: flex; }
.card-del:hover { background: var(--red) !important; color: #fff; }

/* 搜索弹窗核心 */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 9999; justify-content: center; align-items: center; }
.modal-overlay { position: absolute; width: 100%; height: 100%; background: rgba(0,0,0,0.85); backdrop-filter: blur(8px); }
/* 弹窗核心 */
.modal-body { 
  background: #1a1a1a; 
  padding: 45px 35px 35px 35px; 
  border-radius: 24px; 
  width: 90%; 
  max-width: 440px; 
  border: 1px solid #333; 
  position: relative; 
  z-index: 10; 
  box-shadow: var(--shadow); }
.modal-title-center { text-align: center !important; margin-bottom: 30px; font-weight: 500; font-size: 20px; display: block; width: 100%; }


/* 搜索结果 */
.search-modal-container { max-width: 600px; display: flex; flex-direction: column; max-height: 85vh; }
#modal-results-area {
  flex: 1;
  overflow-y: auto;
  margin-top: 10px;
  padding-top: 10px;
  padding-bottom: 0;

  /* Firefox 美化 */
  scrollbar-width: thin;
  scrollbar-color: #999 transparent;
}

/* Chrome / Edge 美化（细、好看、不丑） */
#modal-results-area::-webkit-scrollbar { width: 6px; }
#modal-results-area::-webkit-scrollbar-track { background: transparent; }
#modal-results-area::-webkit-scrollbar-thumb { background: #999; border-radius: 99px; }

/* 保存按钮 */
.save-btn-new { width: 100% !important; height: 52px !important; background: #333 !important; border: none !important; color: #fff !important; border-radius: 14px !important; font-weight: bold !important; cursor: pointer; margin-top: 10px; font-size: 16px; transition: 0.3s; }
.save-btn-new:hover { background: var(--red) !important; transform: translateY(-4px); font-weight: 900; box-shadow: 0 5px 15px rgba(255, 77, 79, 0.4); }


/* 编辑站点对齐 */
.modal-row { display: flex !important;
            gap: 12px !important; 
            margin-bottom: 15px !important; 
            width: 100% !important; 
            align-items: stretch !important; }
.modern-modal input, .modern-modal select { 
    height: 50px !important; 
    background: #000 !important; 
    border: 1px solid #333 !important; 
    color: #fff !important; 
    border-radius: 12px !important; 
    padding: 0 50px 0px 15px !important; 
    font-size: 15px !important; 
    outline: none !important; 
    box-sizing: border-box !important;
}

select {
    cursor: pointer;
    appearance: none; 
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.full-width-input { width: 100% !important; margin-bottom: 15px !important; display: block; flex: none !important; }

/* 图标预览 */
.icon-preview-box {   
  width: 25%;
  width: 48px !important; 
  height: 50px !important; 
  background: #000 !important; 
  border-radius: 12px !important; 
  border: 1px solid #333 !important; 
  display: flex !important; 
  align-items: center !important; 
  justify-content: center !important; 
  flex-shrink: 0 !important; 
  overflow: hidden !important; }
.icon-preview-box img { 
  width: 28px; 
  height: 28px; 
  object-fit: contain; 
  display: none; }
.icon-preview-box img.loaded { 
  display: block !important; }

/* 分类管理扩展 */
.cat-admin-row {
  display: flex;
  align-items: center;
  background: #222;
  padding: 12px 12px;
  border-radius: 14px;
  margin-bottom: 12px;
  border: 1px solid #383838;
}
.sub-cat-admin-list {
  margin-left: 20px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sub-cat-row {
  display: flex;
  align-items: center;
  background: #181818;
  padding: 6px 11px 6px 12px;
  border-radius: 10px;
  border: 2px solid #2c2b2b;
}
.sub-cat-row input { font-size: 14px !important; }

/* 侧边分类管理文字调整 */
.drag-handle { 
  color: #555; 
  margin-right: 4px; 
  cursor: grab; }

.cat-admin-row input,
.sub-cat-row input {
  background: transparent !important;
  border: none !important;
  flex: 1;
  color: #fff;
  height: auto !important;
  padding: 0 6px !important; 
}

/* 按钮组：保证永远横向不换行 */
.row-btns {
  display: flex;
  gap: 6px;
  margin-left: -40px;
  flex-shrink: 0;
}

.btn-mini {
  padding: 4px 8px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 11px;
  color: #fff;
  background: #444;
  transition: 0.2s;
}
.btn-mini:hover { filter: brightness(1.2); }
.btn-mini.blue { background: #333; border: 1px solid #444; }
.btn-mini.blue:hover { background: var(--blue); border-color: var(--blue); }
.btn-mini.red:hover { background: var(--red); }

.scroll-area {
  max-height: 50vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 5px;
  scrollbar-width: thin;
  scrollbar-color: #999 transparent;
}
.scroll-area::-webkit-scrollbar { width: 6px; }
.scroll-area::-webkit-scrollbar-thumb { background: #999; border-radius: 99px; }

.add-cat-area {
  display: flex;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid #333;
  margin: 20px 1px 1px 1px;
  width: 100%;
  justify-content: flex-start;
}
.btn-add-cat {
  width: 23%;
  height: 45px;
  background: #333;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
  flex-shrink: 0;
}
.btn-add-cat:hover { background: var(--blue); }

/* 侧边按钮 */
.side-tools { position: fixed; right: 20px; bottom: 30px; display: flex; flex-direction: column; gap: 12px; z-index: 1000; }
.side-btn { width: 50px; height: 50px; border-radius: 15px; background: rgba(30,30,30,0.9); border: 1px solid rgba(255,255,255,0.1); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 18px; transition: 0.3s; }
.side-btn:hover { background: var(--red); transform: translateY(-3px); }

/* 汽泡描述 */
.link-card[data-desc]::after {
    content: attr(data-desc);
    position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 15px;
    background: rgba(255, 255, 255, 0.75); color: #000; padding: 8px 12px; border-radius: 8px;
    font-size: 12px; z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.15s;
    width: 100px; white-space: normal; word-wrap: break-word; line-height: 1.5; text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.link-card:hover[data-desc]::after { opacity: 1; }
.link-card[data-desc=""]::after { display: none; }

/* 页脚 */
.advanced-footer { margin-top: 60px; position: relative; z-index: 10; }
.footer-divider { height: 1px; width: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent); margin-bottom: 50px; }
.footer-container { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.brand-logo { font-size: 20px; font-weight: 100; letter-spacing: 1px; color: rgba(255,255,255,0.9); }
.footer-brand p { font-size: 12px; color: rgba(255,255,255,0.4); margin-top: 5px; text-align: center; }
.footer-nav { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.nav-group { display: flex; gap: 30px; }
.nav-group a { color: rgba(255,255,255,0.5); text-decoration: none; font-size: 14px; transition: 0.3s; font-weight: 300; }
.nav-group a:hover { color: #fff; }
.social-group { display: flex; gap: 20px; font-size: 18px; }
.social-group a { color: rgba(255,255,255,0.3); transition: 0.3s; }
.social-group a:hover { color: var(--blue); transform: translateY(-3px); }
.footer-copyright p { font-size: 11px; color: rgba(255,255,255,0.2); text-transform: uppercase; letter-spacing: 2px; }

.link-card.dragging { opacity: 0.4; border: 2px dashed var(--blue); }
.link-card.drag-insert-before { border-left: 4px solid var(--blue) !important; transform: translateX(4px); }
