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

:root {
  --bg: #f5f3ef;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #777;
  --border: #e2dfd9;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(0,0,0,0.07);

  --sauce: #b5321e;
  --rub: #c4570a;
  --dressing: #2a7a45;

  --free-bg: #e6f4ea;
  --free-fg: #1e6e35;
  --syn-bg: #fff3e0;
  --syn-fg: #8a4d00;
  --heat-bg: #fdecea;
  --heat-fg: #991b1b;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 18px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

/* ── Header ── */

header {
  background: linear-gradient(135deg, #1a1714 0%, #2a1e16 100%);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-row {
  display: flex;
  align-items: center;
  padding: 18px 24px 14px;
  gap: 16px;
  min-height: 68px;
}

.header-brand {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
}

.tagline {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.38);
  font-style: italic;
  letter-spacing: 0.2px;
}

.back-btn {
  background: rgba(255,255,255,0.12);
  border: none;
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  padding: 10px 18px;
  min-width: 80px;
  min-height: 48px;
  border-radius: 10px;
}

.back-btn:active { background: rgba(255,255,255,0.2); }

.hidden { display: none !important; }

/* ── Tabs ── */

.tabs {
  display: flex;
  padding: 0 16px;
  background: #1e1c1a;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.tab {
  flex: 1;
  padding: 12px 8px 14px;
  border: none;
  background: transparent;
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  min-height: 52px;
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0.1px;
}

.tab.active[data-cat="sauces"]   { color: #ff7f6b; border-color: #ff7f6b; }
.tab.active[data-cat="rubs"]     { color: #ffb347; border-color: #ffb347; }
.tab.active[data-cat="dressings"]{ color: #7ecf8e; border-color: #7ecf8e; }
.tab.active[data-cat="shopping"] { color: #b39ddb; border-color: #b39ddb; }

/* ── Shopping list ── */

.shopping-list {
  max-width: 900px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
  align-items: start;
}

.shopping-group h3 {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.shopping-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

.shopping-item:last-child { border-bottom: none; }

.shopping-item.checked .item-label {
  text-decoration: line-through;
  color: var(--muted);
}

.check-box {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 6px;
  border: 2px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.shopping-item.checked .check-box {
  background: #5b3fa6;
  border-color: #5b3fa6;
  color: #fff;
}

.check-box svg {
  display: none;
  width: 16px;
  height: 16px;
}

.shopping-item.checked .check-box svg { display: block; }

.item-label {
  font-size: 1.05rem;
  line-height: 1.4;
}

.shopping-actions {
  max-width: 900px;
  margin: 0 auto 20px;
  display: flex;
  justify-content: flex-end;
}

.clear-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  min-height: 48px;
}

.clear-btn:active { background: var(--bg); }

.share-btn {
  background: #5b3fa6;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 48px;
}

.share-btn:active { opacity: 0.85; }
.share-btn:disabled { opacity: 0.6; }

/* ── Main ── */

main {
  padding: 24px;
  max-width: 1440px;
  margin: 0 auto;
}

/* ── Card grid ── */

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

.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 22px 20px 18px 20px;
  cursor: pointer;
  transition: transform 0.1s;
  user-select: none;
  border-left-width: 5px;
  border-left-style: solid;
}

.card:active { transform: scale(0.97); }

.card-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.card-cuisine {
  font-size: 0.9rem;
  color: var(--muted);
  text-transform: capitalize;
  margin-bottom: 14px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 4px 10px;
  border-radius: 20px;
}

.badge-free  { background: var(--free-bg); color: var(--free-fg); }
.badge-syn   { background: var(--syn-bg);  color: var(--syn-fg); }
.badge-heat  { background: var(--heat-bg); color: var(--heat-fg); }

/* ── Detail view ── */

.detail {
  max-width: 960px;
  margin: 0 auto;
}

.detail-header {
  margin-bottom: 28px;
}

.detail-header h2 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.detail-cuisine {
  font-size: 1rem;
  color: var(--muted);
  text-transform: capitalize;
  margin-bottom: 14px;
}

.detail-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 14px;
}

.ingredient-list {
  list-style: none;
}

.ingredient-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 1.05rem;
  line-height: 1.4;
}

.ingredient-list li:last-child { border-bottom: none; }

.method-box {
  background: var(--bg);
  border-radius: 10px;
  padding: 18px 20px;
  font-size: 1.05rem;
  line-height: 1.75;
}

.notice {
  margin-top: 16px;
  padding: 13px 16px;
  border-radius: 10px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.notice-syn  { background: var(--syn-bg);  color: var(--syn-fg); }
.notice-heat { background: var(--heat-bg); color: var(--heat-fg); }

.pairs-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.pairs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  margin-top: 4px;
}

.pairs-group h4 {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 6px;
}

.pairs-group p {
  font-size: 1rem;
  text-transform: capitalize;
  line-height: 1.6;
}

/* ── Responsive ── */

/* Mobile */
@media (max-width: 600px) {
  main { padding: 16px; }

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

  .card { padding: 16px 14px 14px; }
  .card-name { font-size: 1.05rem; }

  .detail-body { grid-template-columns: 1fr; }
  .detail-header h2 { font-size: 1.5rem; }
}

/* Tablet portrait */
@media (min-width: 600px) and (max-width: 900px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}

/* Nest Hub Max and large landscape (1200px+) */
@media (min-width: 1200px) {
  body { font-size: 20px; }

  .grid { grid-template-columns: repeat(4, 1fr); }

  .card { padding: 26px 22px 20px; }
  .card-name { font-size: 1.3rem; }

  .tab { font-size: 1.15rem; min-height: 62px; }
  .back-btn { font-size: 1.3rem; }
  .page-title { font-size: 1.6rem; }
}
