:root {
  --bg: #f4f1e7;
  --surface: #fbfaf4;
  --surface-2: #e4ebdc;
  --line: #bcc8b2;
  --text: #243126;
  --muted: #5e6f5f;
  --brand: #4e6b47;
  --brand-dark: #334b32;
  --success-bg: #deeddc;
  --success-text: #2d5732;
  --warn-bg: #f2ead8;
  --warn-text: #74623b;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: url("assets/site-background.jpg") 58% center / cover no-repeat fixed;
  font-family: "Manrope", "Segoe UI", sans-serif;
  padding-bottom: 108px;
}

h1,
h2 {
  font-family: "DM Serif Display", Georgia, serif;
  letter-spacing: 0.2px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
  background: rgba(45, 67, 46, 0.94);
  border-bottom: 1px solid var(--line);
}

.top-nav {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand {
  color: #f4f1e7;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.2rem;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.nav-links a {
  color: #eff4eb;
  text-decoration: none;
  font-weight: 700;
  padding: 7px 10px;
  border-radius: 999px;
}

.nav-links a.active,
.nav-links a:hover {
  background: rgba(244, 241, 231, 0.16);
}

.settings-link {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #eff4eb;
  background: rgba(244, 241, 231, 0.08);
  border: 1px solid rgba(244, 241, 231, 0.16);
  transition: background-color 140ms ease, transform 140ms ease;
}

.settings-link:hover,
.settings-link.active {
  background: rgba(244, 241, 231, 0.18);
  transform: translateY(-1px);
}

.settings-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 18px 48px;
  display: grid;
  gap: 24px;
}

.hero,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 14px 32px rgba(79, 43, 9, 0.08);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: var(--brand);
  font-size: 0.78rem;
}

h1 {
  margin: 10px 0 0;
  font-size: clamp(1.95rem, 4vw, 3.1rem);
  line-height: 1.1;
}

.hero-copy,
.panel p {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.hero-actions,
.finder-actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.back-link {
  display: inline-block;
}

.filters {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.field,
.check-field {
  display: grid;
  gap: 6px;
}

.field span,
.check-field span {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

.check-field {
  align-content: end;
  grid-auto-flow: column;
  justify-content: start;
  align-items: center;
  padding: 8px 0;
}

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 140ms ease, background-color 140ms ease;
}

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

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

.btn-primary:hover,
.btn-install:hover {
  background: var(--brand-dark);
}

.btn-outline {
  border-color: var(--line);
  color: var(--text);
  background: #fff;
}

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

.card {
  background: #fdfcf8;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
}

.card h2 {
  margin: 0;
  font-size: 1.45rem;
}

.card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.settings-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.language-panel {
  width: min(420px, 100%);
  margin-top: 18px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.language-panel h2 {
  margin: 0 0 12px;
}

.language-field select {
  font-size: 1rem;
  background: #0f1110;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Manrope", "Segoe UI", sans-serif;
}

.settings-card {
  display: grid;
  gap: 14px;
  align-content: start;
}

.settings-card .btn {
  justify-self: start;
}

.settings-status {
  margin-top: 18px;
  min-height: 24px;
  font-weight: 700;
  color: var(--brand-dark);
}

.ingredient-list {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.ingredient-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fdfcf8;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
}

.ingredient-item input {
  accent-color: var(--brand);
}

.section-title {
  margin: 0;
  font-size: 1.75rem;
}

.result-summary {
  margin: 10px 0 0;
  color: var(--muted);
}

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

.recipe-card {
  background: #fdfcf8;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  align-items: start;
}

.recipe-card-body {
  min-width: 0;
}

.recipe-thumb {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.card-actions {
  margin-top: 12px;
}

.recipe-open {
  display: inline-block;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.card-head h3 {
  margin: 0;
}

.favorite-btn {
  border: 1px solid var(--line);
  background: #f1f3ea;
  color: #90a283;
  border-radius: 10px;
  min-width: 34px;
  height: 32px;
  font-size: 1rem;
  cursor: pointer;
}

.favorite-btn.active {
  color: #8f7330;
  background: #efe4bd;
}

.recipe-meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  margin-top: 10px;
}

.badge.ok {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge.miss {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.ingredient-tags {
  margin: 12px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ingredient-tag {
  font-size: 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 4px 8px;
  background: #eef3e8;
}

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

.detail-image {
  margin-top: 12px;
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.detail-block {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fdfcf8;
}

.detail-block h2 {
  margin: 0;
  font-size: 1.45rem;
}

.detail-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.65;
}

.ios-hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.bottom-dock {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px 14px;
  border: 1px solid rgba(239, 207, 166, 0.9);
  border-radius: 999px;
  background: rgba(18, 33, 56, 0.96);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 40px rgba(10, 18, 31, 0.38);
}

.dock-icon {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(203, 216, 234, 0.28);
  border-radius: 999px;
  background: linear-gradient(180deg, #35527a, #243a59);
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.dock-icon::after {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: rgba(235, 243, 252, 0.32);
}

.dock-icon-image {
  width: 62%;
  height: 62%;
  object-fit: contain;
  display: block;
  filter: brightness(0) saturate(100%) invert(94%) sepia(16%) saturate(189%) hue-rotate(178deg) brightness(103%) contrast(98%);
}

.dock-icon-has-image::after {
  display: none;
}

.dock-icon:hover,
.dock-icon:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(223, 234, 247, 0.62);
  box-shadow: 0 10px 22px rgba(15, 26, 44, 0.34);
  outline: none;
}

.dock-icon-large {
  width: 60px;
  height: 60px;
  margin: 0 2px;
}

.dock-icon-large::after {
  width: 20px;
  height: 20px;
}

.camera-sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(36, 49, 38, 0.74);
}

.camera-sheet[hidden] {
  display: none;
}

.settings-sheet {
  position: fixed;
  top: 71px;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 60;
  display: grid;
  justify-items: center;
  align-items: start;
  padding: 20px 18px 18px;
  background: rgba(46, 49, 52, 0.94);
  backdrop-filter: blur(4px);
}

.settings-sheet[hidden] {
  display: none;
}

.settings-modal {
  width: min(80vw, 960px);
  min-height: calc(100vh - 71px - 38px);
  max-height: calc(100vh - 71px - 38px);
  overflow: auto;
  background: #4a4d50;
  color: #f3f1e8;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  padding: 24px;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.42);
  animation: rise-in 180ms ease both;
}

.settings-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.settings-modal-header h2 {
  margin: 0;
  color: #fff;
}

.settings-modal-close {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font: inherit;
  font-size: 1.3rem;
  cursor: pointer;
}

.settings-modal-copy {
  color: rgba(243, 241, 232, 0.82);
}

.settings-modal .card {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.06);
}

.settings-modal .card h2,
.settings-modal .card p,
.settings-modal .settings-status {
  color: #f3f1e8;
}

.settings-modal .language-panel {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.06);
}

.settings-modal .language-panel h2,
.settings-modal .language-field span {
  color: #f3f1e8;
}

.settings-modal .language-field select {
  background: #0f1110;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Manrope", "Segoe UI", sans-serif;
}

.language-field select option,
.settings-modal .language-field select option {
  color: #fff;
  background: #0f1110;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Manrope", "Segoe UI", sans-serif;
}

.camera-panel {
  width: min(100%, 420px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 18px 40px rgba(20, 28, 20, 0.28);
}

.camera-panel h2 {
  margin: 0;
  font-size: 1.6rem;
}

.camera-panel p {
  margin: 8px 0 0;
  color: var(--muted);
}

.camera-video {
  width: 100%;
  aspect-ratio: 3 / 4;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #1d261e;
  object-fit: cover;
}

.camera-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.section-animate {
  animation: rise-in 420ms ease both;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .top-nav {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-right {
    width: 100%;
    justify-content: space-between;
  }

  .nav-links {
    width: 100%;
  }

  .recipe-card {
    grid-template-columns: 1fr;
  }

  .recipe-thumb {
    width: 100%;
    height: 170px;
  }

  .bottom-dock {
    bottom: 12px;
    width: calc(100% - 24px);
    max-width: 420px;
    gap: 8px;
    padding: 10px 12px 12px;
  }

  .dock-icon {
    width: 38px;
    height: 38px;
  }

  .dock-icon-large {
    width: 54px;
    height: 54px;
  }

  .settings-modal {
    width: min(92vw, 960px);
    min-height: calc(100vh - 71px - 38px);
    max-height: calc(100vh - 71px - 38px);
    padding: 18px;
  }
}
