:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --text: #222;
  --muted: #666;
  --border: #e6e1d9;
  --accent: #7a4f2b;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

h1 {
  margin: 0 0 18px;
  font-size: 2rem;
  line-height: 1.2;
}

.toolbar {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

#search {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
}

#search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(122, 79, 43, 0.12);
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.thumb {
  width: 100%;
  height: 180px;
  object-fit: cover;
  object-position: center;
  display: block;
  background: #f2f2f2;
  flex: 0 0 auto;
}

.thumb.placeholder {
  object-fit: cover;
  object-position: top center;
}

.card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.card-toggle {
  all: unset;
  cursor: pointer;
  display: block;
}

.title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.card-collapsed {
  display: block;
}

.card-expanded {
  display: none;
  padding-top: 6px;
}

.card.expanded .card-expanded {
  display: block;
}

.ingredients {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.tag {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f3ede7;
  color: #5b4435;
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.steps {
  color: #444;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
  margin-top: 12px;
}

.steps div {
  margin-bottom: 8px;
}

.highlight {
  background: #fff2a8;
  padding: 0 2px;
  border-radius: 3px;
}

@media (max-width: 640px) {
  .container {
    padding: 16px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .thumb {
    height: 160px;
  }
}