/* Production behavior layered over the approved prototype shell. */
.topnav [data-page="library"],
#page-library,
#gotoLibBtn,
#addImgBtn,
#segOut,
#segIn { display: none !important; }
.top-right > .seg { display: none !important; }

/* 工作区选中态见下方 .ws-item.on .ws-btn，不再用挤在一起的 segmented .presets button.on */

/* ===================== 我的书签：书签架 =====================
   面板分四层（#personalContent 的网格行）：文件夹 chips → 操作条 → 磁贴 → 计数。
   工具条固定、只有磁贴区在卡片内滚动；磁贴统一纸面 + 1px 线框，
   图标只用鼠尾草一系：书签＝浅绿底深绿首字，文件夹＝深绿底白「夹」；
   文件夹副标题给“共 N 个书签”并在右侧给 ›，一眼能看出能不能点进去。
   名称和域名都单行省略，任何宽度都不出现横向滚动条。 */

/* 标题下横线：和常用网址 / 天气同一根 2px 线，把「我的书签」头与正文隔开，多一点呼吸。 */
#w-personal > .w-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-right: 2px;
  border-top: 2px solid var(--ph-color-line-strong, var(--ink, #2E2C25));
  padding-top: 12px;
}


body[data-auth="in"] #w-personal #personalContent {
  display: grid !important;
  flex: 1 1 auto;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 6px;
}
body[data-auth="in"] #w-personal #personalContent.is-nested {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}
/* 一行工具条：文件夹 chips 在左，添加 / 保存 / 刷新 / 状态在右；放不下时右侧整体换行，仍靠右。 */
/* 工具条与磁贴之间一根淡线，层次更清楚 */
#w-personal .ph-toolbar {
  grid-row: 1;
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  justify-content: space-between;
  min-width: 0;
  padding-bottom: 10px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--ph-color-line, var(--line));
}
#w-personal #folderChips { flex: 0 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; }
#w-personal #phBookmarkActions { flex: 0 1 auto; min-width: 0; margin-left: auto; }
#w-personal #personalContent > p { grid-row: 3; grid-column: 1 / -1; padding: 0 2px; }
#w-personal #personalContent.is-nested > p { grid-row: 4; }
#w-personal #personalContent > p b { color: var(--sage-d); font-weight: 700; }

/* 个人书签不再在标题右侧放“分区视图 / 网格视图”快捷入口；
   标题区上下留白也收紧，工具条和磁贴整体上移。 */
#w-personal { padding-top: 10px; }
#w-personal .w-head { padding: 2px 2px 4px; }
/* 只隐藏“分区视图 / 网格视图”这组链接；.acts 里的 ⚙ 设置按钮编辑态仍要能用。 */
#w-personal #personalActs { display: none !important; }

/* 收起 / 展开：整行 .w-head（标题 + 标签 + chevron）都是热区；
   收起后组件只跨 1 行、正文藏起，下面的模块由看板 dense 网格自动补位。 */
#w-personal .w-head.personal-collapse-head {
  cursor: pointer;
  border-radius: 6px 12px 6px 12px;
  margin: 0 -4px;
  padding-left: 6px;
  padding-right: 6px;
  transition: background-color .15s ease;
}
#w-personal .w-head.personal-collapse-head:hover {
  background: color-mix(in srgb, var(--sage-soft, var(--ph-color-primary-soft)) 55%, transparent);
}
body.editing #w-personal .w-head.personal-collapse-head,
body[data-auth="out"] #w-personal .w-head.personal-collapse-head {
  cursor: default;
}
body.editing #w-personal .w-head.personal-collapse-head:hover,
body[data-auth="out"] #w-personal .w-head.personal-collapse-head:hover {
  background: transparent;
}
#w-personal .personal-collapse {
  flex: none; margin-left: auto;
  width: 26px; height: 26px; min-height: 26px; padding: 0;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 8px 3px 8px 3px;
  background: var(--paper); color: var(--muted);
  pointer-events: none; /* 点击交给整行，避免和行 handler 各 toggle 一次 */
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
#w-personal .w-head.personal-collapse-head:hover .personal-collapse {
  color: var(--sage-d); border-color: var(--sage); background: var(--sage-tint);
}
#w-personal .personal-collapse:focus-visible {
  outline: 2px solid var(--sage); outline-offset: 2px;
  pointer-events: auto; /* 键盘聚焦时仍可点 */
}
#w-personal .personal-collapse svg { display: block; transition: transform .2s ease; }
#w-personal.is-collapsed .personal-collapse svg { transform: rotate(180deg); }
body.editing #w-personal .personal-collapse,
body[data-auth="out"] #w-personal .personal-collapse { display: none; }

#w-personal.is-collapsed { grid-row: span 1; cursor: pointer; }
#w-personal.is-collapsed:hover { border-color: var(--sage); }
#w-personal.is-collapsed > .w-body { display: none; }
/* 收起后空出来的高度不浪费：中间只留一句“N 项书签”。 */
#w-personal.is-collapsed::after {
  content: attr(data-count) " 项书签";
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .02em;
}
@keyframes personal-fold-in {
  from { opacity: .55; transform: scale(.985); }
  to { opacity: 1; transform: none; }
}
@keyframes personal-unfold {
  from { opacity: 0; }
  to { opacity: 1; }
}
#w-personal.is-fold-anim { animation: personal-fold-in .24s ease; }
#w-personal.is-unfold-anim > .w-body { animation: personal-unfold .24s ease; }

/* 文件夹 chips：只占第一行，选中用实心鼠尾草绿。 */
#w-personal .folderchips button { min-height: 28px; max-width: 100%; padding: 3px 11px; border: 1px solid var(--line); border-radius: var(--ph-radius-pill); background: var(--paper); color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#w-personal .folderchips button:hover { border-color: var(--sage); color: var(--sage-d); background: var(--sage-tint); }
#w-personal .folderchips button.on { background: var(--sage); border-color: var(--sage); color: var(--ph-color-on-primary); font-weight: 600; }
#w-personal .folderchips button.on:hover { background: var(--sage-d); }

/* 操作条整体靠右，和刷新/同步状态放在一起：添加、按需出现的保存主按钮、刷新、短状态。 */
#w-personal .personal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; justify-content: flex-end; min-width: 0; }
#w-personal .personal-actions .pa-main,
#w-personal .personal-actions .pa-side { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-width: 0; }
#w-personal .personal-actions .pa-main { flex: 0 1 auto; }
#w-personal .personal-actions .pa-side { margin-left: 0; gap: 8px; }
#w-personal .personal-actions .btn { min-height: 28px; padding: 3px 10px; border-radius: var(--ph-radius-sm); font-size: 12.5px; }
#w-personal .personal-actions .btn.primary { background: var(--sage); border-color: var(--sage); color: var(--ph-color-on-primary); font-weight: 600; box-shadow: var(--ph-shadow-pressed); }
#w-personal .personal-actions .btn.primary:hover { background: var(--sage-d); border-color: var(--sage-d); color: var(--ph-color-on-primary); }
#w-personal .personal-actions .btn:disabled { opacity: .45; cursor: not-allowed; transform: none; background: var(--paper); border-color: var(--line); color: var(--muted); box-shadow: none; }
#w-personal .pa-refresh { min-height: 28px; padding: 3px 5px; border: 0; border-radius: var(--ph-radius-sm); background: transparent; color: var(--muted); font-size: 12px; white-space: nowrap; }
#w-personal .pa-refresh:hover { color: var(--sage-d); background: var(--sage-tint); }
#w-personal .sync-status { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; white-space: nowrap; cursor: help; letter-spacing: .01em; color: var(--ph-color-ink); }
#w-personal .sync-status::before { content: "✓"; color: var(--sage-d); font-weight: 700; }
#w-personal .sync-status.is-dirty::before { content: "●"; color: var(--clay); }
#w-personal .ph-local-hint { flex: 1 0 100%; text-align: right; color: var(--muted); font-size: 12px; line-height: 1.4; }

/* 磁贴区：桌面 4 列（仍跟随组件设置 --tile-cols）、手机 2 列；行高固定，从工具条下方直接往上排。 */
#w-personal #bookmarkTiles {
  order: 3;
  grid-row: 2;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(var(--tile-cols, 4), minmax(0, 1fr));
  grid-auto-rows: 68px;
  align-content: start;
  gap: 6px;
  min-width: 0;
  min-height: 0;
  padding: 2px 2px 2px 1px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 38%, transparent) transparent;
}
/* 进了子文件夹：返回条单独一行，磁贴行略矮一档；有本地修改提示时也仍放得下 2 行。 */
#w-personal #personalContent.is-nested #bookmarkTiles { grid-row: 3; grid-auto-rows: 56px; }
#w-personal #bookmarkTiles::-webkit-scrollbar { width: 5px; height: 5px; }
#w-personal #bookmarkTiles::-webkit-scrollbar-track { background: transparent; }
#w-personal #bookmarkTiles::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 32%, transparent); border-radius: 99px; }
#w-personal #bookmarkTiles:hover::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 64%, transparent); }

/* 返回顶层：工具条下方通栏一行、左对齐的安静链接，不占磁贴格子。 */
#w-personal .ph-back { grid-row: 2; grid-column: 1 / -1; justify-self: start; display: inline-flex; align-items: center; gap: 5px; min-height: 26px; padding: 2px 6px; border: 0; border-radius: var(--ph-radius-sm); background: transparent; color: var(--muted); font-size: 12.5px; }
#w-personal .ph-back:hover { color: var(--sage-d); background: var(--sage-tint); }

/* 磁贴本体：纸面底 + 1px 线框，hover 边框变绿、整块轻微上浮。 */
#w-personal .personal-bookmark-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--ph-radius-sm);
  background: var(--paper);
  transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease, translate .18s ease;
}
#w-personal .personal-bookmark-card:hover,
#w-personal .personal-bookmark-card:focus-within { border-color: var(--sage); background: color-mix(in srgb, var(--sage-tint) 42%, var(--paper)); box-shadow: 0 6px 16px rgba(54, 65, 56, .10); translate: 0 -2px; }

#w-personal .personal-bookmark-card > a,
#w-personal .personal-bookmark-card > button.open-folder {
  display: flex; align-items: center; gap: 7px;
  width: 100%; height: 100%; min-width: 0;
  padding: 5px 7px; border: 0; border-radius: inherit;
  background: transparent; color: inherit; font: inherit; text-align: left;
  overflow: hidden;
}
#w-personal .personal-bookmark-card > a:hover,
#w-personal .personal-bookmark-card > button.open-folder:hover { background: transparent; border-color: transparent; translate: none; box-shadow: none; text-decoration: none; }
#w-personal .personal-bookmark-card > a:focus-visible,
#w-personal .personal-bookmark-card > button.open-folder:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }
#w-personal .personal-bookmark-card > button.open-folder { cursor: pointer; }

#w-personal .personal-bookmark-card .fav {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px 3px 8px 3px;
  background: var(--sage-soft);
  color: var(--sage-d);
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
  overflow: hidden;
}
#w-personal .personal-bookmark-card.is-folder .fav { background: var(--sage); color: var(--ph-color-on-primary); }
/* 真 favicon：白底 + 居中 contain，加载失败会去掉 .has-icon 回到首字兜底 */
#w-personal .personal-bookmark-card .fav.has-icon {
  background: var(--ph-color-icon-well, #fff);
  color: transparent;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ph-color-line, var(--line)) 80%, transparent);
}
#w-personal .personal-bookmark-card .fav.has-icon img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

#w-personal .personal-bookmark-card .tx { display: flex; flex-direction: column; justify-content: center; gap: 2px; flex: 1 1 auto; min-width: 0; padding-right: 0; transition: padding-right .15s ease; }
#w-personal .personal-bookmark-card.is-folder .tx { padding-right: 18px; }
#w-personal .personal-bookmark-card:hover .tx,
#w-personal .personal-bookmark-card:focus-within .tx { padding-right: 48px; }
#w-personal .personal-bookmark-card .nm,
#w-personal .personal-bookmark-card .dm { display: block; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#w-personal .personal-bookmark-card .nm { color: var(--ink); font-size: 12.8px; font-weight: 600; line-height: 1.25; }
#w-personal .personal-bookmark-card .dm { color: var(--muted); font-size: 12px; line-height: 1.2; }

/* 文件夹右侧的 ›：hover 出现操作 pill 时淡出，避免和按钮叠在一起。 */
#w-personal .personal-bookmark-card .ph-go { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 16px; line-height: 1; pointer-events: none; transition: opacity .15s ease, color .15s ease; }
#w-personal .personal-bookmark-card.is-folder:hover .ph-go,
#w-personal .personal-bookmark-card.is-folder:focus-within .ph-go { opacity: 0; }

/* 修改 / 删除：右上角一个小 pill，hover 或聚焦才出现；给文字留出位置，不压字。 */
#w-personal .bookmark-actions {
  position: absolute; right: 4px; top: 4px; z-index: 2;
  display: flex; gap: 2px; padding: 2px;
  border: 1px solid var(--line); border-radius: var(--ph-radius-pill);
  background: var(--paper); box-shadow: 0 4px 12px rgba(54, 65, 56, .14);
  opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(-2px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
}
#w-personal .personal-bookmark-card:hover .bookmark-actions,
#w-personal .personal-bookmark-card:focus-within .bookmark-actions { opacity: 1; visibility: visible; pointer-events: auto; transform: none; }
#w-personal .bookmark-actions button { width: 20px; height: 20px; min-height: 20px; padding: 0; border: 0; border-radius: var(--ph-radius-pill); background: transparent; color: var(--muted); font-size: 12px; line-height: 1; display: grid; place-items: center; }
#w-personal .bookmark-actions button:hover { background: var(--sage-soft); color: var(--sage-d); }
#w-personal .bookmark-actions button[data-action="delete"]:hover { background: color-mix(in srgb, var(--clay) 14%, var(--paper)); color: var(--clay); }

#w-personal .ph-empty { grid-column: 1 / -1; align-self: center; justify-self: stretch; margin: 0; padding: 8px 6px; color: var(--muted); font-size: 12.5px; text-align: center; }

/* 没有 hover 的触屏：操作 pill 常显，› 挪到右下角；文字按 pill 的宽度留位置。 */
@media (hover: none) {
  #w-personal .personal-bookmark-card .ph-go { top: auto; bottom: 4px; right: 8px; transform: none; }
  #w-personal .personal-bookmark-card.is-folder:hover .ph-go,
  #w-personal .personal-bookmark-card.is-folder:focus-within .ph-go { opacity: 1; }
  #w-personal .personal-bookmark-card .tx,
  #w-personal .personal-bookmark-card.is-folder .tx { padding-right: 48px; }
  #w-personal .bookmark-actions { opacity: 1; visibility: visible; pointer-events: auto; transform: none; }
  #w-personal .bookmark-actions button { width: 24px; height: 24px; min-height: 24px; font-size: 12px; }
}


/* Folder arrows stay inside the card boundary at every grid width. */
#w-personal .personal-bookmark-card.is-folder { position: relative; overflow: hidden; }
#w-personal .personal-bookmark-card.is-folder > button.open-folder { position: relative; box-sizing: border-box; max-width: 100%; padding-right: 30px; }
#w-personal .personal-bookmark-card.is-folder .tx { min-width: 0; max-width: calc(100% - 30px); padding-right: 0; }
#w-personal .personal-bookmark-card.is-folder .ph-go { right: 4px; width: 18px; max-width: 18px; box-sizing: border-box; text-align: center; overflow: hidden; }

@media (hover: none) and (max-width: 560px) {
  #w-personal .personal-bookmark-card { min-height: 70px; }
  #w-personal .personal-bookmark-card .tx,
  #w-personal .personal-bookmark-card.is-folder .tx,
  #w-personal .personal-bookmark-card:hover .tx,
  #w-personal .personal-bookmark-card:focus-within .tx,
  #w-personal .personal-bookmark-card.is-folder:hover .tx,
  #w-personal .personal-bookmark-card.is-folder:focus-within .tx { padding-right: 0; }
  #w-personal .personal-bookmark-card .nm { padding-right: 58px; }
  #w-personal .bookmark-actions button { width: 26px; height: 26px; min-height: 26px; }
}

/* 触屏点按区：chips、添加/保存、刷新都加高到手指好按的尺寸。 */
@media (pointer: coarse) {
  #w-personal .personal-collapse { width: 34px; height: 34px; min-height: 34px; }
  #w-personal .folderchips button { min-height: 34px; padding: 5px 13px; }
  #w-personal .personal-actions .btn { min-height: 34px; }
  #w-personal .pa-refresh { min-height: 34px; }
  #w-personal .ph-back { min-height: 34px; }
}

.ph-dialog { width: min(460px, calc(100vw - 28px)); border: 1.5px solid var(--line); border-radius: 6px 20px 6px 20px; padding: 0; background: var(--paper); color: var(--ink); box-shadow: 0 24px 70px rgba(46,44,37,.2); }
.ph-dialog::backdrop { background: rgba(31,32,27,.42); backdrop-filter: blur(3px); }
.ph-dialog form { padding: 22px; }
.ph-dialog h3 { margin: 0 0 16px; font-family: "Noto Serif SC","Songti SC",serif; font-size: 20px; }
.ph-dialog label { display: block; margin-top: 12px; color: var(--muted); font-size: 13px; }
/* label 写了 display:block，会盖掉 UA 的 [hidden]{display:none}，文件夹模式网址栏会漏出来 */
.ph-dialog [hidden] { display: none !important; }
.ph-dialog input { width: 100%; margin-top: 5px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 5px 12px 5px 12px; background: var(--bg); color: var(--ink); outline: 0; }
.ph-dialog input:focus { border-color: var(--sage); }
.ph-dialog .field-hint { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.ph-dialog .dialog-error { min-height: 22px; margin-top: 8px; color: var(--clay); font-size: 12.5px; }
.ph-dialog .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* 设置地区：跟标题同一行靠右，不再预留 42px 给旧太阳位（太阳已挪到气温区） */
.weather-location-btn {
  margin-left: auto;
  margin-right: 0;
  border: 1.5px solid var(--ph-color-line, var(--line));
  background: var(--ph-color-surface, var(--paper));
  color: var(--ph-color-muted, var(--muted));
  border-radius: 999px;
  min-height: 30px;
  padding: 3px 12px;
  font-size: 12px;
  line-height: 1.2;
  corner-shape: initial;
  white-space: nowrap;
}
.weather-location-btn:hover {
  border-color: var(--ph-color-primary, var(--sage));
  color: var(--ph-color-primary-strong, var(--sage-d));
  background: var(--ph-color-primary-soft, var(--sage-soft));
}
.weather-results { display: grid; gap: 6px; margin-top: 10px; max-height: 220px; overflow-y: auto; }
.weather-results button { text-align: left; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 5px 10px; padding: 8px 10px; }

/* 搜索引擎选中：文字下方马克笔，背景块与文字对齐 */
.engines button {
  position: relative;
  z-index: 0;
  background: transparent !important;
  corner-shape: initial;
  line-height: 1.2;
}
.engines button.on {
  color: var(--ph-color-ink, var(--ink)) !important;
  font-weight: 700;
  background: transparent !important;
}
.engines button.on::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 7px;
  height: 10px;
  background: var(--sun-soft, #F1EBD9);
  border-radius: 2px;
  z-index: -1;
  pointer-events: none;
  corner-shape: initial;
}

#phLogoutBtn { display: none; }
body[data-auth="in"] #phLogoutBtn { display: inline-flex; }

@media (max-width: 860px) {
  #w-personal #bookmarkTiles { grid-auto-rows: 56px; }
  #w-personal #personalContent.is-nested #bookmarkTiles { grid-auto-rows: 44px; }
}

@media (max-width: 680px) {
  #w-personal #bookmarkTiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  #w-personal .personal-actions .pa-side { margin-left: 0; width: auto; justify-content: flex-end; }
  #w-personal .sync-status { white-space: normal; }
}

/* 手机：看板改按内容自然高（见 personal-home.html ≤560 的规则），这里同步解除固定滚动区，
   磁贴继续 2 列往下堆、整页滚，不再在卡片里套一层滚动条。 */
@media (max-width: 560px) {
  #w-personal > .w-body { display: block; overflow: visible; padding-right: 0; }
  body[data-auth="in"] #w-personal #personalContent { grid-template-rows: auto auto auto; }
  body[data-auth="in"] #w-personal #personalContent.is-nested { grid-template-rows: auto auto auto auto; }
  #w-personal #bookmarkTiles { grid-auto-rows: auto; overflow: visible; padding: 0; }
  #w-personal #personalContent.is-nested #bookmarkTiles { grid-row: 3; grid-auto-rows: auto; }
}

/* 窄屏但仍有 hover（窄桌面窗口）：卡片保持紧凑；触屏的高卡片规则在 (hover:none) 里单独生效。 */
@media (max-width: 560px) and (hover: hover) {
  #w-personal .personal-bookmark-card { min-height: 52px; }
}


/* ================= Page-wide reference redesign ================= */
html { background: var(--ph-color-bg); }
body {
  background: var(--ph-color-bg);
  background-image: radial-gradient(rgba(97, 123, 103, .08) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--ph-color-ink);
}
.topbar {
  background: color-mix(in srgb, var(--ph-color-bg) 94%, transparent);
  border-bottom: 1px solid var(--ph-color-line);
  box-shadow: 0 3px 14px rgba(54, 65, 56, .04);
}
.topbar-in { min-height: 64px; padding-top: 8px; padding-bottom: 8px; }
.brand { color: var(--ph-color-ink); letter-spacing: -.02em; }
.brand .mark {
  background: transparent;
  box-shadow: 0 1px 2px rgba(46, 44, 37, .12);
}
.brand .mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.topnav { gap: 4px; }
.topnav a, .topnav button { border-radius: var(--ph-radius-sm); color: var(--ph-color-muted); }
.topnav a.on, .topnav button.on { color: var(--ph-color-primary-strong); background: var(--ph-color-primary-soft); }
.top-right { gap: 8px; }

/* 暂不开放组件：仅当 body 带对应 feature-*-on 时可见 */
body:not(.feature-weather-on) .widget[data-wid="weather"],
body:not(.feature-weather-on) .widget[data-component="weather"],
body:not(.feature-hot-on) .widget[data-wid="hot"],
body:not(.feature-hot-on) .widget[data-component="hot"],
body:not(.feature-sectionview-on) .widget[data-wid="sectionview"],
body:not(.feature-sectionview-on) .widget[data-component="sectionview"],
body:not(.feature-sectionview-on) #w-sectionview,
body:not(.feature-gridview-on) .widget[data-wid="gridview"],
body:not(.feature-gridview-on) .widget[data-component="gridview"],
body:not(.feature-gridview-on) #w-gridview,
.widget[data-feature-off="1"] {
  display: none !important;
}
/* 暂关时也藏掉「我的书签」标题旁的分区/网格快捷入口 */
body:not(.feature-sectionview-on) #personalActs a[href="#w-sectionview"],
body:not(.feature-gridview-on) #personalActs a[href="#w-gridview"] {
  display: none !important;
}

.hero { padding: 34px 0 8px; }
.hero-flex { gap: 28px; }
/* 与内联样式一致：脚印/快捷行上移贴紧搜索，不再被 space-between 拉到底 */
.hero-main { justify-content: flex-start; }
.hero h1 { color: var(--ph-color-ink); font-size: clamp(30px, 3.2vw, 40px); letter-spacing: -.03em; }
.hero p, .clockline, .traces, .quickrow { color: var(--ph-color-muted); }
.search-hint { min-height: 0; margin-top: 0; }
.search-hint:not(:empty) { min-height: 18px; margin-top: 6px; }
.traces { margin-top: 8px; }
.quickrow { margin-top: 6px; }
/* 最近的脚印：无记录时整块不占位；有记录时可点再次打开 */
.traces[hidden],
.traces.is-empty { display: none !important; }
.traces .traces-list { display: contents; }

/* 非输入区：不要文本插入光标 / 拖选反白（输入框、便签除外） */
.topbar,
.brand,
.brand b,
.brand small,
.avatar,
.topnav,
.topnav a,
.top-right,
.hero,
.hero h1,
.hero p,
.clockline,
.engines,
.engines button,
.search-hint,
.traces,
.traces a,
.quickrow,
.quickrow a,
.toolbar,
.presets,
.presets button,
.editbar,
.btn,
.seg,
.seg button,
.hero-side,
.todaycard,
.stickynote .who,
.stickynote .sign,
.note-edit,
.board .widget,
.board .widget .w-head,
.board .widget .w-head h3,
.board .widget .tag,
.board .tiles,
.board .tiles a,
.board .toolgrid a,
.board .catrow,
.board .links a,
.board .hotlist,
.board .cal-grid,
#w-personal .personal-bookmark-card,
.ph-search-results,
.ph-result-item,
.ph-result-title,
.ph-result-folder {
  -webkit-user-select: none;
  user-select: none;
  caret-color: transparent;
}
.board .tiles a,
.board .links a,
.board .toolgrid a,
#w-personal .personal-bookmark-card > a,
#w-personal .personal-bookmark-card > button.open-folder,
.engines button,
.quickrow a,
.traces a,
.topnav a,
.btn {
  cursor: pointer;
}
.board input,
.board textarea,
.searchbox input,
.stickynote .txt,
.stickynote .note-ta,
.ph-dialog input,
.ph-dialog textarea,
.modal input,
.modal textarea {
  -webkit-user-select: text;
  user-select: text;
  caret-color: auto;
  cursor: text;
}
.stickynote, .todaycard { border: 1px solid var(--ph-color-line); box-shadow: var(--ph-shadow-soft); }
/* 便签始终浅色纸 + 深棕墨，日夜不反色（暗色 UI 上的实体便签） */
.stickynote {
  background: var(--note-bg, #F3E9C8) !important;
  color: var(--note-ink, #3F2E08) !important;
  border-color: color-mix(in srgb, var(--note-border, #C7A24C) 40%, transparent);
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}
.stickynote .who,
.stickynote .sign,
.stickynote .note-hint,
.stickynote .note-edit,
.stickynote .txt,
.stickynote .note-ta {
  color: inherit;
}
.stickynote .who,
.stickynote .sign,
.stickynote .note-hint,
.stickynote .note-edit {
  color: var(--note-muted, #7A5C12) !important;
}
.stickynote .txt,
.stickynote .note-ta {
  color: var(--note-ink, #3F2E08) !important;
}
.stickynote .txt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-height: calc(1.5em * 5);
  min-width: 0;
  max-width: 100%;
}
.stickynote .note-ta {
  max-width: 100%;
  box-sizing: border-box;
  resize: none;
  max-height: calc(1.5em * 5 + 16px);
  overflow: auto;
  word-break: break-word;
  overflow-wrap: anywhere;
  background: rgba(255, 255, 255, .45);
  border-color: var(--note-border, #C7A24C);
}
.stickynote .sign {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html[data-color-mode="dark"] .stickynote {
  box-shadow: 0 10px 28px rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.todaycard { background: var(--ph-color-surface); }

/* ---- 日历任务：可点日期 + 任务圆点 ---- */
.cal-grid .d:not(.dim):not(.dow) {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 32px;
  padding: 5px 0 7px;
  cursor: pointer;
  user-select: none;
  transition: background-color .15s ease, box-shadow .15s ease;
}
.cal-grid .d:not(.dim):not(.dow):hover {
  background: color-mix(in srgb, var(--sage, #617B67) 16%, transparent);
}
.cal-grid .d:not(.dim):not(.dow):focus-visible {
  outline: 2px solid var(--sage, #617B67);
  outline-offset: 1px;
}
.cal-grid .d.today:not(.dim):hover {
  background: var(--sun, #E8C547);
}
.cal-grid .d .d-num { line-height: 1.2; }
.cal-grid .d .d-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--sage-d, #3E5A46);
  flex: none;
}
.cal-grid .d .d-dot.done {
  background: color-mix(in srgb, var(--muted, #8A8678) 70%, transparent);
}
.cal-grid .d.today .d-dot { background: #4A3603; }
.cal-grid .d.today .d-dot.done { background: color-mix(in srgb, #4A3603 45%, transparent); }
.widget[data-wid="cal"][data-rows="1"] .cal-grid .d[data-date] {
  min-height: 22px;
  padding: 0 0 3px;
  gap: 1px;
}
.widget[data-wid="cal"][data-rows="1"] .cal-grid .d .d-dot {
  width: 4px;
  height: 4px;
}

/* ---- 日历任务弹窗 ---- */
.cal-task-dialog .cal-task-date {
  margin: -6px 0 12px;
  color: var(--muted, #8A8678);
  font-size: 13.5px;
}
.cal-task-dialog .cal-task-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  max-height: 220px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cal-task-dialog .cal-task-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid var(--line, #E4DFD2);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg, #F7F3E9) 70%, transparent);
}
.cal-task-dialog .cal-task-item.done .cal-task-text {
  text-decoration: line-through;
  color: var(--muted, #8A8678);
}
.cal-task-dialog .cal-task-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  flex: none;
  accent-color: var(--sage, #617B67);
}
.cal-task-dialog .cal-task-text {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}
.cal-task-dialog .cal-task-del {
  flex: none;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted, #8A8678);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.cal-task-dialog .cal-task-del:hover {
  background: color-mix(in srgb, var(--clay, #B85C38) 14%, transparent);
  color: var(--clay, #B85C38);
}
.cal-task-dialog .cal-task-empty {
  margin: 0 0 12px;
  color: var(--muted, #8A8678);
  font-size: 13px;
}

/* ---- 今日一览 · 今日任务 ---- */
.todaycard .tc-tasks {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed var(--line, #E4DFD2);
  min-width: 0;
}
.todaycard .tc-tasks-h {
  font-size: 12px;
  font-weight: 700;
  color: var(--sage-d, #3E5A46);
  letter-spacing: .02em;
  margin-bottom: 6px;
}
.todaycard .tc-task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 132px;
  overflow: auto;
  min-width: 0;
}
.todaycard .tc-task-item {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 13px;
  line-height: 1.35;
}
.todaycard .tc-task-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: none;
  accent-color: var(--sage, #617B67);
}
.todaycard .tc-task-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink, #2E2C25);
  cursor: default;
}
.todaycard .tc-task-item.done .tc-task-text {
  text-decoration: line-through;
  color: var(--muted, #8A8678);
}
.todaycard .tc-task-empty {
  color: var(--muted, #8A8678);
  font-size: 12.5px;
  line-height: 1.4;
  padding: 1px 0;
}
.searchbox { background: var(--ph-color-surface); border: 1px solid var(--ph-color-line-strong); border-radius: var(--ph-radius-md); box-shadow: var(--ph-shadow-soft); transition: border-color .18s ease, box-shadow .18s ease; }
.searchbox:focus-within { border-color: var(--ph-color-primary); box-shadow: var(--ph-focus-ring); }
.searchbox button { background: var(--ph-color-primary); color: var(--ph-color-on-primary); border-radius: 0 var(--ph-radius-md) var(--ph-radius-md) 0; }

.toolbar {
  gap: 12px 16px;
  align-items: center;
  padding: 14px 16px;
  margin: 24px 0 16px;
  border: 1px solid var(--ph-color-line);
  border-radius: var(--ph-radius-md);
  background: color-mix(in srgb, var(--ph-color-surface-muted) 55%, var(--ph-color-bg));
  box-shadow: var(--ph-shadow-soft);
}
.toolbar h2 { color: var(--ph-color-ink); font-size: 20px; }
.toolbar .hintline { color: var(--ph-color-muted); }

/* 工作区：图中分段控件样式（整条圆角底 + 内嵌选中胶囊） */
.presets {
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
}
.presets-track {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  padding: 3px;
  border: 1px solid var(--ph-color-line);
  border-radius: var(--ph-radius-pill);
  background: var(--ph-color-surface);
}
.presets > #wsAddBtn {
  min-height: 34px;
  padding: 6px 14px;
  border: 1.5px dashed color-mix(in srgb, var(--ph-color-primary) 40%, var(--ph-color-line));
  border-radius: var(--ph-radius-pill);
  background: transparent;
  color: var(--ph-color-primary-strong);
  box-shadow: none;
}
.presets > #wsAddBtn:hover {
  border-color: var(--ph-color-primary);
  background: var(--ph-color-primary-soft);
  box-shadow: none;
}
.ws-item {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.ws-item .ws-btn {
  min-height: 34px;
  padding: 6px 14px;
  border: 0;
  border-radius: var(--ph-radius-pill);
  background: transparent;
  color: var(--ph-color-muted);
  font-weight: 500;
  box-shadow: none;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.ws-item .ws-btn:hover {
  color: var(--ph-color-primary-strong);
  background: color-mix(in srgb, var(--ph-color-primary-soft) 70%, transparent);
  transform: none;
  box-shadow: none;
}
.ws-item.on .ws-btn {
  background: var(--ph-color-primary);
  color: var(--ph-color-on-primary);
  font-weight: 700;
  border: 0;
  box-shadow: var(--ph-shadow-pressed);
}
.ws-item .ws-edit {
  position: absolute;
  top: -5px;
  right: -4px;
  z-index: 2;
  width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  border: 1px solid var(--ph-color-line);
  border-radius: 50%;
  background: var(--ph-color-surface);
  color: var(--ph-color-muted);
  font-size: 9px;
  line-height: 1;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: none;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--ph-color-ink) 12%, transparent);
  transition: opacity .15s ease, visibility .15s ease, background .15s ease, color .15s ease, border-color .15s ease;
}
.ws-item:hover .ws-edit,
.ws-item:focus-within .ws-edit,
.ws-item .ws-edit:focus-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.ws-item .ws-edit:hover,
.ws-item .ws-edit:focus-visible {
  color: var(--ph-color-primary-strong);
  border-color: var(--ph-color-primary);
  background: var(--ph-color-primary-soft);
}
@media (hover: none) {
  .ws-item .ws-edit {
    opacity: .65;
    visibility: visible;
    pointer-events: auto;
  }
}

.btn, .seg button, .presets button, .folderchips button, .mini-btn, .iconbtn, .topnav a, .topnav button,
.ws-item .ws-btn {
  font-family: var(--ph-font-body);
}
.btn {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--ph-color-line);
  border-radius: var(--ph-radius-sm);
  background: var(--ph-color-surface);
  color: var(--ph-color-ink);
  box-shadow: none;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.btn:hover { border-color: var(--ph-color-primary); background: var(--ph-color-primary-soft); color: var(--ph-color-primary-strong); transform: translateY(-1px); }
.btn:focus-visible, .presets button:focus-visible, .folderchips button:focus-visible,
.ws-item .ws-btn:focus-visible, .ws-item .ws-edit:focus-visible { outline: 0; box-shadow: var(--ph-focus-ring); }
.btn.primary, .personal-actions .save-dirty { background: var(--ph-color-primary); border-color: var(--ph-color-primary); color: var(--ph-color-on-primary); box-shadow: var(--ph-shadow-pressed); }
.btn.primary:hover, .personal-actions .save-dirty:hover { background: var(--ph-color-primary-strong); color: var(--ph-color-on-primary); }
.btn.ghost { background: transparent; border-color: var(--ph-color-line-strong); }

.board { gap: 16px; }
.widget {
  border: 1px solid var(--ph-color-line);
  box-shadow: var(--ph-shadow-soft);
  border-radius: var(--ph-radius-md);
}
.widget[data-wid="personal"], .widget[data-wid="todo"], .widget[data-wid="common"], .widget[data-wid="weather"], .widget[data-wid="curated"], .widget[data-wid="cal"], .widget[data-wid="hot"], .widget[data-wid="tools"] {
  background: var(--ph-color-surface);
  border-color: var(--ph-color-line);
  border-radius: var(--ph-radius-md);
}
.w-head { padding: 4px 2px 12px; }
.w-head h3 { color: var(--ph-color-ink); }
.w-head .tag { border-color: var(--ph-color-line); background: var(--ph-color-surface-muted); color: var(--ph-color-muted); }
.w-head .tag.lock { background: #F1EBD9; border-color: #D5C58E; color: #806622; }
.widget[data-wid="personal"] .w-body,
.widget[data-wid="common"] .w-body,
.widget[data-wid="weather"] .w-body { border-top-color: var(--ph-color-line-strong); }
.folderchips { gap: 6px; }
.folderchips button { min-height: 38px; padding: 7px 13px; border-color: var(--ph-color-line-strong); background: transparent; color: var(--ph-color-muted); }
.folderchips button.on { background: var(--ph-color-primary); border-color: var(--ph-color-primary); color: var(--ph-color-on-primary); }
.personal-actions { gap: 8px; }
.personal-actions .sync-status { color: var(--ph-color-muted); }

.stickynote, .todaycard, .widget, .toolbar, .searchbox, .btn, .folderchips button { corner-shape: squircle; }

@media (max-width: 760px) {
  .topbar-in { min-height: 58px; }
  .hero { padding-top: 24px; }
  .hero-flex { display: block; }
  .hero-side { display: none; }
  .toolbar { align-items: flex-start; }
  .toolbar h2 { flex-basis: 100%; }
  .toolbar .hintline { flex-basis: 100%; }
  .presets { max-width: 100%; overflow-x: auto; gap: 8px; }
  .presets-track { max-width: 100%; }
  .ws-item, .presets > #wsAddBtn { flex: 0 0 auto; }
}


/* Settings dropdown: one visible control, grouped layout and drag actions. */
.settings-managed-control { display: none !important; }
.personal-settings-wrap { position: relative; flex: 0 0 auto; }
.personal-settings-button { min-width: 76px; }
.personal-settings-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40;
  display: none; min-width: 180px; padding: 6px;
  border: 1px solid var(--ph-color-line); border-radius: var(--ph-radius-md);
  background: var(--ph-color-surface); box-shadow: var(--ph-shadow-soft);
}
.personal-settings-menu.open { display: grid; gap: 3px; }
.settings-menu-action {
  width: 100%; min-height: 40px; padding: 8px 11px; border: 0;
  border-radius: var(--ph-radius-sm); background: transparent;
  color: var(--ph-color-ink); text-align: left; font: inherit; cursor: pointer;
}
.settings-menu-action:hover, .settings-menu-action:focus-visible { background: var(--ph-color-primary-soft); color: var(--ph-color-primary-strong); outline: 0; }
body.global-drag-mode #globalDragModeBtn { background: var(--ph-color-primary); color: var(--ph-color-on-primary); }
@media (max-width: 680px) {
  .personal-settings-wrap { margin-left: auto; }
  .personal-settings-menu { right: 0; left: auto; max-width: min(220px, calc(100vw - 28px)); }
}

/* 右侧中央：编辑布局 / 全局排序 结束浮钮。
   落在「内容右缘 ↔ 视口右缘」侧边空白的约 42% 处（从视口右边量），
   随窗口变宽自动外移、变窄自动内收，既不压内容也不贴死屏幕边。 */
.mode-end-fab {
  --mode-fab-content-max: 1180px;
  --mode-fab-gutter-ratio: 0.42; /* 侧边空白中的位置比例，可调 0.3~0.55 */
  position: fixed;
  right: max(
    18px,
    calc((100vw - min(var(--mode-fab-content-max), 100vw)) / 2 * var(--mode-fab-gutter-ratio))
  );
  top: 50%;
  transform: translateY(-50%);
  z-index: 70;
  display: none;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  pointer-events: none;
}
.mode-end-fab.is-visible { display: flex; }
.mode-end-fab[hidden] { display: none !important; }
.mode-end-fab-btn {
  pointer-events: auto;
  width: 56px;
  height: 56px;
  min-height: 56px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--ph-color-on-primary, #FFFDF6) 35%, transparent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(46, 44, 37, .22), 0 0 0 1px rgba(46, 44, 37, .06);
  transition: transform .15s ease, box-shadow .15s ease;
  corner-shape: initial;
  line-height: 1.05;
}
.mode-end-fab-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 10px 26px rgba(46, 44, 37, .28);
}
.mode-end-fab-btn:focus-visible {
  outline: 2px solid var(--ph-color-primary, var(--sage));
  outline-offset: 3px;
}
.mode-end-fab-btn:active { transform: scale(.96); }
.mode-end-fab-ic { font-size: 16px; font-weight: 800; line-height: 1; }
.mode-end-fab-tx { font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.mode-end-fab-edit {
  background: var(--ph-color-primary, var(--sage, #617B67));
  color: var(--ph-color-on-primary, #FFFDF6);
}
.mode-end-fab-sort {
  background: var(--sun, #E8C547);
  color: #4A3603;
  border-color: color-mix(in srgb, #4A3603 18%, transparent);
}
@media (max-width: 560px) {
  .mode-end-fab {
    --mode-fab-gutter-ratio: 0.5;
    right: max(14px, calc((100vw - min(var(--mode-fab-content-max), 100vw)) / 2 * var(--mode-fab-gutter-ratio)));
  }
  .mode-end-fab-btn { width: 50px; height: 50px; min-height: 50px; }
  .mode-end-fab-ic { font-size: 15px; }
  .mode-end-fab-tx { font-size: 10px; }
}

body.global-drag-mode a.movable-link { cursor: crosshair !important; }
body.global-drag-mode a.movable-link.dragging-link { cursor: grabbing !important; }
body.global-drag-mode #w-personal .personal-bookmark-card.is-link > a { cursor: crosshair; }
body.global-drag-mode #w-personal .personal-bookmark-card.is-folder,
body.global-drag-mode #w-personal .personal-bookmark-card.is-folder > button.open-folder { cursor: pointer; }
body.global-drag-mode #w-personal .personal-bookmark-card.is-link.global-drag-source:hover { animation: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--ph-color-primary) 35%, transparent), var(--ph-shadow-soft); }
@media (max-width: 680px) {
  .global-drag-mode-button { flex-basis: 100%; }
}




/* Personal bookmark drag: long-press for three seconds, then wobble until drag ends. */
@keyframes personal-bookmark-wobble {
  0%, 100% { transform: rotate(-1deg); }
  50% { transform: rotate(1deg); }
}
#w-personal .personal-bookmark-card.is-drag-ready {
  cursor: grab;
  animation: personal-bookmark-wobble .42s ease-in-out infinite;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ph-color-primary) 38%, transparent), var(--ph-shadow-soft);
}
#w-personal .personal-bookmark-card.is-dragging { cursor: grabbing; opacity: .55; animation: none; }
#w-personal.is-drop-target { outline: 2px dashed var(--ph-color-primary); outline-offset: 5px; }
#w-personal #bookmarkTiles > .personal-bookmark-card.is-drop-target { outline: 2px solid var(--ph-color-primary); outline-offset: 3px; background: var(--ph-color-primary-soft); }
#w-personal #bookmarkTiles > .personal-bookmark-card.drop-before::before,
#w-personal #bookmarkTiles > .personal-bookmark-card.drop-after::after {
  content: '放在这里';
  position: absolute;
  left: 6px;
  right: 6px;
  height: 3px;
  border-radius: 999px;
  background: var(--ph-color-primary);
  color: var(--ph-color-primary-strong);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  z-index: 5;
  box-shadow: 0 0 0 2px var(--ph-color-surface), 0 2px 8px rgba(97, 123, 103, .25);
}
#w-personal #bookmarkTiles > .personal-bookmark-card.drop-before::before { top: -2px; }
#w-personal #bookmarkTiles > .personal-bookmark-card.drop-after::after { bottom: -2px; }
#w-personal #bookmarkTiles > .personal-bookmark-card.drop-before::before { transform: translateY(-50%); }
#w-personal #bookmarkTiles > .personal-bookmark-card.drop-after::after { transform: translateY(50%); }
#w-personal #bookmarkTiles > .personal-bookmark-card.drop-before::after,
#w-personal #bookmarkTiles > .personal-bookmark-card.drop-after::before { content: none; }

/* 有壁纸时让出底色，否则会盖住 #wpLayer（z-index:0） */
html.has-wp {
  background: transparent;
}
body.has-wp {
  background-color: transparent;
  background-image: none;
}
/* 原本就有实心底的模块（书签/日历/随手记）保持不透明；
   只有天气/常用/精选/热搜/工具让出半透明，壁纸才能透出来。 */
body.has-wp .widget[data-wid="common"],
body.has-wp .widget[data-wid="weather"],
body.has-wp .widget[data-wid="curated"],
body.has-wp .widget[data-wid="hot"],
body.has-wp .widget[data-wid="tools"] {
  background: color-mix(in srgb, var(--ph-color-surface) 88%, transparent);
}

/* ===================== 我的书签搜索下拉 =====================
   对齐 chrome/search.html 的 .result-item 结构，配色走鼠尾草绿。
   列表盖在搜索框下方，不把看板顶下去。 */
.ph-search-wrap {
  position: relative;
  width: 100%;
}
.ph-search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  max-height: min(420px, 55vh);
  overflow-y: auto;
  background: var(--paper, var(--ph-color-surface));
  border: 1.5px solid var(--ink, var(--ph-color-ink));
  border-radius: 8px 16px 8px 16px;
  box-shadow: 4px 8px 0 rgba(46, 44, 37, .10), var(--ph-shadow-soft, 0 8px 20px rgba(54, 65, 56, .08));
}
.ph-search-results[hidden] {
  display: none !important;
}
.ph-search-results .ph-result-item {
  min-height: 44px;
  padding: 8px 14px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-bottom: 1px solid var(--line, var(--ph-color-line));
  color: var(--ink, var(--ph-color-ink));
  text-decoration: none;
  box-sizing: border-box;
}
.ph-search-results a.ph-result-item {
  color: inherit;
  text-decoration: none;
}
.ph-search-results a.ph-result-item:visited {
  color: inherit;
}
.ph-search-results .ph-result-item:last-child {
  border-bottom: none;
}
.ph-search-results .ph-result-item:hover {
  background: color-mix(in srgb, var(--sage-soft, var(--ph-color-primary-soft)) 70%, var(--paper, #fff));
}
.ph-search-results .ph-result-item.selected,
.ph-search-results .ph-result-item.selected:hover {
  background: var(--sage, var(--ph-color-primary));
  color: var(--ph-color-on-primary, #fff);
}
.ph-search-results .ph-result-favicon {
  width: 16px;
  height: 16px;
  margin-top: 3px;
  flex-shrink: 0;
  border-radius: 3px;
  object-fit: contain;
  background: color-mix(in srgb, var(--sage-tint, #E8EEE5) 80%, transparent);
}
.ph-search-results .ph-result-content {
  flex: 1 1 auto;
  min-width: 0;
}
.ph-search-results .ph-result-folder {
  display: block;
  font-size: 12px;
  line-height: 1.3;
  color: var(--muted, var(--ph-color-muted));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.ph-search-results .ph-result-item.selected .ph-result-folder {
  color: color-mix(in srgb, var(--ph-color-on-primary, #fff) 78%, transparent);
}
.ph-search-results .ph-result-title {
  display: block;
  font-size: 14px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ph-search-results .ph-result-empty {
  padding: 14px 16px;
  font-size: 13.5px;
  color: var(--muted, var(--ph-color-muted));
}

