/* ==========================================================================
   portal.css — 门户首页（v3.37.0 工作台版）
   --------------------------------------------------------------------------
   这一版把首页从「官网页」改成「工作台」：
     · 顶部不再有 158px 的品牌横幅，换成 60px 细条 + 常驻搜索
     · 左侧是抽屉式分类栏（sticky），右侧是随手可点的工具方格
     · 8 张用途大卡取消 —— 左侧导航已经回答「去哪」，右侧不再重复一遍
   只作用于 index.html；工具页、任务页用 app.css 与 task.css。
   ========================================================================== */

/* 骨架尺寸留成变量：搜索区要对齐到右栏，算这个偏移的地方和这里必须是同一个数 */
:root { --side-w: 212px; --side-gap: 32px; }

/* ---------- 顶部细条 ---------- */
.pt-top {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.pt-top-inner {
  max-width: 1200px; margin: 0 auto; padding: 9px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.pt-brand {
  display: inline-flex; align-items: center; gap: 9px; flex: 0 0 auto;
  font-size: 16px; font-weight: 600; letter-spacing: .2px;
  color: var(--text); text-decoration: none;
}
.pt-brand .mk {
  width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 700;
}
.pt-brand:hover .mk { background: var(--accent-dark); }

/* 搜索区（常驻，不随 #home 隐藏）。
   原来是 60px 顶栏里的一个 38px 小框，跟站名挤一行，看着像个附属控件；
   挪到内容区顶部、加宽加高之后，它才是「进来第一件要做的事」。
   顶栏只留品牌 + 主题，空出来的地方反而安静。 */
.pt-find { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.pt-search { position: relative; flex: 1 1 auto; min-width: 0; max-width: 720px; }
.pt-search input {
  width: 100%; height: 46px; padding: 0 42px 0 42px;
  font-family: var(--sans); font-size: 15px; color: var(--text);
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: 12px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.pt-search input::placeholder { color: var(--text-faint); }
.pt-search input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft);
}
.pt-search .si {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  color: var(--text-faint); pointer-events: none; width: 17px; height: 17px;
}
.pt-search .clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--text-faint); font-size: 18px; line-height: 1;
  cursor: pointer; display: none;
}
.pt-search .clear:hover { background: var(--panel-sunken); color: var(--text); }
.pt-search.has-text .clear { display: block; }

/* ---------- 两栏骨架 ---------- */
/* 左列 = 分类导航，右列 = 介绍 + 搜索 + 正文。
   右列**必须是一个整体**（.pt-col）：早先把它拆成「头部占第 1 行、正文占第 2 行、
   侧栏纵跨两行」，一搜东西正文变短，grid 就把侧栏那 440px 高度摊到两行里，
   第 1 行凭空多出 119px —— 搜索框和结果之间隔一大块空白。
   两列同处一行，行高由两者较高者决定，不会互相挤。 */
.pt-shell {
  max-width: 1200px; margin: 0 auto; padding: 18px 20px 60px;
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  gap: 0 var(--side-gap);
  align-items: start;
}
.pt-col { grid-column: 2; min-width: 0; }
.pt-head { margin-bottom: 20px; }

/* 左侧分类栏：像文件管理器的抽屉标签，不是卡片列表 */
.pt-side {
  grid-column: 1;
  position: sticky; top: 60px;
  padding-top: 1px;
}
.pt-side .side-t {
  padding: 0 10px 9px; font-size: 12px; font-weight: 500;
  color: var(--text-faint); letter-spacing: .3px;
}
.pt-side nav { display: flex; flex-direction: column; gap: 1px; }
.pt-cat {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 8px 10px 8px 12px; border-radius: 8px;
  font-size: 14.5px; color: var(--text); text-decoration: none;
  transition: background .13s, color .13s;
}
.pt-cat .n {
  margin-left: auto; font-family: var(--mono); font-size: 12px;
  color: var(--text-faint); font-variant-numeric: tabular-nums;
}
.pt-cat:hover { background: var(--panel-sunken); color: var(--text); }
.pt-cat:hover .n { color: var(--text-dim); }
.pt-cat:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pt-cat.is-active {
  background: var(--accent-soft); color: var(--accent); font-weight: 550;
}
.pt-cat.is-active .n { color: var(--accent); }
.pt-cat.is-active::before {
  content: ''; position: absolute; left: 3px; top: 9px; bottom: 9px;
  width: 2px; border-radius: 2px; background: var(--accent);
}
.pt-side .side-foot {
  margin-top: 14px; padding: 10px 10px 0; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-dim); line-height: 1.75;
}
.pt-side .side-foot a { color: var(--warn); text-decoration: none; }
.pt-side .side-foot a:hover { text-decoration: underline; }

/* ---------- 右栏内容 ---------- */
.pt-main { min-width: 0; }

/* 开场：一句话说清这是什么，然后是 4 条承诺，最后才是搜索框。
   先给判断依据再给动作 —— 一进门只看见输入框，用户不知道该往里填什么。 */
.pt-intro { margin-bottom: 22px; }
.pt-intro h1 {
  font-size: 23px; font-weight: 600; line-height: 1.4;
  letter-spacing: .2px; margin-bottom: 9px; max-width: 28em;
}
.pt-intro p {
  font-size: 13.5px; color: var(--text-dim); line-height: 1.85;
  max-width: 46em; margin-bottom: 12px;
}
.pt-promise { display: flex; flex-wrap: wrap; gap: 7px; }
/* 前三条是「这个站能做到的事」，第四条是「例外，这几个要联网」——语义不同所以颜色不同，
   但形状必须一致。第四条是 <a>（可点，跳到联网工具清单），只给 span 写形状会让它
   变成一块裸色底，看着像另一个组件拼进来的。所以形状走 `> *`，颜色再按语义覆盖。 */
.pt-promise > * {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px; font-size: 12.5px;
  background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok-border);
  text-decoration: none;
}
.pt-promise > *::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; flex: 0 0 auto;
}
.pt-promise .net {
  background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border);
}
.pt-promise .net:hover { border-color: var(--warn); }

/* 热门搜索词：给「不知道这里有什么」的人一个入口。
   用虚线边框而不是实心胶囊 —— 它是「列举可选范围」，不是状态标签，
   和上面那排绿色承诺贴长得一样就分不清了。 */
.pt-try { margin-bottom: 13px; }
.pt-try .lb { display: block; font-size: 12px; color: var(--text-faint); margin-bottom: 7px; }
.pt-try .ws, .pt-empty .ws { display: flex; flex-wrap: wrap; gap: 7px; }
.pt-try .ws button, .pt-empty .ws button {
  padding: 4px 10px; border-radius: 999px; cursor: pointer;
  font-family: var(--sans); font-size: 12.5px; line-height: 1.5;
  color: var(--text-dim); background: var(--panel);
  border: 1px dashed var(--border-strong);
  transition: color .13s, border-color .13s, background .13s;
}
.pt-try .ws button:hover, .pt-empty .ws button:hover {
  color: var(--accent); border-color: var(--accent);
  border-style: solid; background: var(--accent-soft);
}
.pt-try .ws button:focus-visible, .pt-empty .ws button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.pt-empty .ws { margin-bottom: 16px; }

/* 区块标题：小、安静，别抢工具 */
.pt-sec { margin-bottom: 30px; }
.pt-sec-head {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 9px; margin-bottom: 12px;
}
/* 标题不许被压窄：390px 下右侧那句说明一长，「常用工具」会被挤成「常用工/具」 */
.pt-sec-head h2 { flex: 0 0 auto; font-size: 14.5px; font-weight: 600; color: var(--text); }
.pt-sec-head .sp { font-size: 12px; color: var(--text-faint); }
.pt-sec-head .more {
  margin-left: auto; font-size: 12.5px; color: var(--accent); text-decoration: none;
}
.pt-sec-head .more:hover { text-decoration: underline; }

/* 常用工具：方格。图标牌沿用整套工具页的字母牌，只是缩小一档 */
.pt-hot { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.tile {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 10px 11px; text-decoration: none;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  transition: border-color .13s, background .13s, transform .13s;
}
.tile:hover, .tile:focus-visible {
  border-color: var(--accent-border); background: var(--accent-soft);
  outline: none; transform: translateY(-1px);
}
.tile .ico {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: .2px;
  background: var(--panel-sunken); color: var(--text-dim);
  border: 1px solid var(--border);
}
.tile:hover .ico { background: var(--panel); color: var(--accent); border-color: var(--accent-border); }
.tile .tx { min-width: 0; }
.tile .nm {
  display: block; font-size: 13px; font-weight: 550; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile .br {
  display: block; font-size: 11.5px; color: var(--text-faint); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 「我的常用」的卡片：外壳负责定位，移除按钮压右上角。
   只有这一区的卡片带按钮 —— 12 张卡各挂一个星标，整个首页就变成一堆图标了。 */
.tile-w { position: relative; display: block; }
.tile-w .tile { height: 100%; padding-right: 26px; }
.fav-x {
  position: absolute; top: 4px; right: 4px; z-index: 2;
  width: 20px; height: 20px; padding: 0; cursor: pointer;
  display: grid; place-items: center;
  font-family: var(--sans); font-size: 15px; line-height: 1;
  color: var(--text-faint); background: transparent;
  border: 0; border-radius: 6px;
  transition: color .13s, background .13s;
}
.fav-x:hover { color: var(--err); background: var(--err-soft); }
.fav-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* 按用途找：一行一个用途，比 8 张大卡省 600px */
.pt-rows { display: flex; flex-direction: column; gap: 2px; }
.prow {
  display: flex; align-items: baseline; gap: 12px; padding: 9px 10px;
  border-radius: 9px; text-decoration: none; transition: background .13s;
}
.prow:hover, .prow:focus-visible { background: var(--panel-sunken); outline: none; }
.prow .nm {
  flex: 0 0 92px; font-size: 13.5px; font-weight: 550; color: var(--text);
}
.prow:hover .nm { color: var(--accent); }
.prow .eg {
  flex: 1 1 auto; min-width: 0; font-size: 12.5px; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.prow .ct {
  flex: 0 0 auto; font-family: var(--mono); font-size: 11.5px;
  color: var(--text-faint); font-variant-numeric: tabular-nums;
}

/* 最近新增 */
.pt-recent { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 9px; }
.rc {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; min-width: 0;
  text-decoration: none; background: var(--panel);
  border: 1px solid var(--border); border-radius: 10px; transition: border-color .13s;
}
.rc:hover, .rc:focus-visible { border-color: var(--accent-border); outline: none; }
.rc .ico {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 7px;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 9px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-border);
}
.rc .tx { min-width: 0; }
.rc .nm {
  display: block; font-size: 12.5px; font-weight: 550; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rc .br {
  display: block; font-size: 11px; color: var(--text-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rc .ver {
  margin-left: auto; flex: 0 0 auto; font-family: var(--mono);
  font-size: 10.5px; color: var(--text-faint);
}

/* 按领域浏览：折叠起来，它是给明确知道自己要哪一类的人的近路 */
.pt-details { border-top: 1px solid var(--border); padding-top: 14px; }
.pt-details > summary {
  cursor: pointer; font-size: 13px; font-weight: 550; color: var(--text-dim);
  list-style: none; display: flex; align-items: center; gap: 7px;
}
.pt-details > summary::-webkit-details-marker { display: none; }
.pt-details > summary::before {
  content: '▸'; font-size: 10px; color: var(--text-faint); transition: transform .15s;
}
.pt-details[open] > summary::before { transform: rotate(90deg); }
.pt-details > summary:hover { color: var(--text); }
.pt-domains {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 8px; margin-top: 12px;
}
.dm {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  text-decoration: none; border: 1px solid var(--border); border-radius: 9px;
  background: var(--panel); transition: border-color .13s, background .13s;
}
.dm:hover, .dm:focus-visible {
  border-color: var(--accent-border); background: var(--accent-soft); outline: none;
}
.dm .ico {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 6px;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 8.5px; font-weight: 700;
  background: var(--panel-sunken); color: var(--text-dim); border: 1px solid var(--border);
}
.dm .nm { font-size: 12.5px; color: var(--text); }
.dm .n {
  margin-left: auto; font-family: var(--mono); font-size: 11px;
  color: var(--text-faint); font-variant-numeric: tabular-nums;
}

/* 搜索结果 */
.pt-res-group { margin-bottom: 24px; }
.pt-res-head {
  display: flex; align-items: baseline; gap: 9px;
  padding-bottom: 7px; margin-bottom: 10px; border-bottom: 1px solid var(--border);
}
.pt-res-head .rn { font-size: 13.5px; font-weight: 600; color: var(--text); }
.pt-res-head .rc2 { font-size: 12px; color: var(--text-faint); }
.pt-res-head a { margin-left: auto; font-size: 12.5px; color: var(--accent); text-decoration: none; }
.pt-res-head a:hover { text-decoration: underline; }
.pt-res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 9px; }

/* 结果卡片：复用 .tile 的骨架，多两行标签 */
.tile.res { align-items: flex-start; padding: 11px 11px; }
.tile.res .tag {
  display: inline-block; margin: 5px 4px 0 0; padding: 1px 6px;
  font-size: 10.5px; border-radius: 4px;
  color: var(--ok); background: var(--ok-soft); border: 1px solid var(--ok-border);
}
.tile.res .tag.net { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-border); }

.pt-empty { padding: 30px 0 6px; text-align: center; }
.pt-empty .big { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 7px; }
.pt-empty .d { font-size: 12.5px; color: var(--text-dim); margin-bottom: 16px; }
.pt-empty .tp { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }
.pt-empty .tp a {
  padding: 5px 11px; border-radius: 999px; font-size: 12.5px; text-decoration: none;
  color: var(--text-dim); background: var(--panel); border: 1px solid var(--border);
}
.pt-empty .tp a:hover { border-color: var(--accent-border); color: var(--accent); }

/* 页脚说明：说人话，重点加粗 */
.pt-foot {
  margin-top: 34px; padding-top: 16px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-dim); line-height: 1.95;
}
/* 类名故意不叫 .row：app.css 里的 .row 是工具页表单行（flex + 子项 flex:1），
   套到这段说明文字上会把每句话拉成两端对齐。 */
.pt-foot .pt-line { margin-bottom: 6px; }
.pt-foot b { color: var(--text); font-weight: 550; }
.pt-foot a { color: var(--text-dim); border-bottom: 1px solid var(--border-strong); text-decoration: none; }
.pt-foot a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* 悬浮简介 */
#tip {
  position: fixed; z-index: 99; max-width: 420px;
  padding: 12px 14px; text-align: left;
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: 11px; box-shadow: 0 12px 34px rgba(16, 24, 40, .16);
  font-size: 12.5px; color: var(--text-dim); line-height: 1.75;
  opacity: 0; transition: opacity .14s; pointer-events: none;
}
#tip.show { opacity: 1; }
#tip .tip-name { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
#tip ul { margin: 7px 0 0; padding-left: 16px; }
#tip li { margin-bottom: 3px; }
#tip .tip-note { margin-top: 7px; color: var(--warn); }

/* ---------- 中等宽度：侧栏窄一点，常用工具降成 3 列 ---------- */
@media (max-width: 1080px) {
  .pt-shell { grid-template-columns: 184px minmax(0, 1fr); gap: 0 24px; }
  :root { --side-w: 184px; --side-gap: 24px; }
  .pt-hot { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .prow .eg { display: none; }
}

/* ---------- 手机 / 窄屏：侧栏变成顶部横向滑动条 ---------- */
@media (max-width: 900px) {
  .pt-shell { display: flex; flex-direction: column; gap: 0; padding: 0 16px 48px; }
  /* 手机上换顺序：介绍 + 搜索 → 分类 → 常用工具。
     侧栏在 DOM 里排第一（没有 CSS 时先给导航是对的），靠 order 挪到搜索下面 ——
     手机上把 9 个分类胶囊顶在最前面，搜索框就被推到 400px 以下了。
     .pt-col 拆成 display: contents 才能让它的两个孩子分别参与排序。 */
  .pt-col { display: contents; }
  .pt-head { order: 1; margin-bottom: 12px; }
  .pt-side { order: 2; }
  .pt-main { order: 3; }
  .pt-top-inner { padding: 9px 16px; gap: 10px; }
  .pt-brand { font-size: 15px; }
  .pt-brand .mk { width: 26px; height: 26px; border-radius: 8px; font-size: 13px; }

  /* 分类胶囊换行平铺，8 个全部可见。
     上一版是「横向滚动条」，8 个只露 4 个、剩下 4 个藏在滚动区外，
     连半个切边都没有 —— 用户不知道还能划。换行会多占两行（约 70px），
     所以取消 sticky：滚下去之后靠「按用途找」那 8 行换类，功能不丢。 */
  .pt-side { margin: 0 0 6px; padding: 0 0 10px; border-bottom: 1px solid var(--border); }
  .pt-side .side-t, .pt-side .side-foot { display: none; }
  .pt-side nav {
    flex-direction: row; flex-wrap: wrap; gap: 6px;
    overflow: visible; padding: 0;
  }
  .pt-cat {
    flex: 0 0 auto; padding: 5px 11px; border: 1px solid var(--border);
    border-radius: 999px; background: var(--panel); font-size: 13px;
  }
  /* 手机端不显示数量：9 个分类带数字会从 3 行涨到 5 行，
     数量在任务页和首页「按用途找」都看得到，这里省下两行更值。 */
  .pt-cat .n { display: none; }
  .pt-cat.is-active::before { display: none; }
  .pt-cat.is-active { border-color: var(--accent); background: var(--accent-soft); }

  .pt-main { padding-top: 14px; }
  /* 手机端搜索框占满整行，热门词跟在下面 */
  .pt-find { margin-bottom: 10px; }
  .pt-intro h1 { font-size: 18px; }
  .pt-intro p { font-size: 13px; }
  .pt-hot { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  /* 两列窄屏下说明只给一行，字符串全被切在「…」上，用户看不出这个工具干什么。
     放开到两行；用 -webkit-line-clamp 而不是让它自然撑高，是为了让同一行的卡片等高。 */
  .tile { align-items: flex-start; }
  .tile .ico { margin-top: 1px; }
  .tile .br {
    white-space: normal; overflow: hidden;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    line-height: 1.45;
  }
  .pt-recent { grid-template-columns: minmax(0, 1fr); }
  .pt-res-grid { grid-template-columns: minmax(0, 1fr); }
  .prow { padding: 8px 8px; }
  .prow .nm { flex: 0 0 auto; }
  .pt-sec { margin-bottom: 26px; }
}

/* 输入框字号 16px：iOS 聚焦时不会把整页放大 */
@media (max-width: 640px) {
  .pt-search input { font-size: 16px; }
  /* 390px 下品牌文字会把搜索框挤到只剩 150px，只留字牌图标；
     站名在正文 h1 和 <title> 里都有，不缺这一处。 */
  .pt-brand .txt { display: none; }
}

/* 尊重「减少动效」 */
@media (prefers-reduced-motion: reduce) {
  .tile, .pt-cat, .prow, .rc, .dm, .theme-btn { transition: none; }
  .tile:hover, .tile:focus-visible { transform: none; }
}
