:root {
  --bg: #FAF6F0;
  --paper: #F2EADB;
  --card: #FFFFFF;
  --ink: #1F1E1C;
  --text: #2B2A28;
  --muted: #8C857A;
  --line: #E6DBC6;
  --soft: #EFE6D6;
  --terra: #C9714F;
  --gold: #C9A961;
  --shadow: 0 1px 2px rgba(31,30,28,.04), 0 8px 24px rgba(31,30,28,.06);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --serif: "Iowan Old Style", "Palatino", "Cambria", "Georgia", serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  min-height: 100vh; min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }

main { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }

/* ===================== MENU PAGE ===================== */
.menu-head { margin-bottom: 24px; }
.eyebrow {
  font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}
.menu-title {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(36px, 8vw, 56px);
  line-height: 1.05; letter-spacing: -0.015em;
  margin: 10px 0 4px; color: var(--ink);
}
.menu-title em { font-style: italic; color: var(--terra); font-weight: 400; }
.deco-line {
  width: 36px; height: 2px; background: var(--gold);
  border-radius: 2px; margin: 8px 0 18px;
}
.menu-sub { color: var(--muted); font-size: 15px; max-width: 520px; margin: 0; }

.toolbar { margin-top: 24px; display: flex; flex-direction: column; gap: 14px; }
.search {
  position: relative; background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px; box-shadow: var(--shadow);
}
.search input {
  width: 100%; border: 0; background: transparent;
  padding: 16px 20px 16px 52px;
  font: inherit; color: var(--ink);
  border-radius: 999px; outline: none;
}
.search input::placeholder { color: var(--muted); }
.search svg {
  position: absolute; left: 20px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--muted);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 10px 16px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--text); font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
}
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] {
  background: var(--ink); color: #fff; border-color: var(--ink);
}

.grid {
  display: grid; gap: 14px; margin-top: 24px;
  grid-template-columns: 1fr;
}
@media (min-width: 640px)  { .grid { grid-template-columns: repeat(2, 1fr); gap: 16px; } }
@media (min-width: 980px)  { .grid { grid-template-columns: repeat(3, 1fr); gap: 18px; } }

.card {
  display: flex; gap: 14px; align-items: center;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: 12px;
  box-shadow: var(--shadow);
  text-decoration: none; color: inherit;
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(31,30,28,.05), 0 18px 40px rgba(31,30,28,.08); }
.card.hidden { display: none; }
.card-thumb {
  width: 84px; height: 84px; flex: 0 0 84px;
  border-radius: 14px; overflow: hidden;
  background: var(--soft);
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-body { flex: 1; min-width: 0; }
.card-tag {
  display: inline-block;
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--terra); font-weight: 700;
}
.card h3 {
  margin: 4px 0 6px;
  font-family: var(--serif); font-weight: 700;
  font-size: 19px; line-height: 1.15; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-meta {
  display: flex; gap: 14px; align-items: center;
  font-size: 13px; color: var(--muted);
}
.card-meta b { color: var(--ink); font-weight: 700; }
.card-arrow {
  flex: 0 0 28px; color: var(--muted);
  font-size: 22px; line-height: 1; text-align: center;
}

.no-results {
  text-align: center; padding: 60px 20px; color: var(--muted);
  font-family: var(--serif); font-style: italic; font-size: 18px;
  display: none;
}
.no-results.show { display: block; }

/* ===================== RECIPE PAGE ===================== */
.back-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px 11px 14px;
  background: var(--soft); border-radius: 999px;
  color: var(--ink); font-weight: 600; font-size: 14px;
  text-decoration: none;
  transition: background .15s ease;
}
.back-btn:hover { background: #E5DCC6; }

.rcp-head { margin: 4px 0 18px; }

.hero-wrap {
  position: relative; border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow);
  background: var(--paper);
}
.hero-wrap::after { content: ""; display: block; padding-top: 75%; }
.hero-wrap img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
}
.hero-tag {
  position: absolute; top: 14px; left: 14px; z-index: 2;
  background: rgba(255,255,255,0.94);
  padding: 7px 14px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink);
}

.rcp-title {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(32px, 7vw, 46px); line-height: 1.05;
  letter-spacing: -0.015em;
  margin: 24px 0 6px; color: var(--ink);
}
.rcp-subtitle {
  font-family: var(--serif); font-style: italic;
  color: var(--muted); font-size: clamp(15px, 4vw, 19px);
  margin-bottom: 24px;
}

.nutrition {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-bottom: 16px;
}
.nut {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 6px 10px; text-align: center;
}
.nut-big {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(20px, 5vw, 26px); color: var(--ink); line-height: 1;
}
.nut-small {
  font-size: 11px; color: var(--muted); margin-top: 6px;
  letter-spacing: 0.06em; text-transform: uppercase;
}

.meta-row {
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
  margin-bottom: 28px; color: var(--muted); font-size: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}
.meta-row b { color: var(--ink); font-weight: 700; margin-right: 4px; }
.meta-row .counter { margin-left: auto; font-weight: 600; letter-spacing: 0.06em; }

h2.section {
  font-family: var(--serif); font-weight: 700;
  font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); margin: 28px 0 14px;
}

.ingredients { list-style: none; padding: 0; margin: 0; }
.ingredients li {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 14px; margin-bottom: 8px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer; user-select: none;
  transition: background .15s ease, opacity .2s ease;
}
.ingredients li:hover { background: #FFFDF8; }
.ingredients li.checked {
  background: var(--soft);
  color: var(--muted);
  text-decoration: line-through;
  opacity: .65;
}
.check {
  flex: 0 0 22px; width: 22px; height: 22px;
  border: 2px solid var(--line); border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff;
  transition: all .15s ease;
}
.ingredients li.checked .check { background: var(--ink); border-color: var(--ink); }
.check svg { width: 12px; height: 12px; color: #fff; opacity: 0; transition: opacity .15s; }
.ingredients li.checked .check svg { opacity: 1; }

.steps { list-style: none; padding: 0; margin: 0; }
.steps li {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.steps li:first-child { border-top: 0; padding-top: 4px; }
.step-num {
  flex: 0 0 32px; width: 32px; height: 32px;
  background: var(--ink); color: #fff;
  border-radius: 50%;
  font-family: var(--serif); font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.step-text { padding-top: 4px; color: var(--text); }

.rcp-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-top: 36px;
}
.rcp-nav a {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 16px 14px; border-radius: 999px;
  font-size: 15px; font-weight: 600;
  background: var(--card); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none;
  transition: all .15s ease;
}
.rcp-nav a:hover { background: var(--soft); }
.rcp-nav a.disabled { opacity: .35; pointer-events: none; }
@media (max-width: 480px) {
  .rcp-nav a .label { display: none; }
}

.foot {
  text-align: center; color: var(--muted);
  font-size: 12px; letter-spacing: 0.06em;
  margin-top: 40px; padding: 24px 0;
  border-top: 1px solid var(--line);
}

/* ===================== Install CTA on menu ===================== */
.install-cta {
  display: flex; align-items: center; gap: 14px;
  margin: 40px 0 8px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #FFF6E8 0%, #FFEFD8 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  text-decoration: none; color: inherit;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 1px 2px rgba(31,30,28,.03);
}
.install-cta:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(31,30,28,.08); }
.install-cta-icon {
  flex: 0 0 44px; width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink); color: #fff;
  border-radius: 14px;
  font-size: 22px; font-weight: 700;
}
.install-cta-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.install-cta-text b { font-family: var(--serif); font-size: 17px; color: var(--ink); }
.install-cta-text small { font-size: 13px; color: var(--muted); }
.install-cta-arrow { color: var(--muted); font-size: 20px; }

/* ===================== Install page ===================== */
.install-head { margin: 4px 0 22px; }
.install-head h1 {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(30px, 7vw, 44px); line-height: 1.05;
  letter-spacing: -0.015em;
  margin: 12px 0 8px; color: var(--ink);
}
.install-head h1 em { font-style: italic; color: var(--terra); font-weight: 400; }
.install-head p { color: var(--muted); margin: 0; max-width: 540px; }

.detect-card {
  background: var(--card); border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  padding: 18px 18px 8px; margin-bottom: 24px;
  box-shadow: 0 12px 30px rgba(31,30,28,.08);
}
.detect-card .badge {
  display: inline-block;
  background: var(--ink); color: #fff;
  padding: 5px 12px; border-radius: 999px;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  font-weight: 700; margin-bottom: 12px;
}

.os-section {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
}
.os-section summary {
  list-style: none; cursor: pointer;
  padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
  font-family: var(--serif); font-weight: 700; font-size: 19px;
  color: var(--ink);
}
.os-section summary::-webkit-details-marker { display: none; }
.os-section summary::after {
  content: "+"; margin-left: auto;
  font-family: var(--sans); font-size: 22px; color: var(--muted);
  font-weight: 400; transition: transform .2s ease;
}
.os-section[open] summary::after { content: "−"; }
.os-section .os-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--soft);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.os-body { padding: 4px 18px 22px; }
.os-body ol { margin: 0; padding-left: 22px; color: var(--text); }
.os-body ol li { margin-bottom: 10px; line-height: 1.55; }
.os-body ol li b { color: var(--ink); }
.os-note {
  margin-top: 14px; padding: 12px 14px;
  background: var(--soft);
  border-radius: 12px;
  color: var(--text); font-size: 14px;
}

.offline-banner {
  margin: 24px 0;
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px 18px;
  background: #F1F6EC; border: 1px solid #D5E3C5;
  border-radius: var(--radius-md);
}
.offline-banner .dot {
  flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--terra); margin-top: 8px;
  box-shadow: 0 0 0 6px rgba(201,113,79,.18);
  animation: pulse 2s infinite ease-in-out;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 6px rgba(201,113,79,.18); }
  50%      { box-shadow: 0 0 0 10px rgba(201,113,79,.05); }
}
.offline-banner b { font-family: var(--serif); color: var(--ink); display: block; margin-bottom: 4px; font-size: 16px; }
.offline-banner small { color: var(--muted); font-size: 13px; }

/* ===================== Install prep panel ===================== */
.prep {
  margin: 8px 0 24px;
  display: flex; gap: 16px; align-items: flex-start;
  padding: 20px 20px 22px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 30px rgba(31,30,28,.08);
  transition: border-color .3s ease, background .3s ease;
}
.prep.done {
  border-color: #6E8B4F;
  background: #F1F6EC;
}
.prep-icon {
  flex: 0 0 44px; width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink); color: #fff;
  border-radius: 14px;
  transition: background .3s ease;
}
.prep.done .prep-icon { background: #6E8B4F; }
.prep-icon svg { width: 24px; height: 24px; }
.prep-icon .spin {
  animation: spin 1.1s linear infinite;
  transform-origin: center;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.prep-body { flex: 1; min-width: 0; }
.prep-body b {
  font-family: var(--serif); color: var(--ink);
  display: block; font-size: 18px; margin-bottom: 4px;
}
.prep-body small {
  display: block; color: var(--muted); font-size: 13px;
  line-height: 1.5;
}
.prep-bar {
  margin-top: 14px;
  height: 8px; width: 100%;
  background: var(--soft);
  border-radius: 999px;
  overflow: hidden;
}
.prep-bar span {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--gold) 0%, var(--terra) 100%);
  border-radius: 999px;
  transition: width .35s cubic-bezier(.4, 0, .2, 1);
}
.prep.done .prep-bar span {
  background: #6E8B4F;
  width: 100% !important;
}
.prep-count {
  margin-top: 8px;
  font-size: 12px; color: var(--muted);
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}
.prep-offline {
  margin-top: 14px;
  padding: 12px 14px;
  background: #FDF3E8;
  border: 1px solid #F2D9B6;
  border-radius: 12px;
}
.prep-offline b {
  font-family: var(--serif); color: var(--terra);
  font-size: 15px; margin-bottom: 2px;
}
.prep-offline small { color: var(--text); font-size: 13px; }
