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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --text: #e8eaf0;
  --muted: #8b8fa8;
  --accent: #6c63ff;
  --accent-hover: #5a52e0;
  --radius: 14px;
  --gap: 1rem;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  padding-bottom: 2rem;
}

/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
}

header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.search-wrapper {
  position: relative;
  flex: 1;
}

.search-wrapper svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

#search {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 1rem 0.6rem 2.25rem;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

#search:focus {
  border-color: var(--accent);
}

#search::placeholder {
  color: var(--muted);
}

/* Main */
main {
  padding: 1rem;
  max-width: 900px;
  margin: 0 auto;
}

/* Grid */
#grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}

/* Card */
.card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, transform 0.15s;
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.card:active {
  transform: translateY(0);
}

.card-icon {
  font-size: 2rem;
  flex-shrink: 0;
  line-height: 1;
}

.card-body {
  flex: 1;
  min-width: 0;
}

.card-body h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-body p {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 3rem 0;
  font-size: 0.95rem;
}

/* Tablet: 2 columns */
@media (min-width: 540px) {
  #grid {
    grid-template-columns: 1fr 1fr;
  }

  .card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 1.25rem;
  }

  .card-icon {
    font-size: 2.2rem;
  }

  .card-body h2 {
    font-size: 1.05rem;
    white-space: normal;
  }

  .card-body p {
    white-space: normal;
  }


}

/* Desktop: 3 columns */
@media (min-width: 800px) {
  header {
    padding: 1.1rem 1.5rem;
  }

  header h1 {
    font-size: 1.6rem;
  }

  .search-wrapper {
    max-width: 280px;
    margin-left: auto;
  }

  main {
    padding: 1.5rem;
  }

  #grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
