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

:root {
  --primary: #8b6914;
  --primary-dark: #6b5010;
  --primary-light: #c9a84c;
  --primary-glow: rgba(139, 105, 20, 0.45);
  --secondary: #1a1208;
  --accent: #daa520;
  --bg: #f8f2e8;
  --bg-soft: #f0e8d8;
  --bg-card: #fffdf8;
  --text: #3a2a1a;
  --text-light: #7a6a5a;
  --border: #d4c4a0;
  --shadow: 0 4px 20px rgba(80, 60, 20, 0.08);
  --shadow-hover: 0 18px 40px rgba(80, 60, 20, 0.16);
  --radius: 8px;
  --radius-sm: 6px;
  --transition: 0.35s cubic-bezier(0.33, 1, 0.68, 1);
  --max-width: 1200px;
  --header-h: 64px;
  --grad-hero: linear-gradient(135deg, #2a1e10 0%, #5c4033 55%, #8b6914 130%);
  --shimmer: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%);
  --font-body: 'Georgia', 'Times New Roman', serif;
  --font-head: 'Georgia', serif;
  color-scheme: light;
}

body.dark-theme {
  --primary: #c9a84c;
  --primary-dark: #daa520;
  --primary-light: #f0d878;
  --primary-glow: rgba(201, 168, 76, 0.4);
  --secondary: #0d0a04;
  --accent: #f0d878;
  --bg: #141008;
  --bg-soft: #1e1810;
  --bg-card: #241e14;
  --text: #f0e8d8;
  --text-light: #b0a088;
  --border: #3d3020;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 18px 40px rgba(0, 0, 0, 0.55);
  --grad-hero: linear-gradient(135deg, #0d0a04 0%, #2a1e10 55%, #5c4033 130%);
  color-scheme: dark;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, .recipe-title, .modal-title {
  font-family: var(--font-head);
  letter-spacing: 0.2px;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

img {
  max-width: 100%;
  display: block;
}

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

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

.header {
  background: var(--secondary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(201, 168, 76, 0.15);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  gap: 12px;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.logo-icon {
  font-size: 1.8rem;
  display: inline-block;
  animation: gentleSpin 8s linear infinite;
  transform-origin: 50% 55%;
  filter: drop-shadow(0 2px 6px rgba(201, 168, 76, 0.5));
}

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

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-sub {
  font-size: 0.6rem;
  font-weight: 600;
  font-family: var(--font-body);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--primary-light);
  opacity: 0.85;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav {
  display: flex;
  gap: 4px;
}

.nav-link {
  padding: 8px 18px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.72);
  transition: var(--transition);
  position: relative;
}

.nav-link:hover {
  color: #fff;
  background: rgba(201, 168, 76, 0.15);
  transform: translateY(-1px);
}

.nav-link.active {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 4px 14px var(--primary-glow);
}

.nav-menu-link {
  background: rgba(218, 165, 32, 0.18) !important;
  color: #f0d878 !important;
  box-shadow: inset 0 0 0 1px rgba(218, 165, 32, 0.35);
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: var(--transition);
}

.theme-toggle:hover {
  background: rgba(201, 168, 76, 0.25);
  transform: scale(1.08) rotate(15deg);
}

.random-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 50px;
  font-size: 0.88rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
  transition: var(--transition);
  white-space: nowrap;
}

.random-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 22px var(--primary-glow);
}

@media (max-width: 560px) {
  .random-btn span {
    display: none;
  }

  .random-btn {
    padding: 0;
    width: 40px;
    height: 40px;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
  }
}

.burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
}

.burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: var(--transition);
}

.burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.hero {
  position: relative;
  overflow: hidden;
  background: var(--grad-hero);
  color: #fff;
  padding: 90px 20px;
  text-align: center;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(201, 168, 76, 0.08) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(201, 168, 76, 0.3);
  padding: 8px 20px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  backdrop-filter: blur(8px);
  margin-bottom: 24px;
  animation: fadeUp 0.6s ease both;
}

.hero-badge strong {
  color: var(--accent);
}

.hero h1 {
  font-size: 3.4rem;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
  line-height: 1.1;
  animation: fadeUp 0.6s ease 0.1s both;
}

.hero h1 .grad {
  background: linear-gradient(90deg, var(--accent), var(--primary-light));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.15rem;
  opacity: 0.85;
  max-width: 620px;
  margin: 0 auto 36px;
  animation: fadeUp 0.6s ease 0.2s both;
}

.search-box {
  max-width: 520px;
  margin: 0 auto;
  position: relative;
  animation: fadeUp 0.6s ease 0.3s both;
}

.search-box input {
  width: 100%;
  padding: 18px 60px 18px 24px;
  border-radius: 50px;
  border: 2px solid rgba(201, 168, 76, 0.3);
  font-size: 1rem;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  backdrop-filter: blur(12px);
  transition: var(--transition);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.search-box input::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

.search-box input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.22);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.search-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  box-shadow: 0 4px 14px var(--primary-glow);
}

.search-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-50%) scale(1.08);
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 44px;
  flex-wrap: wrap;
  animation: fadeUp 0.6s ease 0.4s both;
}

.hero-stat {
  text-align: center;
}

.hero-stat b {
  display: block;
  font-size: 1.6rem;
  font-family: var(--font-head);
  color: var(--accent);
  line-height: 1.1;
}

.hero-stat span {
  font-size: 0.8rem;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.float-food {
  position: absolute;
  font-size: 4rem;
  opacity: 0.14;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.25));
  animation: floatY 6s ease-in-out infinite;
  pointer-events: none;
  user-select: none;
}

.float-food.f1 { top: 12%; left: 6%; animation-delay: 0s; }
.float-food.f2 { top: 20%; right: 8%; font-size: 3.2rem; animation-delay: 1.4s; }
.float-food.f3 { bottom: 16%; left: 14%; font-size: 3rem; animation-delay: 2.6s; }

@keyframes floatY {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-18px) rotate(5deg); }
}

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

.categories {
  max-width: var(--max-width);
  margin: -44px auto 0;
  padding: 0 20px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  position: relative;
  z-index: 10;
}

.category-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: var(--transition);
  cursor: pointer;
  border: 2px solid var(--border);
  position: relative;
  overflow: hidden;
}

.category-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -80%;
  width: 60%;
  height: 100%;
  background: var(--shimmer);
  transform: skewX(-20deg);
  transition: left 0.6s ease;
}

.category-card:hover::after {
  left: 130%;
}

.category-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary-light);
}

.category-icon {
  font-size: 3.4rem;
  margin-bottom: 14px;
  display: block;
  transition: var(--transition);
}

.category-card:hover .category-icon {
  transform: scale(1.18) rotate(-6deg);
}

.category-title {
  font-size: 1.35rem;
  font-weight: 700;
  font-family: var(--font-head);
  margin-bottom: 8px;
}

.category-count {
  color: var(--text-light);
  font-size: 0.9rem;
  font-weight: 600;
}

.category-count b {
  color: var(--primary);
  font-size: 1.05rem;
}

.page {
  display: none;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 44px 20px 90px;
  animation: pageIn 0.45s ease;
}

.page.active {
  display: block;
}

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

.page-header {
  text-align: center;
  margin-bottom: 40px;
}

.page-header h2 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 6px;
  display: inline-block;
}

.page-header .divider {
  width: 72px;
  height: 4px;
  border-radius: 4px;
  margin: 14px auto 16px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.page-header p {
  color: var(--text-light);
  font-size: 1.05rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 32px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 12px;
}

.toolbar .filters {
  margin-bottom: 0;
}

.sort-select {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.sort-select:hover {
  border-color: var(--primary-light);
}

.sort-select:focus {
  outline: none;
  border-color: var(--primary);
}

.filter-btn {
  padding: 8px 20px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--bg-card);
  color: var(--text-light);
  border: 2px solid var(--border);
  transition: var(--transition);
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 14px var(--primary-glow);
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 26px;
}

.recipe-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  cursor: pointer;
  border: 2px solid var(--border);
  position: relative;
}

.recipe-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary-light);
}

.recipe-img {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  position: relative;
  overflow: hidden;
}

.recipe-img > span {
  transition: var(--transition);
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.15));
}

.recipe-card:hover .recipe-img > span {
  transform: scale(1.2) rotate(-6deg);
}

.recipe-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.05), transparent 45%);
}

.recipe-img.first { background: linear-gradient(135deg, #f0e0c0, #d4b888); }
.recipe-img.second { background: linear-gradient(135deg, #d4e8d0, #e8d4d8); }
.recipe-img.third { background: linear-gradient(135deg, #e0d4e8, #c0c8e0); }
.recipe-img.fish { background: linear-gradient(135deg, #c8e0e8, #a0c0d0); }

body.dark-theme .recipe-img.first { background: linear-gradient(135deg, #3a2810, #5c4033); }
body.dark-theme .recipe-img.second { background: linear-gradient(135deg, #1a3020, #3a2828); }
body.dark-theme .recipe-img.third { background: linear-gradient(135deg, #2a2038, #283050); }
body.dark-theme .recipe-img.fish { background: linear-gradient(135deg, #182830, #2a3848); }

.recipe-time {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  padding: 5px 14px;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 600;
  backdrop-filter: blur(6px);
  z-index: 2;
}

.favorite-btn {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text-light);
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
  transition: var(--transition);
  backdrop-filter: blur(4px);
}

.favorite-btn:hover {
  transform: scale(1.12);
  color: #d6336c;
}

.favorite-btn.active {
  color: #d6336c;
  background: #fff;
  animation: heartPop 0.4s ease;
}

@keyframes heartPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.recipe-body {
  padding: 20px 20px 22px;
}

.recipe-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.25;
  transition: color 0.3s ease;
}

.recipe-card:hover .recipe-title {
  color: var(--primary);
}

.recipe-desc {
  color: var(--text-light);
  font-size: 0.88rem;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.82rem;
  color: var(--text-light);
  border-top: 1px dashed var(--border);
  padding-top: 14px;
}

.recipe-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.recipe-difficulty {
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.diff-easy { background: #d4edda; color: #155724; }
.diff-medium { background: #fff3cd; color: #856404; }
.diff-hard { background: #f8d7da; color: #721c24; }

body.dark-theme .diff-easy { background: #1d3323; color: #8bdb9f; }
body.dark-theme .diff-medium { background: #382f17; color: #e7c875; }
body.dark-theme .diff-hard { background: #3a1a1e; color: #efa3a3; }

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(20, 16, 8, 0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(8px);
}

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

.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: modalIn 0.35s cubic-bezier(0.33, 1, 0.68, 1);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}

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

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: var(--transition);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.modal-close:hover {
  background: var(--primary);
  transform: rotate(90deg) scale(1.05);
}

.modal-img {
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6.5rem;
  border-radius: var(--radius) var(--radius) 0 0;
  position: relative;
  overflow: hidden;
}

.modal-img::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(rgba(201, 168, 76, 0.1) 1px, transparent 1px);
  background-size: 20px 20px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
}

.modal-img > span {
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.2));
  animation: gentleSpin 14s linear infinite;
}

.modal-img.first { background: linear-gradient(135deg, #f0e0c0, #d4b888); }
.modal-img.second { background: linear-gradient(135deg, #d4e8d0, #e8d4d8); }
.modal-img.third { background: linear-gradient(135deg, #e0d4e8, #c0c8e0); }
.modal-img.fish { background: linear-gradient(135deg, #c8e0e8, #a0c0d0); }

body.dark-theme .modal-img.first { background: linear-gradient(135deg, #3a2810, #5c4033); }
body.dark-theme .modal-img.second { background: linear-gradient(135deg, #1a3020, #3a2828); }
body.dark-theme .modal-img.third { background: linear-gradient(135deg, #2a2038, #283050); }
body.dark-theme .modal-img.fish { background: linear-gradient(135deg, #182830, #2a3848); }

.modal-content {
  padding: 32px;
}

.modal-title {
  font-size: 1.9rem;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.2;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.fav-action,
.print-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: inherit;
  background: var(--bg-soft);
  color: var(--text-light);
  border: 2px solid var(--border);
  transition: var(--transition);
}

.fav-action:hover,
.print-action:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.fav-action.active {
  color: #d6336c;
  border-color: #d6336c;
  background: rgba(214, 51, 108, 0.08);
}

.servings-control {
  display: inline-flex !important;
  align-items: center;
  gap: 2px !important;
  background: var(--bg-soft);
  border-radius: 50px;
  padding: 2px;
}

.servings-count {
  padding: 0 6px;
  font-size: 0.9rem !important;
}

.servings-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--primary);
  font-size: 1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: var(--transition);
}

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

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.modal-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-light);
  font-size: 0.95rem;
  font-weight: 500;
}

.modal-meta span strong {
  color: var(--text);
}

.modal-section {
  margin-bottom: 26px;
}

.modal-section h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}

.modal-section h3::after {
  content: '';
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-light), transparent);
}

.modal-section ul {
  list-style: none;
}

.modal-section li {
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  transition: padding-left 0.3s ease, background 0.3s ease;
}

.modal-section ul li:hover {
  padding-left: 8px;
  background: var(--bg-soft);
  border-radius: 8px;
}

.modal-section ul li:last-child {
  border-bottom: none;
}

.modal-section ol {
  padding-left: 22px;
  counter-reset: step;
}

.modal-section ol li {
  counter-increment: step;
  padding: 12px 0 12px 4px;
  border-bottom: 1px dashed var(--border);
  line-height: 1.65;
  list-style: none;
  display: block;
  position: relative;
}

.modal-section ol li::before {
  content: counter(step);
  position: absolute;
  left: -34px;
  top: 12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px var(--primary-glow);
}

.modal-section ol li:last-child {
  border-bottom: none;
}

.ingredient-name {
  font-weight: 600;
}

.ingredient-amount {
  color: var(--primary);
  font-weight: 700;
  background: var(--bg-soft);
  padding: 3px 10px;
  border-radius: 50px;
  white-space: nowrap;
}

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

.modal-tag {
  background: var(--bg-soft);
  color: var(--text-light);
  padding: 4px 14px;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

.footer {
  background: var(--secondary);
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  padding: 34px 20px 40px;
  font-size: 0.9rem;
}

.footer strong {
  color: var(--accent);
}

.back-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 1.3rem;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px var(--primary-glow);
  transition: var(--transition);
  z-index: 50;
}

.back-top.visible {
  display: flex;
  animation: fadeUp 0.4s ease;
}

.back-top:hover {
  transform: translateY(-4px);
}

.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
  grid-column: 1 / -1;
}

.no-results-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  animation: floatY 4s ease-in-out infinite;
}

.no-results h3 {
  font-size: 1.3rem;
  margin-bottom: 8px;
  color: var(--text);
  font-family: var(--font-head);
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 44px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  background: var(--bg-card);
  color: var(--text-light);
  border: 2px solid var(--border);
  transition: var(--transition);
}

.page-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
}

.page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 14px var(--primary-glow);
}

.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--bg-card);
  box-shadow: 0 -2px 24px rgba(0, 0, 0, 0.15);
  z-index: 100;
  padding: 8px 0;
  padding-bottom: env(safe-area-inset-bottom, 8px);
  border-top: 1px solid var(--border);
}

.mobile-nav-inner {
  display: flex;
  justify-content: space-around;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-light);
  transition: var(--transition);
  min-width: 64px;
}

.mobile-nav-item .icon {
  font-size: 1.4rem;
  transition: var(--transition);
}

.mobile-nav-item.active {
  color: var(--primary);
}

.mobile-nav-item.active .icon {
  transform: translateY(-2px) scale(1.15);
}

.mobile-nav-item:hover {
  color: var(--primary);
}

@media (max-width: 768px) {
  .nav {
    display: none;
  }

  .burger {
    display: flex;
  }

  .nav.open {
    display: flex;
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--secondary);
    flex-direction: column;
    padding: 16px;
    gap: 6px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    animation: fadeUp 0.3s ease;
  }

  .nav.open .nav-link {
    padding: 14px 20px;
    border-radius: 12px;
  }

  .hero {
    padding: 60px 16px;
  }

  .hero h1 {
    font-size: 2.1rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .hero-stats {
    gap: 24px;
  }

  .categories {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: -34px;
    padding: 0 16px;
  }

  .category-card {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    text-align: left;
  }

  .category-icon {
    font-size: 2.4rem;
    margin-bottom: 0;
  }

  .recipe-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .page {
    padding: 28px 16px 110px;
  }

  .page-header h2 {
    font-size: 1.8rem;
  }

  .modal {
    max-height: 95vh;
    margin: 0;
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .modal-content {
    padding: 24px 20px;
  }

  .modal-title {
    font-size: 1.45rem;
  }

  .mobile-nav {
    display: block;
  }

  .footer {
    padding-bottom: 90px;
  }

  .back-top {
    bottom: 84px;
  }

  .filters {
    gap: 6px;
    margin-bottom: 24px;
  }

  .filter-btn {
    padding: 6px 14px;
    font-size: 0.8rem;
  }

  .float-food { display: none; }
}

@media (max-width: 480px) {
  :root { --header-h: 58px; }

  .categories {
    grid-template-columns: 1fr;
  }

  .logo {
    font-size: 1.15rem;
  }

  .logo-sub {
    font-size: 0.5rem;
    letter-spacing: 1.5px;
  }

  .hero h1 {
    font-size: 1.7rem;
  }

  .hero-stats {
    gap: 18px;
  }

  .hero-stat b {
    font-size: 1.3rem;
  }

  .recipe-img {
    height: 170px;
    font-size: 4.2rem;
  }

  .recipe-body {
    padding: 16px;
  }

  .recipe-title {
    font-size: 1.15rem;
  }

  .modal-img {
    height: 190px;
    font-size: 5rem;
  }
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--primary-light), var(--primary));
  border-radius: 6px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(var(--primary), var(--primary-dark));
}

.fade-in {
  animation: fadeIn 0.45s ease;
}

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body * {
    visibility: hidden;
  }

  body.printing .modal,
  body.printing .modal * {
    visibility: visible;
  }

  body.printing .modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    margin: 0;
    max-height: none;
    overflow: visible;
    box-shadow: none;
    border-radius: 0;
  }

  body.printing .modal-img,
  body.printing .modal-actions,
  body.printing .servings-control,
  body.printing .ingredient-amount {
    display: none !important;
  }
}