:root {
  --accent: #b3832b;                      /* 加深金，白底可读 */
  --accent-soft: rgba(179, 131, 43, 0.16);
  --up: #d8392c;                          /* 涨 红（白底更清晰） */
  --down: #1f9d57;                        /* 跌 绿（白底更清晰） */
  --flat: #6b7480;
  --text: #1d2430;                        /* 深字 */
  --text-dim: #454e5b;
  --card-bg: rgba(255, 255, 255, 0.74);   /* 浅磨砂 */
  --card-border: rgba(20, 30, 50, 0.08);
  --radius: 16px;
  --shadow: 0 8px 30px rgba(15, 25, 50, 0.12);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC", system-ui, sans-serif;
  font-size: 18px;                        /* 全局基准字号（再次放大） */
  color: var(--text);
  background: #e8edf3;                     /* 浅色降级，不再纯黑 */
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
  /* 用 clip 而非 hidden：避免极小屏幕被宽内容撑出横向滚动条（clip 不会自建滚动容器） */
  overflow-x: clip;
}

/* 背景与遮罩：减轻暗度，让必应壁纸透出来 */
#bg {
  position: fixed; inset: 0; z-index: -2;
  background-size: cover; background-position: center;
  background-color: #e8edf3;               /* 浅色降级 */
  transition: background-image 1.2s ease-in-out, opacity 1.2s ease-in-out;
  opacity: 0;
}
#bg.ready { opacity: 1; }
.overlay {
  position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(160deg, rgba(255,255,255,0.34) 0%, rgba(255,255,255,0.16) 45%, rgba(20,30,50,0.20) 100%);
}

/* 整页是一个纵向 flex 容器：页眉在上、内容居中展开、页脚在下，
   内容不足一屏时页脚自然落到屏幕底部；超过一屏时随页面一起滚动（不吸附） */
.wrap {
  max-width: 1180px; margin: 0 auto;
  min-height: 100vh; min-height: 100dvh;
  padding: 16px clamp(14px, 3vw, 28px);
  display: flex; flex-direction: column; gap: 12px;
}

/* 卡片与通用小件（子页也复用 .card / .card-head / .status-chip） */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.card-head h2 { font-size: 20px; margin: 0; font-weight: 700; }
.status-chip { font-size: 13px; color: var(--text-dim); }
.status-chip {
  padding: 3px 10px; border-radius: 999px; border: 1px solid rgba(20,30,50,0.12);
  background: rgba(20,30,50,0.05); white-space: nowrap;
}

/* ═══════ ① 页眉区：站点标题 + 网址（居中） + 右侧南阳市实时天气 ═══════ */
/* 三列 1fr auto 1fr：中列标题真正居中（左右 1fr 相等），右列天气靠右；
   样式完全交给 .card 基础卡（不吸附，随页面正常滚动） */
.site-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px 18px;
  text-align: center;
  padding: 18px 22px 16px;
}
.sh-brand { grid-column: 2; min-width: 0; }
.site-title {
  margin: 0;
  font-size: clamp(26px, 4.6vw, 40px);
  font-weight: 800;
  letter-spacing: 3px;
  text-indent: 3px;                       /* 抵消 letter-spacing 在行尾多出的一格，保证视觉居中 */
  line-height: 1.2;
}
.site-sub { margin-top: 8px; }
.site-url {
  display: inline-block;
  font-size: clamp(13px, 1.8vw, 15px);
  font-weight: 600;
  letter-spacing: 1.2px;
  color: var(--accent);
  text-decoration: none;
  padding: 2px 0 1px;
  border-bottom: 1px solid rgba(179, 131, 43, 0.32);
  transition: color 0.18s ease, border-color 0.18s ease;
}
.site-url:hover,
.site-url:focus-visible { color: #8f6a1f; border-bottom-color: #8f6a1f; }

/* 页眉右侧天气块：只显示「温度 + 天气词」两项，胶囊形，点击进 7 天预报页 */
.sh-weather {
  grid-column: 3;
  justify-self: end;
  display: inline-flex; align-items: baseline; gap: 7px;
  padding: 8px 16px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(20, 30, 50, 0.09);
  color: var(--text); text-decoration: none; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
}
.sh-weather:hover, .sh-weather:focus-visible {
  background: var(--accent-soft);
  border-color: rgba(179, 131, 43, 0.32);
  transform: translateY(-1px);
  outline: none;
}
.sh-weather .sw-temp {
  font-size: 20px; font-weight: 800; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.sh-weather .sw-desc { font-size: 15px; font-weight: 600; color: var(--text-dim); }
/* 上游失败回退缓存时把温度调淡（只降不增，不额外加字） */
.sh-weather.is-delayed .sw-temp { color: var(--text-dim); }

/* ═══════ ②–⑤ 内容区：一张大卡片装四段（搜索 / 个人工作台 / 每日必访 / 常用网站） ═══════ */
.content { flex: 1 1 auto; display: block; padding: 20px 22px; }
/* 段与段之间用细线分隔：三段视觉上归为同一张卡，但层级仍清晰 */
.pane + .pane { margin-top: 18px; padding-top: 18px; border-top: 1px solid rgba(20, 30, 50, 0.09); }

/* 第一段：日期星期时钟 + 必应搜索 */
.search-zone .clock-row {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center;
  gap: 2px 18px;
  margin-bottom: 14px;
}
.clk-date { font-size: 17px; font-weight: 600; color: var(--text); }
.clk-lunar { font-size: 15px; font-weight: 600; color: var(--accent); }
.clk-time {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  line-height: 1.05;
}
.search-row { display: flex; gap: 8px; max-width: 640px; margin: 0 auto; }
.search-row input {
  flex: 1 1 auto; min-width: 0;
  padding: 12px 18px; border-radius: 999px;
  border: 1px solid rgba(20,30,50,0.12);
  background: rgba(255,255,255,0.86); color: var(--text);
  font-size: 17px; font-family: inherit; outline: none;
  box-shadow: 0 2px 10px rgba(15,25,50,0.08);
}
.search-row input::placeholder { color: #8d95a1; }
.search-row input:focus { border-color: var(--accent); }
.search-row button {
  flex: 0 0 auto;
  padding: 0 24px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--accent); color: #fff;
  font-weight: 700; font-size: 16px; font-family: inherit;
  transition: filter .15s ease;
}
.search-row button:hover { filter: brightness(1.06); }

/* 第二、三段：个人工作台 / 每日必访 */
.board .card-head { margin-bottom: 12px; }

/* 两类的条目共用同一套样式：图标 + 名称的紧凑横条；
   auto-fit 而非 auto-fill：条目少于列数时折叠空轨道，让现有条目均分整行 */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.tile {
  display: flex; align-items: center; gap: 10px;
  min-width: 0; min-height: 48px;
  padding: 14px 13px; border-radius: 12px;
  background: rgba(255,255,255,0.62); border: 1px solid rgba(20,30,50,0.10);
  color: var(--text); text-decoration: none;
  transition: transform .12s, background .12s, border-color .12s, box-shadow .12s;
}
.tile:hover, .tile:focus-visible {
  background: var(--accent-soft);
  border-color: rgba(179, 131, 43, 0.34);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15, 25, 50, 0.10);
  outline: none;
}
.tile .tile-ico {
  width: 20px; height: 20px; flex: 0 0 20px;
  object-fit: contain; border-radius: 4px; display: block;
}
.tile .tile-ico-emoji { font-size: 20px; line-height: 20px; text-align: center; }
.tile .tile-name {
  font-size: 17px; font-weight: 600;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 金色小锁：标在「入口公开、进去要口令」的站内页（写作 / 灵感）名字后面。
   位置与样式都对齐「每日必访」右端的连通性指示灯：同样 margin-left:auto 顶到条目右端、
   同样是一枚 18px 的实心圆徽标（指示灯 = 9px 实心点 + 3px 同色淡环，视觉直径一致）。
   区别只在内容：绿点=连得通，金锁=要口令。淡金底 + 金锁在 1x 下对比不足，
   故用实心金底 + 暖白锁，分量与绿点相当。 */
.tile .tile-lock {
  margin-left: auto; flex: 0 0 18px;
  width: 18px; height: 18px; padding: 3.5px;
  display: grid; place-items: center; box-sizing: border-box;
  border-radius: 50%; background: var(--accent); color: #fffaf0;
}
.tile .tile-lock svg { display: block; width: 100%; height: 100%; }
.tile:hover .tile-lock, .tile:focus-visible .tile-lock { background: #a8761f; }

/* 外链条目同时带「小锁 + 指示灯」时，两者合成一组右端徽标（2026-11-07）：
   锁仍靠 margin-left:auto 顶到右端，指示灯退掉自己的 auto 紧随其后。
   灯的右缘因此与不带锁条目逐像素对齐，全段指示灯仍在同一竖列上；
   若两个 auto 并存，自由空间会被平分、锁会飘到条目中间。 */
.tile .tile-lock ~ .tile-dot { margin-left: 0; }

/* 连通性指示灯（绿=可访问 / 红=不通 / 灰闪=检测中、灰=未知）
   注意：这里的红绿只表示「通不通」，与行情涨红跌绿的语义色无关，故不复用 --up / --down 变量 */
.tile .tile-dot {
  margin-left: auto; flex: 0 0 9px; width: 9px; height: 9px;
  border-radius: 50%; background: rgba(20, 30, 50, 0.22);
  transition: background .25s ease, box-shadow .25s ease;
}
.tile .tile-dot.is-checking { animation: dot-pulse 1.1s ease-in-out infinite; }
.tile .tile-dot.is-up { background: #1f9d57; box-shadow: 0 0 0 3px rgba(31, 157, 87, 0.16); }
.tile .tile-dot.is-down { background: #d8392c; box-shadow: 0 0 0 3px rgba(216, 57, 44, 0.16); }
.tile .tile-dot.is-unknown { background: #9aa3ae; }
@keyframes dot-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* ═══════ ⑤ 页脚区：版权 + 备案（不吸附，随页面正常滚动） ═══════ */
.foot {
  --foot-gold: #8f6a1f;                   /* 比 --accent 略深，保证小字在浅磨砂上可读（对比度约 4.9:1） */
  padding: 14px 20px;
  text-align: center;
  font-weight: 700;
}
.foot-copy { font-size: 14px; color: var(--foot-gold); }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 18px; margin-top: 6px; }
.foot-filing { font-size: 14px; font-weight: 700; color: var(--foot-gold); text-decoration: none; }
.foot-filing:hover { color: var(--text); text-decoration: underline; }

/* 行情（首页已不使用，invest.html 复用这些基础类） */
.quote-group { margin-bottom: 12px; }
.group-title { font-size: 15px; color: var(--text-dim); margin: 6px 0 8px; letter-spacing: 1px; font-weight: 600; }
.quote-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.market { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.q-row > div:first-child { min-width: 0; }
.q-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.q-row {
  display: grid; grid-template-columns: minmax(96px, 1fr) auto; align-items: center; gap: 6px;
  min-width: 0;
  padding: 10px 13px; border-radius: 10px;
  background: rgba(20,30,50,0.045); border: 1px solid rgba(20,30,50,0.06);
}
.q-name { font-size: 17px; font-weight: 600; }
/* 自选股行情数据加粗，与市场项区分 */
.q-stock .q-name { font-weight: 700; }
.q-stock .q-code, .q-stock .q-cur { font-weight: 600; }
.q-stock .q-price { font-weight: 800; }
.q-stock .q-chg { font-weight: 700; }
.q-sample { font-size: 12px; color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 0 5px; margin-left: 5px; vertical-align: middle; font-weight: 700; }
.q-code { font-size: 13px; color: var(--text-dim); }
.q-cur { font-size: 12px; color: var(--text-dim); margin-left: 4px; }
.q-right { text-align: right; }
.q-price { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.q-chg { font-size: 14px; font-variant-numeric: tabular-nums; }
.q-price.up, .q-chg.up { color: var(--up); }
.q-price.down, .q-chg.down { color: var(--down); }
.q-price.flat, .q-chg.flat { color: var(--flat); }
.quote-foot { font-size: 13px; color: var(--text-dim); margin-top: 8px; }

.ph { color: var(--text-dim); font-size: 16px; padding: 8px 0; }

/* 「每日必访」6 项（11-07 增国内RSS / 国外RSS），「常用网站」12 项（11-08 增 14寸看板 / 时钟）：
   两段 ≥1000px 一律固定 4 列 —— 必访 6 = 4 + 2、常用 12 = 4 × 3 三行满，
   列宽与指示灯竖列完全对齐；常用网站末行不再留白。
   ⚠ 别放回 auto-fit：6 项在 1000~1149px 只排得下 5 列，折叠空轨道会把落单的
   第 6 项拉成整行通栏；4 项时 auto-fit 没问题，只是因为 4 列正好排满。
   ⚠ 条目数再变要重算余数（4 列的余数变了就得换列数或给末行补规则）。
   ≤999px 走下面的两列规则：6 项 3 行、12 项 6 行，都无通栏。 */
@media (min-width: 1000px) {
  #link-grid, #common-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* 「个人工作台」2026-11-04 增到 7 项，顺序（天气/资讯/投资/行情/写作/灵感/日历）由用户指定。
   7 项在 auto-fit 下会把落单的第 7 项折叠空轨道、拉成整行通栏，很难看；
   所以 ≥1000px 固定 4 列 —— 7 = 4 + 3，第二行空一格，齐整且无通栏。
   ≤999px 走下面的两列规则，7 是奇数，最后一条通栏。
   ⚠ 条目数再变，这条必须重算（4 列的余数变了就得换列数）。 */
@media (min-width: 1000px) {
  #workspace-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* 响应式：中屏以下条目固定两列；条目数为奇数时最后一条通栏，
   避免「5 条排两列」出现半格落单（桌面宽屏 auto-fit 每行都满，不会触发这条） */
@media (max-width: 999px) {
  .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-grid > .tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* 窄屏（≤720px）：三列堆成单列 —— 标题+网址居中，天气胶囊单独一行居中（与桌面布局一致，不再压成单行） */
@media (max-width: 720px) {
  .site-head {
    grid-template-columns: 1fr; gap: 10px;
    padding: 16px 16px 14px; text-align: center;
  }
  .sh-brand { grid-column: 1; }
  .sh-weather { grid-column: 1; justify-self: center; padding: 6px 14px; gap: 6px; }
  .site-title { font-size: 28px; letter-spacing: 2px; text-indent: 2px; }
  .site-sub { margin-top: 4px; }
  .site-url { font-size: 12.5px; letter-spacing: 1px; }
  .sh-weather .sw-temp { font-size: 18px; }
  .sh-weather .sw-desc { font-size: 14px; }
}

/* 手机（≤680px）压缩留白与字号 */
@media (max-width: 680px) {
  .wrap { padding: 10px 12px; gap: 10px; }
  .site-head { padding: 14px 14px 12px; gap: 8px; }
  .site-title { font-size: 26px; letter-spacing: 2px; text-indent: 2px; }
  .site-sub { margin-top: 3px; }
  .content { padding: 16px; }
  .pane + .pane { margin-top: 16px; padding-top: 16px; }
  .search-zone .clock-row { gap: 2px 12px; margin-bottom: 12px; }
  .clk-date { font-size: 16px; }
  .clk-lunar { font-size: 14px; }
  .clk-time { font-size: 25px; }
  .search-row input { padding: 11px 16px; font-size: 16px; }
  .search-row button { padding: 0 20px; font-size: 15px; }
  .board .card-head h2 { font-size: 19px; }
  .tile-grid { gap: 8px; }
  .tile { padding: 12px 11px; min-height: 46px; gap: 8px; }
  .tile .tile-name { font-size: 16px; }
  .foot { padding: 12px 16px; }
  .foot-copy { font-size: 13px; }
  .foot-filing { font-size: 13px; }
  .foot-links { gap: 2px 12px; margin-top: 4px; }
}
/* 超窄屏（≤360px）：条目单列，避免名称被截断 */
@media (max-width: 360px) {
  .tile-grid { grid-template-columns: 1fr; }
  .clk-time { font-size: 24px; }
  .foot-copy, .foot-filing { font-size: 13px; }
}

/* 尊重减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  #bg { transition: none; }
  .tile { transition: none; }
  .tile .tile-dot.is-checking { animation: none; opacity: .55; }
  .site-url { transition: none; }
  .search-row button { transition: none; }
}

/* ═══════ 首页三段的分类标题（2026-11-04） ═══════════════════════════════
   原来是 20px 纯文字，和下方条目之间没有任何层级语言，看起来像「一行说明」。
   改成杂志栏目式的「记号 + 标题 + 引线」：竖条给出起点、引线把视线领向右侧内容，
   三段因此有统一的节奏，也多了一处金色——与站点主色呼应，却不抢条目。
   ⚠ 只作用于首页 .pane.board；calendar / weather 子页的 .card-head 不受影响。 */
.pane.board .card-head { align-items: center; }
.pane.board .card-head h2 {
  display: flex; align-items: center; gap: 11px; flex: 1 1 auto;
  font-size: 21px; font-weight: 800; letter-spacing: 1px;
}
/* 竖条：上亮下深的金色渐变 + 一点投影，让它看起来是「一枚记号」而不是一根色条 */
.pane.board .card-head h2::before {
  content: ""; flex: 0 0 auto; width: 5px; height: 20px; border-radius: 3px;
  background: linear-gradient(180deg, #dcb365 0%, #b3832b 70%, #96691d 100%);
  box-shadow: 0 1px 4px rgba(179, 131, 43, .35);
}
/* 引线：从左到右渐隐，末端淡到看不见，避免和段落间分隔线抢戏 */
.pane.board .card-head h2::after {
  content: ""; flex: 1 1 auto; height: 1px; margin-left: 8px;
  background: linear-gradient(90deg, rgba(179,131,43,.34), rgba(179,131,43,.10) 55%, rgba(179,131,43,0));
}
@media (max-width: 680px) {
  .pane.board .card-head h2 { font-size: 19px; gap: 9px; letter-spacing: .6px; }
  .pane.board .card-head h2::before { width: 4px; height: 17px; }
  .pane.board .card-head h2::after { margin-left: 6px; }
}
