:root {
  --paper: #f4ead5;
  --paper-deep: #eadfbf;
  --card: #fffbea;
  --card-alt: #fffdf6;
  --ink: #1f2a44;
  --ink-muted: #5a6274;
  --ink-light: #8a8373;
  --red: #b23a48;
  --green: #3d6945;
  --amber: #b9782f;
  --line: #d6cdb2;
  --line-strong: #b9ad8a;
  --accent: #1e3a5f;

  --font-display: "Caveat", "Patrick Hand", cursive;
  --font-body: "Patrick Hand", "Caveat", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  /* Reserve the scrollbar gutter on every page so navigating between a page
     that scrolls and one that doesn't never shifts centered content. */
  scrollbar-gutter: stable;
  overflow-y: scroll; /* fallback for browsers without scrollbar-gutter */
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.35), transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(185, 173, 138, 0.18), transparent 50%);
  background-attachment: fixed;
  min-height: 100vh;
}

.masthead {
  text-align: center;
  padding: 48px 16px 16px;
}

.title {
  font-family: var(--font-display);
  font-size: clamp(56px, 9vw, 92px);
  color: var(--ink);
  margin: 0;
  letter-spacing: 1px;
  line-height: 0.95;
}

.tagline {
  font-family: var(--font-body);
  color: var(--ink-muted);
  font-size: clamp(18px, 2.2vw, 22px);
  margin: 8px 0 0;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 20px 48px;
}

/* search */
.search-stick {
  position: sticky;
  top: 62px; /* matches auth-bar height (14px top + 38px button + 10px bottom) */
  z-index: 30; /* below auth-bar (40), drawer-backdrop (50), drawer (60) */
  background: var(--paper);
  /* Full-screen-width strip; the search-wrap inside self-centers via its own
     max-width and margin: 0 auto. Padding on the strip provides the paper
     buffer above and below the box so tiles scroll cleanly underneath. */
  padding: 16px 20px 18px;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  padding: 10px 16px;
  margin: 0 auto;
  max-width: 720px;
  box-shadow: 0 1px 0 rgba(31, 42, 68, 0.04);
}

.search-icon {
  color: var(--ink-light);
  flex: 0 0 auto;
}

#search {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 20px;
  color: var(--ink);
  padding: 4px 0;
}

#search::placeholder {
  color: var(--ink-light);
}

/* filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  justify-content: center;
  margin-bottom: 18px;
}

.filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
}

.filter-label {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--accent);
  padding-left: 6px;
}

.filter select {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--ink);
  background: var(--card-alt);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 8px 36px 8px 12px;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231e3a5f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
  cursor: pointer;
  transition: border-color 120ms ease;
}

.filter select:hover,
.filter select:focus {
  border-color: var(--accent);
  outline: none;
}

.clear-btn {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--accent);
  background: transparent;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  align-self: end;
}

.clear-btn:hover {
  background: rgba(30, 58, 95, 0.08);
}

/* results count */
.result-count {
  text-align: center;
  color: var(--ink-muted);
  font-size: 16px;
  margin: 6px 0 18px;
}

/* grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.tile {
  background: var(--card-alt);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
  box-shadow: 0 1px 0 rgba(31, 42, 68, 0.04);
}

.tile:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(31, 42, 68, 0.1);
}

.tile-img-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--paper-deep);
  overflow: hidden;
}

.tile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 240ms ease;
}

.tile:hover .tile-img {
  transform: scale(1.04);
}

.tile-body {
  padding: 12px 14px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tile-name {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--ink);
  line-height: 1.05;
  margin: 0;
}

.tile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 16px;
  color: var(--ink-muted);
  margin-top: auto;
}

.tile-meta .dot {
  color: var(--ink-light);
}

.tile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.tag {
  font-size: 14px;
  background: var(--paper-deep);
  color: var(--ink-muted);
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  padding: 2px 10px;
}

.tag.diet-vegan { color: var(--green); }
.tag.diet-vegetarian { color: var(--green); }
.tag.diet-gluten-free { color: var(--amber); }
.tag.diet-pescatarian { color: var(--accent); }

.tile-rating {
  display: flex;
  align-items: center;
  font-size: 15px;
  color: var(--ink-muted);
  margin-top: 2px;
}

.rating {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.stars {
  color: var(--amber);
  letter-spacing: 1px;
  font-size: 17px;
}

.rating-num {
  color: var(--ink-muted);
  font-size: 14px;
}

.rating-empty {
  font-size: 14px;
  color: var(--ink-light);
  font-style: italic;
}

.empty {
  text-align: center;
  color: var(--ink-muted);
  font-size: 20px;
  padding: 40px 16px;
}

.footer {
  text-align: center;
  color: var(--ink-light);
  font-size: 14px;
  padding: 32px 16px;
}

.my-recipes-header {
  margin: 16px 0 18px;
}

.my-recipes-title {
  font-family: var(--font-display);
  font-size: 52px;
  color: var(--ink);
  margin: 0;
  line-height: 1;
}

.my-recipes-sub {
  margin: 4px 0 0;
  color: var(--ink-muted);
  font-size: 17px;
}

.badges-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.badge-card {
  background: var(--card-alt);
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 0 rgba(31, 42, 68, 0.04);
}

.badge-card.is-mine {
  background: var(--card);
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(30, 58, 95, 0.12);
}

.badge-card-icon {
  font-size: 44px;
  line-height: 1;
  text-align: center;
}

.badge-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.badge-card-level {
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--ink-light);
}

.badge-card-title {
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--accent);
  margin: 0;
  line-height: 1;
}

.badge-card-vibe {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--ink-muted);
  margin: 2px 0 0;
}

.badge-card-here {
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--card-alt);
  background: var(--accent);
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

@media (max-width: 540px) {
  .badge-card {
    grid-template-columns: 48px 1fr;
  }
  .badge-card-icon {
    font-size: 36px;
  }
  .badge-card-here {
    grid-column: 1 / -1;
    justify-self: start;
    margin-top: 4px;
  }
}

.fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 25; /* below sticky bars (40) and drawer (60) */
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 0.5px;
  color: var(--card-alt);
  background: var(--accent);
  text-decoration: none;
  padding: 10px 22px 12px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(31, 42, 68, 0.28);
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 120ms ease;
}

.fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(31, 42, 68, 0.34);
}

.fab:active {
  transform: translateY(0);
}

.fab-plus {
  font-size: 30px;
  line-height: 1;
  font-family: var(--font-body);
  margin-top: -2px;
}

@media (max-width: 540px) {
  .fab {
    right: 14px;
    bottom: 14px;
    font-size: 20px;
    padding: 8px 18px 10px;
  }
}

@media (max-width: 540px) {
  .masthead {
    padding-top: 28px;
  }
  .filter {
    min-width: 140px;
    flex: 1 1 calc(50% - 12px);
  }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
  }
  .tile-name {
    font-size: 24px;
  }
}

/* ---- recipe detail page ------------------------------------------------ */

.topbar-wrap {
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
}

.topbar {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.subnav {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 24px 0;
}

.subnav .back-link {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: border-color 120ms ease;
}

.subnav .back-link:hover {
  border-bottom-color: var(--accent);
}

.back-link {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: border-color 120ms ease;
}

.back-link:hover {
  border-bottom-color: var(--accent);
}

.brand {
  font-family: var(--font-display);
  font-size: 32px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 1px;
}

.recipe-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 24px 64px;
}

.recipe-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin-bottom: 32px;
}

.recipe-hero-img-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--paper-deep);
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(31, 42, 68, 0.04);
}

.recipe-hero-img-wrap.no-image {
  display: none;
}

.recipe-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.recipe-hero-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 4px;
}

.recipe-title {
  font-family: var(--font-display);
  font-size: clamp(44px, 6vw, 64px);
  color: var(--ink);
  line-height: 1;
  margin: 0;
}

.recipe-description {
  margin: 0;
  font-size: 19px;
  color: var(--ink-muted);
  line-height: 1.5;
}

.recipe-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-soft {
  background: var(--card-alt);
  color: var(--ink-muted);
}

.recipe-rating-line {
  font-size: 16px;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.recipe-rating-line .dot {
  color: var(--ink-light);
}

.my-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 16px;
  color: var(--ink-muted);
  min-height: 28px;
}

.my-rating:empty {
  display: none;
}

.my-rating-label {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
}

.my-rating-locked {
  color: var(--amber);
  font-size: 22px;
  letter-spacing: 2px;
  cursor: default;
}

.my-rating-signin {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent);
  font-size: 17px;
}

.my-rating-signin:hover {
  background: rgba(30, 58, 95, 0.06);
}

.my-rating-stars {
  display: inline-flex;
  flex-direction: row-reverse;
  gap: 2px;
}

.my-rating-star {
  font-size: 26px;
  line-height: 1;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--ink-light);
  cursor: pointer;
  transition: color 80ms ease, transform 80ms ease;
}

.my-rating-star:hover,
.my-rating-star:focus-visible,
.my-rating-star:hover ~ .my-rating-star,
.my-rating-star:focus-visible ~ .my-rating-star {
  color: var(--amber);
  outline: none;
}

.my-rating-star:hover {
  transform: scale(1.08);
}

.my-rating-star:disabled {
  cursor: default;
  opacity: 0.6;
}

.my-rating-msg {
  font-size: 14px;
  color: var(--red);
}

.favorite-control:empty {
  display: none;
}

.favorite-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--accent);
  background: var(--card);
  border: 1px dashed var(--accent);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.favorite-btn:hover {
  background: rgba(178, 58, 72, 0.06);
  border-color: var(--red);
  color: var(--red);
}

.favorite-btn.is-favorite {
  background: rgba(178, 58, 72, 0.1);
  border-color: var(--red);
  color: var(--red);
}

.favorite-heart {
  font-size: 20px;
  line-height: 1;
}

.favorite-btn.is-favorite .favorite-heart {
  color: var(--red);
}

.favorite-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
  font-size: 17px;
  color: var(--ink);
  padding: 12px 16px;
  background: var(--card);
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
}

.meta-key {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--accent);
  margin-right: 4px;
}

.meta-sep {
  color: var(--ink-light);
  margin: 0 8px;
}

.recipe-source {
  margin: 4px 0 0;
  font-size: 16px;
}

.recipe-source a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent);
}

.recipe-cols {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr);
  gap: 24px;
  align-items: start;
}

.recipe-card {
  background: var(--card-alt);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  padding: 20px 22px 22px;
  box-shadow: 0 1px 0 rgba(31, 42, 68, 0.04);
}

.recipe-section-title {
  font-family: var(--font-display);
  font-size: 36px;
  color: var(--accent);
  margin: 0 0 12px;
  line-height: 1;
}

.ingredients {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ingredients li {
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 18px;
  color: var(--ink);
}

.ingredients li:last-child {
  border-bottom: 0;
}

.ingredient-qty {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--accent);
  margin-right: 6px;
}

.ingredient-notes {
  color: var(--ink-light);
  font-style: italic;
}

.steps {
  margin: 0;
  padding-left: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 10px 0 14px 48px;
  border-bottom: 1px dashed var(--line);
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
}

.steps li:last-child {
  border-bottom: 0;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--accent);
  background: var(--paper-deep);
  border: 1px dashed var(--line-strong);
  border-radius: 50%;
}

@media (max-width: 860px) {
  .recipe-hero {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .recipe-cols {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .recipe-main {
    padding: 16px 18px 48px;
  }
  .topbar {
    padding: 14px 18px 0;
  }
}

@media (max-width: 540px) {
  .brand {
    font-size: 26px;
  }
  .recipe-section-title {
    font-size: 30px;
  }
}

/* ---- auth widget (shown on index + recipe pages) ---------------------- */

.auth-bar {
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
}

.auth-bar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auth-widget {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
}

.auth-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: border-color 120ms ease;
}

.auth-link:hover {
  border-bottom-color: var(--accent);
}

.auth-sep {
  color: var(--ink-light);
}

.auth-greeting {
  color: var(--ink);
}

.auth-logout {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--accent);
  background: transparent;
  border: 1px dashed var(--accent);
  border-radius: 999px;
  padding: 2px 10px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.auth-logout:hover {
  background: var(--accent);
  color: var(--card-alt);
}

/* ---- login page ------------------------------------------------------- */

.auth-page {
  max-width: 460px;
  margin: 32px auto 64px;
  padding: 0 20px;
}

/* Wider variant — matches the topbar/subnav content area so the card aligns
   with "‹ Back to recipes" on the left and the Log out button on the right. */
.auth-page--wide {
  max-width: 1180px;
  padding: 0 24px;
}

.auth-card {
  background: var(--card-alt);
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  padding: 24px 28px 28px;
  box-shadow: 0 1px 0 rgba(31, 42, 68, 0.04);
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  border-bottom: 1px dashed var(--line);
}

.auth-tab {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--ink-light);
  background: transparent;
  border: 0;
  padding: 4px 8px 8px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: color 120ms ease, border-color 120ms ease;
}

.auth-tab:hover {
  color: var(--ink);
}

.auth-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-field > span {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--accent);
  padding-left: 6px;
}

.auth-field input {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--ink);
  background: var(--card);
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 120ms ease;
}

.auth-field input:focus {
  border-color: var(--accent);
}

.auth-hint {
  font-size: 13px;
  color: var(--ink-light);
  padding-left: 6px;
}

.auth-submit {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--card-alt);
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  margin-top: 6px;
  letter-spacing: 0.5px;
  transition: opacity 120ms ease;
}

.auth-submit:hover {
  opacity: 0.92;
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-error {
  margin: 0;
  padding: 8px 12px;
  background: rgba(178, 58, 72, 0.08);
  border: 1px dashed var(--red);
  color: var(--red);
  border-radius: 8px;
  font-size: 16px;
}

.google-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}

.google-btn {
  display: flex;
  justify-content: center;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-light);
  font-size: 15px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-top: 1px dashed var(--line);
}

.settings-title {
  font-family: var(--font-display);
  font-size: 44px;
  color: var(--ink);
  margin: 0 0 6px;
  line-height: 1;
}

.settings-who {
  margin: 0 0 18px;
  color: var(--ink-muted);
  font-size: 17px;
}

.settings-section {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--accent);
  margin: 4px 0 4px;
  line-height: 1;
}

.profile-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--paper-deep);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  margin: 0 0 20px;
}

.profile-badge-icon {
  font-size: 38px;
  line-height: 1;
  flex: 0 0 auto;
}

.profile-badge-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.profile-badge-label {
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--ink-light);
}

.profile-badge-title {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--accent);
  line-height: 1;
}

.profile-badge-vibe {
  font-size: 15px;
  color: var(--ink-muted);
}

.profile-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.photo-uploader {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.photo-preview {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--paper-deep);
  border: 1px dashed var(--line-strong);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-preview-fallback {
  font-family: var(--font-display);
  font-size: 48px;
  color: var(--accent);
  line-height: 1;
}

.photo-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

@media (max-width: 540px) {
  .profile-row {
    grid-template-columns: 1fr;
  }
}

.auth-success {
  margin: 0;
  padding: 8px 12px;
  background: rgba(61, 105, 69, 0.08);
  border: 1px dashed var(--green);
  color: var(--green);
  border-radius: 8px;
  font-size: 16px;
}

.admin-badge {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--card-alt);
  background: var(--accent);
  padding: 1px 8px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 4px;
}

/* ---- drawer (slide-out side menu) ------------------------------------ */

.drawer-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--card);
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  flex: 0 0 auto;
  transition: border-color 120ms ease, background 120ms ease;
}

.drawer-toggle:hover {
  border-color: var(--accent);
  background: var(--card-alt);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(31, 42, 68, 0.45);
  z-index: 50;
  opacity: 0;
  transition: opacity 200ms ease;
}

.drawer-backdrop.is-open {
  opacity: 1;
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(280px, 80vw);
  background: var(--card-alt);
  border-right: 1px dashed var(--line-strong);
  box-shadow: 6px 0 24px rgba(31, 42, 68, 0.12);
  z-index: 60;
  transform: translateX(-100%);
  transition: transform 220ms ease;
  display: flex;
  flex-direction: column;
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 18px 14px;
  border-bottom: 1px dashed var(--line);
}

.drawer-title {
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--ink);
  line-height: 1;
}

.drawer-head-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.drawer-id {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.drawer-avatar {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--paper-deep);
  border: 1px dashed var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
}

.drawer-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.drawer-avatar-fallback {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--accent);
  line-height: 1;
}

.drawer-user {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.drawer-user-name {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--ink);
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.drawer-user-email {
  font-size: 14px;
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-user-badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 3px 10px;
  background: var(--paper-deep);
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  max-width: 100%;
}

.drawer-user-badge-icon {
  font-size: 16px;
  line-height: 1;
}

.drawer-user-badge-title {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--accent);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-close {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  border-radius: 999px;
  transition: background 120ms ease, color 120ms ease;
}

.drawer-close:hover {
  background: var(--paper-deep);
  color: var(--ink);
}

.drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 12px 18px;
}

.drawer-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 19px;
  color: var(--ink);
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
}

.drawer-item:hover {
  background: var(--paper-deep);
}

.drawer-item.is-active {
  background: var(--paper-deep);
  color: var(--accent);
}

.drawer-foot {
  margin-top: auto;
  padding: 14px 18px 18px;
  border-top: 1px dashed var(--line);
  display: flex;
}

.drawer-signin,
.drawer-signout {
  flex: 1;
  font-family: var(--font-body);
  font-size: 17px;
  text-align: center;
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease, opacity 120ms ease;
}

.drawer-signin {
  color: var(--card-alt);
  background: var(--accent);
  border: 1px solid var(--accent);
}

.drawer-signin:hover {
  opacity: 0.92;
}

.drawer-signout {
  color: var(--accent);
  background: transparent;
  border: 1px dashed var(--accent);
}

.drawer-signout:hover {
  background: rgba(30, 58, 95, 0.08);
}

/* ---- admin page ------------------------------------------------------ */

.admin-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 24px 64px;
}

.admin-header {
  margin: 8px 0 18px;
}

.admin-title {
  font-family: var(--font-display);
  font-size: 52px;
  color: var(--ink);
  margin: 0;
  line-height: 1;
}

.admin-sub {
  margin: 4px 0 0;
  color: var(--ink-muted);
  font-size: 17px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.6fr);
  gap: 22px;
  align-items: start;
}

.admin-section-title {
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--accent);
  margin: 0 0 8px;
  line-height: 1;
}

.admin-list-card,
.admin-edit-card {
  background: var(--card-alt);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  padding: 18px 20px 20px;
  box-shadow: 0 1px 0 rgba(31, 42, 68, 0.04);
}

.admin-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 70vh;
  overflow: auto;
}

.admin-list-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  border-bottom: 1px dashed var(--line);
  text-align: left;
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--ink);
  transition: background 120ms ease;
}

.admin-list-item:hover {
  background: var(--paper-deep);
}

.admin-list-item.is-active {
  background: var(--paper-deep);
}

.admin-list-title {
  font-size: 18px;
}

.admin-list-meta {
  font-size: 14px;
  color: var(--ink-muted);
}

.admin-edit-empty {
  margin: 0;
  color: var(--ink-muted);
  font-size: 16px;
  padding: 8px 0;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.admin-form textarea,
.admin-form select {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--ink);
  background: var(--card);
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 120ms ease;
  resize: vertical;
}

.admin-form textarea:focus,
.admin-form select:focus {
  border-color: var(--accent);
}

.admin-fieldset {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px 14px 14px;
  margin: 0;
}

.admin-fieldset legend {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--accent);
  padding: 0 6px;
}

.admin-ing-list,
.admin-step-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.admin-ing-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.5fr) minmax(0, 0.6fr) minmax(0, 1.2fr) auto;
  gap: 6px;
  align-items: center;
}

.admin-ing-row input {
  min-width: 0;
  width: 100%;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--ink);
  background: var(--card);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 6px 10px;
  outline: none;
}

.admin-ing-row input:focus {
  border-color: var(--accent);
}

.admin-step-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: start;
}

.admin-step-row textarea {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--ink);
  background: var(--card);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 8px 10px;
  outline: none;
  resize: vertical;
}

.admin-step-row textarea:focus {
  border-color: var(--accent);
}

.admin-row-remove {
  width: 30px;
  height: 30px;
  font-size: 20px;
  line-height: 1;
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 999px;
  color: var(--ink-light);
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
}

.admin-row-remove:hover {
  color: var(--red);
  border-color: var(--red);
}

.admin-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.admin-btn {
  font-family: var(--font-body);
  font-size: 16px;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.admin-btn-primary {
  color: var(--card-alt);
  background: var(--accent);
  border: 1px solid var(--accent);
}

.admin-btn-primary:hover {
  opacity: 0.92;
}

.admin-btn-ghost {
  color: var(--accent);
  background: transparent;
  border: 1px dashed var(--accent);
}

.admin-btn-ghost:hover {
  background: rgba(30, 58, 95, 0.08);
}

.admin-btn-danger {
  color: var(--red);
  background: transparent;
  border: 1px dashed var(--red);
}

.admin-btn-danger:hover {
  background: rgba(178, 58, 72, 0.08);
}

a.admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.recipe-admin-edit {
  align-self: flex-start;
  width: fit-content;
  margin-top: 4px;
}

/* ---- Picture URL preview (submit + admin forms) ---- */

.picture-preview {
  margin-top: 8px;
  padding: 8px;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 10px;
}

.picture-preview-img {
  display: block;
  max-width: 100%;
  max-height: 280px;
  margin: 0 auto;
  border-radius: 8px;
  object-fit: contain;
}

.picture-preview-msg {
  margin: 0;
  font-size: 14px;
  color: var(--ink-muted);
}

.picture-preview-msg:empty {
  display: none;
}

.picture-preview.is-error .picture-preview-msg {
  color: var(--red);
}

/* ---- Admin: manage users ---- */

.admin-search {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--ink);
  background: var(--card);
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
  outline: none;
}

.admin-search:focus {
  border-color: var(--accent);
}

.user-detail-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.user-detail-head .photo-preview {
  width: 64px;
  height: 64px;
}

.user-detail-name {
  font-size: 22px;
  color: var(--ink);
}

.user-detail-grid {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 18px;
  margin: 0 0 18px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 10px;
  font-size: 16px;
}

.user-detail-grid dt {
  color: var(--ink-muted);
}

.user-detail-grid dd {
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
  white-space: pre-line;
}

@media (max-width: 860px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
  .admin-row {
    grid-template-columns: 1fr 1fr;
  }
  .admin-ing-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.6fr) minmax(0, 0.6fr) auto;
  }
  .admin-ing-row .ing-notes {
    grid-column: 1 / -1;
  }
}
