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

:root {
  --bg:         #f8fafc;
  --surface:    #ffffff;
  --border:     #e2e8f0;
  --text:       #1e293b;
  --muted:      #64748b;
  --brand:      #0ea5e9;
  --brand-glow: rgba(14, 165, 233, 0.08);
}

[data-theme="dark"] {
  --bg:         #0f172a;
  --surface:    #1e293b;
  --border:     #334155;
  --text:       #e2e8f0;
  --muted:      #94a3b8;
  --brand:      #38bdf8;
  --brand-glow: rgba(56, 189, 248, 0.08);
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  transition: background 0.15s, color 0.15s;
}

header {
  text-align: center;
  margin-bottom: 48px;
  position: relative;
}

header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

header p {
  font-size: 14px;
  color: var(--muted);
  margin-top: 6px;
}

.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 16px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  line-height: 1;
}

.theme-toggle:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 860px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.card:hover {
  border-color: var(--brand);
  box-shadow: 0 2px 12px var(--brand-glow);
  text-decoration: none;
}

.card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.card-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  flex: 1;
}

.card-link {
  font-size: 12px;
  color: var(--brand);
  margin-top: 4px;
}

.loading {
  color: var(--muted);
  font-size: 14px;
}

footer {
  margin-top: 48px;
  font-size: 12px;
  color: var(--muted);
}

footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--brand); }

@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr; }
  header h1 { font-size: 20px; }
}
