:root {
  --bg: #f8f5ef;
  --panel: #fffdf9;
  --accent: #d85d3a;
  --accent-dark: #b9462c;
  --text: #1d1d1d;
  --muted: #5e5a58;
  --border: #e8dfd1;
  --shadow: rgba(31, 22, 15, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #f4efe8 0%, #f9f5ee 100%);
  color: var(--text);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 4rem;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  backdrop-filter: blur(10px);
  z-index: 5;
}

.brand {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

nav {
  display: flex;
  gap: 1.5rem;
}

nav a {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
}

.container {
  max-width: 1150px;
  margin: 0 auto;
  padding: 2rem 1.3rem 4rem;
}

.hero {
  background: linear-gradient(135deg, #f7d8c7 0%, #fffefb 100%);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 16px 32px var(--shadow);
  padding: 3.8rem 2.2rem;
  margin-bottom: 2rem;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.6rem, 5vw, 4rem);
  line-height: 1.05;
  max-width: 560px;
}

.hero p {
  color: var(--muted);
  margin: 1rem 0 0;
  max-width: 640px;
  font-size: 1.08rem;
}

.hero-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.3rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.primary {
  background: var(--accent);
  color: white;
}

.secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
}

.content-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 10px 20px rgba(25, 20, 16, 0.05);
  padding: 1.5rem;
  margin-top: 2rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.panel-header h2,
.form-panel h2 {
  margin: 0;
}

.search-form {
  display: flex;
  gap: 0.7rem;
}

.search-form input,
.search-form select,
.field input,
.field textarea {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  font: inherit;
  background: #fff;
}

.search-form input,
.search-form select {
  min-width: 180px;
}

.search-form button,
.submit-btn,
.delete-btn {
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
}

.search-form button {
  background: #2c2c2c;
  color: white;
  padding: 0 1rem;
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.2rem;
}

.recipe-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.2rem;
  background: #fff;
}

.rating-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0.4rem 0 0.7rem;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: #fff7ed;
  color: #874d1e;
  font-size: 0.8rem;
  font-weight: 700;
}

.recipe-detail-page {
  padding-top: 2rem;
}

.recipe-detail-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 1.5rem;
  box-shadow: 0 18px 34px rgba(29, 24, 18, 0.08);
}

.detail-image {
  width: 100%;
  max-height: 380px;
  object-fit: cover;
  border-radius: 18px;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

.recipe-image {
  width: 100%;
  height: 190px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
}

.card-title-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.category {
  display: inline-flex;
  align-items: center;
  background: #f6e6e0;
  border-radius: 999px;
  color: var(--accent-dark);
  font-weight: 700;
  padding: 0.38rem 0.7rem;
  font-size: 0.75rem;
}

.privacy-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.28rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.privacy-badge.public,
.visibility-toggle-btn.public {
  background: #eaf9ee;
  color: #236f43;
}

.privacy-badge.private,
.visibility-toggle-btn.private {
  background: #fff3e8;
  color: #a35a20;
}

.card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0.8rem 0 0.6rem;
}

.delete-btn {
  background: #f7ece8;
  color: #7d382b;
  padding: 0.42rem 0.7rem;
}

.recipe-card h3 {
  margin: 1rem 0 0.4rem;
  font-size: 1.4rem;
}

.description {
  color: var(--muted);
  margin: 0 0 1rem;
}

.recipe-section {
  margin-top: 0.9rem;
}

.recipe-section h4 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}

ul, ol {
  margin: 0;
  padding-left: 1.4rem;
}

li {
  margin-bottom: 0.35rem;
  color: #2a2a2a;
}

.form-panel {
  margin-bottom: 2rem;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.field label {
  font-weight: 700;
}

.field textarea {
  resize: vertical;
}

.submit-btn {
  background: var(--accent);
  color: white;
  padding: 0.9rem 1.2rem;
  margin-top: 1.2rem;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.favorite-btn,
.edit-btn,
.delete-btn,
.mini-button,
.visibility-toggle-btn {
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
}

.profile-layout {
  display: grid;
  gap: 1.5rem;
}

.profile-summary {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.5rem;
}

.small-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.favorite-btn {
  background: #fff0f0;
  color: #d45454;
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
}

.favorite-btn.active {
  background: #ffdfe1;
}

.edit-btn {
  background: #edf5ff;
  color: #1f55a8;
  padding: 0.4rem 0.65rem;
}

.visibility-toggle-btn {
  background: #eef4ff;
  color: #224c99;
  padding: 0.35rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.recipe-detail-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.detail-header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.compact-card-top {
  margin-bottom: 0.6rem;
}

.empty-state {
  color: var(--muted);
  font-style: italic;
  padding: 1rem 0;
}

.ratings-section {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.rating-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.rating-stars {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.star-btn {
  border: none;
  background: transparent;
  font-size: 1.8rem;
  cursor: pointer;
  color: #d7d1c8;
  line-height: 1;
}

.star-btn.filled {
  color: #f4b942;
}

.rating-summary {
  color: var(--muted);
  font-weight: 600;
}

.comments-section {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.comments-list {
  display: grid;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.comment-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  padding: 0.9rem 1rem;
}

.comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.comment-item p {
  margin: 0;
  line-height: 1.5;
}

.comment-form {
  display: grid;
  gap: 0.8rem;
}

.comment-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  resize: vertical;
  font: inherit;
}

.login-hint {
  color: var(--muted);
  margin-top: 0.8rem;
}

.user-pill {
  color: var(--text);
  font-weight: 700;
}

.nav-form {
  display: inline;
}

.mini-button {
  background: var(--accent);
  color: white;
  padding: 0.55rem 0.9rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mini-button.secondary {
  background: #f2efe8;
  color: var(--text);
  border: 1px solid var(--border);
}

.hidden {
  display: none !important;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.auth-card {
  width: min(100%, 480px);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 15px 35px rgba(30, 20, 15, 0.08);
  padding: 2rem;
}

.auth-card h1 {
  margin-top: 0;
}

.profile-form-card {
  width: min(100%, 540px);
}

.auth-subtitle {
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.form-error {
  background: #fff3f2;
  border: 1px solid #f4c9c2;
  color: #af3f2d;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  margin-bottom: 1rem;
}

.auth-button {
  width: 100%;
  margin-top: 0.5rem;
}

.auth-switch {
  margin-top: 1.2rem;
  color: var(--muted);
}

.text-link {
  color: var(--accent-dark);
  text-decoration: none;
  font-weight: 700;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 640px) {
  .topbar {
    padding: 1rem 1.2rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-form {
    flex-direction: column;
    width: 100%;
  }

  .search-form input,
  .search-form button {
    width: 100%;
  }
}
