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

body {
  font-family: sans-serif;
  background: #1a1a2e;
  color: #eee;
  padding: 1rem;
}

h1 {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 1.8rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3.2rem;
}

/* Home page */
.home {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  gap: 2rem;
}

.home-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 320px;
}

.home-btn {
  display: block;
  padding: 1.2rem;
  text-align: center;
  font-size: 1.2rem;
  font-weight: bold;
  border-radius: 12px;
  text-decoration: none;
  background: #16213e;
  color: #eee;
  border: none;
  transition: background 0.15s;
}

.home-btn:hover {
  background: #0f3460;
}

.home-btn--favorites {
  color: #e6a817;
}

.home-btn--favorites:hover {
  background: #3a2c00;
}


/* Back link */
.back-link {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-53%) scaleX(-1);
  color: #eee;
  text-decoration: none;
  font-size: 1.8rem;
  font-weight: 900;
  line-height: 1;
  transition: color 0.15s;
}

.back-link:hover {
  color: #aaa;
}

/* Clear favorites button */
.clear-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
  color: #e94560;
  font-size: 2.9rem;
  font-weight: 700;
  -webkit-text-stroke: 1.5px currentColor;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s;
}

.clear-btn:hover {
  color: #aaa;
}

/* Search bar */
.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  width: 100%;
}

.search-input {
  flex: 1;
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  border: none;
  outline: none;
  background: #16213e;
  color: #eee;
  font-size: 1rem;
}

.search-input::placeholder {
  color: #666;
}

.search-btn {
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  border: none;
  outline: none;
  background: #16213e;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.15s;
}

.search-btn:hover {
  background: #0f3460;
}

/* Card grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

@media (max-width: 480px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
}

/* Card */
.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #16213e;
  border-radius: 8px;
  overflow: hidden;
  padding-bottom: 0.5rem;
}

.card-image-wrapper {
  position: relative;
  width: 100%;
}

.card-image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
}

.star-btn {
  position: absolute;
  top: 7px;
  right: 7px;
  background: rgba(0, 0, 0, 0.55);
  border: none;
  border-radius: 50%;
  width: 64px;
  height: 64px;
  font-size: 2.2rem;
  line-height: 1;
  cursor: pointer;
  color: #aaa;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.star-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  color: #e6a817;
}

.star-btn--active {
  color: #e6a817;
}

.card-name {
  font-size: 0.75rem;
  text-align: center;
  padding: 0.4rem 0.25rem 0;
  color: #ccc;
}

.loading,
.error {
  text-align: center;
  margin-top: 2rem;
  font-size: 1rem;
  color: #aaa;
}
