/* ═══════════════════════════════════════════════════════════════════════════
   TAL'S COOKBOOK - "Mediterranean Kitchen" Design
   A warm, organic aesthetic inspired by sun-drenched kitchens and artisan food
   ═══════════════════════════════════════════════════════════════════════════ */

/* Import distinctive fonts - Playfair Display for elegant headlines,
   Heebo for modern Hebrew body text */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Heebo:wght@300;400;500;600;700;800&family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&display=swap');

/* CSS Variables - Warm Mediterranean Palette */
:root {
  /* Primary Colors - Terracotta & Earth */
  --terracotta: #b85f43;
  --terracotta-light: #d27b5f;
  --terracotta-dark: #95472f;
  --clay: #a9805d;
  --olive: #667253;
  --olive-light: #879576;

  /* Neutrals - Warm creams and rich darks */
  --cream: #f7f4ed;
  --cream-dark: #eee8dd;
  --linen: #fbf9f5;
  --espresso: #28241f;
  --charcoal: #464039;
  --stone: #746e65;
  --sand: #ded6c9;

  /* Accent Colors */
  --gold: #bd9149;
  --sage: #9eac8e;
  --paprika: #bd4d3e;
  --honey: #dda15a;

  /* Semantic Colors */
  --success: #5a7c4a;
  --danger: #b83b3b;
  --info: #4a6c8c;

  /* Applied Colors */
  --bg-color: var(--cream);
  --bg-secondary: var(--cream-dark);
  --card-bg: #fffdf9;
  --text-color: var(--espresso);
  --text-secondary: var(--stone);
  --text-light: #9b958c;
  --border-color: var(--sand);
  --accent-color: var(--terracotta);
  --accent-light: var(--terracotta-light);
  --accent-dark: var(--terracotta-dark);
  --primary-color: var(--espresso);
  --primary-light: var(--charcoal);

  /* Effects */
  --shadow-soft: 0 4px 20px rgba(40, 36, 31, 0.06);
  --shadow-medium: 0 8px 32px rgba(40, 36, 31, 0.1);
  --shadow-strong: 0 16px 48px rgba(40, 36, 31, 0.14);
  --shadow-glow: 0 0 40px rgba(184, 95, 67, 0.14);
  --shadow-control:
    0 0 0 1px rgba(40, 36, 31, 0.07),
    0 1px 2px rgba(40, 36, 31, 0.05),
    0 8px 24px rgba(40, 36, 31, 0.05);
  --shadow-control-hover:
    0 0 0 1px rgba(184, 95, 67, 0.22),
    0 8px 24px rgba(40, 36, 31, 0.09);
  --shadow-card:
    0 0 0 1px rgba(40, 36, 31, 0.07),
    0 12px 32px rgba(40, 36, 31, 0.06);
  --theme-toggle-shadow:
    0 0 0 1px rgba(40, 36, 31, 0.06),
    inset 0 1px 2px rgba(40, 36, 31, 0.04);
  --theme-active-shadow:
    0 0 0 1px rgba(40, 36, 31, 0.06),
    0 2px 8px rgba(40, 36, 31, 0.08);
  --theme-palette-outline: 0 0 0 1px rgba(40, 36, 31, 0.08);

  /* Refined surfaces */
  --header-bg-start: #fffdf9;
  --header-bg-end: #f1ebdf;
  --header-glow: rgba(184, 95, 67, 0.12);
  --control-surface: rgba(255, 253, 249, 0.82);
  --control-surface-hover: #fffdf9;
  --signed-in-surface: rgba(102, 114, 83, 0.12);
  --image-outline: rgba(0, 0, 0, 0.1);
  --video-tag-bg: #fbe8e5;
  --video-tag-text: #a83c36;
  --text-tag-bg: #e9eff7;
  --text-tag-text: #315f8b;
  --photo-tag-bg: #e8f2e7;
  --photo-tag-text: #3f7244;
  --link-tag-bg: #f8edda;
  --link-tag-text: #9b6723;

  /* Borders & Radius */
  --radius: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Spacing */
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);

  /* Typography */
  --font-display: 'Playfair Display', 'Frank Ruhl Libre', Georgia, serif;
  --font-body: 'Heebo', 'Assistant', system-ui, sans-serif;
  --font-accent: 'Cormorant Garamond', 'Frank Ruhl Libre', Georgia, serif;

  /* Legacy support */
  --danger-color: var(--danger);
  --success-color: var(--success);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BASE STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.7;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  font-weight: 400;
  letter-spacing: 0.01em;

  /* Subtle texture background */
  background-image:
    radial-gradient(circle at 20% 80%, rgba(184, 95, 67, 0.035) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(102, 114, 83, 0.035) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(189, 145, 73, 0.02) 0%, transparent 70%);
  background-attachment: fixed;
}

/* App Container */
.app-container {
  max-width: 100%;
  min-height: 100vh;
  padding-top: var(--safe-area-top);
  padding-bottom: var(--safe-area-bottom);
}

/* ═══════════════════════════════════════════════════════════════════════════
   HEADER - Elegant Masthead
   ═══════════════════════════════════════════════════════════════════════════ */

.app-header {
  background:
    radial-gradient(circle at 12% 0%, var(--header-glow) 0%, transparent 34%),
    linear-gradient(145deg, var(--header-bg-start) 0%, var(--header-bg-end) 100%);
  color: var(--text-color);
  padding: 34px 24px 30px;
  position: relative;
  z-index: 100;
  overflow: hidden;
  box-shadow: inset 0 -1px rgba(40, 36, 31, 0.07);
}

/* Fine editorial rule instead of decorative title ornaments */
.app-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 5%, rgba(184, 95, 67, 0.28) 50%, transparent 95%);
}

.header-inner {
  width: min(100%, 1180px);
  margin: 0 auto;
}

.header-top {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  gap: 32px;
  margin-bottom: 28px;
}

.header-brand {
  width: 100%;
  min-width: 0;
  padding-inline: 120px;
  text-align: center;
}

.header-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--terracotta-dark);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.app-header h1 {
  font-family: var(--font-body);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.08;
  text-align: center;
  letter-spacing: -0.025em;
  color: var(--text-color);
  padding: 0;
  text-wrap: balance;
}

.app-header h1::before,
.app-header h1::after {
  content: none;
}

.header-actions {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.header-action {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  background: var(--control-surface);
  border: 0;
  border-radius: 14px;
  box-shadow: var(--shadow-control);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
  transition-property: color, background-color, box-shadow, transform, scale;
  transition-duration: 180ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.settings-btn {
  left: 0;
}

.auth-btn {
  right: 0;
}

.header-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.auth-btn.signed-in {
  color: var(--olive);
  background: var(--signed-in-surface);
}

.auth-btn.signed-in::after {
  content: '';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--olive);
  box-shadow: 0 0 0 2px var(--control-surface-hover);
}

.header-action:hover {
  background: var(--control-surface-hover);
  color: var(--terracotta-dark);
  transform: translateY(calc(-50% - 1px));
  box-shadow: var(--shadow-control-hover);
}

.header-action:active {
  scale: 0.96;
  transform: translateY(-50%);
}

.header-action:focus-visible {
  outline: 3px solid rgba(184, 95, 67, 0.24);
  outline-offset: 3px;
}

/* Search Container */
.search-container {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
}

.search-icon {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: 19px;
  width: 19px;
  height: 19px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--text-light);
  stroke-width: 1.8;
  stroke-linecap: round;
  pointer-events: none;
}

#search-input {
  width: 100%;
  min-height: 54px;
  padding: 14px 52px 14px 48px;
  border: 0;
  border-radius: 17px;
  font-size: 1rem;
  font-family: var(--font-body);
  background: var(--control-surface);
  color: var(--text-color);
  direction: rtl;
  transition-property: background-color, box-shadow;
  transition-duration: 180ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
  box-shadow: var(--shadow-control);
}

html[lang="en"] #search-input {
  direction: ltr;
  padding-right: 48px;
  padding-left: 52px;
}

html[lang="en"] .cooking-workspace-header,
html[lang="en"] .cooking-clear-confirm,
html[lang="en"] .cooking-view-switcher,
html[lang="en"] .cooking-recipe-rail,
html[lang="en"] .cooking-stage {
  direction: ltr;
}

html[lang="en"] .cooking-workspace-close svg {
  transform: none;
}

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

#search-input:focus {
  outline: none;
  background: var(--control-surface-hover);
  box-shadow:
    0 0 0 1px var(--terracotta),
    0 0 0 4px rgba(184, 95, 67, 0.11),
    0 12px 32px rgba(40, 36, 31, 0.08);
}

.clear-btn {
  position: absolute;
  z-index: 1;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-light);
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: none;
  transition-property: color, background-color, scale;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
  border-radius: var(--radius-full);
}

.clear-btn:hover {
  color: var(--terracotta);
  background: rgba(184, 95, 67, 0.1);
}

.clear-btn.visible {
  display: block;
}

.clear-btn:active {
  scale: 0.96;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CATEGORIES NAVIGATION
   ═══════════════════════════════════════════════════════════════════════════ */

.categories-nav {
  display: flex;
  gap: 12px;
  padding: 20px 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 90;
  justify-content: center;
}

.categories-nav::-webkit-scrollbar {
  display: none;
}

.category-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background: transparent;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-full);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
  overflow: hidden;
}

.category-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--terracotta), var(--terracotta-dark));
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.category-btn:hover {
  border-color: var(--terracotta);
  color: var(--terracotta);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.category-btn.active {
  background: linear-gradient(135deg, var(--terracotta), var(--terracotta-dark));
  color: white;
  border-color: var(--terracotta);
  box-shadow: var(--shadow-medium);
}

.category-btn.active::before {
  opacity: 1;
}

.category-icon {
  font-size: 1.3rem;
}

.category-name {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Sub-categories navigation */
.sub-categories-nav {
  display: flex;
  gap: 10px;
  padding: 14px 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: var(--cream-dark);
  border-bottom: 1px solid var(--border-color);
  justify-content: center;
}

.sub-categories-nav::-webkit-scrollbar {
  display: none;
}

.sub-category-btn {
  padding: 10px 20px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sub-category-btn:hover {
  color: var(--terracotta);
  border-color: var(--terracotta);
  transform: translateY(-1px);
}

.sub-category-btn.active {
  background: var(--espresso);
  color: white;
  border-color: var(--espresso);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TAGS FILTER
   ═══════════════════════════════════════════════════════════════════════════ */

.tags-filter {
  padding: 18px 24px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
}

.tags-filter-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--stone);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.tags-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-filter-pill {
  padding: 8px 16px;
  background: var(--cream-dark);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tag-filter-pill:hover {
  border-color: var(--tag-color, var(--terracotta));
  color: var(--tag-color, var(--terracotta));
  background: var(--card-bg);
}

.tag-filter-pill.active {
  background: var(--tag-color, var(--terracotta));
  color: white;
  border-color: var(--tag-color, var(--terracotta));
  box-shadow: 0 4px 12px rgba(184, 95, 67, 0.25);
}

.tag-filter-pill .tag-count {
  font-size: 0.7rem;
  opacity: 0.75;
  margin-right: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ACTION BAR
   ═══════════════════════════════════════════════════════════════════════════ */

.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  background: var(--bg-color);
}

.recipe-count {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
}

.add-recipe-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--terracotta), var(--terracotta-dark));
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.add-recipe-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--terracotta-light), var(--terracotta));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.add-recipe-btn:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-strong);
}

.add-recipe-btn:hover::before {
  opacity: 1;
}

.add-recipe-btn:active {
  transform: translateY(-1px);
}

.add-recipe-btn span {
  font-size: 1.2rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RECIPES GRID - Magazine Layout
   ═══════════════════════════════════════════════════════════════════════════ */

.recipes-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 32px;
  padding: 40px 24px 60px;
  max-width: 1440px;
  margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RECIPE CARD - Elegant Editorial Style
   ═══════════════════════════════════════════════════════════════════════════ */

.recipe-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition-property: transform, box-shadow;
  transition-duration: 320ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
  display: flex;
  flex-direction: column;
  position: relative;
  border: 0;
  box-shadow: var(--shadow-card);
}

/* Accent line on hover */
.recipe-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--terracotta), var(--gold));
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.recipe-card:hover {
  box-shadow: var(--shadow-strong);
  transform: translateY(-8px);
}

.recipe-card:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.recipe-card:active {
  transform: scale(0.98) translateY(-4px);
}

.recipe-image {
  width: 100%;
  height: 220px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--cream-dark), var(--sand));
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

img.recipe-image {
  outline: 1px solid var(--image-outline);
  outline-offset: -1px;
}

.recipe-card:hover .recipe-image {
  transform: scale(1.05);
}

.recipe-image.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4.5rem;
  background: linear-gradient(135deg, var(--cream-dark) 0%, var(--sand) 100%);
  opacity: 0.85;
}

.recipe-info {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.recipe-name {
  font-family: var(--font-body);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 14px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-color);
}

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.recipe-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: var(--cream-dark);
  border-radius: var(--radius);
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.recipe-tag.type-video {
  background: var(--video-tag-bg);
  color: var(--video-tag-text);
}

.recipe-tag.type-text {
  background: var(--text-tag-bg);
  color: var(--text-tag-text);
}

.recipe-tag.type-photo {
  background: var(--photo-tag-bg);
  color: var(--photo-tag-text);
}

.recipe-tag.type-link {
  background: var(--link-tag-bg);
  color: var(--link-tag-text);
}

.recipe-tags {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}

.recipe-tag-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODALS - Elegant Overlays
   ═══════════════════════════════════════════════════════════════════════════ */

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(44, 24, 16, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal.active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: calc(var(--safe-area-top) + 48px);
  animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  max-width: 700px;
  width: 100%;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  position: relative;
  animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-strong);
}

.add-modal-content {
  max-width: 540px;
}

.delete-modal-content {
  max-width: 420px;
}

.transcription-modal-content {
  max-width: 540px;
}

.settings-modal-content {
  max-width: 500px;
}

.auth-modal-content {
  max-width: 440px;
}

.modal-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 24px;
  line-height: 1.6;
}

.settings-section {
  margin-bottom: 32px;
}

.settings-section h3 {
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.settings-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 14px;
}

.settings-note {
  color: var(--text-light);
  font-size: 0.8rem;
  font-style: italic;
  margin-top: 10px;
}

.language-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  padding: 4px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  box-shadow: inset 0 1px 2px rgba(40, 36, 31, 0.06);
}

.language-btn {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font: 650 0.86rem/1 var(--font-body);
  transition-property: background-color, color, box-shadow;
  transition-duration: 180ms;
}

.language-btn.active {
  background: var(--card-bg);
  color: var(--text-color);
  box-shadow: var(--shadow-control);
}

.language-setting-note {
  max-width: 42ch;
  line-height: 1.6;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  position: sticky;
  top: 0;
  background: var(--card-bg);
  z-index: 10;
  border-bottom: 1px solid var(--border-color);
}

.modal-close {
  background: var(--cream-dark);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-secondary);
}

.modal-close:hover {
  background: var(--terracotta);
  color: white;
  transform: rotate(90deg);
}

.modal-delete {
  background: #fef2f2;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-delete:hover {
  background: #fee2e2;
  transform: scale(1.1);
}

.modal-body {
  padding: 0 32px 32px;
}

.modal-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-family: var(--font-body);
  font-size: 1.85rem;
  font-weight: 800;
  margin-bottom: 10px;
  line-height: 1.3;
  color: var(--text-color);
}

.modal-date {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.modal-image {
  width: 100%;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.modal-text {
  white-space: pre-wrap;
  line-height: 2;
  background: linear-gradient(135deg, var(--cream), var(--cream-dark));
  padding: 24px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  font-size: 1rem;
  border-right: 4px solid var(--terracotta);
  position: relative;
}

.modal-text::before {
  content: '"';
  position: absolute;
  top: 8px;
  right: 16px;
  font-family: var(--font-display);
  font-size: 4rem;
  color: var(--terracotta);
  opacity: 0.15;
  line-height: 1;
}

.modal-notes {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  border-right: 4px solid var(--honey);
  margin-bottom: 24px;
}

.modal-notes-label {
  font-weight: 700;
  margin-bottom: 6px;
  color: #92400e;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ═══════════════════════════════════════════════════════════════════════════
   VIDEO & MEDIA
   ═══════════════════════════════════════════════════════════════════════════ */

.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 177.78%;
  margin-bottom: 24px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  max-height: 70vh;
}

.video-container.horizontal {
  padding-bottom: 56.25%;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.video-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 28px;
  background: linear-gradient(135deg, var(--cream-dark), var(--sand));
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  text-align: center;
  color: var(--text-color);
}

.video-fallback-icon {
  font-size: 4rem;
  margin-bottom: 20px;
}

.open-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 32px;
  background: linear-gradient(135deg, var(--terracotta), var(--terracotta-dark));
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: 1rem;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  margin-top: 20px;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-soft);
}

.open-link-btn:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-medium);
}

/* Transcription Box */
.transcription-box {
  background: linear-gradient(135deg, var(--cream), var(--cream-dark));
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  border-right: 4px solid var(--terracotta);
  position: relative;
}

.transcription-box h4 {
  color: var(--terracotta-dark);
  margin-bottom: 14px;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.transcription-box p {
  white-space: pre-wrap;
  line-height: 1.9;
  font-size: 1rem;
}

/* Action Buttons */
.add-transcription-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--terracotta), var(--terracotta-dark));
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-soft);
}

.add-transcription-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

.extract-recipe-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 16px;
  margin-left: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-soft);
}

.extract-recipe-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

.extract-recipe-btn:disabled {
  background: var(--text-light);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.transcription-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.transcription-loading .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-top-color: var(--terracotta);
  border-radius: var(--radius-full);
  animation: spin 1s linear infinite;
}

.images-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.images-gallery img {
  width: 100%;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.images-gallery img:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-medium);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════════════════════ */

.form-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 28px;
}

.form-tab {
  flex: 1;
  padding: 14px;
  background: var(--cream-dark);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-secondary);
}

.form-tab:hover {
  border-color: var(--terracotta);
  color: var(--terracotta);
}

.form-tab.active {
  background: linear-gradient(135deg, var(--terracotta), var(--terracotta-dark));
  color: white;
  border-color: var(--terracotta);
}

.form-tab-content {
  display: none;
}

.form-tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

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

.form-group label {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-color);
  letter-spacing: 0.02em;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-family: var(--font-body);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--card-bg);
  color: var(--text-color);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--terracotta);
  box-shadow: 0 0 0 4px rgba(184, 95, 67, 0.12);
}

.form-group textarea {
  resize: vertical;
  min-height: 160px;
}

.form-actions {
  display: flex;
  gap: 14px;
  margin-top: 32px;
}

.btn {
  flex: 1;
  padding: 16px 28px;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  background: linear-gradient(135deg, var(--terracotta), var(--terracotta-dark));
  color: white;
  box-shadow: var(--shadow-soft);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

.btn-primary:disabled {
  background: var(--border-color);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--cream-dark);
  color: var(--text-color);
  border: 2px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--sand);
  border-color: var(--stone);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #a33030);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOADING & EMPTY STATES
   ═══════════════════════════════════════════════════════════════════════════ */

.loading {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 100px 24px;
}

.loading.active {
  display: flex;
}

.loading p {
  font-family: var(--font-body);
  font-weight: 600;
  margin-top: 20px;
  color: var(--text-secondary);
}

.loading-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid var(--border-color);
  border-top-color: var(--terracotta);
  border-radius: var(--radius-full);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.empty-state {
  text-align: center;
  padding: 100px 24px;
  color: var(--text-secondary);
  grid-column: 1 / -1;
}

.empty-state-icon {
  font-size: 6rem;
  margin-bottom: 24px;
  opacity: 0.5;
}

.empty-state-text {
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════════
   OFFLINE MODE BANNER
   ═══════════════════════════════════════════════════════════════════════════ */

.offline-banner {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: white;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.offline-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1200px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.offline-banner-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.offline-banner-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 200px;
}

.offline-banner-text strong {
  font-weight: 600;
  font-size: 0.95rem;
}

.offline-banner-text span {
  font-size: 0.85rem;
  opacity: 0.9;
}

.offline-banner-retry {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.offline-banner-retry:hover {
  background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 480px) {
  .offline-banner {
    padding: 10px 12px;
  }

  .offline-banner-content {
    gap: 8px;
  }

  .offline-banner-text {
    min-width: 150px;
  }

  .offline-banner-text strong {
    font-size: 0.9rem;
  }

  .offline-banner-text span {
    font-size: 0.8rem;
  }

  .offline-banner-retry {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  bottom: calc(28px + var(--safe-area-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background: linear-gradient(135deg, var(--espresso), var(--charcoal));
  color: white;
  padding: 16px 32px;
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-family: var(--font-body);
  font-weight: 500;
  box-shadow: var(--shadow-strong);
  animation: toastIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.success {
  background: linear-gradient(135deg, var(--olive), var(--olive-light));
}

.toast.error {
  background: linear-gradient(135deg, var(--danger), #a33030);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 600px) {
  /* Header - more compact on mobile */
  .app-header {
    padding: 22px 16px 18px;
  }

  .header-top {
    padding-top: 56px;
    gap: 12px;
    margin-bottom: 18px;
  }

  .header-brand {
    padding-inline: 0;
  }

  .header-eyebrow {
    margin-bottom: 3px;
    font-size: 0.63rem;
    letter-spacing: 0.055em;
  }

  .app-header h1 {
    font-size: clamp(1.45rem, 6.5vw, 1.8rem);
  }

  .header-actions {
    top: 0;
    bottom: auto;
    height: 42px;
  }

  .header-action {
    top: 0;
    transform: none;
    width: 42px;
    min-height: 42px;
    padding: 0;
    border-radius: 13px;
  }

  .header-action:hover {
    transform: translateY(-1px);
  }

  .header-action:active {
    transform: none;
  }

  .header-action-label {
    display: none;
  }

  .header-action svg {
    width: 18px;
    height: 18px;
  }

  /* Search bar - more compact */
  #search-input {
    min-height: 49px;
    padding: 12px 46px 12px 44px;
    border-radius: 15px;
    font-size: 0.9rem;
  }

  .search-icon {
    right: 16px;
    width: 18px;
    height: 18px;
  }

  .clear-btn {
    left: 7px;
    font-size: 1.2rem;
  }

  /* Categories nav - scrollable, compact */
  .categories-nav {
    padding: 12px 16px;
    gap: 8px;
    justify-content: flex-start;
  }

  .category-btn {
    padding: 8px 14px;
    gap: 6px;
  }

  .category-icon {
    font-size: 1.1rem;
  }

  .category-name {
    font-size: 0.8rem;
  }

  /* Sub-categories - compact */
  .sub-categories-nav {
    padding: 10px 16px;
    gap: 6px;
    justify-content: flex-start;
  }

  .sub-category-btn {
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  /* Tags filter - more compact */
  .tags-filter {
    padding: 12px 16px;
  }

  .tags-filter-label {
    font-size: 0.7rem;
    margin-bottom: 8px;
  }

  .tags-filter-pills {
    gap: 6px;
  }

  .tag-filter-pill {
    padding: 6px 12px;
    font-size: 0.75rem;
  }

  /* Action bar - stacked */
  .action-bar {
    flex-direction: column;
    gap: 12px;
    padding: 16px;
  }

  .recipe-count {
    font-size: 0.85rem;
  }

  .add-recipe-btn {
    width: 100%;
    justify-content: center;
    padding: 12px 20px;
  }

  /* Recipe grid - single column */
  .recipes-container {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
  }

  /* Recipe cards - more compact */
  .recipe-card {
    border-radius: var(--radius-lg);
  }

  .recipe-image {
    height: 180px;
  }

  .recipe-info {
    padding: 16px;
  }

  .recipe-name {
    font-size: 1.1rem;
    margin-bottom: 10px;
  }

  .recipe-tag {
    padding: 4px 10px;
    font-size: 0.7rem;
  }

  .recipe-tags {
    margin-top: 8px;
  }

  .recipe-tag-pill {
    width: 22px;
    height: 22px;
    font-size: 0.7rem;
  }

  /* Modals - full width on mobile */
  .modal {
    padding: 10px;
  }

  .modal.active {
    padding-top: calc(var(--safe-area-top) + 20px);
  }

  .modal-content {
    max-height: calc(100vh - 60px);
    border-radius: var(--radius-lg);
  }

  .modal-header-bar {
    padding: 12px 16px;
  }

  .modal-close,
  .modal-delete {
    width: 38px;
    height: 38px;
    font-size: 1.2rem;
  }

  .modal-body {
    padding: 0 16px 20px;
  }

  .modal-title {
    font-size: 1.35rem;
    margin-bottom: 6px;
  }

  .modal-subtitle {
    font-size: 0.85rem;
    margin-bottom: 16px;
  }

  /* Forms - more compact */
  .form-tabs {
    gap: 6px;
    margin-bottom: 20px;
  }

  .form-tab {
    padding: 10px 12px;
    font-size: 0.9rem;
  }

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

  .form-group label {
    font-size: 0.85rem;
    margin-bottom: 6px;
  }

  .form-group input,
  .form-group textarea,
  .form-group select {
    padding: 12px 14px;
    font-size: 0.95rem;
  }

  .form-group textarea {
    min-height: 120px;
  }

  .form-actions {
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
  }

  .btn {
    padding: 14px 20px;
    font-size: 0.95rem;
  }

  /* Settings modal specifics */
  .settings-section {
    margin-bottom: 20px;
  }

  .settings-section h3 {
    font-size: 1rem;
  }

  .settings-desc {
    font-size: 0.85rem;
    margin-bottom: 10px;
  }

  /* Recipe text in modal */
  .modal-text {
    padding: 16px;
    font-size: 0.9rem;
    line-height: 1.8;
  }

  .modal-text::before {
    font-size: 3rem;
    top: 4px;
    right: 10px;
  }

  .transcription-box {
    padding: 16px;
  }

  .transcription-box h4 {
    font-size: 0.8rem;
    margin-bottom: 10px;
  }

  .transcription-box p {
    font-size: 0.9rem;
    line-height: 1.7;
  }

  /* Action buttons in recipe modal */
  .recipe-action-buttons {
    gap: 8px;
    flex-wrap: wrap;
  }

  .add-transcription-btn,
  .extract-recipe-btn,
  .add-image-btn,
  .edit-tags-btn,
  .edit-category-btn {
    padding: 10px 16px;
    font-size: 0.8rem;
  }

  /* External recipe card */
  .external-recipe-card {
    padding: 20px;
    border-radius: var(--radius-lg);
  }

  .external-recipe-header {
    gap: 12px;
    margin-bottom: 16px;
  }

  .external-recipe-icon {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    border-radius: var(--radius);
  }

  .external-recipe-site-name {
    font-size: 1.1rem;
  }

  .external-recipe-domain {
    font-size: 0.8rem;
  }

  .external-recipe-hint {
    font-size: 0.9rem;
  }

  .external-recipe-btn {
    padding: 12px 24px;
    font-size: 0.9rem;
    width: 100%;
    justify-content: center;
  }

  /* Auth modal */
  .auth-user-info {
    padding: 16px;
    gap: 12px;
  }

  .auth-user-photo {
    width: 48px;
    height: 48px;
    border-width: 2px;
  }

  .auth-user-name {
    font-size: 1rem;
  }

  .auth-user-email {
    font-size: 0.8rem;
  }

  .auth-permission-status {
    padding: 10px 14px;
    font-size: 0.85rem;
  }

  .google-signin-btn {
    padding: 14px 20px;
    font-size: 0.95rem;
  }

  /* Tags editor */
  .tags-editor {
    gap: 8px;
    margin-bottom: 20px;
  }

  .tag-editor-item {
    padding: 10px 14px;
    font-size: 0.85rem;
  }

  .tag-editor-item .tag-icon {
    font-size: 1rem;
  }

  /* Recipe tags display */
  .recipe-tags-display {
    padding: 14px;
    gap: 8px;
  }

  .recipe-tags-display .tags-label {
    font-size: 0.75rem;
  }

  .tag-display-pill {
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  /* Category manager */
  .categories-manager {
    max-height: 350px;
  }

  .category-manager-section {
    padding: 14px;
    margin-bottom: 10px;
  }

  .category-manager-header {
    font-size: 0.95rem;
    gap: 8px;
    margin-bottom: 10px;
  }

  .category-manager-icon {
    font-size: 1.2rem;
  }

  .sub-categories-list {
    gap: 8px;
    margin-bottom: 12px;
  }

  .sub-category-item {
    padding: 6px 8px 6px 12px;
    font-size: 0.8rem;
  }

  .add-sub-category-row {
    gap: 6px;
    flex-wrap: wrap;
  }

  .add-sub-category-row input {
    padding: 8px 10px;
    font-size: 0.85rem;
  }

  .add-sub-category-row .sub-category-name-input {
    flex: 1;
    min-width: 120px;
  }

  .add-category-section {
    padding-top: 16px;
  }

  .add-category-section h3 {
    font-size: 0.9rem;
    margin-bottom: 10px;
  }

  .add-category-form {
    flex-wrap: wrap;
    gap: 8px;
  }

  .add-category-form input {
    padding: 10px 12px;
    font-size: 0.9rem;
  }

  .btn-small {
    padding: 8px 14px !important;
    font-size: 0.85rem !important;
  }

  /* Loading state */
  .loading {
    padding: 60px 16px;
  }

  .loading-spinner {
    width: 44px;
    height: 44px;
  }

  .loading p {
    font-size: 0.9rem;
    margin-top: 16px;
  }

  /* Empty state */
  .empty-state {
    padding: 60px 16px;
  }

  .empty-state-icon {
    font-size: 4rem;
    margin-bottom: 16px;
  }

  .empty-state-text {
    font-size: 1rem;
  }

  /* Toast - narrower on mobile */
  .toast {
    padding: 12px 24px;
    font-size: 0.85rem;
    max-width: calc(100vw - 32px);
    text-align: center;
  }

  /* Video container */
  .video-container {
    margin-bottom: 16px;
    border-radius: var(--radius);
  }

  .video-fallback {
    padding: 40px 20px;
    border-radius: var(--radius);
  }

  .video-fallback-icon {
    font-size: 3rem;
    margin-bottom: 14px;
  }

  .open-link-btn {
    padding: 12px 24px;
    font-size: 0.9rem;
    margin-top: 14px;
  }

  /* Notes */
  .modal-notes {
    padding: 14px 16px;
    border-radius: var(--radius);
  }

  .modal-notes-label {
    font-size: 0.75rem;
  }
}

@media (min-width: 768px) {
  .app-header {
    padding: 40px 32px 32px;
  }

  .app-header h1 {
    font-size: clamp(2.25rem, 4vw, 2.8rem);
  }

  .categories-nav {
    padding: 22px 32px;
    top: 0;
  }

  .sub-categories-nav {
    padding: 16px 32px;
  }

  .tags-filter {
    padding: 20px 32px;
  }

  .action-bar {
    padding: 24px 32px;
  }

  .recipes-container {
    padding: 48px 32px 72px;
    gap: 40px;
  }
}

@media (min-width: 1200px) {
  .recipes-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   DARK MODE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #171b18;
    --bg-secondary: #1e2420;
    --card-bg: #252b26;
    --text-color: #f3eee4;
    --text-secondary: #b8b1a7;
    --text-light: #8f8a82;
    --border-color: #394139;
    --cream: #1e2420;
    --cream-dark: #171b18;
    --linen: #212722;
    --sand: #343c35;
    --terracotta: #df8666;
    --terracotta-light: #efa083;
    --terracotta-dark: #c76d51;
    --olive: #91a178;
    --olive-light: #a8b78f;
    --header-bg-start: #252c26;
    --header-bg-end: #191e1a;
    --header-glow: rgba(223, 134, 102, 0.12);
    --control-surface: rgba(255, 255, 255, 0.055);
    --control-surface-hover: rgba(255, 255, 255, 0.085);
    --signed-in-surface: rgba(145, 161, 120, 0.14);
    --image-outline: rgba(255, 255, 255, 0.1);
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.16);
    --shadow-medium: 0 8px 32px rgba(0, 0, 0, 0.22);
    --shadow-strong: 0 16px 48px rgba(0, 0, 0, 0.3);
    --shadow-control: 0 0 0 1px rgba(255, 255, 255, 0.08);
    --shadow-control-hover: 0 0 0 1px rgba(255, 255, 255, 0.13);
    --shadow-card:
      0 0 0 1px rgba(255, 255, 255, 0.075),
      0 18px 40px rgba(0, 0, 0, 0.18);
    --theme-toggle-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.08),
      inset 0 1px 2px rgba(0, 0, 0, 0.24);
    --theme-active-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.08),
      0 2px 8px rgba(0, 0, 0, 0.24);
    --theme-palette-outline: 0 0 0 1px rgba(255, 255, 255, 0.1);
    --video-tag-bg: rgba(218, 103, 96, 0.15);
    --video-tag-text: #ffaaa4;
    --text-tag-bg: rgba(91, 137, 185, 0.17);
    --text-tag-text: #a9cdf2;
    --photo-tag-bg: rgba(102, 158, 109, 0.16);
    --photo-tag-text: #a8d6ab;
    --link-tag-bg: rgba(208, 154, 72, 0.16);
    --link-tag-text: #e6bd78;
  }

  body {
    background-image:
      radial-gradient(circle at 20% 80%, rgba(223, 134, 102, 0.055) 0%, transparent 50%),
      radial-gradient(circle at 80% 20%, rgba(145, 161, 120, 0.06) 0%, transparent 50%);
  }

  .app-header {
    background:
      radial-gradient(circle at 12% 0%, var(--header-glow) 0%, transparent 34%),
      linear-gradient(145deg, var(--header-bg-start) 0%, var(--header-bg-end) 100%);
    box-shadow: inset 0 -1px rgba(255, 255, 255, 0.07);
  }

  .app-header h1 {
    color: var(--text-color);
  }

  #search-input {
    background: var(--control-surface);
    color: var(--text-color);
  }

  #search-input:focus {
    background: var(--control-surface-hover);
  }

  .categories-nav,
  .sub-categories-nav {
    background: var(--card-bg);
    border-bottom-color: var(--border-color);
  }

  .category-btn.active {
    background: linear-gradient(135deg, var(--terracotta), var(--terracotta-dark));
    color: #1a1a1a;
    border-color: var(--terracotta);
  }

  .sub-category-btn.active {
    background: var(--terracotta);
    color: #1a1a1a;
  }

  .tags-filter {
    background: var(--card-bg);
    border-bottom-color: var(--border-color);
  }

  .recipe-card {
    border-color: var(--border-color);
  }

  .modal-content {
    background: var(--card-bg);
  }

  .form-group input,
  .form-group textarea,
  .form-group select {
    background: var(--bg-secondary);
    color: var(--text-color);
  }

  .transcription-box,
  .modal-text {
    background: linear-gradient(135deg, var(--bg-secondary), var(--card-bg));
  }

  .modal-notes {
    background: rgba(230, 167, 86, 0.1);
    border-right-color: var(--honey);
  }

  .recipe-image.placeholder {
    background: linear-gradient(135deg, var(--bg-secondary), var(--border-color));
  }

  .google-signin-btn {
    background: var(--bg-secondary);
    color: var(--text-color);
    border-color: var(--border-color);
  }

  .google-signin-btn:hover {
    background: var(--card-bg);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   IMAGE UPLOAD
   ═══════════════════════════════════════════════════════════════════════════ */

.image-upload-area {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--cream-dark);
}

.image-upload-area:hover {
  border-color: var(--terracotta);
  background: rgba(184, 95, 67, 0.05);
}

.image-upload-area.has-images {
  border-style: solid;
  padding: 14px;
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
}

.upload-placeholder .upload-icon {
  font-size: 3rem;
}

.image-preview-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
  gap: 12px;
  width: 100%;
}

.image-preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-item .remove-image {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.image-preview-item .remove-image:hover {
  background: var(--danger);
  transform: scale(1.1);
}

.add-more-images {
  aspect-ratio: 1;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.add-more-images:hover {
  border-color: var(--terracotta);
  color: var(--terracotta);
}

/* Add Image Button in Recipe Modal */
.add-image-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--olive), var(--olive-light));
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 16px;
  margin-right: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-soft);
}

.add-image-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

/* Recipe Action Buttons */
.recipe-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TAGS EDITOR
   ═══════════════════════════════════════════════════════════════════════════ */

.tags-editor {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.tag-editor-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--cream-dark);
  border: 2px solid transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.95rem;
}

.tag-editor-item:hover {
  border-color: var(--tag-color, var(--terracotta));
  transform: translateY(-2px);
}

.tag-editor-item.selected {
  background: var(--tag-color, var(--terracotta));
  color: white;
  border-color: var(--tag-color, var(--terracotta));
  box-shadow: var(--shadow-soft);
}

.tag-editor-item .tag-icon {
  font-size: 1.2rem;
}

.tag-editor-item .tag-name {
  font-weight: 600;
}

/* Edit Tags Button */
.edit-tags-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-soft);
}

.edit-tags-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

/* Recipe tags display in modal */
.recipe-tags-display {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 20px;
  background: linear-gradient(135deg, var(--cream), var(--cream-dark));
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.recipe-tags-display .tags-label {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-left: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tag-display-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
}

.recipe-reading-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.recipe-reading-header h4 {
  margin: 0;
}

.recipe-language-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  min-width: 156px;
  padding: 3px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--text-color) 6%, transparent);
}

.recipe-language-toggle button {
  min-height: 34px;
  padding: 6px 11px;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font: 650 0.72rem/1 var(--font-body);
}

.recipe-language-toggle button.active {
  background: var(--card-bg);
  color: var(--text-color);
  box-shadow: var(--shadow-control);
}

.recipe-translation-status {
  min-height: 18px;
  margin-top: 8px;
  color: var(--text-light);
  font-size: 0.72rem;
}

#recipe-text-content.translation-loading {
  opacity: 0.48;
}

/* Category hierarchy in recipe cards */
.recipe-tag.category-hierarchy {
  font-size: 0.7rem;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════════════════════════════
   EXTERNAL RECIPE CARD
   ═══════════════════════════════════════════════════════════════════════════ */

.external-recipe-card {
  background: linear-gradient(135deg, var(--cream), var(--cream-dark));
  border-radius: var(--radius-xl);
  padding: 28px;
  margin-bottom: 24px;
  border: 1px solid var(--border-color);
  border-right: 5px solid var(--site-color, var(--terracotta));
}

.external-recipe-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}

.external-recipe-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--site-color, var(--terracotta));
  border-radius: var(--radius-lg);
  font-size: 2rem;
  box-shadow: var(--shadow-medium);
}

.external-recipe-source {
  display: flex;
  flex-direction: column;
}

.external-recipe-site-name {
  font-family: var(--font-body);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-color);
}

.external-recipe-domain {
  font-size: 0.9rem;
  color: var(--text-light);
  direction: ltr;
  text-align: right;
}

.external-recipe-body {
  margin-bottom: 24px;
}

.external-recipe-hint {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.external-recipe-hint .hint-secondary {
  display: block;
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--text-light);
}

.external-recipe-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 32px;
  background: var(--site-color, var(--terracotta));
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: 1rem;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-medium);
}

.external-recipe-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-3px);
  box-shadow: var(--shadow-strong);
}

/* Dark mode for external recipe card */
@media (prefers-color-scheme: dark) {
  .external-recipe-card {
    background: linear-gradient(135deg, var(--bg-secondary), var(--card-bg));
    border-color: var(--border-color);
  }

  .external-recipe-icon {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   AUTH STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

.google-signin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  padding: 16px 28px;
  background: white;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 24px;
}

.google-signin-btn:hover {
  background: var(--cream-dark);
  border-color: var(--terracotta);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.auth-user-info {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px;
  background: linear-gradient(135deg, var(--cream), var(--cream-dark));
  border-radius: var(--radius-lg);
  margin-top: 20px;
}

.auth-user-photo {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 3px solid var(--terracotta);
}

.auth-user-details {
  flex: 1;
}

.auth-user-name {
  font-weight: 700;
  font-size: 1.15rem;
}

.auth-user-email {
  color: var(--text-secondary);
  font-size: 0.9rem;
  direction: ltr;
  text-align: right;
}

.auth-permission-status {
  margin-top: 20px;
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  font-size: 0.95rem;
  font-weight: 500;
}

.auth-permission-status.has-permission {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  color: #166534;
}

.auth-permission-status.no-permission {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
}

/* Hide edit buttons when not authorized */
.add-recipe-btn.hidden,
.modal-delete.hidden,
.add-transcription-btn.hidden,
.add-image-btn.hidden,
.edit-tags-btn.hidden {
  display: none !important;
}

/* Edit Category Button */
.edit-category-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #0891b2, #0e7490);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-soft);
}

.edit-category-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CATEGORIES MANAGER
   ═══════════════════════════════════════════════════════════════════════════ */

.categories-manager {
  max-height: 420px;
  overflow-y: auto;
  margin-bottom: 28px;
}

.category-manager-section {
  background: linear-gradient(135deg, var(--cream), var(--cream-dark));
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 14px;
}

.category-manager-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  font-weight: 700;
  font-size: 1.05rem;
}

.category-manager-icon {
  font-size: 1.4rem;
}

.category-manager-name {
  flex: 1;
}

.delete-main-category-btn {
  background: transparent;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  opacity: 0.5;
  transition: all 0.2s;
}

.delete-main-category-btn:hover {
  opacity: 1;
  background: #fef2f2;
}

.sub-categories-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.sub-category-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card-bg);
  padding: 8px 10px 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.delete-sub-category-btn {
  background: transparent;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  opacity: 0.4;
  transition: all 0.2s;
  color: var(--text-secondary);
  line-height: 1;
}

.delete-sub-category-btn:hover {
  opacity: 1;
  background: #fef2f2;
  color: var(--danger);
}

.add-sub-category-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.add-sub-category-row input {
  padding: 10px 14px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  font-family: var(--font-body);
  transition: all 0.2s;
}

.add-sub-category-row input:focus {
  outline: none;
  border-color: var(--terracotta);
}

.add-sub-category-row .sub-category-name-input {
  flex: 1;
}

.btn-small {
  padding: 10px 18px !important;
  font-size: 0.9rem !important;
}

.add-category-section {
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
  margin-top: 10px;
}

.add-category-section h3 {
  font-size: 1rem;
  margin-bottom: 14px;
  font-weight: 700;
}

.add-category-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.add-category-form input {
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-size: 0.95rem;
  font-family: var(--font-body);
  transition: all 0.2s;
}

.add-category-form input:focus {
  outline: none;
  border-color: var(--terracotta);
}

.add-category-form input:first-child {
  flex: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

@media print {
  .app-header,
  .categories-nav,
  .sub-categories-nav,
  .tags-filter,
  .modal-close,
  .modal-delete,
  .action-bar {
    display: none;
  }

  .modal {
    position: static;
    background: none;
    padding: 0;
  }

  .modal-content {
    box-shadow: none;
    max-height: none;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   THEME TOGGLE
   ═══════════════════════════════════════════════════════════════════════════ */

.theme-toggle {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  background: var(--bg-secondary);
  border-radius: 18px;
  box-shadow:
    var(--theme-toggle-shadow);
}

.theme-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  min-height: 52px;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  border-radius: 14px;
  font-size: clamp(0.78rem, 2.5vw, 0.88rem);
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  transition-property: background-color, color, box-shadow, scale;
  transition-duration: 180ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.theme-btn:hover {
  color: var(--text-color);
  background: var(--control-surface);
}

.theme-btn.active {
  background: var(--card-bg);
  color: var(--text-color);
  box-shadow: var(--theme-active-shadow);
}

.theme-btn:active {
  scale: 0.96;
}

.theme-btn:focus-visible {
  outline: 3px solid rgba(184, 95, 67, 0.24);
  outline-offset: 2px;
}

.theme-palette {
  display: block;
  width: 30px;
  height: 4px;
  border-radius: var(--radius-full);
  box-shadow: var(--theme-palette-outline);
}

.theme-palette-light {
  background: linear-gradient(90deg, #fffdf9 0 50%, #b85f43 50% 100%);
}

.theme-palette-dark {
  background: linear-gradient(90deg, #252b26 0 50%, #df8666 50% 100%);
}

.theme-palette-auto {
  background: linear-gradient(90deg, #fffdf9 0 49%, #252b26 51% 100%);
}

/* Hide categories settings for non-editors */
#categories-settings-section.hidden {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MANUAL DARK MODE OVERRIDE
   ═══════════════════════════════════════════════════════════════════════════ */

html.dark-mode {
  --bg-color: #171b18;
  --bg-secondary: #1e2420;
  --card-bg: #252b26;
  --text-color: #f3eee4;
  --text-secondary: #b8b1a7;
  --text-light: #8f8a82;
  --border-color: #394139;
  --cream: #1e2420;
  --cream-dark: #171b18;
  --linen: #212722;
  --sand: #343c35;
  --terracotta: #df8666;
  --terracotta-light: #efa083;
  --terracotta-dark: #c76d51;
  --olive: #91a178;
  --olive-light: #a8b78f;
  --header-bg-start: #252c26;
  --header-bg-end: #191e1a;
  --header-glow: rgba(223, 134, 102, 0.12);
  --control-surface: rgba(255, 255, 255, 0.055);
  --control-surface-hover: rgba(255, 255, 255, 0.085);
  --signed-in-surface: rgba(145, 161, 120, 0.14);
  --image-outline: rgba(255, 255, 255, 0.1);
  --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.16);
  --shadow-medium: 0 8px 32px rgba(0, 0, 0, 0.22);
  --shadow-strong: 0 16px 48px rgba(0, 0, 0, 0.3);
  --shadow-control: 0 0 0 1px rgba(255, 255, 255, 0.08);
  --shadow-control-hover: 0 0 0 1px rgba(255, 255, 255, 0.13);
  --shadow-card:
    0 0 0 1px rgba(255, 255, 255, 0.075),
    0 18px 40px rgba(0, 0, 0, 0.18);
  --theme-toggle-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 1px 2px rgba(0, 0, 0, 0.24);
  --theme-active-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 2px 8px rgba(0, 0, 0, 0.24);
  --theme-palette-outline: 0 0 0 1px rgba(255, 255, 255, 0.1);
  --video-tag-bg: rgba(218, 103, 96, 0.15);
  --video-tag-text: #ffaaa4;
  --text-tag-bg: rgba(91, 137, 185, 0.17);
  --text-tag-text: #a9cdf2;
  --photo-tag-bg: rgba(102, 158, 109, 0.16);
  --photo-tag-text: #a8d6ab;
  --link-tag-bg: rgba(208, 154, 72, 0.16);
  --link-tag-text: #e6bd78;
}

html.dark-mode body {
  background-image:
    radial-gradient(circle at 20% 80%, rgba(223, 134, 102, 0.055) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(145, 161, 120, 0.06) 0%, transparent 50%);
}

html.dark-mode .app-header {
  background:
    radial-gradient(circle at 12% 0%, var(--header-glow) 0%, transparent 34%),
    linear-gradient(145deg, var(--header-bg-start) 0%, var(--header-bg-end) 100%);
  box-shadow: inset 0 -1px rgba(255, 255, 255, 0.07);
}

html.dark-mode .app-header h1 {
  color: var(--text-color);
}

html.dark-mode #search-input {
  background: var(--control-surface);
  color: var(--text-color);
}

html.dark-mode #search-input:focus {
  background: var(--control-surface-hover);
}

html.dark-mode .categories-nav,
html.dark-mode .sub-categories-nav {
  background: var(--card-bg);
  border-bottom-color: var(--border-color);
}

html.dark-mode .category-btn.active {
  background: linear-gradient(135deg, var(--terracotta), var(--terracotta-dark));
  color: #1a1a1a;
  border-color: var(--terracotta);
}

html.dark-mode .sub-category-btn.active {
  background: var(--terracotta);
  color: #1a1a1a;
}

html.dark-mode .tags-filter {
  background: var(--card-bg);
  border-bottom-color: var(--border-color);
}

html.dark-mode .recipe-card {
  border-color: var(--border-color);
}

html.dark-mode .modal-content {
  background: var(--card-bg);
}

html.dark-mode .form-group input,
html.dark-mode .form-group textarea,
html.dark-mode .form-group select {
  background: var(--bg-secondary);
  color: var(--text-color);
}

html.dark-mode .transcription-box,
html.dark-mode .modal-text {
  background: linear-gradient(135deg, var(--bg-secondary), var(--card-bg));
}

html.dark-mode .modal-notes {
  background: rgba(230, 167, 86, 0.1);
  border-right-color: var(--honey);
}

html.dark-mode .recipe-image.placeholder {
  background: linear-gradient(135deg, var(--bg-secondary), var(--border-color));
}

html.dark-mode .google-signin-btn {
  background: var(--bg-secondary);
  color: var(--text-color);
  border-color: var(--border-color);
}

html.dark-mode .google-signin-btn:hover {
  background: var(--card-bg);
}

html.dark-mode .external-recipe-card {
  background: linear-gradient(135deg, var(--bg-secondary), var(--card-bg));
  border-color: var(--border-color);
}

html.dark-mode .external-recipe-icon {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Light mode override (when user explicitly chooses light) */
html.light-mode {
  --bg-color: #f7f4ed;
  --bg-secondary: #eee8dd;
  --card-bg: #fffdf9;
  --text-color: #28241f;
  --text-secondary: #746e65;
  --text-light: #9b958c;
  --border-color: #ded6c9;
  --cream: #f7f4ed;
  --cream-dark: #eee8dd;
  --linen: #fbf9f5;
  --sand: #ded6c9;
  --terracotta: #b85f43;
  --terracotta-light: #d27b5f;
  --terracotta-dark: #95472f;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SMART RECIPE IMPORT - A warm kitchen clipping desk
   ═══════════════════════════════════════════════════════════════════════════ */

[hidden] {
  display: none !important;
}

.recipe-import-modal {
  max-width: 820px;
  overflow-x: hidden;
}

.recipe-import-modal > .modal-close {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 12;
}

.recipe-import-modal .modal-body {
  padding: 0 40px 40px;
}

.import-header {
  position: relative;
  margin: 0 -40px 30px;
  padding: 42px 40px 30px;
  text-align: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 18%, rgba(184, 95, 67, 0.12), transparent 25%),
    radial-gradient(circle at 90% 5%, rgba(102, 114, 83, 0.12), transparent 26%),
    linear-gradient(145deg, var(--linen), var(--cream-dark));
  border-bottom: 1px solid var(--border-color);
}

.import-header::before {
  content: '';
  position: absolute;
  width: 132px;
  height: 132px;
  top: -83px;
  right: 52px;
  border: 1px solid rgba(184, 95, 67, 0.24);
  border-radius: 50%;
  box-shadow:
    0 0 0 14px rgba(184, 95, 67, 0.04),
    0 0 0 28px rgba(184, 95, 67, 0.025);
}

.import-eyebrow {
  display: inline-block;
  color: var(--terracotta-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.import-header .modal-title {
  margin: 4px 0 6px;
  font-size: 2rem;
}

.import-header .modal-subtitle {
  margin: 0 auto 24px;
  max-width: 500px;
}

.import-steps {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 42px;
  width: min(100%, 420px);
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.import-steps::before {
  content: '';
  position: absolute;
  top: 15px;
  right: 16%;
  left: 16%;
  height: 1px;
  background: var(--border-color);
}

.import-steps li {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 60px;
  color: var(--text-light);
  font-size: 0.72rem;
  font-weight: 600;
}

.import-steps li span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background: var(--card-bg);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.import-steps li.active {
  color: var(--terracotta-dark);
}

.import-steps li.active span {
  border-color: var(--terracotta);
  background: var(--terracotta);
  color: white;
  box-shadow: 0 4px 14px rgba(184, 95, 67, 0.25);
}

.import-tabs {
  max-width: 440px;
  margin: 0 auto 26px;
  padding: 5px;
  gap: 4px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--cream-dark);
}

.import-tabs .form-tab {
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  font-size: 0.9rem;
}

.import-tabs .form-tab.active {
  background: var(--card-bg);
  color: var(--terracotta-dark);
  box-shadow: 0 3px 12px rgba(44, 24, 16, 0.08);
}

.import-source-card,
.import-review,
.import-details-section {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  background: var(--card-bg);
}

.import-source-card {
  padding: 26px 26px 4px;
  box-shadow: var(--shadow-soft);
}

.import-url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  direction: ltr;
}

.import-url-row input {
  min-width: 0;
}

.import-analyze-btn {
  min-width: 132px;
  padding: 0 22px;
  border-radius: var(--radius-lg);
  white-space: nowrap;
}

.field-hint {
  margin: 8px 2px 0;
  color: var(--text-light);
  font-size: 0.78rem;
}

.social-import-helper {
  margin: 4px -10px 20px;
  padding: 22px;
  border: 1px solid rgba(102, 114, 83, 0.28);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(168, 184, 156, 0.15), rgba(168, 184, 156, 0.05));
}

.social-helper-heading {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.social-helper-heading > span {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(102, 114, 83, 0.35);
  border-radius: 50%;
  color: var(--olive);
  font-size: 1.35rem;
}

.social-helper-heading strong {
  display: block;
  color: var(--text-color);
  font-size: 0.92rem;
}

.social-helper-heading p {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.55;
}

.social-import-helper textarea {
  min-height: 104px;
  background: var(--card-bg);
}

.import-progress {
  display: flex;
  gap: 14px;
  align-items: center;
  margin: 18px 0 0;
  padding: 15px 18px;
  border: 1px solid rgba(184, 95, 67, 0.24);
  border-radius: var(--radius-lg);
  background: rgba(184, 95, 67, 0.06);
}

.import-progress-mark {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border: 2px solid rgba(184, 95, 67, 0.22);
  border-top-color: var(--terracotta);
  border-radius: 50%;
  animation: importSpin 0.8s linear infinite;
}

.import-progress strong,
.import-progress span {
  display: block;
}

.import-progress strong {
  font-size: 0.88rem;
}

.import-progress div > span {
  color: var(--text-secondary);
  font-size: 0.76rem;
}

@keyframes importSpin {
  to { transform: rotate(360deg); }
}

.import-review {
  position: relative;
  margin-top: 20px;
  padding: 26px;
  background:
    linear-gradient(rgba(189, 145, 73, 0.05) 1px, transparent 1px) 0 14px / 100% 28px,
    var(--card-bg);
  box-shadow: var(--shadow-soft);
}

.import-review::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 50%;
  width: 92px;
  height: 18px;
  transform: translateX(50%) rotate(-1deg);
  background: rgba(230, 167, 86, 0.2);
  border-right: 1px solid rgba(189, 145, 73, 0.26);
  border-left: 1px solid rgba(189, 145, 73, 0.26);
}

.import-review-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.import-review-heading h3 {
  font-size: 1.25rem;
  line-height: 1.2;
}

.confidence-badge {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid rgba(102, 114, 83, 0.28);
  border-radius: var(--radius-full);
  background: rgba(102, 114, 83, 0.09);
  color: var(--olive);
  font-size: 0.72rem;
  font-weight: 700;
}

.section-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.section-label-row label {
  margin-bottom: 0;
}

.section-label-row span {
  color: var(--text-light);
  font-size: 0.72rem;
}

.section-label-row #category-suggestion {
  color: var(--olive);
  font-weight: 700;
}

.image-candidates-section {
  margin-top: 6px;
}

.image-candidates {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.image-candidate {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  background: var(--cream-dark);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.image-candidate:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.image-candidate.selected {
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px rgba(184, 95, 67, 0.12);
}

.image-candidate.selected::after {
  content: '✓';
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--terracotta);
  color: white;
  font-size: 0.76rem;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(44, 24, 16, 0.22);
}

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

.import-inline-notice {
  margin-top: 16px;
  padding: 14px 16px;
  border-right: 3px solid var(--honey);
  border-radius: var(--radius);
  background: rgba(230, 167, 86, 0.1);
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.manual-entry-intro {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--cream-dark), var(--linen));
}

.manual-entry-intro > span {
  font-family: var(--font-display);
  color: var(--terracotta);
  font-size: 2rem;
  line-height: 1;
}

.manual-entry-intro p {
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.55;
}

.manual-entry-intro strong {
  color: var(--text-color);
}

.import-details-section {
  margin-top: 22px;
  padding: 26px;
  background: linear-gradient(180deg, var(--card-bg), var(--linen));
}

.import-upload-zone {
  margin-bottom: 24px;
  padding: 10px;
  border: 1px dashed var(--clay);
  border-radius: var(--radius-lg);
  background: rgba(184, 149, 108, 0.05);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.import-upload-zone:focus-within,
.import-upload-zone:hover {
  border-color: var(--terracotta);
  background: rgba(184, 95, 67, 0.05);
}

.import-upload-zone.compact {
  margin: 0;
  padding: 8px;
}

.upload-zone-label {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 8px 10px;
  cursor: pointer;
}

.upload-zone-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--cream-dark);
  color: var(--terracotta);
  font-size: 1.35rem;
}

.upload-zone-label > span:nth-child(2) {
  display: grid;
  flex: 1;
}

.upload-zone-label strong {
  color: var(--text-color);
  font-size: 0.86rem;
}

.upload-zone-label small {
  color: var(--text-light);
  font-size: 0.72rem;
}

.upload-zone-action {
  padding: 7px 11px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--card-bg);
  color: var(--terracotta-dark);
  font-size: 0.72rem;
  font-weight: 700;
}

.selected-image-preview {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px;
}

.selected-image-preview img {
  width: 72px;
  height: 56px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  object-fit: cover;
}

.selected-image-preview div {
  display: grid;
  min-width: 0;
}

.selected-image-preview strong {
  overflow: hidden;
  color: var(--text-color);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-image-preview span {
  color: var(--text-light);
  font-size: 0.72rem;
}

.selected-image-preview button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: var(--cream-dark);
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
}

.screenshot-previews {
  display: flex;
  gap: 8px;
  padding: 0 8px 8px;
}

.screenshot-preview {
  position: relative;
  width: 58px;
  height: 58px;
}

.screenshot-preview img {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  object-fit: cover;
}

.screenshot-preview button {
  position: absolute;
  top: -5px;
  left: -5px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: var(--espresso);
  color: white;
  cursor: pointer;
}

.import-tags-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.import-tag-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--card-bg);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.import-tag-option:hover {
  border-color: var(--tag-color, var(--terracotta));
  color: var(--tag-color, var(--terracotta));
}

.import-tag-option.selected {
  border-color: var(--tag-color, var(--terracotta));
  background: color-mix(in srgb, var(--tag-color, var(--terracotta)) 11%, var(--card-bg));
  color: var(--tag-color, var(--terracotta));
  box-shadow: 0 3px 10px rgba(44, 24, 16, 0.05);
}

.optional-label {
  color: var(--text-light);
  font-size: 0.72rem;
  font-weight: 400;
}

.recipe-import-modal .form-actions {
  position: sticky;
  bottom: -1px;
  z-index: 8;
  margin: 28px -40px -40px;
  padding: 18px 40px calc(18px + var(--safe-area-bottom));
  border-top: 1px solid var(--border-color);
  background: color-mix(in srgb, var(--card-bg) 92%, transparent);
  backdrop-filter: blur(14px);
}

.recipe-import-modal .form-actions .btn-secondary {
  flex: 0 0 128px;
}

.import-service-status {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 15px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--cream-dark);
}

.status-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--text-light);
  box-shadow: 0 0 0 4px rgba(140, 127, 117, 0.12);
}

.import-service-status.ready .status-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(90, 124, 74, 0.12);
}

.import-service-status.error .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(184, 59, 59, 0.12);
}

.import-service-status div {
  display: grid;
}

.import-service-status strong {
  font-size: 0.84rem;
}

.import-service-status small {
  color: var(--text-secondary);
  font-size: 0.72rem;
}

html.dark-mode .import-header {
  background:
    radial-gradient(circle at 12% 18%, rgba(223, 134, 102, 0.1), transparent 25%),
    radial-gradient(circle at 90% 5%, rgba(138, 158, 104, 0.09), transparent 26%),
    linear-gradient(145deg, var(--card-bg), var(--bg-secondary));
}

html.dark-mode .import-tabs .form-tab.active,
html.dark-mode .import-review,
html.dark-mode .import-source-card {
  background-color: var(--card-bg);
}

html.dark-mode .confidence-badge {
  color: var(--olive-light);
}

@media (max-width: 600px) {
  .recipe-reading-header {
    align-items: stretch;
    flex-direction: column;
  }

  .recipe-language-toggle {
    width: 100%;
  }

  .recipe-import-modal .modal-body {
    padding: 0 14px 22px;
  }

  .recipe-import-modal > .modal-close {
    top: 12px;
    left: 12px;
  }

  .import-header {
    margin: 0 -14px 20px;
    padding: 28px 46px 22px;
  }

  .import-header .modal-title {
    font-size: 1.55rem;
  }

  .import-header .modal-subtitle {
    font-size: 0.78rem;
  }

  .import-steps {
    gap: 18px;
  }

  .import-steps li {
    min-width: 48px;
    font-size: 0.66rem;
  }

  .import-source-card,
  .import-review,
  .import-details-section {
    padding: 18px;
    border-radius: var(--radius-lg);
  }

  .import-url-row {
    grid-template-columns: 1fr;
  }

  .import-analyze-btn {
    min-height: 48px;
  }

  .social-import-helper {
    margin-right: -6px;
    margin-left: -6px;
    padding: 16px;
  }

  .image-candidates {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .upload-zone-action {
    display: none;
  }

  .recipe-import-modal .form-actions {
    flex-direction: row;
    margin: 22px -14px -22px;
    padding: 13px 14px calc(13px + var(--safe-area-bottom));
  }

  .recipe-import-modal .form-actions .btn-secondary {
    flex: 0 0 92px;
  }

  .recipe-import-modal .form-actions .btn {
    padding: 13px 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .import-progress-mark {
    animation-duration: 1.6s;
  }

  .image-candidate,
  .import-tag-option {
    transition: none;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LIVE COOKING — a calm, persistent kitchen counter
   ═══════════════════════════════════════════════════════════════════════════ */

.cooking-card-add,
.modal-cooking-btn,
.cooking-fab,
.cooking-workspace button {
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

.cooking-card-add {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 12px 9px 14px;
  border: 0;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--card-bg) 91%, transparent);
  color: var(--text-color);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.06),
    0 4px 16px rgba(40, 36, 31, 0.13);
  backdrop-filter: blur(12px);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
  transition-property: background-color, color, box-shadow, scale;
  transition-duration: 180ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.cooking-card-add:hover {
  box-shadow:
    0 0 0 1px rgba(184, 95, 67, 0.2),
    0 8px 22px rgba(40, 36, 31, 0.17);
}

.cooking-card-add:active,
.modal-cooking-btn:active,
.cooking-fab:active,
.cooking-workspace button:active {
  scale: 0.96;
}

.cooking-card-add.selected {
  background: var(--olive);
  color: #fffdf9;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.16),
    0 7px 20px rgba(40, 36, 31, 0.18);
}

.cooking-card-add svg,
.modal-cooking-btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
  overflow: visible;
}

.cooking-icon-pot,
.cooking-icon-check {
  transform-box: fill-box;
  transform-origin: center;
  transition-property: opacity, transform, filter;
  transition-duration: 260ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.cooking-icon-check {
  opacity: 0;
  filter: blur(4px);
  transform: scale(0.25);
  stroke-width: 2;
}

.selected .cooking-icon-pot {
  opacity: 0;
  filter: blur(4px);
  transform: scale(0.25);
}

.selected .cooking-icon-check {
  opacity: 1;
  filter: blur(0);
  transform: scale(1);
}

.modal-cooking-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px 10px 18px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--espresso);
  color: #fffdf9;
  box-shadow: var(--shadow-control);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
  transition-property: background-color, color, box-shadow, scale;
  transition-duration: 180ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.modal-cooking-btn:hover {
  background: var(--charcoal);
  box-shadow: var(--shadow-control-hover);
}

.modal-cooking-btn.selected {
  background: var(--olive);
}

.cooking-fab {
  position: fixed;
  right: 50%;
  bottom: calc(22px + var(--safe-area-bottom));
  z-index: 950;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 12px 10px 19px;
  border: 0;
  border-radius: var(--radius-full);
  background:
    linear-gradient(135deg, var(--espresso), color-mix(in srgb, var(--espresso) 78%, var(--olive)));
  color: #fffdf9;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.14),
    0 10px 24px rgba(40, 36, 31, 0.2),
    0 22px 54px rgba(40, 36, 31, 0.18);
  cursor: pointer;
  font-size: 0.94rem;
  font-weight: 700;
  transform: translateX(50%);
  transition-property: transform, box-shadow, background-color;
  transition-duration: 200ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.cooking-fab:hover {
  transform: translateX(50%) translateY(-2px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.18),
    0 14px 28px rgba(40, 36, 31, 0.23),
    0 26px 62px rgba(40, 36, 31, 0.2);
}

.cooking-fab:active {
  transform: translateX(50%);
}

.cooking-fab-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
}

.cooking-fab-count {
  display: grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  padding: 0 9px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.13);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  font-variant-numeric: tabular-nums;
}

body.has-cooking-fab .recipes-container {
  padding-bottom: 124px;
}

body.has-cooking-fab .toast-container {
  bottom: calc(96px + var(--safe-area-bottom));
}

.cooking-workspace {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  background:
    radial-gradient(circle at 9% -6%, rgba(184, 95, 67, 0.11), transparent 28%),
    radial-gradient(circle at 92% 105%, rgba(102, 114, 83, 0.09), transparent 32%),
    var(--bg-color);
  color: var(--text-color);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition-property: opacity, transform;
  transition-duration: 220ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.cooking-workspace.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.cooking-workspace-header {
  direction: rtl;
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 120px;
  align-items: center;
  min-height: calc(84px + var(--safe-area-top));
  padding: calc(14px + var(--safe-area-top)) clamp(18px, 4vw, 52px) 14px;
  background: color-mix(in srgb, var(--card-bg) 88%, transparent);
  box-shadow: 0 1px rgba(40, 36, 31, 0.07);
  backdrop-filter: blur(18px);
}

.cooking-workspace-close {
  display: grid;
  place-items: center;
  justify-self: start;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--control-surface);
  color: var(--text-color);
  box-shadow: var(--shadow-control);
  cursor: pointer;
  transition-property: background-color, box-shadow, scale;
  transition-duration: 180ms;
}

.cooking-workspace-close:hover {
  background: var(--control-surface-hover);
  box-shadow: var(--shadow-control-hover);
}

.cooking-workspace-close svg,
.cooking-source-link svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.cooking-workspace-close svg {
  transform: rotate(180deg);
}

.cooking-workspace-heading {
  min-width: 0;
  text-align: center;
}

.cooking-workspace-heading > span {
  display: block;
  margin-bottom: 1px;
  color: var(--terracotta-dark);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.cooking-workspace-heading h2 {
  font-size: clamp(1.22rem, 3vw, 1.65rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.cooking-clear-btn {
  justify-self: end;
  min-height: 42px;
  padding: 8px 13px;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  transition-property: background-color, color, scale;
  transition-duration: 180ms;
}

.cooking-clear-btn:hover {
  background: var(--control-surface);
  color: var(--danger);
}

.cooking-clear-confirm {
  direction: rtl;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 12px 18px;
  background: color-mix(in srgb, var(--honey) 12%, var(--card-bg));
  box-shadow: inset 0 -1px rgba(40, 36, 31, 0.06);
}

.cooking-clear-confirm p {
  font-size: 0.86rem;
  font-weight: 650;
}

.cooking-clear-confirm > div {
  display: flex;
  gap: 8px;
}

.cooking-clear-confirm button {
  min-height: 40px;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--card-bg);
  color: var(--text-secondary);
  box-shadow: var(--shadow-control);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
}

.cooking-clear-confirm button.danger {
  background: var(--danger);
  color: white;
}

.cooking-view-switcher {
  direction: rtl;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  width: min(540px, calc(100% - 36px));
  margin: 14px auto 4px;
  padding: 4px;
  border: 1px solid color-mix(in srgb, var(--text-color) 8%, transparent);
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--control-surface) 86%, transparent);
  box-shadow: inset 0 1px 2px rgba(40, 36, 31, 0.04);
}

.cooking-view-switcher button {
  min-height: 40px;
  padding: 7px 14px;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 680;
  transition-property: background-color, color, box-shadow;
  transition-duration: 180ms;
}

.cooking-view-switcher button.active {
  background: var(--card-bg);
  color: var(--text-color);
  box-shadow: var(--shadow-control);
}

.cooking-recipe-rail {
  direction: rtl;
  display: flex;
  gap: 10px;
  min-height: 98px;
  padding: 14px clamp(18px, 4vw, 52px);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  background: color-mix(in srgb, var(--card-bg) 56%, transparent);
  box-shadow: inset 0 -1px rgba(40, 36, 31, 0.06);
}

.cooking-rail-item {
  direction: rtl;
  display: grid;
  grid-template-columns: 54px minmax(76px, 132px) 22px;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-height: 68px;
  padding: 7px 7px 7px 10px;
  border: 0;
  border-radius: 19px;
  background: var(--card-bg);
  color: var(--text-secondary);
  box-shadow: var(--shadow-control);
  cursor: pointer;
  scroll-snap-align: center;
  text-align: right;
  transition-property: color, box-shadow, transform, background-color;
  transition-duration: 180ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.cooking-rail-item:hover {
  color: var(--text-color);
  box-shadow: var(--shadow-control-hover);
  transform: translateY(-1px);
}

.cooking-rail-item.active {
  background: color-mix(in srgb, var(--terracotta) 8%, var(--card-bg));
  color: var(--text-color);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--terracotta) 42%, transparent),
    0 7px 18px rgba(40, 36, 31, 0.08);
}

.cooking-rail-thumb {
  display: block;
  width: 54px;
  height: 54px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--cream-dark);
}

.cooking-rail-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  outline: 1px solid var(--image-outline);
  outline-offset: -1px;
}

.cooking-rail-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 1.45rem;
}

.cooking-rail-name {
  overflow: hidden;
  font-size: 0.81rem;
  font-weight: 700;
  line-height: 1.3;
  text-overflow: ellipsis;
  text-wrap: pretty;
}

.cooking-rail-index {
  color: var(--text-light);
  font-family: var(--font-accent);
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.cooking-stage {
  direction: rtl;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: clamp(24px, 5vw, 64px);
  outline: none;
  -webkit-overflow-scrolling: touch;
}

.cooking-plan-view,
.cooking-plan-state {
  width: min(820px, 100%);
  margin: 0 auto;
}

.cooking-plan-heading {
  max-width: 650px;
  margin-bottom: 30px;
}

.cooking-plan-heading > span {
  display: block;
  margin-bottom: 5px;
  color: var(--terracotta-dark);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.cooking-plan-heading h3 {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.cooking-plan-heading p {
  max-width: 580px;
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
  text-wrap: pretty;
}

.cooking-checklist {
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--text-color) 9%, transparent);
  border-radius: 22px;
  background: color-mix(in srgb, var(--card-bg) 92%, transparent);
  box-shadow: var(--shadow-card);
}

.cooking-check-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  padding: 17px 20px;
  cursor: pointer;
  transition-property: background-color, color;
  transition-duration: 160ms;
}

.cooking-check-item + .cooking-check-item {
  border-top: 1px solid color-mix(in srgb, var(--text-color) 7%, transparent);
}

.cooking-check-item:hover {
  background: color-mix(in srgb, var(--terracotta) 5%, transparent);
}

.cooking-check-item input,
.cooking-timeline input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.cooking-check-mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border: 1.5px solid color-mix(in srgb, var(--text-color) 28%, transparent);
  border-radius: 7px;
  background: var(--card-bg);
  transition-property: background-color, border-color;
  transition-duration: 160ms;
}

.cooking-check-mark::after {
  width: 8px;
  height: 4px;
  border-bottom: 1.8px solid white;
  border-left: 1.8px solid white;
  content: "";
  opacity: 0;
  transform: rotate(-45deg) translateY(-1px);
}

.cooking-check-item.checked .cooking-check-mark,
.cooking-timeline li.checked .cooking-check-mark {
  border-color: var(--olive);
  background: var(--olive);
}

.cooking-check-item.checked .cooking-check-mark::after,
.cooking-timeline li.checked .cooking-check-mark::after {
  opacity: 1;
}

.cooking-check-copy {
  display: grid;
  gap: 3px;
}

.cooking-check-copy strong {
  font-size: 0.98rem;
  font-weight: 680;
  line-height: 1.5;
}

.cooking-check-copy small,
.cooking-timeline-copy small {
  color: var(--terracotta-dark);
  font-size: 0.7rem;
  font-weight: 700;
}

.cooking-check-copy em,
.cooking-timeline-copy em {
  color: var(--text-light);
  font-size: 0.73rem;
  font-style: normal;
  line-height: 1.5;
}

.cooking-check-item.checked .cooking-check-copy strong,
.cooking-timeline li.checked .cooking-timeline-copy strong {
  color: var(--text-light);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.cooking-timeline {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 0;
  list-style: none;
}

.cooking-timeline::before {
  position: absolute;
  top: 18px;
  bottom: 18px;
  right: 20px;
  width: 1px;
  background: color-mix(in srgb, var(--terracotta) 28%, transparent);
  content: "";
}

.cooking-timeline li {
  position: relative;
  border: 1px solid color-mix(in srgb, var(--text-color) 8%, transparent);
  border-radius: 20px;
  background: var(--card-bg);
  box-shadow: var(--shadow-control);
}

.cooking-timeline label {
  display: grid;
  grid-template-columns: 22px 92px minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  padding: 17px 20px;
  cursor: pointer;
}

.cooking-timeline-time {
  color: var(--text-secondary);
  font-family: var(--font-accent);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.cooking-timeline-copy {
  display: grid;
  gap: 5px;
}

.cooking-timeline-copy strong {
  font-size: 0.94rem;
  font-weight: 680;
  line-height: 1.65;
}

.cooking-plan-warnings {
  margin-top: 20px;
  padding: 14px 17px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--honey) 10%, var(--card-bg));
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.6;
}

.cooking-plan-state {
  display: grid;
  place-items: center;
  min-height: 45vh;
  text-align: center;
}

.cooking-plan-state h3 {
  margin-top: 14px;
  font-size: 1.45rem;
}

.cooking-plan-state p {
  max-width: 420px;
  margin-top: 6px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.cooking-plan-state button {
  min-height: 42px;
  margin-top: 18px;
  padding: 9px 18px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--terracotta);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

.cooking-plan-loader {
  width: 34px;
  height: 34px;
  border: 2px solid color-mix(in srgb, var(--terracotta) 20%, transparent);
  border-top-color: var(--terracotta);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.cooking-plan-empty {
  padding: 28px;
  border: 1px dashed color-mix(in srgb, var(--text-color) 18%, transparent);
  border-radius: 18px;
  color: var(--text-secondary);
  text-align: center;
}

.cooking-recipe {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.cooking-recipe-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.cooking-recipe-position {
  display: block;
  margin-bottom: 5px;
  color: var(--terracotta-dark);
  font-family: var(--font-accent);
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cooking-recipe-header h3 {
  max-width: 780px;
  font-size: clamp(1.85rem, 5vw, 3.35rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.cooking-recipe-header p {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.cooking-remove-btn {
  flex: 0 0 auto;
  min-width: 72px;
  min-height: 42px;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 650;
  transition-property: background-color, color, scale;
  transition-duration: 180ms;
}

.cooking-remove-btn:hover {
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  color: var(--danger);
}

.cooking-recipe-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(0, 1.35fr);
  align-items: start;
  gap: clamp(26px, 5vw, 72px);
}

.cooking-media-column {
  display: grid;
  gap: 18px;
  position: sticky;
  top: 0;
  min-width: 0;
}

.cooking-hero-image,
.cooking-media-placeholder {
  width: 100%;
  max-height: 520px;
  border-radius: 22px;
  background: var(--cream-dark);
  box-shadow: var(--shadow-card);
}

.cooking-hero-image {
  display: block;
  object-fit: cover;
  outline: 1px solid var(--image-outline);
  outline-offset: -1px;
}

.cooking-media-placeholder {
  display: grid;
  place-items: center;
  min-height: 280px;
  background:
    linear-gradient(145deg, var(--cream-dark), color-mix(in srgb, var(--olive) 10%, var(--card-bg)));
}

.cooking-media-placeholder span {
  font-size: 5rem;
  filter: saturate(0.72);
}

.cooking-media-column .video-container,
.cooking-media-column .video-fallback,
.cooking-media-column .external-recipe-card {
  margin-bottom: 0;
}

.cooking-copy-column {
  min-width: 0;
  padding: 3px 0 60px;
}

.cooking-copy-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.cooking-copy-heading > span {
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.cooking-source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  color: var(--terracotta-dark);
  font-size: 0.76rem;
  font-weight: 700;
  text-decoration: none;
}

.cooking-source-link svg {
  width: 16px;
  height: 16px;
}

.cooking-recipe-text {
  color: var(--text-color);
  font-size: clamp(1.02rem, 1.6vw, 1.16rem);
  line-height: 2;
  white-space: pre-wrap;
}

.cooking-no-text {
  padding: 28px;
  border-radius: var(--radius-xl);
  background: var(--card-bg);
  box-shadow: var(--shadow-card);
}

.cooking-no-text h4 {
  margin-bottom: 5px;
  font-size: 1.08rem;
}

.cooking-no-text p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-wrap: pretty;
}

.cooking-notes {
  margin-top: 32px;
  padding: 20px 22px;
  border-right: 3px solid var(--honey);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--honey) 8%, var(--card-bg));
}

.cooking-notes > span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.cooking-notes p {
  font-size: 0.91rem;
  line-height: 1.7;
  text-wrap: pretty;
}

.cooking-empty-state {
  display: grid;
  place-items: center;
  width: min(520px, 100%);
  margin: 12vh auto 0;
  text-align: center;
}

.cooking-empty-rule {
  width: 52px;
  height: 3px;
  margin-bottom: 22px;
  border-radius: var(--radius-full);
  background: var(--terracotta);
}

.cooking-empty-state h3 {
  margin-bottom: 7px;
  font-size: 1.75rem;
  text-wrap: balance;
}

.cooking-empty-state p {
  max-width: 390px;
  color: var(--text-secondary);
  text-wrap: pretty;
}

.cooking-empty-state button {
  min-height: 44px;
  margin-top: 24px;
  padding: 10px 18px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--espresso);
  color: #fffdf9;
  box-shadow: var(--shadow-control);
  cursor: pointer;
  font-weight: 700;
}

.cooking-workspace button:focus-visible,
.cooking-fab:focus-visible,
.cooking-card-add:focus-visible,
.modal-cooking-btn:focus-visible,
.cooking-source-link:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--terracotta) 32%, transparent);
  outline-offset: 3px;
}

html.dark-mode .cooking-card-add {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1),
    0 8px 22px rgba(0, 0, 0, 0.25);
}

html.dark-mode .modal-cooking-btn,
html.dark-mode .cooking-fab,
html.dark-mode .cooking-empty-state button {
  background: #f3eee4;
  color: #20241f;
}

html.dark-mode .modal-cooking-btn.selected,
html.dark-mode .cooking-card-add.selected {
  background: var(--olive);
  color: #151914;
}

@media (max-width: 760px) {
  .cooking-card-add {
    top: 12px;
    right: 12px;
    min-height: 40px;
    padding: 8px 10px 8px 12px;
    font-size: 0.71rem;
  }

  .cooking-fab {
    bottom: calc(14px + var(--safe-area-bottom));
    width: calc(100% - 28px);
    max-width: 420px;
    min-height: 56px;
  }

  body.has-cooking-fab .toast-container {
    bottom: calc(84px + var(--safe-area-bottom));
  }

  .cooking-workspace {
    height: 100dvh;
  }

  .cooking-workspace-header {
    grid-template-columns: 48px minmax(0, 1fr) 70px;
    min-height: calc(72px + var(--safe-area-top));
    padding: calc(10px + var(--safe-area-top)) 14px 10px;
  }

  .cooking-workspace-heading > span {
    font-size: 0.6rem;
  }

  .cooking-workspace-heading h2 {
    font-size: 1.08rem;
  }

  .cooking-clear-btn {
    min-height: 40px;
    padding: 6px;
    font-size: 0.68rem;
  }

  .cooking-clear-confirm {
    align-items: stretch;
    gap: 10px;
    padding: 10px 14px;
  }

  .cooking-clear-confirm p {
    align-self: center;
    flex: 1;
    font-size: 0.76rem;
  }

  .cooking-clear-confirm button {
    padding: 7px 11px;
    font-size: 0.7rem;
  }

  .cooking-view-switcher {
    width: calc(100% - 28px);
    margin-top: 10px;
  }

  .cooking-view-switcher button {
    min-height: 38px;
    padding: 6px 8px;
    font-size: 0.69rem;
  }

  .cooking-recipe-rail {
    min-height: 83px;
    gap: 8px;
    padding: 10px 14px;
  }

  .cooking-rail-item {
    grid-template-columns: 48px minmax(70px, 105px);
    min-height: 62px;
    gap: 8px;
    border-radius: 17px;
  }

  .cooking-rail-thumb {
    width: 48px;
    height: 48px;
    border-radius: 10px;
  }

  .cooking-rail-name {
    font-size: 0.73rem;
  }

  .cooking-rail-index {
    display: none;
  }

  .cooking-stage {
    padding: 24px 16px calc(42px + var(--safe-area-bottom));
  }

  .cooking-plan-heading {
    margin-bottom: 22px;
  }

  .cooking-plan-heading h3 {
    font-size: 1.85rem;
  }

  .cooking-check-item {
    padding: 15px 16px;
  }

  .cooking-timeline label {
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 11px 13px;
    padding: 15px 16px;
  }

  .cooking-timeline-time {
    grid-column: 2;
    grid-row: 1;
  }

  .cooking-timeline-copy {
    grid-column: 2;
    grid-row: 2;
  }

  .cooking-recipe-header {
    align-items: start;
    gap: 12px;
    margin-bottom: 21px;
  }

  .cooking-recipe-position {
    margin-bottom: 3px;
    font-size: 0.88rem;
  }

  .cooking-recipe-header h3 {
    font-size: clamp(1.65rem, 8vw, 2.25rem);
  }

  .cooking-recipe-header p {
    margin-top: 5px;
    font-size: 0.75rem;
  }

  .cooking-remove-btn {
    min-width: 58px;
    min-height: 40px;
    padding: 7px 9px;
    font-size: 0.7rem;
  }

  .cooking-recipe-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .cooking-recipe.has-recipe-text .cooking-copy-column {
    grid-row: 1;
  }

  .cooking-recipe.has-recipe-text .cooking-media-column {
    grid-row: 2;
  }

  .cooking-media-column {
    position: static;
  }

  .cooking-hero-image,
  .cooking-media-placeholder {
    max-height: 58vh;
    border-radius: 18px;
  }

  .cooking-media-placeholder {
    min-height: 220px;
  }

  .cooking-copy-column {
    padding-bottom: 28px;
  }

  .cooking-copy-heading {
    margin-bottom: 11px;
  }

  .cooking-recipe-text {
    font-size: 1rem;
    line-height: 1.9;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cooking-card-add,
  .modal-cooking-btn,
  .cooking-fab,
  .cooking-workspace,
  .cooking-workspace button,
  .cooking-rail-item,
  .cooking-icon-pot,
  .cooking-icon-check {
    transition: none;
  }
}

@media print {
  .cooking-card-add,
  .cooking-fab,
  .cooking-workspace {
    display: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   COOKBOOK V2 — personal libraries and shared kitchens
   A quiet editorial layer that keeps ownership controls distinct from food tags.
   ═══════════════════════════════════════════════════════════════════════════ */

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.library-toolbar {
  position: relative;
  z-index: 4;
  width: min(100% - 48px, 1120px);
  margin: 22px auto 4px;
  padding: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-radius: 22px;
  background: color-mix(in srgb, var(--card-bg) 90%, transparent);
  box-shadow:
    0 0 0 1px rgba(40, 36, 31, 0.06),
    0 1px 2px -1px rgba(40, 36, 31, 0.06),
    0 12px 32px rgba(40, 36, 31, 0.05);
  backdrop-filter: blur(18px);
}

.library-switcher {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  min-width: min(100%, 410px);
  padding: 3px;
  border-radius: 17px;
  background: var(--bg-secondary);
  box-shadow: inset 0 1px 2px rgba(40, 36, 31, 0.05);
}

.library-scope {
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text-secondary);
  font: 600 0.86rem/1 var(--font-body);
  cursor: pointer;
  transition-property: color, background-color, box-shadow, scale;
  transition-duration: 180ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.library-scope:hover {
  color: var(--text-color);
}

.library-scope:active {
  scale: 0.96;
}

.library-scope.active {
  color: var(--text-color);
  background: var(--card-bg);
  box-shadow:
    0 0 0 1px rgba(40, 36, 31, 0.05),
    0 2px 9px rgba(40, 36, 31, 0.08);
}

.library-scope:focus-visible,
.kitchen-picker select:focus-visible,
.favorite-button:focus-visible,
.account-icon-action:focus-visible,
.account-text-action:focus-visible {
  outline: 3px solid rgba(184, 95, 67, 0.24);
  outline-offset: 2px;
}

.kitchen-picker {
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-inline: 14px 4px;
  color: var(--text-light);
  font: 600 0.76rem/1 var(--font-body);
}

.kitchen-picker select {
  min-height: 42px;
  flex: 1;
  padding: 0 12px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text-color);
  font: 600 0.86rem/1 var(--font-body);
  cursor: pointer;
}

.tag-filter-pill.system-favorite {
  --tag-color: var(--gold);
  gap: 7px;
}

.system-favorite svg,
.favorite-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.system-favorite.active svg,
.favorite-button.active svg {
  fill: currentColor;
}

.favorite-button {
  position: absolute;
  z-index: 4;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--card-bg) 90%, transparent);
  color: var(--text-secondary);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.06),
    0 6px 18px rgba(40, 36, 31, 0.12);
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition-property: color, background-color, scale, box-shadow;
  transition-duration: 180ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.favorite-button:hover,
.favorite-button.active {
  color: var(--gold);
  background: var(--card-bg);
  box-shadow:
    0 0 0 1px rgba(189, 145, 73, 0.2),
    0 8px 22px rgba(40, 36, 31, 0.14);
}

.favorite-button:active {
  scale: 0.96;
}

.recipe-card.has-v2-controls .cooking-card-add {
  right: auto;
  left: 14px;
}

.recipe-card .recipe-meta {
  align-items: center;
  gap: 7px;
}

.recipe-card .recipe-tag,
.recipe-card .recipe-tag.type-video,
.recipe-card .recipe-tag.type-text,
.recipe-card .recipe-tag.type-photo,
.recipe-card .recipe-tag.type-link {
  min-height: 27px;
  padding: 5px 10px;
  border: 1px solid color-mix(in srgb, var(--text-color) 8%, transparent);
  border-radius: 9px;
  background: color-mix(in srgb, var(--card-bg) 62%, var(--bg-secondary));
  color: var(--text-secondary);
  font-size: 0.69rem;
  font-weight: 620;
  letter-spacing: 0;
}

.recipe-card .recipe-tags {
  align-items: center;
  min-height: 25px;
  margin-top: 9px;
}

.recipe-card .recipe-tag-pill {
  width: auto;
  height: 25px;
  max-width: 112px;
  padding: 4px 9px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--olive) 14%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--olive) 6%, transparent);
  color: color-mix(in srgb, var(--olive) 82%, var(--text-color));
  font-size: 0.67rem;
  font-weight: 650;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipe-tag-more {
  color: var(--text-light);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.recipe-tags-display {
  border: 1px solid color-mix(in srgb, var(--text-color) 7%, transparent);
  background: color-mix(in srgb, var(--card-bg) 70%, var(--bg-secondary));
}

.recipe-tags-display .tag-display-pill {
  border: 1px solid color-mix(in srgb, var(--olive) 14%, transparent);
  border-radius: 9px;
  background: color-mix(in srgb, var(--olive) 7%, transparent);
  color: color-mix(in srgb, var(--olive) 82%, var(--text-color));
}

.recipe-origin-line,
.recipe-provenance {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: -3px 0 13px;
  color: var(--text-light);
  font: 500 0.76rem/1.4 var(--font-body);
}

.recipe-origin-line::before,
.recipe-provenance::before {
  content: '';
  width: 14px;
  height: 1px;
  background: var(--sage);
}

.recipe-provenance {
  width: fit-content;
  margin: 12px auto 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--olive) 8%, transparent);
  color: var(--olive);
}

.recipe-v2-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.recipe-v2-action {
  min-height: 42px;
  padding: 0 15px;
  border: 0;
  border-radius: 13px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  box-shadow: 0 0 0 1px rgba(40, 36, 31, 0.06);
  font: 600 0.82rem/1 var(--font-body);
  cursor: pointer;
  transition-property: color, background-color, box-shadow, scale;
  transition-duration: 160ms;
}

.recipe-v2-action:hover {
  color: var(--terracotta-dark);
  background: var(--card-bg);
  box-shadow: 0 0 0 1px rgba(184, 95, 67, 0.2);
}

.recipe-v2-action:active {
  scale: 0.96;
}

.account-eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--terracotta);
  font: 700 0.72rem/1.2 var(--font-body);
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.account-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.account-heading .modal-title,
.account-heading .account-eyebrow {
  margin-bottom: 0;
  text-align: right;
}

.account-heading .account-eyebrow {
  margin-bottom: 7px;
}

.auth-user-photo {
  outline: 1px solid rgba(0, 0, 0, 0.1);
  outline-offset: -1px;
}

.account-identity-card {
  margin-bottom: 14px;
  padding: 16px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--olive) 7%, var(--card-bg));
  box-shadow: 0 0 0 1px rgba(40, 36, 31, 0.05);
}

.auth-username {
  margin-top: 3px;
  color: var(--olive);
  font: 600 0.82rem/1.2 var(--font-body);
  direction: ltr;
  text-align: right;
}

.account-text-action {
  min-height: 40px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--terracotta-dark);
  font: 600 0.8rem/1 var(--font-body);
  cursor: pointer;
  transition-property: color, scale;
  transition-duration: 160ms;
}

.account-text-action:hover {
  color: var(--terracotta);
}

.account-text-action:active {
  scale: 0.96;
}

.account-section {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid color-mix(in srgb, var(--border-color) 75%, transparent);
}

.account-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 13px;
}

.account-section-heading h3,
.account-section-heading p {
  text-align: right;
}

.account-section-heading h3 {
  font: 700 1rem/1.25 var(--font-body);
}

.account-section-heading p {
  margin-top: 4px;
  color: var(--text-light);
  font: 400 0.8rem/1.45 var(--font-body);
  text-wrap: pretty;
}

.account-icon-action {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  background: var(--bg-secondary);
  color: var(--terracotta);
  box-shadow: 0 0 0 1px rgba(40, 36, 31, 0.06);
  font: 400 1.5rem/1 var(--font-body);
  cursor: pointer;
  transition-property: color, background-color, scale;
  transition-duration: 160ms;
}

.account-icon-action:hover {
  color: var(--terracotta-dark);
  background: var(--card-bg);
}

.account-icon-action:active {
  scale: 0.96;
}

.account-kitchen-list,
.account-invitation-list {
  display: grid;
  gap: 9px;
}

.account-kitchen-item,
.account-invitation-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 12px 10px 14px;
  border-radius: 16px;
  background: var(--bg-secondary);
  box-shadow: 0 0 0 1px rgba(40, 36, 31, 0.05);
}

.account-kitchen-copy,
.account-invitation-copy {
  min-width: 0;
}

.account-kitchen-copy strong,
.account-kitchen-copy span,
.account-invitation-copy strong,
.account-invitation-copy span {
  display: block;
  text-align: right;
}

.account-kitchen-copy strong,
.account-invitation-copy strong {
  font: 650 0.9rem/1.25 var(--font-body);
}

.account-kitchen-copy span,
.account-invitation-copy span {
  margin-top: 4px;
  color: var(--text-light);
  font: 400 0.74rem/1.3 var(--font-body);
}

.account-kitchen-actions,
.account-invitation-actions {
  display: flex;
  gap: 4px;
}

.account-kitchen-actions button,
.account-invitation-actions button {
  min-width: 40px;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text-secondary);
  font: 600 0.74rem/1 var(--font-body);
  cursor: pointer;
  transition-property: color, background-color, scale;
  transition-duration: 160ms;
}

.account-kitchen-actions button:hover,
.account-invitation-actions button:hover {
  color: var(--terracotta-dark);
}

.account-kitchen-actions button:active,
.account-invitation-actions button:active {
  scale: 0.96;
}

.account-signout {
  width: 100%;
  margin-top: 26px;
}

.auth-permission-status.v2-profile-status {
  background: color-mix(in srgb, var(--olive) 10%, transparent);
  color: var(--olive);
}

.onboarding-modal {
  z-index: 1300;
}

.onboarding-modal-content {
  max-width: 780px;
  display: grid;
  grid-template-columns: minmax(230px, 0.75fr) minmax(360px, 1.25fr);
  overflow: hidden;
}

.onboarding-cover {
  min-height: 510px;
  padding: 38px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(circle at 30% 18%, rgba(255, 255, 255, 0.18), transparent 26%),
    linear-gradient(155deg, var(--terracotta), var(--terracotta-dark));
}

.onboarding-cover span {
  color: rgba(255, 255, 255, 0.76);
  font: 700 0.72rem/1 var(--font-body);
  letter-spacing: 0.14em;
}

.onboarding-cover svg {
  width: 100%;
  max-width: 200px;
  align-self: center;
  fill: none;
  stroke: rgba(255, 255, 255, 0.86);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.onboarding-modal-content .modal-body {
  align-self: center;
  padding: 44px 42px;
}

.username-input-wrap {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding-left: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--card-bg);
  transition-property: border-color, box-shadow;
  transition-duration: 180ms;
}

.username-input-wrap:focus-within {
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px rgba(184, 95, 67, 0.12);
}

.username-input-wrap > span {
  color: var(--text-light);
  font: 600 0.95rem/1 var(--font-body);
}

.username-input-wrap input {
  min-width: 0;
  flex: 1;
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  text-align: left;
}

.field-error {
  min-height: 18px;
  display: block;
  margin-top: 5px;
  color: var(--danger);
  font: 500 0.75rem/1.4 var(--font-body);
  text-align: right;
}

.onboarding-actions {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.compact-modal-content {
  max-width: 500px;
}

.share-modal-content {
  max-width: 620px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.editorial-check {
  position: relative;
  margin-top: 12px;
  padding: 14px 48px 14px 14px;
  display: block;
  border-radius: 16px;
  background: var(--bg-secondary);
  box-shadow: 0 0 0 1px rgba(40, 36, 31, 0.05);
  cursor: pointer;
}

.editorial-check input {
  position: absolute;
  top: 17px;
  right: 16px;
  width: 20px;
  height: 20px;
  accent-color: var(--olive);
}

.editorial-check strong,
.editorial-check small {
  display: block;
  text-align: right;
}

.editorial-check strong {
  font: 650 0.86rem/1.3 var(--font-body);
}

.editorial-check small {
  margin-top: 4px;
  color: var(--text-light);
  font: 400 0.75rem/1.45 var(--font-body);
}

html.dark-mode .library-toolbar,
html.dark-mode .favorite-button {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

html.dark-mode .auth-user-photo,
html.dark-mode .recipe-image,
html.dark-mode .modal-image {
  outline-color: rgba(255, 255, 255, 0.1);
}

html.dark-mode .account-identity-card,
html.dark-mode .account-kitchen-item,
html.dark-mode .account-invitation-item,
html.dark-mode .recipe-v2-action,
html.dark-mode .editorial-check {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

@media (max-width: 760px) {
  .library-toolbar {
    width: calc(100% - 24px);
    margin-top: 14px;
    padding: 6px;
    display: grid;
    gap: 7px;
    border-radius: 20px;
  }

  .library-switcher {
    width: 100%;
    min-width: 0;
  }

  .library-scope {
    padding: 0 9px;
    font-size: 0.78rem;
  }

  .kitchen-picker {
    width: 100%;
    padding-inline: 10px 4px;
  }

  .onboarding-modal.active {
    padding: 0;
    align-items: stretch;
  }

  .onboarding-modal-content {
    min-height: 100dvh;
    max-height: none;
    display: block;
    border-radius: 0;
  }

  .onboarding-cover {
    min-height: 134px;
    padding: calc(var(--safe-area-top) + 22px) 24px 18px;
  }

  .onboarding-cover svg {
    width: 116px;
    position: absolute;
    top: calc(var(--safe-area-top) + 30px);
    left: 24px;
  }

  .onboarding-modal-content .modal-body {
    padding: 32px 24px calc(var(--safe-area-bottom) + 28px);
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .account-identity-card {
    align-items: center;
  }
}

@media (max-width: 430px) {
  .library-scope {
    font-size: 0.73rem;
    letter-spacing: -0.04em;
  }

  .account-kitchen-item,
  .account-invitation-item {
    grid-template-columns: 1fr;
  }

  .account-kitchen-actions,
  .account-invitation-actions {
    justify-content: flex-start;
  }

  .onboarding-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .onboarding-actions .btn,
  .onboarding-actions .account-text-action {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .library-scope,
  .favorite-button,
  .recipe-v2-action,
  .account-text-action,
  .account-icon-action,
  .account-kitchen-actions button,
  .account-invitation-actions button {
    transition: none;
  }
}

@media print {
  .library-toolbar,
  .favorite-button,
  .recipe-v2-actions {
    display: none !important;
  }
}
