/* ==========================================================================
   subnot-web 样式：三主题 tokens → 组件 → 页面布局
   参考站：mashangso.pages.dev 的设计语言（宋体标题×黑体正文×等宽元信息，
   纸感浅色 + 磷光绿强调，卡片线框 hover 浮起，"热01" 徽章）
   ========================================================================== */

/* --------------------------------------------------------------------------
   一、主题 tokens（组件与布局层只允许引用 var(--*)，禁止裸色值）
   -------------------------------------------------------------------------- */
:root,
:root[data-theme="paper"] {
  --bg: #faf9f6;
  --bg-card: #ffffff;
  --bg-muted: #f1efe9;
  --fg: #26241f;
  --fg-muted: #6f6a5e;
  --fg-faint: #a39d8f;
  --fg-strong: #c14a26; /* 热度文本强调色（原网页热度/🔥），浅色下加深保证对比度 */
  --accent: #0a7d4f;
  --accent-soft: rgba(10, 125, 79, 0.09);
  --accent-contrast: #ffffff;
  --warn: #b45309;
  --danger: #b91c1c;
  --border: #e3e0d8;
  --border-strong: #cfc9bd;
  --shadow: 0 2px 10px rgba(38, 36, 31, 0.06);
  --font-title: "Songti SC", "Noto Serif SC", "SimSun", serif;
  --font-body: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", Consolas, monospace;
  --radius: 6px;
  --radius-sm: 3px;
  --maxw: 1080px;
}

:root[data-theme="ink"] {
  --bg: #101210;
  --bg-card: #181b18;
  --bg-muted: #20241f;
  --fg: #d6d3c8;
  --fg-muted: #91958a;
  --fg-faint: #6b6f64;
  --fg-strong: #ef8050;
  --accent: #3ecf8e;
  --accent-soft: rgba(62, 207, 142, 0.12);
  --accent-contrast: #101210;
  --warn: #e0a458;
  --danger: #e5695f;
  --border: #2b2f2a;
  --border-strong: #3a3f38;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

:root[data-theme="forest"] {
  --bg: #f2f5ee;
  --bg-card: #fbfcf9;
  --bg-muted: #e6ebe0;
  --fg: #2a3326;
  --fg-muted: #66705d;
  --fg-faint: #98a28c;
  --fg-strong: #ad4a22;
  --accent: #2f6f3e;
  --accent-soft: rgba(47, 111, 62, 0.1);
  --accent-contrast: #ffffff;
  --warn: #9a6b1f;
  --danger: #a83232;
  --border: #d9dfd0;
  --border-strong: #c2cab7;
  --shadow: 0 2px 10px rgba(42, 51, 38, 0.07);
}

/* 系统偏好兜底：未设置主题时跟随系统 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #101210;
    --bg-card: #181b18;
    --bg-muted: #20241f;
    --fg: #d6d3c8;
    --fg-muted: #91958a;
    --fg-faint: #6b6f64;
    --fg-strong: #ef8050;
    --accent: #3ecf8e;
    --accent-soft: rgba(62, 207, 142, 0.12);
    --accent-contrast: #101210;
    --warn: #e0a458;
    --danger: #e5695f;
    --border: #2b2f2a;
    --border-strong: #3a3f38;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  }
}

/* --------------------------------------------------------------------------
   二、基础与组件
   -------------------------------------------------------------------------- */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* 键盘可达性：Tab 导航时的统一焦点环（鼠标点击不触发）；输入框类保留各自的 border-color 焦点样式 */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---- header：sticky，双线底边 ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 3px double var(--border-strong);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 56px;
}

.brand {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 品牌图标：与 favicon 同源（终端风深色方块 + 磷光绿 RSS 弧线） */
.brand-logo {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  flex: none;
  display: block;
}

.brand .brand-accent {
  color: var(--accent);
}

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.site-nav a.nav-link {
  font-size: 14px;
  color: var(--fg-muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.site-nav a.nav-link:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- hero：居中宋体大标题 + em 绿色下划线 ---- */
.hero {
  text-align: center;
  padding: 56px 0 30px;
}

.hero h1 {
  font-family: var(--font-title);
  font-size: 34px;
  font-weight: 800;
  margin: 0 0 12px;
  letter-spacing: 2px;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 7px;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

.hero .tagline {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-muted);
  letter-spacing: 3px;
  margin: 0;
}

.hero-features {
  display: flex;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
  margin-top: 26px;
}

.hero-features .feat {
  font-size: 13px;
  color: var(--fg-muted);
}

.hero-features .feat b {
  color: var(--fg);
  font-weight: 600;
}

/* ---- 首页手动抓取：结果提示在左，右侧相邻「抓取该订阅」「全局手动抓取」两个胶囊按钮 ---- */
.hero-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.hero-crawl {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 5px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.hero-crawl:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.hero-crawl:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hero-crawl:disabled:hover {
  border-color: var(--border);
  color: var(--fg-muted);
}

.hero-crawl.loading {
  pointer-events: none;
  opacity: 0.7;
}

/* loading 态：内联旋转 spinner（与 .btn.loading 同款） */
.hero-crawl.loading::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  vertical-align: -2px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}

.hero-crawl-note {
  flex: 1;
  text-align: right;
  margin-right: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-faint);
}

/* ---- 锚点导航 chips ---- */
.hero-cats {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.hero-cats a {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  background: var(--bg-card);
  padding: 4px 12px;
  border-radius: 999px;
  transition: border-color 0.15s, color 0.15s;
}

.hero-cats a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.hero-cats a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

/* ---- 首页订阅 chips：与热榜页签同行（.home-subs-inline 由 renderSubRow 动态插入页签行末尾） ---- */
.home-subs-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: 14px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
}

/* ---- uTools 端适配：小窗口紧凑布局（body.utools 仅 uTools 端 HTML 挂载） ---- */
body.utools .site-header .container {
  height: 44px;
}

body.utools .hero {
  padding: 14px 0 12px;
  text-align: left;
}

body.utools .hero-cats {
  justify-content: flex-start;
  margin-top: 0;
}

body.utools .hero-actions {
  justify-content: flex-end;
}

body.utools .site-footer {
  padding: 10px 0;
  font-size: 12px;
}

body.utools .page-title {
  margin: 14px 0 6px;
  font-size: 24px;
}

body.utools .page-sub {
  margin: 0 0 14px;
}

/* chip 样式与上方热榜页签（.hero-cats a）完全一致：线框胶囊 + 圆点 + 等宽小字 */
.home-sub-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  background: var(--bg-card);
  padding: 4px 12px;
  border-radius: 999px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}

.home-sub-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.home-sub-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

/* ---- 我的订阅：左侧分组导航 + 右侧条目面板 ---- */
.mine-body {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

/* 左侧订阅导航栏：按类型分五组纵排；自身可滚动但隐藏滚动条（滚轮/拖拽仍可用），
   避免点底部分组时页面滚动导致面板离开视口 */
.sub-tabs {
  flex: none;
  width: 236px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 0;
  position: sticky;
  top: 16px;
  padding-bottom: 4px;
}

.sub-tabs::-webkit-scrollbar {
  display: none;
}

/* 分组容器：组标签 + 该组订阅项纵排；collapsed 时隐藏订阅项。
   组间用细分隔线 + 留白划分层次，替代纯间距 */
.sub-tab-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-bottom: 12px;
}

.sub-tab-group + .sub-tab-group {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.sub-tab-group:last-child {
  padding-bottom: 0;
}

.sub-tab-group.collapsed .sub-tab {
  display: none;
}

/* 分组头：箭头 + 组名 + 计数徽标靠左成组，抓取按钮 margin-left:auto 靠右（右缘与订阅项开关对齐）；
   整行可点击折叠/展开 */
.sub-tab-group-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  cursor: pointer;
  user-select: none;
}

/* 折叠指示箭头：展开朝下，折叠朝右；固定宽度保证各组组名左缘对齐 */
.sub-group-caret {
  flex: none;
  width: 10px;
  text-align: center;
  font-size: 10px;
  color: var(--fg-faint);
  transition: transform 0.15s;
}

.sub-tab-group.collapsed .sub-group-caret {
  transform: rotate(-90deg);
}

/* 组内订阅数徽标：小圆角胶囊，折叠时尤其有用（仍能看到每组规模） */
.sub-tab-count {
  flex: none;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  color: var(--fg-faint);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 3px 7px;
  font-variant-numeric: tabular-nums;
}

.sub-tab-group.collapsed .sub-tab-count {
  opacity: 0.6;
}

/* 分组抓取按钮：小号幽灵按钮，margin-left:auto 推到行尾 */
.sub-group-crawl {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--fg-faint);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 8px;
  cursor: pointer;
  flex: none;
  margin-left: auto;
  transition: color 0.15s, border-color 0.15s;
}

.sub-group-crawl:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.sub-group-crawl:disabled {
  opacity: 0.6;
  cursor: default;
}

.sub-tab {
  font-family: var(--font-body);
  /* 字号小于组名（12px < 13px），左缩进 46px 与组名文字对齐（组头 10+10+7+序号约 13+4） */
  font-size: 12px;
  font-weight: 500;
  /* 淡色文字与热榜页签一致（配圆点更轻盈），选中态/hover 由 .active/:hover 提亮 */
  color: var(--fg-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 7px 10px 7px 46px;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  transition: background 0.15s, color 0.15s;
}

/* 订阅名：占满剩余宽度，超长省略 */
.sub-tab .tab-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 行内启停开关：右侧小滑块，点击切换启用状态 */
.sub-toggle {
  flex: none;
  width: 28px;
  height: 16px;
  border-radius: 999px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.sub-toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s;
}

.sub-toggle:hover {
  opacity: 0.85;
}

.sub-toggle.on {
  background: var(--accent);
}

.sub-toggle.on::after {
  transform: translateX(12px);
}

/* 停用订阅：名称淡化（保持可读但明显弱于启用项） */
.sub-tab.off .tab-name {
  opacity: 0.5;
}

/* 面板标题后的抓取频率说明 */
.sub-interval {
  font-size: 12px;
  font-weight: 400;
  color: var(--fg-faint);
  white-space: nowrap;
}

.sub-tab:hover {
  background: var(--accent-soft);
  color: var(--fg);
}

/* 选中态：柔和底色 + 左缘强调条 + accent 文字（比实心大色块更轻，列表层级更清晰） */
.sub-tab.active {
  background: var(--accent-soft);
  border-color: transparent;
  box-shadow: inset 3px 0 0 var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* 默认热榜订阅：与用户自定义订阅视觉区分 */
.sub-tab.hot {
  border-style: dashed;
}

.sub-tab.hot.active {
  border-style: solid;
}

/* 分组标题：等宽字体 + 序号前缀（01/02…），仿排印分区标题；比订阅项字号大，超长省略 */
.sub-tab-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
}

/* 分组序号：磷光绿点缀，与订阅项名称明显区分 */
.sub-group-no {
  color: var(--accent);
  font-weight: 700;
  font-size: 11px;
  margin-right: 4px;
  font-variant-numeric: tabular-nums;
}

/* 右侧条目面板占满剩余宽度 */
#sub-groups {
  flex: 1;
  min-width: 0;
}

/* 窄屏回退：导航栏在上、面板在下，取消吸附与内部滚动 */
@media (max-width: 720px) {
  .mine-body {
    flex-direction: column;
    gap: 14px;
  }
  .sub-tabs {
    position: static;
    width: 100%;
    max-height: none;
    overflow: visible;
  }
}

/* ---- 金价多行阈值 ---- */
/* 金价阈值行、抓取间隔独占整行，避免与其它字段并排挤压导致对齐错乱、输入显示不全 */
.sub-panel .field-row .field.gold-field,
.sub-panel .field-row .field.field-interval {
  flex: 1 1 100%;
}

.field-interval input {
  max-width: 260px;
}

.gold-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 8px;
  max-width: 480px;
}

/* 提高特异性压过 .field select/input 的 width:100%；stretch 保证方向/阈值/删除按钮同高对齐 */
.field .gold-row select {
  flex: 0 0 auto;
  width: auto;
  font-size: 14px;
}

.field .gold-row input {
  flex: 1 1 auto;
  width: auto;
  min-width: 120px;
}

.gold-row-del {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  font-size: 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  padding: 6px 10px;
  cursor: pointer;
}

.gold-row-del:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.gold-add-row {
  margin-top: 2px;
}

/* ---- 分区（每个热榜源一个分组卡片） ---- */
.cat-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: var(--maxw);
  margin: 0 auto 18px;
  padding: 20px 24px;
}

.cat-section > .container {
  padding-left: 0;
  padding-right: 0;
}

.cat-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 18px;
}

.cat-head h2 {
  font-family: var(--font-title);
  font-size: 21px;
  font-weight: 700;
  margin: 0;
  letter-spacing: 1px;
}

.cat-head .cat-desc {
  font-size: 13px;
  color: var(--fg-muted);
}

.cat-head .cat-updated {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-faint);
}

/* ---- 卡片网格 ---- */
.card-grid {
  display: grid;
  grid-template-columns: 1fr; /* 单列展示 */
  gap: 10px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.card .card-title {
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.45;
  display: inline;
}

.card a.card-title:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.card .card-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-faint);
}

/* ---- 徽章：热01 / 来源名 ---- */
.badge-hot {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-contrast);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

/* 前三名金银铜徽标统一在下方「热度文本」区段定义，此处不再重复覆盖 */

.badge-source {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 1px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.card .card-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 标题占满剩余宽度，热度/时间靠右 */
.card .card-title {
  flex: 1 1 auto;
  min-width: 0;
}

.card .card-meta {
  margin-left: auto;
  flex: 0 0 auto;
  white-space: nowrap;
}

/* ---- 占位/空态 ---- */
.empty-note {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-muted);
  color: var(--fg-muted);
  font-size: 13px;
  padding: 22px;
  text-align: center;
}

.loading-note {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-faint);
  text-align: center;
  padding: 26px 0;
}

/* ---- 表单 ---- */
.form-card {
  max-width: 420px;
  margin: 60px auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 30px 26px;
}

.form-card h2 {
  font-family: var(--font-title);
  font-size: 22px;
  margin: 0 0 4px;
  letter-spacing: 1px;
}

.form-card .form-sub {
  font-size: 13px;
  color: var(--fg-muted);
  margin: 0 0 18px;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.tabs button {
  font-size: 14px;
  padding: 8px 18px;
  border: none;
  background: none;
  color: var(--fg-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.tabs button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 5px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  transition: border-color 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.field-hint {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  color: var(--fg-faint);
  line-height: 1.5;
}

.field .hint {
  font-size: 12px;
  color: var(--fg-faint);
  margin-top: 4px;
}

.btn {
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-contrast);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 9px 22px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn:hover {
  opacity: 0.88;
}

.btn.btn-ghost {
  color: var(--fg-muted);
  background: transparent;
  border-color: var(--border);
}

.btn.btn-ghost:hover {
  color: var(--danger);
  border-color: var(--danger);
  opacity: 1;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
  margin: 10px 0 0;
}

.form-ok {
  color: var(--accent);
  font-size: 13px;
  margin: 10px 0 0;
}

/* ---- 我的订阅页 ---- */
.page-title {
  font-family: var(--font-title);
  font-size: 26px;
  letter-spacing: 1px;
  margin: 36px 0 6px;
}

.page-sub {
  font-size: 13px;
  color: var(--fg-muted);
  margin: 0 0 22px;
}

.sub-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 16px;
}

.sub-panel h3 {
  font-size: 15px;
  margin: 0 0 14px;
}

.sub-panel .field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: start; /* 各类型字段带 hint 高度不一，顶对齐保证 label 起线一致 */
}

.sub-panel .field-row .field {
  flex: 1 1 190px;
  min-width: 0;
  margin-bottom: 0;
}

.sub-panel .field-row .field-btn {
  flex: 0 0 auto;
  align-self: end; /* 提交按钮始终对齐最后一行输入框 */
}

@media (max-width: 720px) {
  .sub-panel .field-row .field {
    flex: 1 1 100%;
  }
}

.sub-pattern {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  white-space: nowrap;
}

/* ---- 工具行（手动抓取） ---- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.toolbar .hint {
  font-size: 12px;
  color: var(--fg-faint);
}

/* 按钮 loading 态：内联旋转 spinner */
.btn.loading {
  pointer-events: none;
}

.btn.loading::before {
  content: "";
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- 新手步骤引导 ---- */
.guide {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 16px;
}

.guide summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
  user-select: none;
}

.guide-steps {
  margin: 14px 0 16px;
  padding-left: 22px;
  font-size: 14px;
  line-height: 1.9;
  color: var(--fg);
}

.guide-steps code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  word-break: break-all;
}

.guide-steps a {
  color: var(--accent);
}

/* ---- 订阅分组 ---- */
.sub-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 22px;
  margin-bottom: 18px;
}

.sub-group-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.sub-group-name {
  font-family: var(--font-title);
  font-size: 18px;
  margin: 0;
}

.sub-count {
  font-size: 12px;
  color: var(--fg-faint);
}

.sub-group .sub-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.sub-group .sub-actions button {
  font-size: 12px;
  font-family: var(--font-body);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  padding: 4px 12px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.sub-group .sub-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.sub-group .sub-actions button.del:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.sub-group-url {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-faint);
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- 我的订阅条目（分组内的紧凑行） ---- */
.sub-items {
  margin-top: 14px;
  border-top: 1px solid var(--border);
}

.sub-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--border);
}

.sub-item:last-child {
  border-bottom: none;
}

.sub-item-title {
  color: var(--fg);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.6;
  flex: 1;
  min-width: 0;
}

.sub-item-title:hover {
  color: var(--accent);
}

.sub-item-time {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--fg-faint);
  white-space: nowrap;
}

/* ---- footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 48px;
  padding: 26px 0 40px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-faint);
}

.site-footer a {
  color: var(--fg-muted);
}

.site-footer a:hover {
  color: var(--accent);
}

/* 页脚「码上搜」图标链接：内联终端提示符图标与文字基线对齐（图标色为码上搜品牌色，静态允许硬编码） */
.site-footer .mss-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  vertical-align: middle;
}

.site-footer .mss-link svg {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  flex: none;
}


/* ---- 源主题色页签圆点（热榜页签 + 首页订阅 chips + 我的订阅页签，规格统一为 7px） ---- */
.chip-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px; /* 行内上下文（热榜页签为 inline 元素）用 margin 控制间距 */
  flex: none;
  vertical-align: middle;
}
/* flex 容器（订阅 chips / 左侧页签）间距由 flex gap 控制，去掉 margin 避免双重间距 */
.home-sub-chip .chip-dot,
.sub-tab .chip-dot {
  margin-right: 0;
}

/* ---- 热度文本：🔥 + 原网页热度（原网页用热度的源），无热度显示发布时间 ---- */
.card-meta.has-heat {
  color: var(--fg-strong);
  font-variant-numeric: tabular-nums;
}
.card-meta .fire {
  font-size: 0.85em;
  margin-right: 3px;
}
.hot-badge {
  display: inline-block;
  margin-left: 5px;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 11px;
  line-height: 17px;
  color: #fff;
  font-weight: 600;
  background: #ff8c00;
}
.hot-badge[data-badge="爆"] { background: #ff3852; }
.hot-badge[data-badge="热"] { background: #ff7f24; }
.hot-badge[data-badge="新"] { background: #2f9dff; }
.hot-badge[data-badge="沸"] { background: #f5b218; }
.sub-item-time.has-heat { color: var(--fg-strong); font-variant-numeric: tabular-nums; }

/* ---- 前三名金银铜徽标（卡片不再加左侧色条，置顶保留红边） ---- */
.badge-hot.rank-1 { background: #f5a623; }
.badge-hot.rank-2 { background: #8a94a3; }
.badge-hot.rank-3 { background: #cd8b5c; }
.badge-hot.rank-n { background: var(--fg-muted); } /* 弱于金银铜，且与文字对比度足够 */
.sub-item-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex: none;
}
.sub-item-rank.top-1 { background: #f5a623; }
.sub-item-rank.top-2 { background: #8a94a3; }
.sub-item-rank.top-3 { background: #cd8b5c; }
.sub-item-rank.rank-n { background: var(--fg-muted); color: var(--bg); }
.hot-badge[data-badge="置顶"] { background: #e0243d; }
.badge-hot.pinned,
.sub-item-rank.pinned {
  background: #e0243d; /* 置顶红色标签 */
  font-weight: 600;
}
/* 置顶行特殊标记：左右各一条红边 */
.card.pinned,
.sub-item.pinned {
  box-shadow: inset 3px 0 0 #e0243d, inset -3px 0 0 #e0243d;
}
.sub-item-rank.pinned {
  width: auto;
  padding: 0 6px;
  font-size: 11px;
}

/* ---- 示例弹窗 ---- */
.example-dialog {
  max-width: 560px;
  width: calc(100vw - 32px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  background: var(--bg-card);
  color: var(--fg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.example-dialog::backdrop {
  background: rgba(10, 20, 30, 0.45);
}
.example-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
#example-body p { margin: 8px 0; font-size: 14px; line-height: 1.7; }
#example-body ul { margin: 8px 0 8px 18px; padding: 0; font-size: 14px; line-height: 1.8; }
#example-body code {
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 13px;
  word-break: break-all;
}

/* 示例内容可选中复制（uTools webview 默认全局禁选，这里显式放开）；
   code 单击即整体选中，便于一键复制示例地址 */
.example-dialog,
.example-dialog p,
.example-dialog li,
.example-dialog strong {
  user-select: text;
  -webkit-user-select: text;
}

.example-dialog code {
  user-select: all;
  -webkit-user-select: all;
  cursor: pointer;
}

/* 单击复制成功反馈：边框高亮 + 「已复制」角标，1.5 秒后由 JS 移除 */
.example-dialog code.copied {
  border-color: var(--accent);
}

.example-dialog code.copied::after {
  content: "已复制";
  margin-left: 6px;
  font-size: 12px;
  color: var(--accent);
}
