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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7f5;
  color: #333;
  line-height: 1.6;
}

.container {
  max-width: 700px;
  margin: 0 auto;
  padding: 16px;
}

h1 {
  text-align: center;
  font-size: 1.6rem;
  color: #2e7d32;
  margin-bottom: 20px;
  padding: 16px 0 12px;
  border-bottom: 2px solid #c8e6c9;
}

h2 {
  font-size: 1rem;
  color: #2e7d32;
  margin-bottom: 12px;
}

h3 {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 6px;
}

/* 検索 */
.search-section {
  margin-bottom: 20px;
}

.search-box {
  display: flex;
  gap: 8px;
}

.search-box input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid #c8e6c9;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: #4caf50;
}

.search-box button {
  padding: 10px 14px;
  background: #e8f5e9;
  border: 2px solid #c8e6c9;
  border-radius: 8px;
  cursor: pointer;
  color: #666;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.search-box button:hover {
  background: #c8e6c9;
}

.search-count {
  font-size: 0.85rem;
  color: #888;
  margin-top: 6px;
}

/* フォーム */
.form-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
}

.required {
  color: #e53935;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: #4caf50;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: #4caf50;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #388e3c;
}

/* 一覧 */
.list-section {
  margin-bottom: 40px;
}

.list-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.recipe-count {
  font-size: 0.85rem;
  background: #e8f5e9;
  color: #2e7d32;
  padding: 2px 10px;
  border-radius: 20px;
  font-weight: 600;
}

.recipe-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recipe-card {
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.1s;
}

.recipe-card:hover {
  box-shadow: 0 3px 10px rgba(76,175,80,0.2);
  transform: translateY(-1px);
}

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

.recipe-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: #2e7d32;
  margin-bottom: 4px;
}

.recipe-card-preview {
  font-size: 0.82rem;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recipe-card-highlight {
  background: #fff9c4;
  border-radius: 3px;
  padding: 0 2px;
}

.recipe-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.btn-delete {
  padding: 6px 12px;
  background: #ffebee;
  color: #e53935;
  border: 1px solid #ffcdd2;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.btn-delete:hover {
  background: #ffcdd2;
}

.empty-msg {
  text-align: center;
  color: #aaa;
  padding: 40px 20px;
  font-size: 0.95rem;
}

/* モーダル */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
}

.modal-content {
  position: relative;
  background: #fff;
  border-radius: 14px;
  padding: 24px 20px;
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: #f5f5f5;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: #e0e0e0;
}

.modal-content h2 {
  font-size: 1.2rem;
  color: #2e7d32;
  margin-bottom: 16px;
  padding-right: 30px;
}

.modal-section {
  margin-bottom: 16px;
}

.modal-section p {
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: #444;
  background: #f9f9f9;
  border-radius: 8px;
  padding: 10px 12px;
}

.modal-memo {
  margin-bottom: 8px;
}

.modal-memo p {
  font-size: 0.88rem;
  color: #666;
  font-style: italic;
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.3rem;
  }
  .recipe-card {
    flex-direction: column;
    gap: 8px;
  }
  .recipe-card-actions {
    flex-direction: row;
  }
}
