:root {
  --red: #b91c1c;
  --red-dark: #8f1414;
  --orange: #ef7d00;
  --orange-soft: #fff3e8;
  --ink: #171717;
  --muted: #6b7280;
  --line: #eaded5;
  --paper: #fffdfb;
  --white: #ffffff;
  --green: #16a34a;
  --shadow: 0 10px 28px rgba(71, 32, 15, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: #f7f2ed;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(100%, 780px);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--paper);
  box-shadow: 0 0 50px rgba(0,0,0,.07);
}
.screen { display: none; min-height: 100dvh; }
.screen.active { display: block; }

.hero {
  padding: calc(20px + env(safe-area-inset-top)) 20px 26px;
  color: var(--white);
  background:
    radial-gradient(circle at 90% 5%, rgba(255,255,255,.16), transparent 28%),
    linear-gradient(135deg, var(--red-dark), var(--red) 54%, #d5441a);
  border-radius: 0 0 28px 28px;
}
.brand-row { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 66px; height: 66px; flex: 0 0 66px;
  border-radius: 18px; overflow: hidden;
  box-shadow: 0 8px 18px rgba(0,0,0,.16);
}
.brand-logo img, .brand-logo svg { width: 100%; height: 100%; display: block; object-fit: cover; }
.eyebrow { margin: 0 0 3px; font-size: .75rem; letter-spacing: .16em; font-weight: 900; opacity: .8; }
.hero h1, .subheader h1 { margin: 0; font-size: clamp(1.35rem, 6vw, 2rem); line-height: 1.05; }
.hero h2 { margin: 28px 0 4px; font-size: clamp(2rem, 10vw, 3.2rem); line-height: .98; letter-spacing: -.04em; }
.hero-subtitle { margin: 0; font-size: 1.08rem; color: #ffe9d6; font-weight: 650; }

.info-strip {
  margin: 14px 16px 0;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px;
  border: 1px solid #ffd1ad;
  border-radius: 16px;
  background: var(--orange-soft);
}
.info-strip strong { color: #9a3412; }
.info-strip span { font-size: .9rem; color: #7c4a2d; }

.category-tabs {
  position: sticky; top: 0; z-index: 10;
  display: flex; gap: 8px;
  overflow-x: auto; scrollbar-width: none;
  padding: 14px 16px 10px;
  background: rgba(255,253,251,.96);
  backdrop-filter: blur(10px);
}
.category-tabs::-webkit-scrollbar { display: none; }
.category-chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--white);
  color: #442c22;
  border-radius: 999px;
  padding: 10px 15px;
  font-weight: 800;
  cursor: pointer;
}
.category-chip.active { background: var(--ink); color: var(--white); border-color: var(--ink); }

.menu-content { padding: 4px 16px 24px; }
.category-section { scroll-margin-top: 68px; margin: 14px 0 28px; display: none; }
.category-section.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.category-title { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 0 2px 12px; }
.category-title h2 { margin: 0; font-size: 1.5rem; }
.category-title span { color: var(--muted); font-size: .86rem; }
.products-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }

.product-card {
  overflow: hidden;
  background: var(--white);
  border: 1px solid #f0e7e1;
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.product-image-wrap { position: relative; aspect-ratio: 16 / 10; background: #f3e9df; overflow: hidden; }
.product-image { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-fallback { width: 100%; height: 100%; display: grid; place-items: center; font-size: 3rem; background: linear-gradient(135deg,#fff1df,#ffe0b8); }
.product-body { padding: 15px; }
.product-name { margin: 0 0 5px; font-size: 1.12rem; line-height: 1.2; font-weight: 700; }
.product-description { margin: 0; color: var(--muted); font-size: .94rem; min-height: 2.8em; }
.product-price { display: block; margin-top: 13px; color: var(--red); font-size: 1.25rem; font-weight: 900; }
.add-btn { width: 100%; margin-top: 10px; }

.btn {
  min-height: 52px;
  width: 100%;
  border: 0;
  border-radius: 15px;
  padding: 13px 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  transition: transform .1s ease, opacity .15s ease;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { color: var(--white); background: linear-gradient(135deg, var(--red), #df4519); box-shadow: 0 9px 18px rgba(185,28,28,.22); }
.btn-secondary { color: var(--ink); background: #f3ede8; margin-top: 10px; }
.btn-whatsapp { color: var(--white); background: #16a34a; margin-top: 20px; }
.btn-print { color: var(--white); background: #2563eb; margin-top: 10px; }
.bottom-spacer { height: 98px; }
.floating-cart-wrap {
  position: fixed; z-index: 30;
  left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(100%, 780px);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(255,253,251,.94) 22%, var(--paper) 55%);
}
.btn-cart { justify-content: space-between; min-height: 58px; padding-inline: 20px; }

.subheader {
  padding: calc(18px + env(safe-area-inset-top)) 18px 18px;
  display: flex; align-items: center; gap: 12px;
  color: var(--white); background: var(--red);
}
.icon-btn { width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255,255,255,.16); color: var(--white); font-size: 1.5rem; cursor: pointer; }
.order-items { padding: 18px 16px 8px; display: grid; gap: 12px; }
.order-item {
  display: grid; grid-template-columns: 1fr auto; gap: 12px;
  padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--white); box-shadow: var(--shadow);
}
.order-item h3 { margin: 0 0 4px; font-size: 1rem; }
.order-item-price { color: var(--red); font-weight: 900; }
.quantity-controls { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qty-group { display: inline-flex; align-items: center; gap: 8px; }
.qty-btn, .remove-btn { border: 0; min-width: 42px; min-height: 42px; border-radius: 12px; font-weight: 900; cursor: pointer; }
.qty-btn { background: #f3ede8; font-size: 1.2rem; }
.qty-value { min-width: 28px; text-align: center; font-weight: 900; }
.remove-btn { background: #fff0f0; color: var(--red); padding: 0 13px; }
.order-total { margin: 10px 16px 18px; padding: 18px; display: flex; align-items: center; justify-content: space-between; border-radius: 18px; background: var(--ink); color: var(--white); }
.order-total strong { font-size: 1.5rem; }

.checkout-card { margin: 0 16px; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--white); box-shadow: var(--shadow); }
.section-heading { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: 1.25rem; }
.section-heading p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.step-badge { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: var(--white); background: var(--orange); font-weight: 900; }
label { display: block; margin: 14px 0; font-size: .9rem; font-weight: 800; }
.optional { color: var(--muted); font-weight: 600; }
input, textarea { width: 100%; margin-top: 6px; border: 1.5px solid #dfd5cf; border-radius: 13px; background: #fffefc; padding: 13px 14px; color: var(--ink); outline: none; }
input:focus, textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(239,125,0,.12); }
textarea { resize: vertical; }
.checkout-card { padding-bottom: calc(22px + env(safe-area-inset-bottom)); }

.confirmed-screen { min-height: 100dvh; padding: calc(28px + env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom)); background: linear-gradient(180deg,#fff7f1,#fffdfb); }
.confirmation-card { min-height: calc(100dvh - 56px); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 24px; border: 1px solid var(--line); border-radius: 28px; background: var(--white); box-shadow: var(--shadow); }
.check-icon { width: 82px; height: 82px; display: grid; place-items: center; border-radius: 50%; background: #dcfce7; color: var(--green); font-size: 2.8rem; font-weight: 950; margin-bottom: 18px; }
.confirmation-card h1 { margin: 0; font-size: 2rem; }
.order-number { margin: 8px 0 18px; color: var(--red); font-size: 2rem; font-weight: 950; }
.confirmation-message { max-width: 330px; margin: 0; color: var(--muted); }
.confirmation-total { width: 100%; margin-top: 24px; padding: 16px; display: flex; justify-content: space-between; border-radius: 16px; background: #f8f2ed; }
.confirmation-total strong { color: var(--red); }

.toast {
  position: fixed; z-index: 100;
  left: 50%; top: calc(18px + env(safe-area-inset-top));
  transform: translate(-50%, -130%);
  width: max-content; max-width: calc(100% - 32px);
  padding: 12px 16px; border-radius: 999px;
  background: #111827; color: var(--white); font-weight: 800;
  opacity: 0; transition: .25s ease; box-shadow: 0 12px 28px rgba(0,0,0,.2);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.empty-state { padding: 28px 16px; text-align: center; color: var(--muted); }
.loading { padding: 36px 16px; text-align: center; color: var(--muted); }

@media (min-width: 620px) {
  .products-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hero { padding-inline: 28px; }
  .menu-content, .category-tabs { padding-left: 28px; padding-right: 28px; }
}

/* Performance: browsers can skip layout/paint work for off-screen menu sections. */
.category-section { content-visibility: auto; contain-intrinsic-size: 420px; }
