/* ───────── 基础重置 ───────── */
*,::before,::after{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;padding:0;width:100%;height:100%;
  display:flex;align-items:center;justify-content:center;
  font-family:-apple-system,"Helvetica Neue","Microsoft YaHei","Hiragino Sans GB",sans-serif;
  font-size:14px;font-weight:400;
  overflow:hidden;
  -webkit-tap-highlight-color:transparent;
}
a{text-decoration:none;color:inherit}
img{-webkit-touch-callout:none;user-select:none}
button,input{font-family:inherit;-webkit-appearance:none}

/* ───────── 壁纸与遮罩 ───────── */
#bg-layer{
  position:fixed;inset:0;z-index:-2;
  background-size:cover;background-position:center;background-repeat:no-repeat;
  transition:background-image .4s ease,filter .3s ease;
}
#mask-layer{
  position:fixed;inset:0;z-index:-1;
  background-color:rgba(0,0,0,.1);
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
  transition:background-color .25s ease,backdrop-filter .25s ease;
}

/* ───────── 主容器 ───────── */
#main{
  width:90%;
  max-width:1000px;
  min-width:320px;
  margin:auto;
  padding:20px 0;
}

/* ───────── 搜索框 ───────── */
#search-wrap{
  position:relative;
  width:70%;min-width:340px;
  height:56px;
  margin:0 auto 150px auto;
  display:flex;align-items:center;
  background:#fff;
  border-radius:4px;
  box-shadow:0 1px 3px rgba(0,0,0,.12),0 8px 24px rgba(0,0,0,.06);
  opacity:.8;
  transition:opacity .25s ease,height .2s ease,width .2s ease,border-radius .2s ease,margin .2s ease;
  z-index:2;
}
#search-wrap:hover{opacity:1}

#search-type{
  width:52px;height:100%;flex:0 0 52px;
  background-repeat:no-repeat;background-position:center;background-size:20px 20px;
  border-radius:3px 0 0 3px;
  cursor:pointer;
  opacity:.35;
  transition:opacity .25s ease;
  position:relative;
}
#search-type:hover{opacity:1}
#search-type-arrow{
  position:absolute;right:7px;top:50%;margin-top:-3px;
  width:7px;height:7px;
  transition:transform .25s ease;
}

#search-form{
  flex:1;display:flex;align-items:center;height:100%;min-width:0;
}
#search{
  flex:1;min-width:0;height:96%;
  border:none;outline:none;background:transparent;
  font-size:16px;color:#333;
  padding:0 8px 0 2px;
}
#search::placeholder{color:#c5c5c5}
#search-btn{
  flex:0 0 60px;width:60px;height:100%;
  border:none;outline:none;cursor:pointer;
  background:url(/assets/img/ui/search.svg) no-repeat center/20px 20px;
  border-radius:2px;
  transition:background-color .2s ease;
}
#search-btn:hover{background-color:rgba(0,0,0,.04)}

/* 引擎下拉 */
#engine-box,#kw-box{
  position:absolute;left:0;top:calc(100% + 10px);width:100%;
  background:#fff;border-radius:6px;
  box-shadow:0 4px 20px rgba(0,0,0,.14);
  overflow:hidden;display:none;z-index:6;
}
#engine-toolbar{
  display:flex;justify-content:space-between;align-items:center;
  padding:8px 12px;font-size:12px;color:#8a8a8a;
  border-bottom:1px solid #f0f0f0;
}
#engine-list{
  display:flex;flex-wrap:wrap;padding:8px;
  max-height:280px;overflow-y:auto;
}
.engine-item{
  position:relative;
  display:flex;align-items:center;gap:8px;
  width:25%;min-width:130px;
  padding:10px;margin:0;
  border-radius:6px;
  border:2px solid transparent;
  cursor:pointer;
  font-size:15px;color:#333;
  transition:background-color .2s ease,border-color .2s ease;
}
.engine-item:hover{background:#f7f7f7}
.engine-item.active{border-color:#4b8ef7;background:#f2f7ff}
.engine-item .e-icon{width:20px;height:20px;flex:0 0 20px;border-radius:3px;object-fit:contain}
.engine-item .e-title{flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.engine-item .e-del,.engine-item .e-edit{
  width:16px;height:16px;flex:0 0 16px;display:none;opacity:.55;
}
.engine-item .e-del:hover,.engine-item .e-edit:hover{opacity:1}
#engine-list.editing .engine-item .e-del,
#engine-list.editing .engine-item .e-edit{display:block}
.engine-item .e-del{background:url(/assets/img/ui/trash.svg) no-repeat center/contain}
.engine-item .e-edit{background:url(/assets/img/ui/pencil.svg) no-repeat center/contain}

/* 联想词 */
#kw-box{max-height:0;transition:max-height .18s ease}
.kw-item{
  height:34px;line-height:34px;padding:0 20px;
  font-size:15px;color:#333;cursor:pointer;
  overflow:hidden;white-space:nowrap;text-overflow:ellipsis;
}
.kw-item:hover,.kw-item.sel{background:#f2f2f2}

/* ───────── 站点区 ───────── */
#site-wrap{position:relative;width:100%}
#site-toolbar{
  display:none;justify-content:space-between;align-items:center;
  padding:0 4px 10px;font-size:12px;color:#fff;
  text-shadow:0 1px 3px rgba(0,0,0,.5);
}
#site-box{
  display:flex;flex-flow:row wrap;justify-content:center;
  margin:0 auto;padding:0;list-style:none;
  width:100%;
  transition:width .2s ease;
}
.site-a{
  display:block;text-align:center;color:#fff;
  margin:0 15px 16px;padding:0;
  opacity:.8;
  transition:transform .25s ease,opacity .25s ease;
}
.site-a:hover{transform:translateY(-4px);opacity:1}
.site-a:hover>.site-li{box-shadow:0 6px 16px rgba(0,0,0,.28)}
.site-li{
  position:relative;
  width:56px;height:56px;
  display:flex;align-items:center;justify-content:center;
  background:#fff;
  border-radius:50%;
  box-shadow:0 1px 3px rgba(0,0,0,.12);
  margin:0 10px;
  line-height:0;
  transition:width .2s ease,height .2s ease,border-radius .2s ease;
}
.site-img{width:36%;height:36%;object-fit:contain;border-radius:2px}
.site-title{
  display:block;margin:5px auto 0;
  font-size:13px;line-height:1.2;
  text-shadow:0 1px 3px rgba(0,0,0,.45);
  overflow:hidden;white-space:nowrap;text-overflow:ellipsis;
  transition:opacity .2s ease,width .2s ease;
}
.site-a .s-del,.site-a .s-edit{
  position:absolute;width:18px;height:18px;display:none;opacity:.6;cursor:pointer;
  background:rgba(255,255,255,.9) no-repeat center/12px 12px;
  border-radius:50%;
  top:-2px;
}
.site-a .s-del{right:-2px;background-image:url(/assets/img/ui/trash.svg)}
.site-a .s-edit{left:-2px;background-image:url(/assets/img/ui/pencil.svg)}
.site-a .s-del:hover,.site-a .s-edit:hover{opacity:1}
#site-box.editing .site-a .s-del,
#site-box.editing .site-a .s-edit{display:block}
.site-add .site-li{background:rgba(255,255,255,.25);border:1px dashed rgba(255,255,255,.7)}
.site-add .site-img{width:26%;height:26%;opacity:.9}
.site-add{cursor:pointer}

/* ───────── 右下角按钮 ───────── */
#fab-box{position:fixed;right:26px;bottom:24px;display:flex;flex-direction:column;gap:12px;z-index:50}
.fab{
  position:relative;width:40px;height:40px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  background:rgba(0,0,0,.28);
  backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);
  cursor:pointer;transition:background-color .2s ease,transform .2s ease;
}
.fab:hover{background:rgba(0,0,0,.45);transform:scale(1.06)}
.fab img{width:19px;height:19px;opacity:.92;filter:invert(1)}
.fab-tip{
  position:absolute;right:50px;top:50%;transform:translateY(-50%);
  padding:5px 10px;border-radius:5px;
  background:rgba(0,0,0,.72);color:#fff;font-size:12px;white-space:nowrap;
  opacity:0;pointer-events:none;transition:opacity .2s ease;
}
.fab:hover .fab-tip{opacity:1}

/* ───────── 提示条 ───────── */
#toast-wrap{position:fixed;top:0;left:0;width:100%;z-index:999;text-align:center;pointer-events:none}
#toast{
  display:none;margin:20px auto;padding:10px 34px;
  background:rgba(0,0,0,.82);color:#fff;font-size:15px;
  border-radius:100px;
  box-shadow:0 4px 16px rgba(0,0,0,.2);
  opacity:0;transition:opacity .3s ease,margin .3px ease;
}

/* ───────── 右键菜单 ───────── */
#ctx-menu{
  position:fixed;z-index:998;display:none;flex-flow:column nowrap;
  padding:8px;background:#fff;border-radius:7px;
  box-shadow:0 6px 28px rgba(0,0,0,.22);
  user-select:none;
}
.ctx-item{
  padding:7px 14px;font-size:14px;color:rgba(0,0,0,.75);
  border-radius:4px;cursor:pointer;white-space:nowrap;
  transition:background-color .15s ease;
}
.ctx-item:hover{background:rgba(0,0,0,.05)}

/* ───────── 大屏适配 ───────── */
@media (min-width:2000px){
  #search-type{background-size:24px 24px;flex-basis:60px}
  #search-btn{flex-basis:72px;background-size:22px 22px}
  #search{font-size:18px}
  .site-title{font-size:14px}
  .kw-item{height:38px;line-height:38px}
  .engine-item{padding:12px}
  .engine-item .e-icon{width:23px;height:23px;flex-basis:23px}
}
@media (max-width:700px){
  #main{width:94%}
  #search-wrap{width:100%;min-width:0}
  .engine-item{width:50%}
  .site-a{margin:0 10px 14px}
  #fab-box{right:16px;bottom:16px}
}
