/* ============================================================
   Bayis Kochbuch — Premium "Culinary Glass" Redesign
   ============================================================ */

:root {
  color-scheme: dark;
  --bg-color: #050508;
  --text-main: #f8f9fa;
  --text-muted: #a1a1aa;
  
  /* Primary Accent: Vibrant Saffron/Orange */
  --accent-primary: #ff6b35;
  --accent-primary-hover: #ff8255;
  --accent-primary-glow: rgba(255, 107, 53, 0.4);
  
  /* Secondary Accent: Fresh Herb Green */
  --accent-secondary: #00e676;
  --accent-secondary-glow: rgba(0, 230, 118, 0.2);

  /* Glassmorphism Tokens */
  --glass-bg: rgba(20, 20, 25, 0.6);
  --glass-bg-hover: rgba(30, 30, 38, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-highlight: rgba(255, 255, 255, 0.15);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  
  /* Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-pill: 9999px;

  /* Typography */
  --font-display: 'Outfit', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  /* Transitions */
  --spring: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --ease: 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Theme variations handled by CSS variables, overridden by body classes */
body.theme-alt {
  --bg-color: #060a08;
  --accent-primary: #00e676;
  --accent-primary-hover: #33ff99;
  --accent-primary-glow: rgba(0, 230, 118, 0.4);
  --accent-secondary: #ffce00;
  --accent-secondary-glow: rgba(255, 206, 0, 0.2);
}

body.theme-vivid {
  --bg-color: #090f2a;
  --text-main: #dff2ff;
  --text-muted: #8ba8cc;
  --accent-primary: #24d8ff;
  --accent-primary-hover: #3ee0ff;
  --accent-primary-glow: rgba(36, 216, 255, 0.4);
  --accent-secondary: #ff4fd8;
  --accent-secondary-glow: rgba(255, 79, 216, 0.2);
  --glass-bg: rgba(17, 24, 54, 0.85);
  --glass-border: rgba(82, 121, 255, 0.25);
  --font-display: "Fraunces", "Outfit", system-ui, serif;
}

body.theme-vivid .bg-orb--one {
  background: rgba(36, 216, 255, 0.2) !important;
}
body.theme-vivid .bg-orb--two {
  background: rgba(255, 79, 216, 0.16) !important;
}
body.theme-vivid .bg-orb--three {
  display: none !important;
}

body.theme-vivid .glass-bg {
  background:
    radial-gradient(circle at 8% -8%, rgba(36, 216, 255, 0.18), transparent 36%),
    radial-gradient(circle at 95% 4%, rgba(255, 79, 216, 0.14), transparent 35%),
    linear-gradient(145deg, #090f2a 0%, #11183e 54%, #141026 100%);
}

body.theme-vivid .glass-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.14;
  background:
    repeating-linear-gradient(
      -28deg,
      rgba(36, 216, 255, 0.1) 0px,
      rgba(36, 216, 255, 0.1) 8px,
      transparent 8px,
      transparent 22px
    );
}

/* —— Reset & Base —— */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background-color: transparent;
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Background Animation */
.glass-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--bg-color); /* Fallback */
}

.noise-overlay {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  pointer-events: none;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.4;
  pointer-events: none;
  animation: float 20s infinite alternate ease-in-out;
}

.bg-orb--one {
  width: 60vw;
  height: 60vw;
  background: var(--accent-primary);
  top: -20vh;
  left: -20vw;
  animation-duration: 25s;
}

.bg-orb--two {
  width: 50vw;
  height: 50vw;
  background: var(--accent-secondary);
  bottom: -10vh;
  right: -10vw;
  animation-duration: 22s;
  animation-delay: -5s;
}

.bg-orb--three {
  width: 40vw;
  height: 40vw;
  background: rgba(100, 100, 255, 0.2);
  top: 40vh;
  left: 30vw;
  animation-duration: 30s;
  animation-delay: -10s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -50px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.9); }
  100% { transform: translate(0, 0) scale(1); }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.02em;
}

.gradient-text {
  background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.7) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Glass Panel Utility */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
}

/* Layout */
.app-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: relative;
  z-index: 1;
}

/* Hero Section */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  padding: 2.5rem 3rem;
  gap: 2rem;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--accent-primary-glow));
  opacity: 0.2;
  pointer-events: none;
}

.hero h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: linear-gradient(to right, #fff, var(--text-muted));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 500px;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  z-index: 1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: all var(--ease);
  position: relative;
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

.btn-sm {
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
}

.btn-primary {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 4px 15px var(--accent-primary-glow);
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-primary-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--glass-border-highlight);
  transform: translateY(-2px);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--ease);
  font-size: 1.2rem;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
}

/* Form Controls */
.toolbar {
  display: grid;
  grid-template-columns: 2fr repeat(3, minmax(0, 1fr)) auto;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  align-items: end;
  position: sticky;
  top: 1rem;
  z-index: 10;
}

.toolbar-advanced {
  display: contents;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

label span {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input, select, textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  padding: 0.75rem 1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  transition: all var(--ease);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px var(--accent-primary-glow);
  background: rgba(0, 0, 0, 0.5);
}

input::placeholder, textarea::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

select option {
  background-color: var(--bg-color);
  color: var(--text-main);
}

.toolbar-design {
  display: flex;
  height: 100%;
  align-items: flex-end;
}

.toolbar-toggle {
  width: 100%;
  justify-content: space-between;
}

.toolbar-toggle::after {
  content: "+";
  font-size: 1rem;
  line-height: 1;
}

.toolbar-expanded .toolbar-toggle::after {
  content: "−";
}

/* Grid & Cards */
.main-header {
  margin-bottom: 1.5rem;
  padding-left: 0.5rem;
}

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

.recipes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.recipe-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--spring);
  display: flex;
  flex-direction: column;
  position: relative;
  backdrop-filter: blur(16px);
  animation: fadeUp 0.6s var(--spring) backwards;
}

/* Stagger animations for grid items */
.recipe-card:nth-child(1) { animation-delay: 0.1s; }
.recipe-card:nth-child(2) { animation-delay: 0.15s; }
.recipe-card:nth-child(3) { animation-delay: 0.2s; }
.recipe-card:nth-child(4) { animation-delay: 0.25s; }
.recipe-card:nth-child(5) { animation-delay: 0.3s; }
.recipe-card:nth-child(n+6) { animation-delay: 0.35s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.recipe-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: var(--glass-border-highlight);
  box-shadow: 0 15px 35px rgba(0,0,0,0.6), 0 0 20px rgba(255, 255, 255, 0.05);
}

.recipe-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent 50%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.recipe-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  transition: transform 0.7s var(--spring);
}

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

.recipe-card__content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  background: linear-gradient(to top, rgba(20,20,25,0.9), rgba(20,20,25,0.4));
  margin-top: -30px; /* Overlap image slightly */
  z-index: 2;
  border-radius: var(--radius-lg);
}

.recipe-card__name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
  min-height: calc(2 * 1.3em);
}

.recipe-card__meta, .badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

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

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(4px);
}

.badge--status {
  background: rgba(0, 230, 118, 0.1);
  color: #00e676;
  border-color: rgba(0, 230, 118, 0.2);
}

.badge--custom {
  background: rgba(255, 107, 53, 0.1);
  color: var(--accent-primary);
  border-color: rgba(255, 107, 53, 0.2);
}

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  background: rgba(255,255,255,0.02);
  border: 1px dashed var(--glass-border-highlight);
  border-radius: var(--radius-lg);
}
.empty-state h3 {
  margin-bottom: 0.5rem;
  color: #fff;
}
.empty-state p {
  color: var(--text-muted);
}

/* Dialogs */
.sheet-dialog {
  background: transparent;
  border: none;
  padding: 0;
  margin: auto;
  width: min(1100px, 95vw);
  height: 90vh;
  max-height: 90vh;
  border-radius: var(--radius-xl);
}

.sheet-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.sheet-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  overscroll-behavior: contain;
}

/* Fix background gradient inheritance inside dialog */
.sheet-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(255,107,53,0.1), transparent 40%),
              radial-gradient(circle at bottom left, rgba(0,230,118,0.05), transparent 40%);
  pointer-events: none;
  z-index: -1;
}

#recipe-detail {
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
  overscroll-behavior-x: none;
  -webkit-overflow-scrolling: touch;
}

.detail-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: rgba(15, 15, 20, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
}

.detail-content {
  padding: 2rem;
  display: grid;
  gap: 2rem;
  min-width: 0;
  overflow-x: hidden;
}

.detail-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  margin-bottom: 1rem;
  background: linear-gradient(to right, #fff, #ccc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.thumbnail-row {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.5rem 0;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
}
.thumbnail-row img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0.6;
  transition: all var(--ease);
  border: 2px solid transparent;
}
.thumbnail-row button {
  background: none;
  border: none;
  padding: 0;
}
.thumbnail-row button.active img,
.thumbnail-row img:hover {
  opacity: 1;
  border-color: var(--accent-primary);
  transform: scale(1.05);
}

.meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.meta-pill {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--glass-border);
  padding: 0.35rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 500;
}

.status-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  width: 100%;
  margin-top: 1rem;
  padding: 0.95rem 1rem;
  border: 1px solid;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

.status-warning--draft {
  color: #ffd7d7;
  background: linear-gradient(135deg, rgba(255, 63, 92, 0.2), rgba(255, 63, 92, 0.08));
  border-color: rgba(255, 91, 119, 0.38);
}

.status-warning--test {
  color: #ffe6c9;
  background: linear-gradient(135deg, rgba(255, 151, 61, 0.22), rgba(255, 107, 53, 0.08));
  border-color: rgba(255, 170, 75, 0.4);
}

.status-warning__icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  font-weight: 800;
  line-height: 1;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.status-warning strong {
  display: block;
  color: #fff;
  font-size: 0.92rem;
  line-height: 1.25;
}

.status-warning p {
  margin: 0.18rem 0 0;
  color: currentColor;
  font-size: 0.86rem;
  line-height: 1.45;
}

/* Editor Specific Styles */
.editor-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(0,0,0,0.2);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

#recipe-form {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 2rem;
  overflow-y: auto;
  overflow-x: hidden;
  height: calc(100% - 73px);
}

.editor-section {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.editor-section h3 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: #fff;
}

.editor-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.two-col-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.two-col-grid .full-width {
  grid-column: 1 / -1;
}

.glass-input-group {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--glass-border);
  padding: 1rem;
  border-radius: var(--radius-md);
  transition: all var(--ease);
  min-width: 0;
}
.glass-input-group:focus-within {
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
}

.ingredient-row {
  display: grid;
  grid-template-columns: 1.6fr 0.55fr 0.55fr 1fr 1fr auto;
  gap: 0.75rem;
  align-items: center;
  min-width: 0;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.row-action {
  background: rgba(255, 255, 255, 0.04);
}

.step-row {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}
.step-row .full-width {
  width: 100%;
}
.step-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hint-link-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
}

.hint-link-tools label {
  min-width: 0;
}

.hint-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.35fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.hint-row .full-width {
  grid-column: 1 / -1;
}

.hint-row-actions {
  justify-content: space-between;
}

.inline-actions,
.editor-footer {
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.file-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  border: 1px dashed rgba(255,255,255,0.3);
  color: var(--text-main);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--ease);
  position: relative;
  overflow: hidden;
  max-width: 100%;
}
.file-upload:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--accent-primary);
}
.file-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.image-preview-list {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.image-preview-chip {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--glass-border);
}
.image-preview-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.image-preview-chip button {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.editor-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 1rem;
}

/* Detail View Components */
.portion-box {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.portion-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.portion-stepper {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.05);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--ease);
}
.portion-stepper:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}
.portion-controls input {
  width: 80px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--glass-border);
  border-radius: 0;
  padding: 0.5rem;
}
.portion-controls input:focus {
  box-shadow: none;
  border-color: var(--accent-primary);
}

.ingredients-block, .steps-block, .notes-block, .nutrition-block {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.ingredients-section {
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  font-size: 0.85rem;
  margin: 1.5rem 0 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--glass-border);
}

.ingredient-row-view {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  align-items: center;
  min-width: 0;
}
.ingredient-amount {
  font-weight: 700;
  color: #fff;
  font-size: 1.1rem;
}
.ingredient-base {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.step-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.step-item {
  display: flex;
  gap: 1.5rem;
  min-width: 0;
}
.step-item > div,
.ingredient-row-view > div,
.ingredients-block,
.steps-block,
.notes-block,
.nutrition-block {
  min-width: 0;
}
.step-item h4 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}
.step-index {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(36, 216, 255, 0.1);
  color: #24d8ff;
  border: 1px solid rgba(36, 216, 255, 0.2);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.2rem;
}

.step-needs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
}

.need-chip {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  display: inline-block;
}
.need-chip--matched {
  background: rgba(36, 216, 255, 0.15);
  border-color: #24d8ff;
  color: #24d8ff;
}

.oven-hint {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255,255,255,0.05);
  border-left: 3px solid #ff4fd8;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text-main);
}

.info-line--hint {
  padding: 1rem;
  background: rgba(36, 216, 255, 0.1);
  border-left: 3px solid #24d8ff;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 1rem 0;
}

.recipe-note-block {
  padding: 0;
  overflow: hidden;
}

.recipe-note summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  list-style: none;
}

.recipe-note summary::-webkit-details-marker {
  display: none;
}

.recipe-note summary > span:first-child {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.recipe-note summary strong {
  color: var(--text-main);
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.2;
}

.recipe-note summary small {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.recipe-note-toggle {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--accent-primary);
  background: rgba(255,255,255,0.04);
  transition: transform var(--ease), border-color var(--ease), background var(--ease);
}

.recipe-note[open] .recipe-note-toggle {
  transform: rotate(180deg);
  border-color: var(--accent-primary);
  background: var(--accent-primary-glow);
}

.recipe-note-content {
  padding: 0 1.5rem 1.5rem;
  border-top: 1px solid var(--glass-border);
}

.recipe-note-content .info-line:first-child {
  margin-top: 1.25rem;
}

.hint-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.05rem 0.4rem;
  border: 1px solid rgba(36, 216, 255, 0.28);
  border-radius: var(--radius-pill);
  background: rgba(36, 216, 255, 0.1);
  color: var(--accent-primary);
  font-size: 0.95em;
  font-weight: 650;
}

.hint-trigger::after {
  content: "i";
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(36, 216, 255, 0.18);
  font-size: 0.7rem;
  font-weight: 800;
}

.hint-dialog {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.hint-dialog[hidden] {
  display: none;
}

.hint-dialog-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.58);
  cursor: pointer;
}

.hint-dialog-card {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(70vh, 640px);
  overflow-y: auto;
  padding: 1.35rem;
  border: 1px solid var(--glass-border-highlight);
  border-radius: var(--radius-lg);
  background: rgba(12, 16, 36, 0.96);
  box-shadow: var(--glass-shadow);
}

.hint-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.hint-dialog-header h3 {
  font-size: 1.35rem;
  margin: 0;
}

.hint-dialog-body p {
  margin: 0 0 1rem;
}

.hint-dialog-body p:last-child {
  margin-bottom: 0;
}

.detail-content a {
  color: var(--accent-primary);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent-primary);
  transition: all var(--ease);
  overflow-wrap: anywhere;
}
.detail-content a:hover {
  color: var(--accent-primary-hover);
  border-bottom-style: solid;
}

.detail-content a.hint-trigger {
  border: 1px solid rgba(36, 216, 255, 0.28);
  text-decoration: none;
}

.detail-content a.hint-trigger:hover {
  border-color: var(--accent-primary);
  background: rgba(36, 216, 255, 0.16);
}

.markdown-inline-image {
  max-width: 100%;
  border-radius: var(--radius-md);
  margin: 1rem 0;
  border: 1px solid var(--glass-border);
}

.nutrition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.nutrition-item {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
}
.nutrition-item span {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.nutrition-item strong {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}

.raw-details {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--glass-border);
}
.raw-details summary {
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 500;
}
.raw-details pre {
  background: rgba(0,0,0,0.5);
  padding: 1rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
  font-size: 0.85rem;
  border: 1px solid var(--glass-border);
  color: #a0c0e8;
}

/* Detail Footer */
.detail-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  background: rgba(0,0,0,0.5);
  border-top: 1px solid var(--glass-border);
}

/* Animations */
@keyframes slideInRight {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 1024px) {
  .toolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .toolbar .search-field {
    grid-column: 1 / -1;
  }

  .toolbar-design {
    grid-column: auto;
  }

  .ingredient-row {
    grid-template-columns: 1fr 1fr;
  }
  .ingredient-row .span-ingredient {
    grid-column: 1 / -1;
  }
  .ingredient-row-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

@media (max-width: 768px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 2rem;
  }

  .toolbar {
    grid-template-columns: 1fr;
    padding: 1rem;
    gap: 0.75rem;
  }

  .toolbar-toggle {
    display: inline-flex;
  }

  .toolbar-advanced {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .toolbar-collapsed {
    padding-bottom: 1rem;
  }

  .toolbar-collapsed .search-field {
    margin-bottom: 0;
  }

  .toolbar-design {
    grid-column: auto;
  }

  .recipes-grid {
    grid-template-columns: 1fr;
  }
  .sheet-dialog {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .sheet-card {
    border-radius: 0;
  }
  .detail-content {
    padding: 1.5rem;
  }
  .two-col-grid {
    grid-template-columns: 1fr;
  }

  .hint-link-tools,
  .hint-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .app-shell {
    padding: 1.25rem 1rem;
    gap: 1.25rem;
  }

  .hero {
    padding: 1.5rem;
    gap: 1.25rem;
  }

  .hero h1 {
    font-size: clamp(2.15rem, 10vw, 2.9rem);
    margin-bottom: 0.35rem;
  }

  .hero-subtitle {
    font-size: 0.98rem;
    max-width: 28ch;
  }

  .hero-actions {
    width: 100%;
    gap: 0.75rem;
  }

  .btn {
    font-size: 0.94rem;
    padding: 0.68rem 1.15rem;
  }

  .btn-sm {
    font-size: 0.8rem;
    padding: 0.45rem 0.9rem;
  }

  .icon-button {
    width: 36px;
    height: 36px;
    font-size: 1.05rem;
  }

  label span {
    font-size: 0.77rem;
  }

  input,
  select,
  textarea {
    padding: 0.68rem 0.9rem;
    font-size: 0.95rem;
  }

  select {
    background-position: right 0.85rem center;
    padding-right: 2.2rem;
  }

  .toolbar {
    top: 0.75rem;
    padding: 0.9rem;
    gap: 0.65rem;
  }

  .toolbar-advanced {
    gap: 0.65rem;
  }

  .main-header {
    margin-bottom: 1rem;
    padding-left: 0;
  }

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

  .recipes-grid {
    gap: 1rem;
  }

  .recipe-card img {
    height: 190px;
  }

  .recipe-card__content {
    padding: 1.15rem;
    gap: 0.6rem;
    margin-top: -24px;
  }

  .recipe-card__name {
    font-size: 1.08rem;
  }

  .recipe-card__meta {
    font-size: 0.8rem;
  }

  .recipe-card__meta,
  .badge-row {
    gap: 0.4rem;
  }

  .badge {
    padding: 0.2rem 0.62rem;
    font-size: 0.68rem;
  }

  .empty-state {
    padding: 2.75rem 1.25rem;
  }

  .detail-header {
    padding: 0.85rem 1rem;
  }

  .detail-content {
    padding: 1.1rem;
    gap: 1.15rem;
  }

  .detail-title {
    font-size: clamp(1.65rem, 7vw, 2.1rem);
    margin-bottom: 0.75rem;
  }

  .thumbnail-row {
    gap: 0.4rem;
    padding: 0.4rem 0;
  }

  .thumbnail-row img {
    width: 68px;
    height: 68px;
  }

  .meta-list {
    gap: 0.4rem;
  }

  .meta-pill {
    padding: 0.28rem 0.8rem;
    font-size: 0.78rem;
  }

  #recipe-form {
    gap: 1.25rem;
    padding: 1.15rem;
  }

  .editor-header {
    padding: 1rem 1.15rem;
  }

  .editor-section {
    padding: 1.15rem;
  }

  .editor-section h3 {
    font-size: 1.08rem;
  }

  .editor-section-head {
    margin-bottom: 0.8rem;
  }

  .editor-header,
  .editor-section-head,
  .step-actions,
  .inline-actions,
  .editor-footer {
    align-items: stretch;
  }

  .two-col-grid,
  .image-preview-list,
  .inline-actions {
    gap: 0.9rem;
  }

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

  .ingredient-row-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .ingredient-row .remove-row,
  .step-actions .remove-row {
    justify-self: end;
  }

  .glass-input-group {
    padding: 0.85rem;
  }

  .step-row {
    gap: 0.85rem;
  }

  .step-actions > * ,
  .inline-actions > * ,
  .editor-footer > * {
    width: 100%;
  }

  .file-upload {
    justify-content: flex-start;
    text-align: left;
  }

  .portion-box {
    padding: 1.1rem;
    gap: 0.8rem;
  }

  .portion-controls {
    gap: 0.4rem;
  }

  .portion-stepper {
    width: 36px;
    height: 36px;
    font-size: 1.05rem;
  }

  .portion-controls input {
    width: 72px;
    font-size: 1.08rem;
    padding: 0.4rem;
  }

  .ingredients-block,
  .steps-block,
  .notes-block,
  .nutrition-block {
    padding: 1.15rem;
  }

  .ingredients-section {
    font-size: 0.78rem;
    margin-top: 1rem;
  }

  .ingredient-row-view {
    grid-template-columns: 84px 1fr;
    gap: 0.8rem;
    padding: 0.62rem 0;
  }

  .ingredient-amount {
    font-size: 1rem;
  }

  .ingredient-base {
    font-size: 0.74rem;
  }

  .step-list {
    gap: 1.35rem;
  }

  .step-item {
    gap: 0.95rem;
  }

  .step-item h4 {
    margin-bottom: 0.4rem;
  }

  .step-index {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }

  .step-needs {
    gap: 0.4rem;
    margin-top: 0.4rem;
    margin-bottom: 0.6rem;
  }

  .need-chip {
    padding: 0.08rem 0.35rem;
    font-size: 0.64rem;
  }

  .oven-hint,
  .info-line--hint {
    padding: 0.75rem 0.85rem;
  }

  .markdown-inline-image {
    margin: 0.75rem 0;
  }

  .hint-dialog {
    align-items: end;
    padding: 0.75rem;
  }

  .hint-dialog-card {
    width: 100%;
    max-height: 78vh;
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-md) var(--radius-md);
    padding: 1.1rem;
  }

  .nutrition-grid {
    gap: 0.75rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nutrition-item {
    padding: 0.85rem;
  }

  .nutrition-item span {
    font-size: 0.72rem;
    margin-bottom: 0.35rem;
  }

  .nutrition-item strong {
    font-size: 1.25rem;
  }

  .raw-details {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
  }

  .raw-details pre {
    padding: 0.85rem;
    font-size: 0.8rem;
  }

  .detail-footer {
    padding: 1rem 1.15rem;
    gap: 0.75rem;
    flex-wrap: wrap;
  }
}
