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

:root {
  --bg: #fdf9f3;
  --fg: #1a1a1a;
  --accent: #4a7a3a;
  --accent-dark: #385f2a;
  --accent-light: #eaf3e4;
  --accent-border: #bdd6a8;
  --accent-hover-bg: #f0f6ea;
  --accent-shadow: rgba(74,122,58,0.1);
  --border: #d8d4cc;
  --card-border: #e0ddd6;
  --img-bg: #ede9e2;
  --tag-bg: #eceae4;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
}

header {
  text-align: center;
  padding: 56px 24px 0;
}
header h1 {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--fg);
}
.tagline {
  font-size: 15px;
  color: #777;
  margin-top: 8px;
  font-weight: 400;
}

.search-area {
  max-width: 680px;
  margin: 32px auto 0;
  padding: 0 24px;
}

.search-box {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  position: relative;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-shadow);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-light);
  color: var(--accent-dark);
  border: 1px solid var(--accent-border);
  border-radius: 100px;
  padding: 3px 8px 3px 12px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  margin-right: 5px;
}
.chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent);
  opacity: 0.6;
  padding: 0;
  display: flex;
  align-items: center;
}
.chip-remove:hover { opacity: 1; }

.search-input {
  border: none;
  outline: none;
  font-size: 16px;
  flex: 1;
  min-width: 120px;
  background: transparent;
  color: var(--fg);
}
.search-input::placeholder { color: #aaa; }

.dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.09);
  z-index: 200;
  overflow: hidden;
  display: none;
}
.dropdown.open { display: block; }

.dropdown-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  color: #333;
  transition: background 0.1s;
}
.dropdown-item:hover, .dropdown-item.active {
  background: var(--accent-hover-bg);
  color: var(--accent-dark);
}

.results-area {
  max-width: 1180px;
  margin: 32px auto 60px;
  padding: 0 24px;
  transition: opacity 0.2s;
}
.results-area.loading {
  opacity: 0.4;
}

.results-meta {
  font-size: 13px;
  color: #666;
  margin-bottom: 18px;
}

.recipes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}

.recipe-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: box-shadow 0.15s, transform 0.15s;
}
.recipe-card:hover {
  box-shadow: 0 6px 22px rgba(0,0,0,0.13);
  transform: translateY(-2px);
}

.recipe-img {
  width: 100%;
  height: 175px;
  object-fit: cover;
  background: var(--img-bg);
  display: block;
}
.recipe-img-placeholder {
  width: 100%;
  height: 175px;
  background: var(--img-bg);
}

.recipe-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
}

.recipe-site {
  font-size: 11px;
  color: #999;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.recipe-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.recipe-desc {
  font-size: 13px;
  color: #666;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recipe-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: auto;
  padding-top: 4px;
}

.tag {
  background: var(--tag-bg);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 11px;
  color: #666;
}
.tag.highlight {
  background: var(--accent-light);
  color: var(--accent-dark);
  font-weight: 600;
}

.loading-spinner {
  display: flex;
  justify-content: center;
  padding: 64px 24px;
}
.loading-spinner::after {
  content: '';
  width: 32px;
  height: 32px;
  border: 3px solid var(--accent-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: #aaa;
  font-size: 15px;
}
