: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;
  overflow-x: hidden;
}

/* 背景与遮罩：减轻暗度，让必应壁纸透出来 */
#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%);
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 22px clamp(14px, 3vw, 28px) 28px; }

/* 顶栏 */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 16px;
  margin-bottom: 20px;
}
/* 顶栏三模块也做成卡片，避免壁纸变化导致看不清 */
.topbar > .brand, .topbar > .clock, .topbar > .search {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 16px 20px;
}
.brand { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.site-title { font-size: clamp(22px, 2.9vw, 34px); font-weight: 700; letter-spacing: 0.5px; }
.site-sub { font-size: 15px; color: var(--text); margin-top: 3px; font-weight: 500; }
/* 副标题改为站点域名链接（金色 + 细下划线，hover 加深） */
.site-sub a.site-url {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  padding-bottom: 1px;
  border-bottom: 1px solid rgba(179, 131, 43, 0.32);
  transition: color 0.18s ease, border-color 0.18s ease;
}
.site-sub a.site-url:hover,
.site-sub a.site-url:focus-visible { color: #8f6a1f; border-bottom-color: #8f6a1f; }

.clock { text-align: center; display: flex; flex-direction: column; justify-content: center; }
.time { font-size: clamp(38px, 6vw, 58px); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 1px; line-height: 1.05; }
.date { font-size: 16px; color: var(--text-dim); margin-top: 2px; }
.lunar { font-size: 15px; color: var(--accent); margin-top: 1px; font-weight: 600; }

.search { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.search input {
  flex: 1; max-width: 360px; min-width: 0;
  padding: 12px 16px; 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; outline: none;
  box-shadow: 0 2px 10px rgba(15,25,50,0.08);
}
.search input:focus { border-color: var(--accent); }
.search button {
  padding: 0 22px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 16px;
}
.search button:hover { filter: brightness(1.06); }

/* 网格 */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}
.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;
}

/* 首页只剩必访一张卡（天气卡已移至 weather.html、行情卡已移至 invest.html），故占满整行 */
.links { grid-column: span 12; }

/* 天气卡样式（.weather/.weather-now/.wn-*/.weather-7/.w7-*）已随天气迁至 weather.html，
   完整样式在 assets/weather.css，此处不再保留首页小卡的死代码。 */

/* 行情（首页已不使用，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; }

/* 链接 */
/* auto-fit 而非 auto-fill：链接条数少于列数时折叠空轨道，让现有条目均分整行（5 条时不至于右侧空一格） */
.link-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.link-item {
  display: flex; align-items: center; gap: 10px;
  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;
  min-height: 48px;
}
.link-item:hover { background: var(--accent-soft); transform: translateY(-2px); }
.link-item .li-ico {
  width: 20px; height: 20px; flex: 0 0 20px;
  object-fit: contain; border-radius: 4px; display: block;
}
.link-item .li-ico-emoji { font-size: 20px; line-height: 20px; text-align: center; }
.link-item .li-name {
  font-size: 17px; font-weight: 600;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

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

/* 页脚（一张卡片：版权 + 备案；文字统一金色加粗） */
.foot {
  --foot-gold: #8f6a1f;              /* 比 --accent 略深，保证小字在浅磨砂上可读（对比度约 4.9:1） */
  margin-top: 16px; font-size: 14px; font-weight: 700; color: var(--foot-gold);
}
.foot-card { padding: 18px 22px; }
.foot-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 28px; }
.foot-col { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.foot-copy { font-size: 15px; font-weight: 700; color: var(--foot-gold); }
.foot-links { display: flex; flex-direction: column; gap: 3px; }
.foot-filing { font-size: 14px; font-weight: 700; color: var(--foot-gold); text-decoration: none; }
.foot-filing:hover { color: var(--text); text-decoration: underline; }

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

/* 响应式 */
/* 顶栏换位后中间是标题卡（较宽）：三卡并排需 ≥1160px 才不折行，故在此之下切二列 */
@media (max-width: 1160px) {
  .topbar { grid-template-columns: 1fr 1fr; }
  .search { grid-column: span 2; justify-content: stretch; }
  .search input { max-width: none; }
}
@media (max-width: 680px) {
  .topbar { grid-template-columns: 1fr; text-align: center; gap: 12px; }
  .clock { order: -1; }
  .search { grid-column: auto; justify-content: stretch; }
  .links { grid-column: span 12; }
  .foot-cols { grid-template-columns: 1fr; }
  .quote-list, .market { grid-template-columns: 1fr; }
  .link-grid { grid-template-columns: 1fr 1fr; }
  .card-head { flex-wrap: wrap; }
  .card-head h2 { white-space: nowrap; }
  .wrap { padding: 16px 12px 22px; }
}
@media (max-width: 380px) {
  .quote-list, .market { grid-template-columns: 1fr; }
}

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