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

:root {
  --bg:       #0f0f13;
  --surface:  #1a1a24;
  --surface2: #22222e;
  --border:   #2e2e40;
  --text:     #e8e8f2;
  --muted:    #8888aa;
  --dim:      #55556a;
  --green:    #1A5C3A;
  --green-hi: #2E9E6E;
  --brown:    #7B1E00;
  --brown-hi: #D4724A;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-width: 375px;
}

/* ── Header ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #0d0d11ee;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-header .logo-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  cursor: pointer;
}

.app-header .logo-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.app-header .app-title {
  font-size: 17px;
  font-weight: 700;
  background: linear-gradient(90deg, #FF416C, #C850C0, #7B6FE8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.2px;
}

/* ── Main content ── */
main { padding: 28px 20px 60px; max-width: 960px; margin: 0 auto; }

/* ── Home view ── */
.home-heading {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
}

.category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 640px) {
  .category-grid { grid-template-columns: 1fr; }
}

/* Category box */
.cat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.cat-box-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.cat-box-header.nonveg { background: #1e1008; }
.cat-box-header.veg    { background: #0d1e12; }

.cat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.nonveg .cat-dot { background: #D4724A; }
.veg    .cat-dot { background: #2E9E6E; }

.cat-box-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.1px;
  text-transform: uppercase;
}
.nonveg .cat-box-title { color: #D4724A; }
.veg    .cat-box-title { color: #2E9E6E; }

/* Search bar */
.search-wrap {
  position: relative;
  margin-bottom: 20px;
}
.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dim);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 11px 40px 11px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.search-input::placeholder { color: var(--dim); }
.search-input:focus { border-color: #5555aa; }
.search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--dim);
  cursor: pointer;
  padding: 2px;
  display: none;
  line-height: 1;
  font-size: 16px;
}
.search-clear:hover { color: var(--text); }

/* Search results */
.search-results {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.search-empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.search-result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.search-result-row:last-child { border-bottom: none; }
.search-result-row:hover { background: var(--surface2); }
.search-result-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.search-result-dot.green { background: var(--green-hi); }
.search-result-dot.brown { background: var(--brown-hi); }
.search-result-info { flex: 1; }
.search-result-name { font-size: 14px; font-weight: 600; color: var(--text); }
.search-result-meta { font-size: 12px; color: var(--dim); margin-top: 1px; }

/* Non-veg sub-category section inside the box */
.subcat-section { border-bottom: 1px solid var(--border); }
.subcat-section:last-child { border-bottom: none; }

.subcat-label {
  padding: 10px 18px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: #c47a45;
}

.subcat-empty {
  padding: 7px 18px 10px;
  font-size: 12px;
  color: var(--dim);
  font-style: italic;
}

/* Ingredient group */
.ingredient-group { border-bottom: 1px solid var(--border); }
.ingredient-group:last-child { border-bottom: none; }

.ingredient-label {
  padding: 10px 18px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--dim);
}

/* Recipe rows inside a group */
.recipe-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 18px;
  cursor: pointer;
  transition: background 0.12s;
  gap: 8px;
}
.recipe-row:hover { background: var(--surface2); }

.recipe-row-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}

.recipe-row-cuisine {
  font-size: 11px;
  color: var(--dim);
  flex-shrink: 0;
}

.recipe-row-arrow {
  flex-shrink: 0;
  color: var(--dim);
  transition: color 0.12s, transform 0.12s;
}
.recipe-row:hover .recipe-row-arrow { color: var(--text); transform: translateX(2px); }

/* ── Detail view ── */
[hidden] { display: none !important; }

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 22px;
  border: none;
  background: none;
  transition: color 0.15s;
}
.detail-back:hover { color: var(--text); }

.detail-header {
  border-radius: 12px;
  padding: 28px 24px;
  margin-bottom: 24px;
}
.detail-header.green { background: linear-gradient(135deg, #0d2e1e, #1A5C3A); }
.detail-header.brown { background: linear-gradient(135deg, #2a0800, #7B1E00); }

.detail-title {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 8px;
}

.detail-intro {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  font-style: italic;
  line-height: 1.5;
}

/* Sections */
.section-heading {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  padding: 10px 14px;
  border-radius: 8px;
  margin: 24px 0 12px;
  color: #fff;
}
.section-heading.green { background: var(--green); }
.section-heading.brown { background: #A0522D; }

.subsection-heading {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 7px 14px;
  border-radius: 6px;
  margin: 16px 0 10px;
  color: #fff;
}
.subsection-heading.green { background: #2E7D52; }
.subsection-heading.brown { background: #C47A45; }

/* Tables */
.recipe-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 8px;
  overflow: hidden;
  font-size: 13.5px;
  margin-bottom: 4px;
}

.recipe-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.4px;
  background: var(--surface2);
}
.green .recipe-table thead th,
.green-table .recipe-table thead th { color: var(--green-hi); }
.brown .recipe-table thead th,
.brown-table .recipe-table thead th { color: var(--brown-hi); }

.recipe-table tbody tr:nth-child(odd)  { background: var(--surface); }
.recipe-table tbody tr:nth-child(even) { background: #14141c; }

.recipe-table td {
  padding: 9px 12px;
  vertical-align: top;
  border-top: 1px solid var(--border);
  line-height: 1.5;
}
.recipe-table td:first-child {
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
  min-width: 120px;
  max-width: 200px;
}
.recipe-table td:last-child { color: var(--muted); }

/* Steps */
.steps-list {
  list-style: none;
  counter-reset: step;
}

.steps-list li {
  counter-increment: step;
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  align-items: flex-start;
  line-height: 1.6;
  font-size: 14.5px;
}
.steps-list li:first-child { border-top: none; }

.step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  margin-top: 1px;
}
.green .step-num { background: var(--green); }
.brown .step-num { background: #A0522D; }

.step-text { color: var(--text); flex: 1; }

/* Tip */
.tip-block {
  display: flex;
  gap: 12px;
  background: var(--surface);
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 24px;
  align-items: flex-start;
  border: 1px solid var(--border);
}

.tip-label {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 2px;
}
.green .tip-label { color: var(--green-hi); }
.brown .tip-label { color: var(--brown-hi); }

.tip-text {
  font-size: 13.5px;
  font-style: italic;
  color: var(--muted);
  line-height: 1.6;
}

/* Mobile */
@media (max-width: 600px) {
  main { padding: 20px 14px 48px; }
  .detail-header { padding: 20px 18px; }
  .detail-title  { font-size: 21px; }
  .recipe-table  { font-size: 12.5px; }
  .recipe-table td:first-child { min-width: 90px; white-space: normal; }
}