:root {
  --bg: #f2f2f2;
  --card: #fafafa;
  --panel: #fff;
  --text: #222;
  --muted: #555;
  --border: #ccc;
  --primary: #e53935;
  --primary-dark: #c62828;
  --accent: #1565c0;
  --modal: #fff;
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.dark-mode,
body.dark-mode {
  --bg: #0f172a;
  --card: #0b1223;
  --panel: #0b1223;
  --modal: #0f172a;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --border: #374151;
  --primary: #ef4444;
  --primary-dark: #dc2626;
  --accent: #38bdf8;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  background: var(--bg);
  color: var(--text);
}

body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: block;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
  /* ne pas forcer overflow-y: visible (ça peut casser sticky) */
}

html {
  scroll-padding-top: 74px; /* header height buffer for anchor links */
}

#footer-placeholder {
  margin-top: auto;
}

.auth-box {
  display: none;
}

.site-title {
  font-size: 1.6rem;
  text-align: center;
  margin: 0 0 0.4rem;
}

.recipes-assistant-wrapper {
  width: min(1000px, 95vw);
  margin: 1.5rem auto;
  padding: 0 1rem 2.25rem;
  background: var(--card);
  box-sizing: border-box;
}

body.simple-mode .advanced-field {
  display: none;
}

.recipes-assistant-wrapper h2 {
  text-align: center;
  margin-bottom: 0.25rem;
}

.query-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.inline-simple-mode {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 500;
  font-size: 0.9rem;
}

.inline-simple-mode input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  border-radius: 4px;
  border: 2px solid var(--border);
  appearance: auto;
  -webkit-appearance: auto;
}

.recipes-assistant-wrapper p.sub {
  text-align: center;
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.field-help {
  font-weight: 400;
  display: block;
  font-size: 0.8rem;
}

/* Form */

.recipes-form {
  background: var(--panel);
  padding: 1rem 1.2rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}

.recipes-field-group {
  display: grid;
  gap: 0.35rem;
}

.recipes-field-group label {
  font-size: 0.9rem;
  font-weight: 600;
}

.recipes-form input[type="text"],
.recipes-form input[type="number"],
.recipes-form select {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  font-size: 0.9rem;
  box-sizing: border-box;
  background: var(--panel);
  color: var(--text);
}

.recipes-form input[type="text"]:focus,
.recipes-form input[type="number"]:focus,
.recipes-form select:focus {
  border-color: var(--accent);
  outline: none;
}

.recipes-inline-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.6rem;
}

.recipes-checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.3rem 0.75rem;
  font-size: 0.85rem;
}

.recipes-checkbox-group label {
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.recipes-form button {
  margin-top: 0.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.recipes-form button:hover {
  background: var(--primary-dark);
}

#recipes-status {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

#recipes-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.15);
  transition:
    width 0.2s ease,
    opacity 0.2s ease;
  opacity: 0;
  z-index: 2600;
  pointer-events: none;
}
#recipes-loading-bar.visible {
  width: 100%;
  opacity: 1;
}

/* Recipes grid */

.recipes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.recipe-card {
  background: var(--panel);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
}

.recipe-card img {
  width: 100%;
  display: block;
  object-fit: cover;
  max-height: 180px;
}

.recipe-card-image-wrapper {
  position: relative;
}

.recipe-card-badges {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
}

.notebook-bookmark,
.favorite-heart {
  background: #0d6efd;
  color: #fff;
  border: 1px solid #0d6efd;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  transition:
    transform 0.1s ease,
    background 0.2s ease;
  box-shadow: var(--shadow);
}

.favorite-heart.is-fav {
  background: #0d6efd;
  border-color: #0d6efd;
  color: #ef4444;
}

.favorite-heart:hover {
  transform: scale(1.05);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
}

.notebook-bookmark {
  color: #fff;
  background: #0d6efd;
  border-color: #0d6efd;
}

.notebook-bookmark.is-noted {
  background: #e63946;
  border-color: #e63946;
}

.notebook-bookmark.nb-saved {
  background: #2ecc71 !important;
  border-color: #2ecc71 !important;
  color: #fff !important;
  border-radius: 6px;
  padding: 2px 6px;
}

.notebook-bookmark.nb-exists {
  background: #f39c12 !important;
  border-color: #f39c12 !important;
  color: #fff !important;
  border-radius: 6px;
  padding: 2px 6px;
}

.notebook-remove {
  background: #e63946;
  border: 1px solid #e63946;
  color: #fff;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition:
    transform 0.1s ease,
    background 0.2s ease;
}

.notebook-remove:hover {
  transform: scale(1.05);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
}

.notebook-bookmark:hover {
  transform: scale(1.05);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
}

.recipe-card-body {
  padding: 0.8rem 0.9rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.recipe-card-title {
  font-size: 1rem;
  font-weight: 600;
}

.recipe-card-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.recipe-card button {
  align-self: flex-start;
  margin-top: 0.3rem;
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.recipe-card button:hover {
  background: #0d47a1;
}

.recipe-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.25rem;
}

.btn-favorite {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-favorite:hover {
  background: rgba(21, 101, 192, 0.08);
}

.account-wrapper {
  margin-top: 1rem;
}

.account-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1rem;
}

.account-tabs-vertical {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.account-tab {
  padding: 0.6rem 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  color: var(--muted);
}

.account-tab:hover {
  border-color: var(--accent);
  color: var(--text);
}

.account-tab.active {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.tab-content {
  display: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem;
  box-shadow: var(--shadow);
}

.tab-content.active {
  display: block;
}

.favorites-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.favorite-lists {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.favorite-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.favorite-list-item.active {
  border-color: var(--accent);
  background: rgba(21, 101, 192, 0.08);
}

.favorite-list-item.active .favorite-list-select {
  color: var(--accent);
  font-weight: 600;
}

.favorite-list-actions button {
  margin-left: 0.4rem;
}

.favorites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
}

.favorite-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.favorite-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
}

.favorite-card-body {
  padding: 0.6rem 0.7rem;
}

.notebook-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.notebook-toggle {
  display: flex;
  justify-content: flex-start;
  margin: 0.5rem 0 0.25rem;
}

.notebook-toggle-btn {
  border: none;
  background: var(--primary);
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: var(--shadow);
}

.notebook-toggle-btn.open {
  background: var(--primary-dark);
}

.notebook-forms {
  display: none;
  margin-bottom: 0.75rem;
}

.notebook-forms.open {
  display: block;
}

.notebook-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0 0.4rem;
}

.nf-btn {
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 0.3rem 0.8rem;
  background: var(--panel);
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--muted);
}

.nf-btn.nf-active {
  border-color: var(--accent);
  background: rgba(21, 101, 192, 0.08);
  color: var(--accent);
  font-weight: 600;
}

.notebook-list {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.notebook-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem;
  background: var(--panel);
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.6rem;
}

.notebook-card h4 {
  margin: 0;
}

.notebook-form {
  display: grid;
  gap: 0.5rem;
}

.notebook-form label {
  display: grid;
  gap: 0.25rem;
  font-weight: 600;
  color: var(--text);
}

.notebook-form input[type="text"],
.notebook-form input[type="url"],
.notebook-form textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  box-sizing: border-box;
}

.notebook-form textarea {
  resize: vertical;
}

.notebook-form button {
  justify-self: flex-start;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.notebook-form button:hover {
  background: var(--primary-dark);
}

.favorite-card-title {
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.favorite-card-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}

.btn-notebook {
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--primary);
  background: #e7f1ff;
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
}

.btn-notebook.is-noted {
  background: #ffe5e8;
  color: #e63946;
  border-color: #e63946;
}

.info-field {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.7rem;
}

#account-main-logout {
  align-self: flex-start;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}

#account-main-logout:hover {
  background: var(--primary-dark);
}

@media (max-width: 700px) {
  .account-layout {
    grid-template-columns: 1fr;
  }

  .account-tabs-vertical {
    flex-direction: row;
    gap: 0.6rem;
  }
}

@media (max-width: 768px) {
  .site-header .header-inner {
    flex-wrap: wrap;
  }
  .mobile-icons {
    display: inline-flex;
    margin-left: auto;
  }
  .mobile-menu-toggle {
    display: inline-flex;
  }
  .site-header nav {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 70%;
    max-width: 320px;
    background: var(--panel);
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.3);
    transform: translateX(100%);
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 1rem;
    padding-top: calc(1rem + env(safe-area-inset-top));
    z-index: 7000;
    overflow-y: auto;
    visibility: hidden;
    pointer-events: none;
  }
  .site-header nav.open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }
  .site-header nav a,
  .site-header nav button {
    width: 100%;
    text-align: left;
  }
  .recipes-assistant-wrapper {
    padding: 0.8rem 1rem 2rem;
  }
  .recipes-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
  .auth-card {
    padding: 1.2rem;
  }
  .account-tabs-vertical {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .account-layout {
    flex-direction: column;
  }
  .account-tab {
    flex: 1 1 120px;
    text-align: center;
  }
  .favorite-list-item {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 540px) {
  .query-label-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .recipes-form {
    padding: 0.8rem;
  }
  .recipes-assistant-wrapper {
    padding: 0.8rem;
  }
  .recipes-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }
  .vision-previews {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}

#more-recipes-btn {
  margin: 1.5rem auto 0;
  display: none;
  padding: 0.6rem 1.3rem;
  border-radius: 999px;
  border: none;
  background: #424242;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}

#more-recipes-btn.open {
  display: block;
}

#more-recipes-btn:hover {
  background: #212121;
}

/* Mode switches */
.mode-switches {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: var(--shadow);
  user-select: none;
  touch-action: manipulation;
}

.mode-switch input {
  accent-color: var(--accent);
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  margin: 0;
}

.mode-switch input,
.mode-switch span {
  cursor: pointer;
}

.auth-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.auth-status {
  font-size: 0.85rem;
  color: var(--muted);
}

#account-status {
  margin-top: 0.35rem;
  margin-bottom: 0.6rem;
}

.link-button {
  background: transparent;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
}

.auth-page {
  display: flex;
  justify-content: center;
  padding: 2rem 0 3rem;
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  width: min(480px, 92vw);
  padding: 1.6rem 1.65rem 1.9rem;
  text-align: center;
  margin: 0 auto;
  box-sizing: border-box;
}

.auth-form {
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
}

.auth-sub {
  color: var(--muted);
  margin-top: -0.35rem;
  margin-bottom: 1rem;
}

.auth-form {
  display: grid;
  gap: 0.85rem;
  text-align: left;
}

.auth-form label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
  color: var(--text);
}

.auth-form input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.btn-primary,
.btn-secondary {
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-secondary {
  background: var(--accent);
  color: #fff;
}

/* Loading indicator */

.loading-animated {
  position: relative;
  padding-left: 1.4rem;
}
.loading-animated::before {
  content: "";
  position: absolute;
  left: 0.2rem;
  top: 50%;
  width: 0.7rem;
  height: 0.7rem;
  margin-top: -0.35rem;
  border-radius: 50%;
  border: 2px solid #999;
  border-top-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Modal */

.recipe-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.recipe-modal-overlay.open {
  display: flex;
}

.recipe-modal {
  background: var(--modal);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.18s ease-out;
  color: var(--text);
}

@keyframes modalIn {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.recipe-modal-header {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.recipe-modal-title {
  font-size: 1.05rem;
  font-weight: 600;
}

.recipe-modal-source {
  font-size: 0.8rem;
  color: var(--muted);
}

.recipe-modal-source a {
  color: var(--accent);
  text-decoration: none;
}
.recipe-modal-source a:hover {
  text-decoration: underline;
}

.recipe-modal-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  color: var(--text);
}

.recipe-modal-body {
  padding: 0.75rem 1rem 1rem;
  overflow-y: auto;
}

.recipe-modal-body h4 {
  margin: 0.2rem 0 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.recipe-modal-body ul,
.recipe-modal-body ol {
  margin: 0 0 0.7rem 1.1rem;
  padding: 0;
  font-size: 0.9rem;
}

.recipe-modal-body li {
  margin-bottom: 0.25rem;
}

.recipe-modal-body .recipe-meta-small {
  font-size: 0.8rem;
  color: #777;
  margin-bottom: 0.6rem;
}

.servings-control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.7rem;
  font-size: 0.9rem;
}

.servings-control input {
  width: 70px;
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 0.9rem;
}

.servings-base {
  font-size: 0.8rem;
  color: #777;
}

/* Instacart button */

.instacart-block {
  margin: 0.5rem 0 0.8rem;
}

.instacart-btn {
  border-radius: 999px;
  border: none;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  background: #00b26f;
  color: #fff;
}
.instacart-btn:hover {
  background: #00915b;
}

.instacart-btn + .instacart-btn {
  margin-left: 0.5rem;
}

.instacart-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.4rem 0;
}

/* Footer */

.site-footer {
  border-top: 1px solid #ddd;
  background: #ffffff;
  padding: 0.8rem 1rem;
  width: 100%;
}

.footer-inner {
  width: min(1000px, 95vw);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #555;
}

.footer-links {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.footer-links a {
  color: #1565c0;
  text-decoration: none;
}
.footer-links a:hover {
  text-decoration: underline;
}
.recipe-card-source {
  font-size: 0.8rem;
  color: var(--muted);
}

.recipe-card-source a {
  color: var(--accent);
  text-decoration: none;
}
.recipe-card-source a:hover {
  text-decoration: underline;
}

/* Chips input */
.chips-input {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid #dcdfe4;
  border-radius: 8px;
  background: var(--panel);
  position: relative;
}

.chips-input input {
  border: none;
  flex: 1;
  min-width: 140px;
  padding: 0.4rem 0.5rem;
  outline: none;
}

.suggestions-wrapper {
  position: relative;
  width: 100%;
}

.suggestions-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  width: 100%;
  max-height: 220px;
  overflow-y: auto;
  z-index: 999;
  display: none;
  padding: 0.4rem;
  gap: 0.4rem;
  flex-wrap: wrap;
  flex-direction: row;
}

.suggestions-panel.open {
  display: flex;
}

.suggestions-panel .suggestion-item {
  all: unset;
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 0.35rem 0.75rem;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
  border-radius: 999px;
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.suggestions-panel .suggestion-item:hover,
.suggestions-panel .suggestion-item:focus {
  background: rgba(21, 101, 192, 0.08);
}

.suggestions-panel .suggestion-item:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 2500;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 0.65rem 1rem;
}

.site-header .header-inner {
  width: min(1000px, 95vw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-header .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}

.mobile-menu-toggle {
  display: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text);
}

.site-header nav {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.site-header nav a,
.site-header nav button {
  color: var(--accent);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  line-height: 1.1;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}

.site-header nav button {
  color: var(--primary);
}

.account-link-icon::before {
  content: "👤 ";
}

.favorites-link-icon::before {
  content: "⭐ ";
}

.forum-link-icon::before {
  content: "💬 ";
}

.notebook-link-icon::before {
  content: "🔖 ";
}

.home-link::before {
  content: "🏠 ";
}

.nav-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.mobile-icons {
  display: none;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  z-index: 3200;
}

.mobile-account-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  background: var(--panel);
  font-size: 1.2rem;
  z-index: 3200;
}

@media (max-width: 768px) {
  .site-header .header-inner {
    flex-wrap: wrap;
  }
  .mobile-icons {
    display: inline-flex;
    margin-left: auto;
  }
  .mobile-menu-toggle {
    display: inline-flex;
  }
  .site-header nav {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 70%;
    max-width: 320px;
    background: var(--panel);
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.3);
    transform: translateX(100%);
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 1rem;
    padding-top: calc(1rem + env(safe-area-inset-top));
    z-index: 7000;
    overflow-y: auto;
    visibility: hidden;
    pointer-events: none;
  }
  .site-header nav.open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }
  .site-header nav a,
  .site-header nav button {
    width: 100%;
    text-align: left;
  }
}

.list-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.list-picker-overlay.open {
  display: flex;
}

.list-picker {
  background: var(--panel);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 1rem;
  max-width: 360px;
  width: 90%;
  display: grid;
  gap: 0.6rem;
  color: var(--text);
  border: 1px solid var(--border);
}

.list-picker h4 {
  margin: 0;
  font-size: 1rem;
}

.list-picker .list-options {
  display: grid;
  gap: 0.35rem;
}

.list-picker .list-option {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  color: var(--text);
}

.list-picker .list-option:hover {
  background: rgba(21, 101, 192, 0.08);
}

.list-picker .new-list {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.list-picker .new-list input {
  flex: 1;
  padding: 0.35rem 0.45rem;
  border: 1.5px solid var(--border);
  background: var(--panel);
  color: var(--text);
}

.vision-upload {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
  align-items: start;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.vision-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  margin-right: 6px;
  vertical-align: middle;
  animation: spin 0.8s linear infinite;
}

.vision-upload + .chips-input {
  margin-top: 0.4rem;
}

.vision-status {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.chips-input .link-button {
  margin-top: 0.3rem;
}

.vision-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text);
}

.vision-previews {
  display: grid;
  grid-template-columns: repeat(3, minmax(80px, 1fr));
  gap: 0.4rem;
  width: 100%;
}

.vision-preview-slot {
  border: 1px dashed var(--border);
  border-radius: 10px;
  aspect-ratio: 4 / 3;
  background: #f9fafb;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.vision-preview-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vision-preview-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  line-height: 1;
}

.vision-label input {
  display: none;
}

.vision-upload button {
  border: none;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
}

.vision-upload button:hover {
  opacity: 0.9;
}

.vision-upload button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.vision-status {
  font-size: 0.85rem;
  color: var(--muted);
}

.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #eef3ff;
  color: #1f3a64;
  border-radius: 16px;
  padding: 0.25rem 0.6rem;
  font-size: 0.9rem;
}

.chip button {
  background: transparent;
  border: none;
  color: #1f3a64;
  cursor: pointer;
  font-weight: 700;
}

.chip button:focus {
  outline: 2px solid #e53935;
  outline-offset: 2px;
}

.favorite-actions-overlay {
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  display: flex;
  justify-content: flex-start;
  gap: 6px;
  pointer-events: none;
  align-items: center;
}

.favorite-actions-right {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.fav-remove,
.fav-move {
  border: none;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}

.fav-move {
  transform: translateX(-2px);
}

.favorite-actions-overlay .notebook-bookmark {
  pointer-events: auto;
}

@media (pointer: coarse) {
  .fav-remove,
  .fav-move {
    width: 38px;
    height: 38px;
    font-size: 1.25rem;
  }
}

.recipe-card-source a {
  color: var(--accent);
}

.back-home {
  margin: 0.5rem 0 1rem;
}
.back-home a {
  color: var(--accent);
  font-weight: 600;
}

.back-home-spaced {
  margin-top: 2rem;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 4000;
}

.image-lightbox.open {
  display: flex;
}

.image-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}
.image-lightbox-content {
  position: relative;
  background: #000;
  padding: 0.5rem;
  border-radius: 10px;
  max-width: 90vw;
  max-height: 90vh;
  z-index: 4001;
}
.image-lightbox-content img {
  max-width: 90vw;
  max-height: 80vh;
  display: block;
}
#img-lightbox-close {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
}
