:root {
  /* 暖色调 · 珊瑚橙主色 + 暖白底 */
  --bg: #fbf8f6;
  --card-bg: #ffffff;
  --sidebar-bg: #ffffff;
  --sidebar-text: #6b625d;
  --text: #201916;
  --text-soft: #9b908a;
  --accent: #f5663b;          /* 强调色 = 珊瑚橙 */
  --accent-soft: rgba(245, 102, 59, .12);
  --border: #efe7e2;
  --hover: rgba(245, 102, 59, .07);
  --shadow: 0 1px 2px rgba(60, 30, 20, .04);
  --shadow-hover: 0 12px 32px rgba(120, 60, 40, .14);
  --radius: 14px;
  --sidebar-w: 256px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.layout { display: flex; min-height: 100vh; }

/* ===================== 左侧边栏 ===================== */
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 30;
  border-right: 1px solid var(--border);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 92px;
  padding: 0 28px;
  text-decoration: none;
  color: inherit;
}
.brand-mark {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 13px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
}
.brand-mark svg { width: 24px; height: 24px; color: var(--card-bg); }
.brand-mark.has-logo { background: var(--card-bg); }
.brand-mark img.brand-logo { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.brand-tag { font-size: 10.5px; font-weight: 600; color: var(--text-soft); letter-spacing: .22em; margin-top: 2px; }

.nav-label {
  padding: 8px 30px 6px;
  font-size: 11px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-soft);
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 4px 16px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 16px;
  margin-bottom: 2px;
  border-radius: 10px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 15px;
  cursor: pointer;
  transition: background .18s, color .18s;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item .nav-icon { flex: none; display: flex; align-items: center; justify-content: center; width: 22px; opacity: .85; }
.nav-item .nav-icon svg { width: 19px; height: 19px; }
.nav-item .nav-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item .nav-count { font-size: 12px; color: var(--text-soft); }

.sidebar-mask { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 25; }

/* ===================== 右侧主区 ===================== */
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }

/* 顶部栏 —— 毛玻璃 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  height: 72px; padding: 0 48px;
  background: rgba(251, 248, 246, .82);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}
.menu-toggle { display: none; background: none; border: none; color: var(--text); cursor: pointer; align-items: center; }
.menu-toggle svg { width: 22px; height: 22px; }

/* 搜索（带引擎切换） */
.search {
  position: relative;
  flex: 1; max-width: 460px;
  display: flex; align-items: center;
  background: var(--hover);
  border-radius: 11px;
  transition: box-shadow .2s, background .2s;
}
.search:focus-within { background: var(--card-bg); box-shadow: 0 0 0 3px var(--accent-soft); }
.scope-btn {
  flex: none;
  display: flex; align-items: center; gap: 4px;
  height: 40px; padding: 0 14px;
  background: none; border: none;
  border-right: 1px solid var(--border);
  color: var(--text); font-size: 14px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  border-radius: 11px 0 0 11px;
}
.scope-btn:hover { color: var(--text-soft); }
.scope-btn .caret { font-size: 10px; color: var(--text-soft); }
.search-input {
  flex: 1; min-width: 0;
  height: 40px; padding: 0 16px;
  background: none; border: none; outline: none;
  color: var(--text); font-size: 14px;
}
.search-input::placeholder { color: var(--text-soft); }

/* 顶栏右侧快捷按钮（PC 显示，移动端隐藏并改用侧栏） */
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.top-btn {
  display: inline-flex; align-items: center;
  height: 38px; padding: 0 16px;
  border-radius: 10px; white-space: nowrap;
  font-size: 14px; font-weight: 600; text-decoration: none;
  color: var(--text); background: var(--hover);
  transition: background .18s, color .18s, opacity .18s;
}
.top-btn:hover { background: var(--accent-soft); color: var(--accent); }
.top-btn.primary { background: var(--accent); color: #fff; }
.top-btn.primary:hover { opacity: .9; color: #fff; }

/* 侧栏底部快捷按钮（仅移动端抽屉里显示） */
.sidebar-actions { display: none; flex-direction: column; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.sidebar-action {
  display: block; padding: 11px 16px; border-radius: 10px;
  font-size: 14px; font-weight: 600; text-decoration: none;
  color: var(--text); background: var(--hover);
}
.sidebar-action:first-child { background: var(--accent); color: #fff; }
.sidebar-action:hover { background: var(--accent-soft); color: var(--accent); }
.sidebar-action:first-child:hover { background: var(--accent); color: #fff; opacity: .9; }
.scope-menu {
  position: absolute; top: calc(100% + 8px); left: 0;
  min-width: 130px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-hover);
  padding: 6px; z-index: 40;
}
.scope-menu[hidden] { display: none; }
.scope-opt {
  display: block; width: 100%;
  padding: 9px 14px; border: none; background: none;
  text-align: left; font-size: 14px; color: var(--text);
  border-radius: 8px; cursor: pointer;
}
.scope-opt:hover { background: var(--hover); }
.scope-opt.active { background: var(--accent-soft); font-weight: 600; }

/* 公告条 —— 极简素净（中性） */
.notice-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 28px 48px 0;
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 20px;
}
.notice-icon { flex: none; display: flex; opacity: .5; color: var(--text); }
.notice-icon svg { width: 18px; height: 18px; }
.notice-viewport { flex: 1; overflow: hidden; height: 24px; position: relative; }
.notice-track { position: absolute; inset: 0; }
.notice-item {
  position: absolute; inset: 0;
  display: flex; align-items: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transform: translateY(100%);
  transition: opacity .4s ease, transform .4s ease;
  font-size: 13.5px; color: var(--text-soft);
}
.notice-item a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.notice-item.active { opacity: 1; transform: translateY(0); }
.notice-item.leave { opacity: 0; transform: translateY(-100%); }
.notice-ctrl { flex: none; display: flex; gap: 2px; }
.notice-btn {
  background: transparent; border: none; color: var(--text-soft);
  font-size: 17px; line-height: 1; width: 22px; height: 22px;
  cursor: pointer; border-radius: 50%;
}
.notice-btn:hover { background: var(--hover); color: var(--text); }

/* 内容 */
.content { flex: 1; padding: 8px 48px 40px; }
.category { margin-top: 44px; scroll-margin-top: 90px; }
.category-title {
  display: flex; align-items: center; gap: 9px;
  font-size: 15px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-soft);
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.category-title .cat-icon { display: flex; }
.category-title .cat-icon svg { width: 17px; height: 17px; }
.category-count { margin-left: auto; font-size: 12px; font-weight: 500; }

/* 通用图标块 */
.ico {
  flex: none;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; overflow: hidden;
}
.ico img { width: 100%; height: 100%; object-fit: cover; }

/* ---- card 类型：横向长条（图标在左 + 名字 + 备注） ---- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 14px;
}
.card {
  display: flex; align-items: center; gap: 14px;
  min-width: 0;                 /* 关键：作为网格项允许被压缩，省略号才能生效 */
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
  text-decoration: none; color: inherit;
  box-shadow: var(--shadow);
  transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s ease, border-color .22s;
}
.card:active { transform: scale(.985); }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: transparent; }
.card .ico { width: 42px; height: 42px; border-radius: 11px; font-size: 17px; }
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.card-name {
  font-size: 15px; font-weight: 600; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-remark {
  font-size: 12.5px; color: var(--text-soft); margin-top: 2px;
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---- app 类型：紧凑宫格（图标 + 名字 + 小备注） ---- */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(98px, 1fr));
  gap: 10px;
}
.card-grid + .app-grid { margin-top: 14px; }
.app {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  min-width: 0;                 /* 关键：作为网格项允许被压缩，省略号才能生效 */
  gap: 8px;
  padding: 14px 8px;
  border-radius: 16px;
  text-decoration: none; color: inherit;
  transition: background .18s, transform .18s;
}
.app:hover { background: var(--hover); }
.app:active { transform: scale(.95); }
.app .ico { width: 50px; height: 50px; border-radius: 14px; font-size: 21px; box-shadow: var(--shadow); }
.app-name {
  font-size: 12.5px; font-weight: 500;
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-remark {
  font-size: 11px; color: var(--text-soft);
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.empty-tip { text-align: center; color: var(--text-soft); padding: 80px 0; font-size: 14px; }

.site-footer { margin-top: auto; padding: 32px; text-align: center; color: var(--text-soft); font-size: 12.5px; letter-spacing: .02em; }
.site-footer a { color: var(--text-soft); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

/* ===================== 响应式 ===================== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: 0 0 40px rgba(0,0,0,.18); }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open ~ .sidebar-mask { display: block; }
  .main { margin-left: 0; }
  .menu-toggle { display: flex; }
  .topbar { padding: 0 20px; height: 64px; }
  .search { max-width: none; }
  .notice-bar { margin: 18px 20px 0; }
  .content { padding: 8px 20px 28px; }
  .card-grid { grid-template-columns: 1fr; }            /* 长条卡片：一排 1 个 */
  .app-grid { grid-template-columns: repeat(4, 1fr); }  /* app：一排 4 个 */
  .topbar-actions { display: none; }                    /* 顶栏按钮收起 */
  .sidebar-actions { display: flex; }                   /* 改在抽屉菜单里显示 */
  /* 移动端：摘要一行放不下就用 … 省略（备注的单行省略已由基础样式统一处理） */
  .blog-item-summary {
    display: block;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
}
@media (max-width: 380px) {
  .app-grid { grid-template-columns: repeat(3, 1fr); }  /* 窄屏 app：一排 3 个 */
}

/* ===================== 详情页（文章 / 公告） ===================== */
.article { max-width: 720px; margin: 8px auto 0; padding: 8px 4px 40px; }
.article-back {
  display: inline-block; font-size: 13.5px; color: var(--text-soft);
  text-decoration: none; margin-bottom: 22px;
}
.article-back:hover { color: var(--text); }
.article-title { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; }
.article-meta { margin-top: 10px; font-size: 13px; color: var(--text-soft); }
.article-body { margin-top: 26px; font-size: 15.5px; line-height: 1.8; color: #2a2a2a; }
.article-body h1, .article-body h2, .article-body h3 {
  font-weight: 700; letter-spacing: -.01em; line-height: 1.3;
  margin: 1.6em 0 .6em;
}
.article-body h1 { font-size: 24px; }
.article-body h2 { font-size: 20px; }
.article-body h3 { font-size: 17px; }
.article-body p { margin: 1em 0; }
.article-body ul, .article-body ol { margin: 1em 0; padding-left: 1.4em; }
.article-body li { margin: .3em 0; }
.article-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.article-body img { max-width: 100%; border-radius: 10px; margin: 1em 0; }
.article-body blockquote {
  margin: 1.2em 0; padding: 6px 16px; color: var(--text-soft);
  border-left: 3px solid var(--border);
}
.article-body code {
  background: var(--accent-soft); padding: 2px 6px; border-radius: 6px;
  font-size: .9em; font-family: "SF Mono", Menlo, Consolas, monospace;
}
.article-body pre {
  background: #f3f3f5; border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; overflow-x: auto; margin: 1.2em 0;
}
.article-body pre code { background: none; padding: 0; font-size: 13.5px; }
.article-body hr { border: none; border-top: 1px solid var(--border); margin: 1.8em 0; }
.article-body table { border-collapse: collapse; width: 100%; margin: 1.2em 0; font-size: 14.5px; }
.article-body th, .article-body td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.article-body th { background: var(--accent-soft); font-weight: 600; }
.article-body details { margin: 1.2em 0; }
.article-body summary { cursor: pointer; font-weight: 600; }

/* ===================== 博客列表 ===================== */
.blog-list { margin-top: 22px; display: flex; flex-direction: column; gap: 12px; }
.blog-item {
  display: block; background: var(--card-bg);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; text-decoration: none; color: inherit;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.blog-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.blog-item-title { font-size: 16.5px; font-weight: 600; letter-spacing: -.01em; }
.blog-item-summary { margin-top: 6px; font-size: 14px; color: var(--text-soft); line-height: 1.6; }
.blog-item-date { margin-top: 8px; font-size: 12.5px; color: var(--text-soft); }
