:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: min(1120px, 92%); margin: 0 auto; }

/* 头部 */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(247,248,250,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between; height: 60px;
}
.logo {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none;
}
.logo-mark {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 800;
}
.nav { display: flex; gap: 20px; }
.nav a {
  color: var(--muted); text-decoration: none; font-size: 14px; transition: color .15s;
}
.nav a:hover { color: var(--accent); }

/* Hero */
.hero { padding: 64px 0 32px; }
.hero-kicker {
  font-size: 12px; letter-spacing: .18em; color: var(--accent);
  font-weight: 700; margin-bottom: 14px;
}
.hero h1 {
  font-size: clamp(30px, 5vw, 46px); line-height: 1.15;
  letter-spacing: -.02em; margin-bottom: 20px;
}
.hero-desc {
  max-width: 640px; color: var(--muted); font-size: 15.5px; margin-bottom: 32px;
}

/* 搜索 */
.search {
  display: flex; align-items: center; gap: 10px;
  max-width: 440px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 16px; margin-bottom: 22px;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.search svg { color: var(--muted); flex-shrink: 0; }
.search input {
  border: 0; outline: 0; background: transparent;
  font-size: 15px; width: 100%; color: var(--text);
}

/* 筛选 */
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-btn {
  border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font-size: 13px; padding: 6px 14px;
  border-radius: 999px; cursor: pointer; transition: all .15s;
  font-family: inherit;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
}

/* 卡片网格 */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px; padding: 28px 0 56px;
}

/* 科目配色 */
.card[data-subject="语文"] { --subj: #dc2626; --subj-soft: #fef2f2; }
.card[data-subject="数学"] { --subj: #2563eb; --subj-soft: #eff6ff; }
.card[data-subject="英语"] { --subj: #7c3aed; --subj-soft: #f5f3ff; }
.card[data-subject="物理"] { --subj: #0891b2; --subj-soft: #ecfeff; }
.card[data-subject="化学"] { --subj: #ea580c; --subj-soft: #fff7ed; }
.card[data-subject="生物"] { --subj: #16a34a; --subj-soft: #f0fdf4; }
.card[data-subject="地理"] { --subj: #92400e; --subj-soft: #fef3c7; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px;
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: #d1d5db;
}
.card-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card-avatar {
  width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 22px;
  background: var(--subj-soft, var(--accent-soft));
}
.card-subject {
  font-size: 11.5px; padding: 3px 10px;
  border-radius: 999px;
  background: var(--subj-soft, var(--accent-soft));
  color: var(--subj, var(--accent));
  font-weight: 600;
}
.card h3 { font-size: 17px; margin-bottom: 8px; line-height: 1.4; }
.card-summary {
  font-size: 14px; color: #4b5563; flex: 1; margin-bottom: 16px;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  font-size: 11.5px; padding: 3px 9px;
  border-radius: 999px; background: #f3f4f6; color: #6b7280;
  white-space: nowrap;
}
.tag-diff-easy { background: #f0fdf4; color: #16a34a; }
.tag-diff-medium { background: #fff7ed; color: #ea580c; }
.tag-diff-hard { background: #fef2f2; color: #dc2626; }

.empty { text-align: center; color: var(--muted); padding: 60px 0; font-size: 15px; }

/* 详情页 */
.detail { padding: 48px 0 72px; max-width: 780px; }
.detail-back {
  display: inline-block; font-size: 14px; color: var(--muted);
  text-decoration: none; margin-bottom: 28px;
}
.detail-back:hover { color: var(--accent); }

.detail-header { margin-bottom: 32px; }
.detail-header h1 {
  font-size: clamp(24px, 4vw, 34px); line-height: 1.3; margin-bottom: 16px;
}
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; }

/* 题目 */
.question-box {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px 28px;
  margin-bottom: 24px;
}
.question-label {
  font-size: 12px; letter-spacing: .15em;
  color: var(--muted); font-weight: 700;
  margin-bottom: 14px;
}
.question-text {
  font-size: 16px; color: #1f2937; line-height: 1.85;
  white-space: pre-wrap;
}

/* 提示 */
.hint-box {
  border-left: 3px solid #f59e0b;
  background: #fffbeb;
  border-radius: 0 10px 10px 0;
  padding: 16px 20px; margin-bottom: 32px;
}
.hint-box summary {
  cursor: pointer; font-weight: 600; color: #b45309;
  font-size: 14.5px; list-style: none;
}
.hint-box summary::-webkit-details-marker { display: none; }
.hint-box summary::before { content: "💡 提示（点击展开）"; }
.hint-box[open] summary::before { content: "💡 提示（点击收起）"; }
.hint-box p {
  margin-top: 12px; font-size: 14.5px; color: #78350f; line-height: 1.75;
}

/* 解答 */
.answer-title {
  font-size: 20px; margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
}
.answer-title::before {
  content: ""; width: 6px; height: 6px;
  border-radius: 50%; background: var(--accent);
}

.step {
  display: flex; gap: 16px;
  padding: 18px 0;
  border-bottom: 1px dashed var(--line);
}
.step:last-of-type { border-bottom: 0; }

.step-num {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 14px; font-weight: 700;
  display: grid; place-items: center;
  margin-top: 2px;
}
.step-body h3 {
  font-size: 15.5px; margin-bottom: 6px; color: #111827;
}
.step-body p {
  font-size: 15px; color: #374151; line-height: 1.8;
  white-space: pre-wrap;
}

.detail-nav {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line);
}
.detail-nav a {
  text-decoration: none; color: var(--accent);
  font-size: 14.5px; font-weight: 600;
  max-width: 45%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.detail-nav a:hover { text-decoration: underline; }
.detail-nav .disabled { color: #d1d5db; pointer-events: none; }

/* 错误 */
.error-box {
  background: #fef2f2; border: 1px solid #fecaca;
  border-radius: var(--radius); padding: 24px;
  color: #991b1b; margin: 40px 0;
}
.error-box h2 { font-size: 18px; margin-bottom: 8px; }
.error-box p { font-size: 14px; line-height: 1.7; }

/* 关于页 */
.about-page { padding: 48px 0 72px; max-width: 720px; }
.about-page h1 { font-size: 32px; margin-bottom: 24px; }
.about-page p { color: #374151; font-size: 15.5px; margin-bottom: 16px; }

/* 页脚 */
.site-footer {
  border-top: 1px solid var(--line); padding: 28px 0;
  text-align: center; color: var(--muted); font-size: 13px;
}
.site-footer .fine { font-size: 12px; margin-top: 4px; color: #9ca3af; }
.beian { margin-top: 8px; font-size: 12px; }
.beian a { color: #9ca3af; text-decoration: none; transition: color .15s; }
.beian a:hover { color: var(--accent); text-decoration: underline; }

@media (max-width: 640px) {
  .hero { padding: 40px 0 24px; }
  .grid { grid-template-columns: 1fr; }
  .detail { padding: 32px 0 56px; }
  .question-box { padding: 20px; }
  .step { gap: 12px; }
}