:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1a1f2e;
  --muted: #6b7280;
  --border: #e6e8ef;
  --brand: #4f46e5;
  --brand-soft: #eef2ff;
  --accent: #0ea5e9;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.06);
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  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.6;
}

a { color: inherit; text-decoration: none; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* Header */
header {
  background: linear-gradient(135deg, #4f46e5 0%, #0ea5e9 100%);
  color: #fff;
  padding: 48px 0 40px;
}
header h1 { margin: 0 0 8px; font-size: 30px; letter-spacing: -0.5px; }
header p { margin: 0; opacity: 0.92; font-size: 15px; max-width: 640px; }

/* Controls */
.controls {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.search {
  width: 100%;
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Grid */
main { padding: 28px 0 60px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 4px 12px rgba(16,24,40,.12), 0 16px 40px rgba(16,24,40,.10); }
.card h3 { margin: 0 0 4px; font-size: 18px; }
.card .cat {
  display: inline-block;
  font-size: 12px;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 2px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
  width: fit-content;
}
.card .free { font-size: 14px; margin: 0 0 8px; }
.card .limit { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tag {
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 6px;
}
.card .foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card .updated { font-size: 12px; color: var(--muted); }
.btn {
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  transition: opacity .15s;
}
.btn:hover { opacity: .9; }

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

footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
footer a { color: var(--brand); }

@media (max-width: 600px) {
  header { padding: 36px 0 30px; }
  header h1 { font-size: 24px; }
  .grid { grid-template-columns: 1fr; }
}
