/* 个人资料 / 创建角色 / 世界书 等通用表单页（原 index.html 第 566-1091 行） */

/* ============ 个人资料页（点击头像进入） ============ */
.user-view{ background:var(--bg); }
.user-head{
  display:flex; align-items:center; gap:4px;
  padding:var(--head-top) 14px 4px;
}
.back-btn{
  width:44px; height:44px;
  border:none; background:transparent;
  color:var(--ink);
  border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer;
  transition:background .18s, transform .18s var(--spring);
}
.back-btn:hover{ background:rgba(11,11,15,.05); }
.back-btn:active{ transform:scale(.9); }
.back-btn svg{ width:26px; height:26px; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
.user-head h1{
  flex:1;
  font-size:17px; font-weight:600; margin:0;
}
.head-actions{ display:flex; gap:2px; }
.head-actions .icon-btn{ width:42px; height:42px; }
.user-body{
  flex:1; min-height:0;
  overflow-y:auto;
  padding:8px 20px 24px;
}
.user-avatar-wrap{
  margin:22px auto 6px;
  width:96px; height:96px;
  border-radius:50%;
  box-shadow:0 12px 30px -10px rgba(0,0,0,.3);
}
.user-avatar-wrap img{
  width:100%; height:100%;
  border-radius:50%; object-fit:cover;
}
.user-hint{
  text-align:center;
  font-size:12px; color:var(--gray-2);
  margin:0 0 6px;
}
.user-name-line{
  text-align:center;
  font-size:20px; font-weight:700; margin:0;
}
.field-list{
  margin-top:26px;
  background:var(--bg);
  border-radius:22px;
  overflow:hidden;
  box-shadow:0 1px 0 var(--hairline), 0 0 0 1px var(--hairline);
}
.field{
  display:flex; align-items:center; gap:12px;
  padding:14px 18px;
  background:var(--bg);
}
.field + .field{ border-top:1px solid var(--hairline); }
.field label{
  width:76px; flex:0 0 auto;
  font-size:14px; font-weight:500;
  color:var(--gray-1);
}
.field input{
  flex:1; min-width:0;
  border:none; outline:none; background:transparent;
  font-family:inherit; font-size:15px;
  text-align:right; color:var(--ink);
  padding:2px 0;
}
.field input::placeholder{ color:var(--gray-3); }
.field select{
  flex:1; min-width:0;
  border:none; outline:none;
  background:var(--fill);
  font-family:inherit; font-size:14px;
  color:var(--ink);
  text-align:right; text-align-last:right;
  appearance:none; -webkit-appearance:none;
  cursor:pointer;
  padding:7px 14px;
  border-radius:10px;
}
.field select::-ms-expand{ display:none; }
.field svg{
  width:16px; height:16px;
  color:var(--gray-3);
  flex:0 0 auto;
  fill:none; stroke:currentColor;
  stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round;
}
/* 性别分段选择 */
.field-gender{ gap:14px; }
.seg{
  flex:1; display:flex;
  background:var(--fill);
  border-radius:12px;
  padding:3px; gap:2px;
}
.seg-btn{
  flex:1; height:32px;
  border:none; border-radius:9px;
  background:transparent;
  font-size:13px; font-weight:500;
  color:var(--gray-1);
  cursor:pointer;
  transition:background .2s, color .2s, box-shadow .2s;
}
.seg-btn.active{
  background:#fff; color:var(--ink); font-weight:600;
  box-shadow:0 1px 4px rgba(0,0,0,.1);
}

/* 位置 / 绑定世界书（可展开行，无箭头） */
.field-loc{ cursor:pointer; }
.field-loc .loc-value{
  flex:1; text-align:right;
  font-size:14px; color:var(--gray-1);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.loc-panel{
  border-top:1px solid var(--hairline);
  background:var(--fill);
  padding:2px 0;
}
.loc-panel .field{ background:transparent; padding:12px 18px 12px 30px; }
.loc-real{
  flex:1; display:flex; align-items:center;
  justify-content:flex-end; gap:10px; min-width:0;
}
.loc-btn{
  flex:0 0 auto;
  height:32px; padding:0 14px;
  border:none; border-radius:10px;
  background:var(--primary); color:var(--ink);
  font-size:12.5px; font-weight:600;
  cursor:pointer;
  transition:transform .18s var(--spring), opacity .2s;
}
.loc-btn:active{ transform:scale(.94); }
.loc-btn:disabled{ opacity:.5; }
.loc-result{
  flex:1; min-width:0;
  font-size:13px; color:var(--gray-1);
  text-align:right;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

/* 人设：大输入框 + 删除 */
.persona-card{
  margin-top:26px;
  background:var(--bg);
  border-radius:22px;
  box-shadow:0 1px 0 var(--hairline), 0 0 0 1px var(--hairline);
  padding:16px 18px 18px;
}
.persona-label{
  font-size:14px; font-weight:500;
  color:var(--gray-1);
}
.persona-textarea{
  width:100%; min-height:130px;
  margin-top:12px;
  border:none; outline:none; resize:vertical;
  background:var(--fill);
  border-radius:16px;
  padding:14px 16px;
  font-family:inherit; font-size:15px; line-height:1.75;
  color:var(--ink);
  transition:box-shadow .2s;
}
.persona-textarea::placeholder{ color:var(--gray-3); }
.persona-textarea:focus{ box-shadow:0 0 0 1.5px var(--ink); }
.del-persona-btn{
  width:100%; height:46px;
  margin-top:14px;
  border:1px solid var(--hairline);
  border-radius:16px;
  background:transparent;
  color:var(--gray-1);
  font-size:14px; font-weight:500;
  cursor:pointer;
  transition:color .2s, background .2s, transform .18s var(--spring);
}
.del-persona-btn:hover{ background:rgba(11,11,15,.04); color:var(--ink); }
.del-persona-btn:active{ transform:scale(.97); }

/* 切换人设底部面板 */
.sheet-backdrop{
  position:absolute; inset:0;
  background:rgba(11,11,15,.42);
  opacity:0; pointer-events:none;
  transition:opacity .25s;
  z-index:80;
}
.sheet-backdrop.show{ opacity:1; pointer-events:auto; }
.sheet{
  position:absolute; left:0; right:0; top:0;
  background:var(--bg);
  border-radius:0 0 28px 28px;
  padding:8px 0 18px;
  transform:translateY(-105%);
  transition:transform .35s var(--spring);
  z-index:90;
  max-height:72%;
  overflow-y:auto;
}
.sheet-backdrop.show .sheet{ transform:none; }
/* 评论面板：列表区滚动，输入行固定在底部 */
.sheet-comments{
  display:flex; flex-direction:column;
  overflow:hidden;
}
.sheet-comments .comment-list{ flex:1; min-height:0; overflow-y:auto; }
.sheet-handle{
  width:36px; height:4px;
  border-radius:999px;
  background:var(--gray-3);
  margin:6px auto 2px;
}
.sheet-title{
  font-size:13px; font-weight:500;
  color:var(--gray-2);
  text-align:center;
  padding:8px 0 10px;
}
.sheet-item{
  display:flex; align-items:center; gap:12px;
  width:100%;
  padding:14px 24px;
  border:none; background:none;
  cursor:pointer;
  text-align:left;
  transition:background .15s;
}
.sheet-item:hover{ background:rgba(11,11,15,.03); }
.sheet-item:active{ background:rgba(11,11,15,.05); }
.sheet-item + .sheet-item{ border-top:1px solid var(--hairline); }
.sheet-item-name{ font-size:15px; font-weight:600; color:var(--ink); }
.sheet-item-preview{
  font-size:12.5px; color:var(--gray-2);
  margin-top:2px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  max-width:280px;
}
.sheet-item .sheet-check{ margin-left:auto; color:var(--ink); flex:0 0 auto; }
.sheet-item .sheet-check svg{
  width:20px; height:20px;
  fill:none; stroke:currentColor;
  stroke-width:2; stroke-linecap:round; stroke-linejoin:round;
}
.sheet-empty{
  padding:30px 24px;
  text-align:center;
  font-size:13px; color:var(--gray-2);
  line-height:1.7;
}

.save-btn{
  margin-top:30px;
  width:100%; height:50px;
  border:none; border-radius:25px;
  background:var(--primary); color:var(--ink);
  font-size:16px; font-weight:600;
  cursor:pointer;
  transition:transform .2s var(--spring), opacity .2s;
}
.save-btn:hover{ opacity:.92; }
.save-btn:active{ transform:scale(.97); }

/* 删除二次确认弹窗 */
.dialog-backdrop{
  position:absolute; inset:0;
  background:rgba(11,11,15,.42);
  display:flex; align-items:center; justify-content:center;
  padding:0 44px;
  z-index:85;
}
.dialog-backdrop[hidden]{ display:none; }
.dialog{
  width:100%;
  background:var(--bg);
  border-radius:26px;
  padding:26px 24px 20px;
  animation:viewIn .25s var(--ease-out) both;
}
.dialog h3{ margin:0 0 8px; font-size:17px; font-weight:600; }
.dialog p{ margin:0; font-size:13.5px; color:var(--gray-1); line-height:1.75; }
.dialog-actions{ display:flex; gap:10px; margin-top:22px; }
.dialog-actions button{
  flex:1; height:46px;
  border:none; border-radius:16px;
  font-size:15px; font-weight:600;
  cursor:pointer;
  transition:transform .18s var(--spring), opacity .2s;
}
.dialog-actions button:active{ transform:scale(.96); }
.dialog-actions #delCancel{ background:var(--fill); color:var(--ink); }
.dialog-actions #delConfirm{ background:var(--danger); color:#fff; }

/* ============ 世界书：列表 / 编辑 ============ */
.book-card{
  display:flex; align-items:center; gap:14px;
  padding:14px 20px;
  border-top:1px solid var(--hairline);
  cursor:pointer;
  transition:background .15s;
}
.book-card:first-child{ border-top:none; }
.book-card:hover{ background:rgba(11,11,15,.028); }
.book-cover{
  flex:0 0 auto;
  width:46px; height:62px;
  border-radius:8px;
  overflow:hidden;
  background:var(--fill);
  display:flex; align-items:center; justify-content:center;
}
.book-cover img{ width:100%; height:100%; object-fit:cover; }
.book-cover-ph{
  color:var(--gray-2);
  display:flex; align-items:center; justify-content:center;
}
.book-cover-ph svg{
  width:20px; height:20px;
  fill:none; stroke:currentColor;
  stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round;
}
.book-info{ flex:1; min-width:0; }
.book-name{
  font-size:16px; font-weight:600;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.book-meta{
  font-size:12.5px; color:var(--gray-2);
  margin-top:3px;
}
.book-check{
  flex:0 0 auto;
  width:24px; height:24px;
  color:var(--gray-3);
  display:flex; align-items:center; justify-content:center;
}
.book-check svg{
  width:20px; height:20px;
  fill:none; stroke:currentColor;
  stroke-width:2; stroke-linecap:round; stroke-linejoin:round;
}
.book-card.selected .book-check{ color:var(--ink); }

/* 世界书编辑模式操作栏 */
.book-edit-bar{
  flex:0 0 auto;
  display:flex; align-items:center; gap:10px;
  padding:10px 20px calc(10px + env(safe-area-inset-bottom));
  border-top:1px solid var(--hairline);
  background:var(--bg);
}
.book-edit-bar[hidden]{ display:none; }
.book-sel-count{ flex:1; font-size:13px; color:var(--gray-2); }
.bar-btn{
  height:40px; padding:0 20px;
  border:none; border-radius:20px;
  background:var(--fill); color:var(--ink);
  font-size:14px; font-weight:600;
  cursor:pointer;
  transition:transform .18s var(--spring), opacity .2s;
}
.bar-btn:active{ transform:scale(.95); }
.bar-btn.danger{ background:var(--danger); color:#fff; }

/* 世界书编辑页 */
.cover-wrap{ display:flex; justify-content:center; margin:12px 0 2px; }
.book-cover-edit{
  position:relative;
  width:132px; height:176px;   /* 竖版封面（宽:高 = 3:4） */
  border-radius:16px;
  background:var(--fill);
  overflow:hidden;
  cursor:pointer;
  box-shadow:0 8px 22px -10px rgba(0,0,0,.22);
  display:flex; align-items:center; justify-content:center;
}
.book-cover-edit img{ width:100%; height:100%; object-fit:cover; }
.cover-placeholder{
  display:flex; flex-direction:column; align-items:center; gap:8px;
  color:var(--gray-2); font-size:11.5px;
  padding:0 12px; text-align:center;
}
.cover-placeholder svg{
  width:26px; height:26px;
  fill:none; stroke:currentColor;
  stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round;
}
.cover-remove{
  position:absolute; top:6px; right:6px;
  width:24px; height:24px; border-radius:50%;
  background:var(--primary); color:var(--ink);
  display:flex; align-items:center; justify-content:center;
  font-size:15px; line-height:1;
  cursor:pointer;
  border:none;
}
.entries-head{
  display:flex; align-items:baseline; gap:8px;
  margin:26px 4px 2px;
  font-size:14px; font-weight:600;
}
.entries-count{
  font-size:12px; color:var(--gray-2); font-weight:500;
  font-variant-numeric:tabular-nums;
}
.entry-card{
  margin-top:14px;
  background:var(--bg);
  border-radius:22px;
  box-shadow:0 1px 0 var(--hairline), 0 0 0 1px var(--hairline);
  padding:16px 18px 18px;
}
.entry-head{
  display:flex; align-items:center; gap:4px;
  margin-bottom:14px;
}
.entry-toggle{
  flex:0 0 auto;
  width:28px; height:28px;
  border:none; border-radius:50%;
  background:transparent; color:var(--gray-2);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer;
  transition:background .15s, color .15s;
}
.entry-toggle:hover{ background:var(--fill); color:var(--ink); }
.entry-chev{
  width:16px; height:16px;
  fill:none; stroke:currentColor;
  stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round;
  transition:transform .28s var(--spring);
}
.entry-card.collapsed .entry-chev{ transform:rotate(-90deg); }
.entry-name{
  flex:1; min-width:0;
  border:none; outline:none; background:transparent;
  font-family:inherit; font-size:15px; font-weight:600;
  color:var(--ink);
  padding:4px 0;
}
.entry-name::placeholder{ color:var(--gray-3); font-weight:500; }
.entry-card.collapsed .entry-body{ display:none; }
.entry-remove{
  width:30px; height:30px;
  border:none; border-radius:50%;
  background:transparent; color:var(--gray-2);
  font-size:16px; cursor:pointer;
  transition:background .15s, color .15s;
}
.entry-remove:hover{ background:var(--fill); color:var(--ink); }
.entry-trigger{ display:flex; align-items:center; gap:12px; }
.entry-label{
  flex:0 0 auto; width:76px;
  font-size:13.5px; color:var(--gray-1); font-weight:500;
}
.entry-seg{ flex:1; }
.entry-seg .seg-btn{ height:34px; font-size:12.5px; }
.entry-field{ display:flex; align-items:center; gap:12px; margin-top:12px; }
.entry-field input{
  flex:1; min-width:0; height:40px;
  border:none; outline:none;
  background:var(--fill);
  border-radius:12px;
  padding:0 14px;
  font-family:inherit; font-size:14px; color:var(--ink);
}
.entry-field input::placeholder{ color:var(--gray-3); }
.entry-row{ display:flex; gap:12px; margin-top:12px; }
.entry-num{ flex:1; display:flex; align-items:center; gap:12px; }
.entry-num input{
  flex:1; min-width:0; width:100%; height:40px;
  border:none; outline:none;
  background:var(--fill);
  border-radius:12px;
  padding:0 14px;
  font-family:inherit; font-size:14px; color:var(--ink);
  -moz-appearance:textfield;
}
.entry-num input::-webkit-outer-spin-button,
.entry-num input::-webkit-inner-spin-button{ -webkit-appearance:none; margin:0; }
.entry-content{
  width:100%; min-height:92px;
  margin-top:12px;
  border:none; outline:none; resize:vertical;
  background:var(--fill);
  border-radius:14px;
  padding:12px 14px;
  font-family:inherit; font-size:14px; line-height:1.7;
  color:var(--ink);
}
.entry-content::placeholder{ color:var(--gray-3); }
.add-entry-btn{
  width:100%; height:46px;
  margin-top:14px;
  border:1px dashed var(--gray-3);
  border-radius:16px;
  background:transparent;
  color:var(--gray-1);
  font-size:14px; font-weight:500;
  cursor:pointer;
  transition:color .2s, border-color .2s, transform .18s var(--spring);
}
.add-entry-btn:hover{ color:var(--ink); border-color:var(--ink); }
.add-entry-btn:active{ transform:scale(.98); }
.move-body{ padding:4px 24px 24px; }
.move-body input{
  width:100%; height:46px;
  border:none; outline:none;
  background:var(--fill);
  border-radius:14px;
  padding:0 16px;
  font-family:inherit; font-size:15px; color:var(--ink);
}
.move-body input::placeholder{ color:var(--gray-3); }
.move-body .save-btn{ margin-top:16px; }
