:root{
  --bg-blur: 18px;
  --card: rgba(255,255,255,0.72);
  --text: #111;
  --text-dim: #555;
  --primary: #4f46e5;
  --danger: #dc2626;
}
*{ box-sizing: border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft Yahei", sans-serif;
  color: var(--text);
  backdrop-filter: blur(var(--bg-blur));
  overflow: hidden; /* 关键：禁止整页滚动，只让内部容器滚动 */
}

/* 固定模糊背景 */
.bg{
  position: fixed;
  inset:0;
  background: center/cover no-repeat var(--bg, #f3f4f6);
  filter: blur(12px);
  transform: scale(1.05);
  z-index: -1;
}

/* 顶部栏固定在最上面 */
.topbar{
  position: sticky;
  top:0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 16px;
  backdrop-filter: blur(16px);
  background: rgba(255,255,255,0.6);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  z-index:10;
}
.brand{ font-weight: 800; letter-spacing: .2px; }
.user-menu{ display:flex; align-items:center; gap:8px; }
.user-menu.hidden, .hidden{ display:none; }
.right{ margin-left: auto; }

/* 中间区域：用 flex 垂直布局，上面 profile，下面 links-scroll 可滚动 */
.container{
  max-width:720px;
  margin:0 auto;
  padding:16px 16px 16px;
  height: calc(100vh - 56px); /* 56px ≈ topbar 高度，可按实际微调 */
  box-sizing:border-box;
  display:flex;
  flex-direction:column;
}

/* 头像卡片 */
.profile{
  display:flex;
  gap:16px;
  align-items:center;
  background: var(--card);
  border-radius: 20px;
  padding:16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.06);
}
.avatar{
  width:88px;
  height:88px;
  border-radius: 50%;
  object-fit:cover;
}
.info h1{ margin: 0 0 6px; font-size: 28px; }
.info p{ margin:0; color: var(--text-dim); }

/* 只让这一块滚动 */
.links-scroll{
  flex:1;
  min-height:0;              /* 非常关键，允许内部元素 overflow */
  margin-top:24px;
  display:flex;
  flex-direction:column;
  overflow-y:auto;
  padding-bottom:24px;
}

/* 链接列表 */
.links{
  list-style:none;
  padding:0;
  margin:0;                  /* 间距由 links-scroll 控制 */
  display:flex;
  flex-direction:column;
  gap:12px;
}
.link-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  background: var(--card);
  border-radius: 16px;
  padding:14px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.05);
  cursor:grab;
}
.link-left{ display:flex; align-items:center; gap:12px; min-width:0; }
.icon{
  width:28px;
  height:28px;
  border-radius:8px;
  display:grid;
  place-items:center;
  overflow:hidden;
  font-size:18px;
  background:#fff;
}
.icon img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.title{
  font-weight:600;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:420px;
}
.url{
  color: var(--text-dim);
  font-size:12px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:280px;
}
.link-right{ display:flex; align-items:center; gap:10px; }
.edit-btn{ opacity:0; transition: .2s; }
.link-item:hover .edit-btn{ opacity:1; }

/* 按钮样式 */
.btn{
  border:1px solid rgba(0,0,0,0.1);
  background:#fff;
  padding:8px 12px;
  border-radius:12px;
  cursor:pointer;
}
.btn.small{ padding:6px 10px; font-size:12px; }
.btn.primary{
  background: var(--primary);
  color:#fff;
  border-color: transparent;
}
.btn.danger{
  background: var(--danger);
  color:#fff;
  border-color: transparent;
}
.btn.dashed{
  border:1.5px dashed rgba(0,0,0,0.2);
  background: transparent;
  width:100%;
  padding:12px;
  border-radius: 14px;
  margin-top:12px;
}

/* 弹窗 */
.dialog{ border:none; border-radius:16px; padding:0; }
.dialog::backdrop{
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(2px);
}
.dialog-body{
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:10px;
  min-width:320px;
}
label{ display:flex; flex-direction:column; gap:6px; font-size:12px; color: var(--text-dim); }
label.muted{ color:#888; font-style: italic; }
input, textarea{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(0,0,0,0.1);
  font:inherit;
}
.actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:8px;
}
.actions.split{ justify-content:space-between; align-items:center; }
.dragging{ opacity: .6; }
.right .btn{ margin-left:6px; }
.topbar .btn.right{ margin-left:auto; }

/* 加载器 */
.loader {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(0,0,0,0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  z-index: 1001;
}
.loader.hidden { display: none; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 错误提示 Toast */
.error-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--danger);
  color: white;
  padding: 10px 16px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.error-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-10px);
}
