* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, "Segoe UI", Arial, sans-serif;
  background: #fdf3ee;
  color: #2f2f2f;
  text-align: center;
  margin: 0;
  padding: 24px 16px 40px;
}

h1 {
  margin-bottom: 16px;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.main-nav a {
  color: #ff6b6b;
  font-weight: bold;
  text-decoration: none;
}

.main-nav a:hover {
  text-decoration: underline;
}

.flash-message {
  background: #eafaf1;
  color: #1e8449;
  border-radius: 8px;
  padding: 10px 16px;
  max-width: 320px;
  margin: 0 auto 20px;
}

#add-form {
  display: flex;
  flex-direction: column;
  max-width: 320px;
  margin: 0 auto;
  text-align: left;
}

#add-form label {
  font-size: 14px;
  font-weight: bold;
  margin: 12px 0 4px;
}

#add-form input,
#add-form textarea,
#add-form select {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-size: 14px;
  font-family: inherit;
}

#add-form button {
  margin-top: 24px;
  padding: 12px;
  border: none;
  border-radius: 999px;
  background: #ff6b6b;
  color: white;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: normal;
  font-size: 14px;
}

.checkbox-label input {
  width: auto;
}

#filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.filter-btn {
  border: 2px solid #ff6b6b;
  background: white;
  color: #ff6b6b;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.filter-btn:hover {
  background: #ffe3e3;
}

.filter-btn.active {
  background: #ff6b6b;
  color: white;
}

#card-stack {
  position: relative;
  width: 320px;
  max-width: 90vw;
  height: 420px;
  margin: 0 auto;
}

.card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  cursor: grab;
  user-select: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.card:active {
  cursor: grabbing;
}

.card .badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.card .badge {
  background: #ff6b6b;
  color: white;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
}

.card h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.card .prep-time {
  color: #777;
  font-size: 14px;
  margin-bottom: 16px;
}

.card ul {
  text-align: left;
  padding-left: 20px;
  margin: 0;
}

.card ul li {
  margin-bottom: 6px;
}

.card .stamp {
  position: absolute;
  top: 24px;
  font-size: 22px;
  font-weight: bold;
  border: 4px solid;
  border-radius: 8px;
  padding: 4px 10px;
  opacity: 0;
  transition: opacity 0.15s;
}

.stamp-like {
  right: 20px;
  color: #2ecc71;
  border-color: #2ecc71;
  transform: rotate(15deg);
}

.stamp-nope {
  left: 20px;
  color: #ff6b6b;
  border-color: #ff6b6b;
  transform: rotate(-15deg);
}

#empty-message {
  margin-top: 40px;
  color: #777;
}

.hidden {
  display: none;
}

#actions {
  margin-top: 24px;
  display: flex;
  justify-content: center;
  gap: 24px;
}

#actions button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  background: white;
}

#btn-dislike {
  color: #ff6b6b;
}

#btn-like {
  color: #2ecc71;
}

#add-category-form {
  display: flex;
  gap: 8px;
  max-width: 320px;
  margin: 0 auto 32px;
}

#add-category-form input {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-size: 14px;
}

#add-category-form button {
  padding: 10px 16px;
  border: none;
  border-radius: 999px;
  background: #ff6b6b;
  color: white;
  font-weight: bold;
  cursor: pointer;
}

#item-list {
  max-width: 400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-row {
  background: white;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
}

.item-info {
  font-size: 14px;
}

.item-tags {
  color: #777;
  font-size: 12px;
  margin-top: 4px;
}

.delete-btn {
  border: none;
  background: #ffe3e3;
  color: #ff6b6b;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
}

.hint {
  max-width: 400px;
  margin: 20px auto 0;
  color: #999;
  font-size: 13px;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  border-radius: 16px;
  padding: 24px;
  max-width: 320px;
  width: 100%;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}

.modal-actions button {
  padding: 10px 20px;
  border: none;
  border-radius: 999px;
  font-weight: bold;
  cursor: pointer;
}

#confirm-cancel {
  background: #eee;
  color: #333;
}

#confirm-ok {
  background: #ff6b6b;
  color: white;
}

.match-content {
  text-align: center;
  background: linear-gradient(160deg, #ffffff, #ffe9e9);
  animation: match-pop 0.35s ease;
}

@keyframes match-pop {
  from {
    transform: scale(0.7);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.match-emoji {
  font-size: 32px;
  margin: 0 0 8px;
}

.match-content h2 {
  margin: 0 0 8px;
  color: #ff6b6b;
  font-size: 26px;
}

#match-recipe-name {
  font-weight: bold;
  font-size: 18px;
  margin: 0;
}

.match-subtitle {
  color: #777;
  margin: 4px 0 0;
}

#match-close {
  margin-top: 20px;
  padding: 12px 20px;
  border: none;
  border-radius: 999px;
  background: #ff6b6b;
  color: white;
  font-weight: bold;
  font-size: 15px;
  cursor: pointer;
  width: 100%;
}
