:root {
  /* 深空科技底色 */
  --bg: #0a0f1f;
  --bg-2: #0d1526;
  --sidebar-bg: #080d1a;
  --card: rgba(255, 255, 255, 0.045);
  --card-solid: #131c31;
  --text: #e6edf7;
  --muted: #8fa0bd;
  --border: rgba(255, 255, 255, 0.09);

  /* 多色霓虹主色 */
  --cyan: #22d3ee;
  --blue: #3b82f6;
  --violet: #8b5cf6;
  --pink: #ec4899;
  --teal: #2dd4bf;
  --primary: #38bdf8;
  --primary-dark: #0ea5e9;
  --gradient: linear-gradient(135deg, #22d3ee 0%, #3b82f6 50%, #8b5cf6 100%);
  --glow: 0 0 0 1px rgba(56, 189, 248, .25), 0 8px 28px rgba(37, 99, 235, .25);
  --shadow: 0 4px 18px rgba(2, 6, 23, .5);
  --radius: 12px;
  --sidebar-w: 220px;
  --aside-w: 260px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
  background-color: var(--bg);
  /* 随主题变化的深空辉光 */
  background-image: var(--bg-glow);
  background-attachment: fixed;
}
a { color: inherit; text-decoration: none; }

/* ================= 三栏 ================= */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--aside-w);
  min-height: 100vh;
}

/* ================= 左侧栏 ================= */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; }
.side-mark {
  width: 34px; height: 34px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--gradient);
  color: #fff; font-weight: 800;
  box-shadow: 0 4px 14px rgba(56, 189, 248, .4);
}
.side-name { font-weight: 700; font-size: 16px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-group { color: #5d6b86; font-size: 12px; letter-spacing: 1px; padding: 12px 10px 4px; margin: 0; text-transform: uppercase; }
.side-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; color: var(--muted);
  transition: .18s; position: relative;
}
.side-item:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.side-active {
  background: linear-gradient(90deg, rgba(34, 211, 238, .18), rgba(139, 92, 246, .14));
  color: #fff;
  box-shadow: inset 2px 0 0 var(--cyan);
}
.side-dot { width: 18px; text-align: center; font-size: 14px; }
.side-foot { border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }

/* ================= 中间 ================= */
.content { padding: 22px 24px 40px; min-width: 0; }

.search-box {
  display: flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px; overflow: hidden;
  margin-bottom: 24px;
  backdrop-filter: blur(10px);
  transition: .2s;
}
.search-box:focus-within { box-shadow: var(--glow); border-color: rgba(56, 189, 248, .6); }
.search-box input { flex: 1; border: 0; outline: 0; padding: 12px 22px; font-size: 15px; background: transparent; color: var(--text); }
.search-box input::placeholder { color: var(--muted); }
.search-box button {
  border: 0; background: var(--gradient); color: #fff;
  padding: 0 26px; cursor: pointer; font-weight: 600;
}
.search-box button:hover { filter: brightness(1.1); }

.block { margin-bottom: 30px; scroll-margin-top: 18px; }
.block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.block-head h2 { margin: 0; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.block-icon { font-size: 18px; filter: drop-shadow(0 0 6px rgba(56,189,248,.5)); }
.more { color: var(--muted); font-size: 13px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.site-card {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 15px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.site-card:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, .5);
  box-shadow: var(--glow);
}
.site-icon {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 10px;
  object-fit: cover; display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px; overflow: hidden;
}
.site-icon.emoji { background: var(--icon-soft); }
.site-icon.letter { color: #fff; font-weight: 700; font-size: 18px; box-shadow: 0 3px 10px rgba(0,0,0,.35); }
.site-body { min-width: 0; display: flex; flex-direction: column; }
.site-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-desc { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.empty { color: var(--muted); text-align: center; padding: 40px 0; }

.page-footer { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 20px; text-align: center; }
.page-footer p { margin: 3px 0; color: var(--muted); font-size: 13px; }
.page-footer a:hover { color: var(--primary); }

/* ================= 右侧栏 ================= */
.aside { padding: 22px 18px 40px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand-card {
  background: var(--gradient);
  color: #fff; border-radius: var(--radius); padding: 18px;
  box-shadow: 0 10px 30px rgba(59, 130, 246, .4);
  position: relative; overflow: hidden;
}
.brand-card::after {
  content: ""; position: absolute; top: -40%; right: -30%;
  width: 160px; height: 160px; border-radius: 50%;
  background: rgba(255,255,255,.12);
}
.brand-card-name { margin: 0; font-weight: 800; font-size: 17px; }
.brand-card-slogan { margin: 4px 0 14px; font-size: 12.5px; opacity: .92; }
.brand-stats { display: flex; justify-content: space-between; gap: 6px; position: relative; z-index: 1; }
.brand-stats div { display: flex; flex-direction: column; align-items: center; background: rgba(255,255,255,.16); border-radius: 9px; padding: 8px 4px; flex: 1; }
.brand-stats b { font-size: 18px; }
.brand-stats span { font-size: 11px; opacity: .92; }

.aside-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  backdrop-filter: blur(8px);
}
.aside-block h3 { margin: 0 0 10px; font-size: 15px; color: var(--text); }
.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.rank-list li { display: flex; align-items: center; gap: 9px; min-width: 0; }
.rank-num {
  width: 20px; height: 20px; flex: 0 0 20px; border-radius: 6px;
  background: rgba(255,255,255,.08); color: var(--muted); font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}
.rank-top { background: linear-gradient(135deg, var(--pink), var(--violet)); color: #fff; }
.rank-list a { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.rank-list a:hover { color: var(--primary); }
.rank-visit { font-style: normal; font-size: 12px; color: var(--muted); }

/* ================= 浮动主题切换器 ================= */
.theme-switch {
  position: fixed; left: 18px; bottom: 18px; z-index: 60;
  display: flex; flex-direction: column; align-items: flex-start;
}
.theme-toggle {
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--gradient);
  color: #fff; font-size: 20px; cursor: pointer;
  box-shadow: 0 8px 22px rgba(2, 6, 23, .4);
  display: flex; align-items: center; justify-content: center;
}
.theme-panel {
  display: none; margin-bottom: 10px;
  background: var(--card-solid); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px;
  box-shadow: 0 12px 30px rgba(2, 6, 23, .5);
  backdrop-filter: blur(12px);
  width: 168px;
}
.theme-switch.open .theme-panel { display: block; }
.theme-panel-title { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.theme-opt {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 7px 8px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text); font-size: 13px;
  cursor: pointer; text-align: left;
}
.theme-opt:hover { background: rgba(255, 255, 255, .07); }
.theme-opt.active { color: var(--primary); }
.theme-dot {
  width: 20px; height: 20px; border-radius: 50%; flex: 0 0 20px;
  border: 1px solid rgba(255, 255, 255, .25);
}
.theme-opt-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ================= 响应式 ================= */
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: var(--sidebar-w) minmax(0,1fr); }
  .aside { display: none; }
}
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .side-brand { width: 100%; }
  .side-nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .side-group { width: 100%; }
  .side-foot { flex-direction: row; border-top: 0; padding-top: 0; }
  .content { padding: 16px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); }
}
