:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #24292f;
  --primary-text: #ffffff;
  --error: #b91c1c;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 4px 16px rgb(0 0 0 / 0.06);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #161b22;
    --text: #e6edf3;
    --muted: #8b949e;
    --border: #30363d;
    --primary: #f0f6fc;
    --primary-text: #0d1117;
    --error: #f87171;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 4px 16px rgb(0 0 0 / 0.3);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  text-decoration: none;
}

.actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.home-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}

.home-link:hover {
  color: var(--text);
}

.user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.user img {
  border-radius: 50%;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

.center {
  display: grid;
  place-items: center;
  min-height: 60vh;
}

.card {
  max-width: 420px;
  padding: 32px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.card h1 {
  margin-top: 0;
  font-size: 22px;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font: inherit;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
}

button.primary,
.button.primary {
  padding: 10px 20px;
  color: var(--primary-text);
  background: var(--primary);
  border: none;
}

button.ghost,
.button.ghost {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
}

.error {
  color: var(--error);
}

.muted {
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.toolbar h1 {
  margin: 0;
  font-size: 24px;
}

#filter {
  width: min(280px, 100%);
  padding: 8px 12px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  padding: 20px;
  text-decoration: none;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: 12px;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.tile:hover,
.tile:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.12);
  outline: none;
}

.tile .icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 6px;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 12px;
  overflow: hidden;
}

.tile .icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile h2 {
  margin: 0;
  font-size: 17px;
}

.tile p {
  flex: 1;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.tile small {
  color: var(--muted);
  font-size: 12px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 600px) {
  .topbar,
  main {
    padding-left: 16px;
    padding-right: 16px;
  }
  .user span {
    display: none;
  }
}

.button {
  text-decoration: none;
}

.tile .badge {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 12px;
  color: var(--muted);
}

.hint {
  margin-top: 24px;
}
