:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --ink: #1f2a44;
  --muted: #6b7793;
  --line: #e3e8f0;
  --brand: #3b6ef0;
  --brand2: #19b6a8;
  --math: #3b6ef0;
  --physics: #e0533d;
  --chemistry: #2f9e6b;
  --game: #b061f0;
  --shadow: 0 6px 22px rgba(31, 42, 68, .08);
  --shadow-hover: 0 12px 32px rgba(31, 42, 68, .16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

header {
  background: linear-gradient(120deg, #3b6ef0, #19b6a8);
  color: #fff;
  padding: 36px 24px 28px;
  text-align: center;
  box-shadow: var(--shadow);
}
header h1 { margin: 0; font-size: 28px; letter-spacing: 1px; }
header p { margin: 8px 0 0; opacity: .92; font-size: 14px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 18px 60px; }

/* 搜索 + 学科筛选 */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  padding: 16px 0 12px;
  margin-bottom: 8px;
}
.search-box {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 16px;
  box-shadow: var(--shadow);
}
.search-box svg { width: 18px; height: 18px; fill: var(--muted); flex: none; }
.search-box input {
  border: none;
  outline: none;
  flex: 1;
  font-size: 15px;
  padding: 0 10px;
  background: transparent;
  color: var(--ink);
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  transition: .2s;
}
.tab:hover { border-color: var(--brand); color: var(--brand); }
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* 统计 */
.stat {
  font-size: 13px;
  color: var(--muted);
  margin: 4px 2px 16px;
}

/* 卡片网格 */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
  transition: .2s;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.card .badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 10px;
  margin-bottom: 10px;
  align-self: flex-start;
}
.badge.math { background: #eef3ff; color: var(--math); }
.badge.physics { background: #fdeee9; color: var(--physics); }
.badge.chemistry { background: #e8f6ee; color: var(--chemistry); }
.badge.game { background: #f4ecfc; color: var(--game); }
.card h3 { margin: 0 0 8px; font-size: 17px; }
.card p { margin: 0 0 12px; font-size: 13px; color: var(--muted); flex: 1; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  font-size: 12px;
  background: #f1f4f9;
  color: var(--muted);
  border-radius: 8px;
  padding: 2px 8px;
}
.card .foot {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  font-size: 15px;
}

/* 加载/错误提示 */
.notice {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 12px;
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.7;
}
.notice code {
  background: #1f2a44;
  color: #fff;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 13px;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 28px 16px 40px;
}

@media (max-width: 600px) {
  header h1 { font-size: 22px; }
  .grid { grid-template-columns: 1fr; }
  .wrap { padding: 16px 12px 40px; }
}
