/* ==========================================================
   小步学堂 · 主样式表
   配色通过 CSS 变量控制，改这里就能整站换肤
   ========================================================== */

:root{
  --brand:#2563eb;
  --brand-dark:#1d4ed8;
  --brand-soft:#e8f0ff;
  --accent:#f97316;
  --accent-soft:#fff1e6;
  --green:#10b981;
  --pink:#ec4899;
  --purple:#8b5cf6;

  --bg:#f6f8fc;
  --surface:#ffffff;
  --surface-2:#f2f5fa;
  --border:#e4e9f2;
  --text:#1b2436;
  --text-2:#5a6579;
  --text-3:#8b95a7;

  --radius:16px;
  --radius-sm:10px;
  --shadow:0 1px 2px rgba(20,30,60,.04), 0 8px 24px rgba(20,30,60,.06);
  --shadow-hover:0 4px 12px rgba(37,99,235,.10), 0 16px 40px rgba(20,30,60,.12);
  --wrap:1200px;
}

[data-theme="dark"]{
  --brand:#5b8cff;
  --brand-dark:#7ba3ff;
  --brand-soft:#1e2a45;
  --accent:#fb923c;
  --accent-soft:#3a2617;
  --bg:#0f141f;
  --surface:#171e2c;
  --surface-2:#1e2635;
  --border:#2a3446;
  --text:#e8edf7;
  --text-2:#a4b0c4;
  --text-3:#78849a;
  --shadow:0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  --shadow-hover:0 4px 12px rgba(0,0,0,.35), 0 16px 40px rgba(0,0,0,.4);
}

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

body{
  font-family:"PingFang SC","Microsoft YaHei","Hiragino Sans GB","Source Han Sans SC",system-ui,-apple-system,sans-serif;
  background:var(--bg);
  color:var(--text);
  line-height:1.65;
  -webkit-font-smoothing:antialiased;
  transition:background .25s,color .25s;
}
a{color:inherit;text-decoration:none}
.wrap{max-width:var(--wrap);margin:0 auto;padding:0 20px}

/* ---------- 顶栏 ---------- */
.topbar{
  position:sticky;top:0;z-index:100;
  background:color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter:saturate(180%) blur(14px);
  border-bottom:1px solid var(--border);
}
.topbar-inner{display:flex;align-items:center;gap:24px;height:66px}
.brand{display:flex;align-items:center;gap:10px;flex-shrink:0}
.brand-logo{font-size:28px;line-height:1}
.brand-text{display:flex;flex-direction:column;line-height:1.2}
.brand-text strong{font-size:18px;letter-spacing:.5px}
.brand-text small{font-size:11px;color:var(--text-3)}

.search-box{
  flex:1;max-width:460px;margin-left:auto;position:relative;display:flex;align-items:center;
}
.search-icon{
  position:absolute;left:13px;width:17px;height:17px;
  fill:none;stroke:var(--text-3);stroke-width:2;stroke-linecap:round;pointer-events:none;
}
.search-box input{
  width:100%;height:40px;padding:0 36px 0 40px;
  border:1px solid var(--border);border-radius:20px;
  background:var(--surface-2);color:var(--text);font-size:14px;font-family:inherit;
  outline:none;transition:.2s;
}
.search-box input:focus{
  border-color:var(--brand);background:var(--surface);
  box-shadow:0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent);
}
.search-clear{
  position:absolute;right:10px;width:22px;height:22px;border:none;border-radius:50%;
  background:var(--border);color:var(--text-2);font-size:15px;line-height:1;cursor:pointer;
}
.theme-toggle{
  width:38px;height:38px;flex-shrink:0;border:1px solid var(--border);border-radius:50%;
  background:var(--surface-2);font-size:16px;cursor:pointer;transition:.2s;
}
.theme-toggle:hover{background:var(--brand-soft);border-color:var(--brand)}

/* ---------- Hero ---------- */
.hero{
  position:relative;overflow:hidden;
  background:linear-gradient(135deg, var(--brand-soft) 0%, transparent 55%),
             linear-gradient(300deg, var(--accent-soft) 0%, transparent 50%);
  border-bottom:1px solid var(--border);
}
.hero-inner{display:flex;align-items:center;gap:40px;padding-top:52px;padding-bottom:52px}
.hero-copy{flex:1;min-width:0}
.hero-copy h1{
  font-size:clamp(26px,4vw,40px);line-height:1.25;letter-spacing:-.5px;margin-bottom:14px;
}
.hero-copy h1::after{
  content:"";display:block;width:56px;height:4px;border-radius:2px;margin-top:14px;
  background:linear-gradient(90deg,var(--brand),var(--accent));
}
.hero-copy p{color:var(--text-2);font-size:15.5px;max-width:600px;margin-top:14px}
.hero-stats{display:flex;gap:14px;margin-top:26px;flex-wrap:wrap}
.stat{
  background:color-mix(in srgb, var(--surface) 75%, transparent);
  border:1px solid var(--border);border-radius:var(--radius-sm);
  padding:10px 18px;min-width:92px;
}
.stat b{display:block;font-size:22px;color:var(--brand);line-height:1.2}
.stat span{font-size:12px;color:var(--text-3)}

.hero-art{position:relative;width:240px;height:180px;flex-shrink:0}
.blob{position:absolute;border-radius:50%;filter:blur(6px);opacity:.5}
.b1{width:120px;height:120px;background:var(--brand);top:0;left:30px;opacity:.18}
.b2{width:90px;height:90px;background:var(--accent);bottom:0;right:20px;opacity:.2}
.b3{width:70px;height:70px;background:var(--purple);bottom:40px;left:0;opacity:.15}
.float{position:absolute;font-size:30px;animation:bob 4s ease-in-out infinite}
.f1{top:14px;left:60px}
.f2{top:60px;right:24px;animation-delay:.6s}
.f3{bottom:16px;left:26px;animation-delay:1.2s}
.f4{bottom:44px;right:70px;animation-delay:1.8s}
@keyframes bob{0%,100%{transform:translateY(0)}50%{transform:translateY(-12px)}}

/* ---------- 分类导航 ---------- */
.catbar{
  position:sticky;top:66px;z-index:90;
  background:color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter:blur(12px);
  border-bottom:1px solid var(--border);
}
.catbar-inner{display:flex;gap:8px;overflow-x:auto;padding-top:10px;padding-bottom:10px;scrollbar-width:none}
.catbar-inner::-webkit-scrollbar{display:none}
.cat-btn{
  display:flex;align-items:center;gap:7px;flex-shrink:0;
  padding:8px 16px;border:1px solid var(--border);border-radius:999px;
  background:var(--surface);color:var(--text-2);
  font-size:14px;font-family:inherit;cursor:pointer;white-space:nowrap;transition:.18s;
}
.cat-btn:hover{border-color:var(--brand);color:var(--brand);transform:translateY(-1px)}
.cat-btn.active{
  background:var(--brand);border-color:var(--brand);color:#fff;font-weight:500;
  box-shadow:0 4px 12px color-mix(in srgb, var(--brand) 30%, transparent);
}
.cat-btn .n{
  font-size:11px;padding:1px 6px;border-radius:8px;
  background:var(--surface-2);color:var(--text-3);
}
.cat-btn.active .n{background:rgba(255,255,255,.22);color:#fff}

/* ---------- 布局 ---------- */
.layout{display:grid;grid-template-columns:1fr 300px;gap:32px;padding-top:32px;padding-bottom:48px;align-items:start}
.content{min-width:0}

/* ---------- 工具条 ---------- */
.toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;margin-bottom:20px}
.toolbar-title{display:flex;align-items:baseline;gap:10px}
.toolbar-title h2{font-size:20px;letter-spacing:-.2px}
.count{font-size:13px;color:var(--text-3)}
.filters{display:flex;gap:8px;flex-wrap:wrap}
.sel{
  height:34px;padding:0 30px 0 12px;border:1px solid var(--border);border-radius:var(--radius-sm);
  background:var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b95a7' stroke-width='3'><path d='M6 9l6 6 6-6'/></svg>") no-repeat right 10px center;
  color:var(--text-2);font-size:13px;font-family:inherit;cursor:pointer;appearance:none;outline:none;
}
.sel:hover{border-color:var(--brand)}

/* ---------- 卡片网格 ---------- */
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(268px,1fr));gap:18px}
.card{
  position:relative;display:flex;flex-direction:column;
  background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);
  padding:20px;box-shadow:var(--shadow);overflow:hidden;
  transition:transform .22s cubic-bezier(.2,.8,.3,1), box-shadow .22s, border-color .22s;
  animation:rise .4s backwards;
}
@keyframes rise{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
.card::before{
  content:"";position:absolute;inset:0 0 auto 0;height:3px;
  background:var(--c,var(--brand));opacity:0;transition:.22s;
}
.card:hover{transform:translateY(-4px);box-shadow:var(--shadow-hover);border-color:color-mix(in srgb, var(--c,var(--brand)) 40%, var(--border))}
.card:hover::before{opacity:1}
.card-head{display:flex;align-items:flex-start;gap:12px;margin-bottom:10px}
.card-icon{
  width:42px;height:42px;flex-shrink:0;display:grid;place-items:center;
  border-radius:12px;font-size:21px;
  background:color-mix(in srgb, var(--c,var(--brand)) 12%, transparent);
}
.card-title{font-size:15.5px;font-weight:600;line-height:1.4;letter-spacing:-.2px}
.card-desc{
  color:var(--text-2);font-size:13.5px;line-height:1.6;flex:1;margin-bottom:14px;
  display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;
}
.card-tags{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:14px}
.chip{
  font-size:11.5px;padding:2px 9px;border-radius:6px;
  background:var(--surface-2);color:var(--text-3);
}
.card-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;padding-top:12px;border-top:1px dashed var(--border)}
.card-meta{font-size:12px;color:var(--text-3);display:flex;align-items:center;gap:8px}
.go{
  display:inline-flex;align-items:center;gap:5px;
  padding:6px 14px;border-radius:999px;font-size:13px;font-weight:500;
  background:var(--c,var(--brand));color:#fff;transition:.18s;
}
.go:hover{filter:brightness(1.08);gap:9px}
.badge{
  position:absolute;top:14px;right:-26px;width:96px;padding:3px 0;
  transform:rotate(38deg);text-align:center;font-size:10.5px;font-weight:600;color:#fff;letter-spacing:1px;
}
.badge.hot{background:var(--accent)}
.badge.new{background:var(--green)}

/* ---------- 空状态 ---------- */
.empty{text-align:center;padding:70px 20px;color:var(--text-3)}
.empty-icon{font-size:44px;margin-bottom:10px}
.btn-ghost{
  margin-top:14px;padding:8px 20px;border:1px solid var(--border);border-radius:999px;
  background:var(--surface);color:var(--brand);font-size:13px;font-family:inherit;cursor:pointer;
}
.btn-ghost:hover{background:var(--brand-soft)}

/* ---------- 侧边栏 ---------- */
.sidebar{display:flex;flex-direction:column;gap:18px;position:sticky;top:124px}
.side-card{
  background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);
  padding:18px;box-shadow:var(--shadow);
}
.side-card:empty{display:none}
.side-card h3{font-size:14.5px;margin-bottom:12px;letter-spacing:-.2px}
.rank-list{list-style:none;counter-reset:r}
.rank-list li{counter-increment:r;margin-bottom:9px}
.rank-list a{display:flex;gap:9px;align-items:flex-start;font-size:13.5px;color:var(--text-2);transition:.15s}
.rank-list a::before{
  content:counter(r);flex-shrink:0;
  width:18px;height:18px;margin-top:2px;border-radius:5px;
  background:var(--surface-2);color:var(--text-3);
  font-size:11px;font-weight:700;display:grid;place-items:center;
}
.rank-list li:nth-child(1) a::before{background:var(--accent);color:#fff}
.rank-list li:nth-child(2) a::before{background:color-mix(in srgb,var(--accent) 60%,var(--surface-2));color:#fff}
.rank-list li:nth-child(3) a::before{background:color-mix(in srgb,var(--accent) 35%,var(--surface-2));color:var(--text-2)}
.rank-list a:hover{color:var(--brand)}
.recent-list{list-style:none}
.recent-list li{margin-bottom:9px;font-size:13.5px}
.recent-list a{color:var(--text-2);display:flex;justify-content:space-between;gap:10px;transition:.15s}
.recent-list a:hover{color:var(--brand)}
.recent-list time{color:var(--text-3);font-size:11.5px;flex-shrink:0}
.tag-cloud{display:flex;flex-wrap:wrap;gap:7px}
.tag-cloud button{
  border:1px solid var(--border);border-radius:999px;padding:4px 11px;
  background:var(--surface-2);color:var(--text-2);font-size:12px;font-family:inherit;cursor:pointer;transition:.15s;
}
.tag-cloud button:hover,.tag-cloud button.active{background:var(--brand);border-color:var(--brand);color:#fff}
.tip-card p{font-size:13px;color:var(--text-2)}
kbd{
  background:var(--surface-2);border:1px solid var(--border);border-bottom-width:2px;
  border-radius:4px;padding:0 5px;font-size:11.5px;font-family:ui-monospace,monospace;
}

/* ---------- 广告位 ---------- */
.ad-slot-wrap:empty{display:none}
.ad-slot{
  margin:18px 0;border-radius:var(--radius);overflow:hidden;
}
.ad-placeholder{
  display:grid;place-items:center;min-height:92px;padding:18px;
  border:1.5px dashed var(--border);border-radius:var(--radius);
  background:repeating-linear-gradient(45deg,var(--surface-2),var(--surface-2) 10px,transparent 10px,transparent 20px);
  color:var(--text-3);font-size:12.5px;text-align:center;
}
.ad-card{grid-column:1/-1}
.side-card .ad-placeholder{min-height:200px}

/* ---------- 页脚 ---------- */
.footer{background:var(--surface);border-top:1px solid var(--border);margin-top:20px}
.footer-inner{display:flex;justify-content:space-between;align-items:center;gap:30px;padding-top:32px;padding-bottom:32px;flex-wrap:wrap}
.footer-brand{font-size:16px;font-weight:600;margin-bottom:6px}
.footer-main p{color:var(--text-2);font-size:13.5px}
.footer-meta{margin-top:10px;display:flex;gap:16px;align-items:center;font-size:12.5px;color:var(--text-3)}
.admin-link{color:var(--text-3);border-bottom:1px dashed var(--text-3);padding-bottom:1px}
.admin-link:hover{color:var(--brand);border-color:var(--brand)}
.footer-qr{text-align:center}
.footer-qr img{width:96px;height:96px;border-radius:10px;border:1px solid var(--border);display:block}
.footer-qr span{display:block;margin-top:6px;font-size:11.5px;color:var(--text-3)}

/* ---------- 回到顶部 ---------- */
.to-top{
  position:fixed;right:26px;bottom:26px;width:42px;height:42px;
  border:1px solid var(--border);border-radius:50%;background:var(--surface);color:var(--brand);
  font-size:18px;cursor:pointer;box-shadow:var(--shadow);
  opacity:0;pointer-events:none;transition:.25s;z-index:80;
}
.to-top.show{opacity:1;pointer-events:auto}
.to-top:hover{background:var(--brand);color:#fff;border-color:var(--brand)}

/* ---------- 响应式 ---------- */
@media (max-width:1024px){
  .layout{grid-template-columns:1fr}
  .sidebar{position:static;display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr))}
  .hero-art{display:none}
}
@media (max-width:640px){
  .wrap{padding:0 14px}
  .topbar-inner{height:auto;padding:10px 0;flex-wrap:wrap;gap:10px}
  .search-box{order:3;max-width:none;flex-basis:100%;margin-left:0}
  .theme-toggle{margin-left:auto}
  .hero-inner{padding-top:34px;padding-bottom:34px}
  .catbar{top:0}
  .grid{grid-template-columns:1fr}
  .toolbar{align-items:flex-start;flex-direction:column}
  .filters{width:100%}
  .sel{flex:1}
  .footer-inner{flex-direction:column;text-align:center}
  .footer-meta{justify-content:center}
}

/* ---------- 打印 ---------- */
@media print{
  .topbar,.catbar,.sidebar,.to-top,.hero-art,.filters,.ad-slot-wrap,.ad-card,.footer-qr{display:none!important}
  .layout{grid-template-columns:1fr}
  .card{break-inside:avoid;box-shadow:none}
}
