: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: 100; 
    background: rgba(15, 15, 15, 0.35); 
    backdrop-filter: blur(20px); 
    border-radius: 12px; 
    margin: 40px 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: 80px; }
.category-title { border-left: 4px solid var(--red); padding-left: 12px; margin-bottom: 30px; font-weight: 500; font-size: 22px; }

/* 线条窗口容器基础样式 */
.link-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(115px, 1fr)); 
    gap: 20px; 
    /* --- 核心修改 --- */
    min-height: 80px;            /* 必须：给空分类一个保底高度，否则鼠标移不上去 */
    padding: 15px;               /* 增加内边距，让容器更像一个“盒子” */
    border-radius: 18px;
    border: 2px dashed transparent; /* 预留一个透明的虚线边框，防止抖动 */
    transition: all 0.2s 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-title, 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; /* <--- 核心修复：确保 Hover 时卡片及描述文字永远在最上层 */
}
.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: 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%; }

/* 编辑站点对齐 */
.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 15px !important; 
    font-size: 15px !important; 
    outline: none !important; 
    box-sizing: border-box !important;
}
#cat-hint { 
    width: 120px !important; 
    flex: none !important; 
    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; }
#in-cat, #in-url { flex: 1 !important; }

/* 图标预览 */
.icon-preview-box { width: 50px !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; }

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

/* 保存按钮 */
.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); }

/* 分类管理 */
.scroll-area { max-height: 50vh; overflow-y: auto; padding-right: 5px; }
.cat-admin-row { display: flex; align-items: center; background: #222; padding: 12px; border-radius: 14px; margin-bottom: 12px; cursor: move; }

/* --- 新增：修改三条杠颜色 --- */
.drag-handle { color: #555; margin-right: 12px; cursor: grab; }

.cat-admin-row input { background: transparent !important; border: none !important; flex: 1; color: #fff; font-size: 16px; height: auto !important; padding: 0 !important; }
.row-btns { display: flex; gap: 8px; margin-left: 10px; }
.btn-mini { padding: 6px 12px; border-radius: 8px; border: none; cursor: pointer; font-size: 12px; color: #fff; background: #444; }
.btn-mini.blue:hover { background: var(--blue); }
.btn-mini.red:hover { background: var(--red); }

/* --- 修改：自适应添加分类区域 --- */
.add-cat-area { display: flex; gap: 10px; padding-top: 20px; border-top: 1px solid #333; margin-top: 10px; width: 100%; }
.add-cat-area input { flex: 0.98; height: 45px !important; min-width: 0; }
.btn-add-cat { width: 90px; 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;       /* 与卡片保持 10px 间距 */
    background: rgba(255, 255, 255, 0.75); /* 稍微加深背景 */
    color: #000000;
    padding: 8px 12px;      /* 增加内边距，更有呼吸感 */
    border-radius: 8px;
    font-size: 12px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;

    /* --- 核心修复：换行逻辑 --- */
    width: 115px;           /* 设置一个固定宽度，超过就换行 */
    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;
}
