/* Casa Ceiba — identidad del restaurante (no la de Lux Digital)
   Paleta: selva, ceiba, terracota, maíz, oro, carbón, hoja.
   Tipografía: serif humanista del sistema para títulos; sans del sistema para texto. */
:root {
  --selva: #1E3A2E;
  --ceiba: #2E5745;
  --ceiba-claro: #3F6E59;
  --terracota: #C4532D;
  --terracota-osc: #A5421F;
  --maiz: #F4EADB;
  --maiz-osc: #E8D9C0;
  --papel: #FBF7F0;
  --oro: #E0A33A;
  --carbon: #1B1A17;
  --tinta: #2B2823;
  --gris: #6F675C;
  --hoja: #6FA544;
  --linea: rgba(43, 40, 35, .12);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radio: 18px;
  --sombra: 0 10px 30px rgba(20, 30, 24, .18);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  color: var(--tinta);
  background: var(--papel);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--terracota); outline-offset: 2px; }
.cabecera :focus-visible, .categorias :focus-visible { outline-color: var(--oro); }
::selection { background: rgba(224, 163, 58, .35); }

/* ---------- Presentación: pantalla completa por defecto ---------- */
.escenario { height: 100%; }
.telefono { height: 100%; }
.pantalla {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--papel);
  container-type: size;
}
.barra-estado, .pie-escenario { display: none; }

/* ---------- Silueta de celular (escritorio, html.marco) ---------- */
html.marco body {
  background:
    radial-gradient(1200px 700px at 70% 10%, rgba(196, 83, 45, .18), transparent 60%),
    radial-gradient(900px 600px at 10% 90%, rgba(224, 163, 58, .14), transparent 60%),
    var(--selva);
}
html.marco .escenario {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 16px;
  gap: 14px;
}
html.marco .telefono {
  position: relative;
  width: 392px;
  height: min(844px, calc(100vh - 80px));
  border-radius: 56px;
  padding: 12px;
  background: linear-gradient(145deg, #2c2b29, #0d0d0c);
  box-shadow: 0 0 0 2px #3a3936, 0 40px 80px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(255, 255, 255, .06);
}
html.marco .telefono::before { /* isla dinámica */
  content: "";
  position: absolute;
  top: 23px; left: 50%;
  width: 112px; height: 32px;
  transform: translateX(-50%);
  background: #000;
  border-radius: 20px;
  z-index: 30;
}
html.marco .pantalla { border-radius: 44px; }
html.marco .barra-estado {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 46px;
  padding: 6px 30px 0 36px;
  font-size: 14px;
  font-weight: 600;
  color: var(--maiz);
  background: var(--selva);
  flex: none;
}
.iconos-estado { display: flex; gap: 5px; align-items: center; }
.iconos-estado i { display: block; width: 16px; height: 10px; border-radius: 2px; background: var(--maiz); opacity: .9; }
.iconos-estado i:nth-child(1) { width: 14px; clip-path: polygon(0 100%, 100% 0, 100% 100%); }
.iconos-estado i:nth-child(2) { width: 12px; border-radius: 50% 50% 0 0; }
.iconos-estado i:nth-child(3) { width: 22px; }
html.marco .pie-escenario { display: block; margin: 0; color: rgba(244, 234, 219, .6); font-size: 13px; letter-spacing: .04em; }

/* ---------- Cabecera ---------- */
.cabecera {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--selva);
  color: var(--maiz);
}
.marca { display: flex; align-items: center; gap: 10px; }
.simbolo { flex: none; color: var(--maiz); }
.marca-nombre { margin: 0; line-height: 0; color: var(--maiz); }
.marca-nombre svg { display: block; width: auto; height: 19px; }
.marca-lema { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; opacity: .7; margin-top: 3px; }
.btn-carrito {
  position: relative;
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border: 1px solid rgba(244, 234, 219, .25);
  border-radius: 50%;
  background: transparent;
  color: var(--maiz);
}
.btn-carrito:hover { background: rgba(244, 234, 219, .08); }
.insignia {
  position: absolute; top: -4px; right: -4px;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px;
  background: var(--terracota);
  color: #fff;
  font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
}
.insignia.salto { animation: salto .4s ease; }
@keyframes salto { 40% { transform: scale(1.35); } }

/* ---------- Categorías ---------- */
.categorias {
  flex: none;
  display: flex;
  gap: 6px;
  padding: 8px 12px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--selva);
}
.categorias::-webkit-scrollbar { display: none; }
.categorias button {
  flex: none;
  padding: 7px 14px;
  border: 1px solid rgba(244, 234, 219, .25);
  border-radius: 999px;
  background: transparent;
  color: var(--maiz);
  font-size: 14px;
}
.categorias button[aria-current="true"] { background: var(--maiz); color: var(--selva); border-color: var(--maiz); font-weight: 600; }

/* ---------- Menú ---------- */
.menu {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  padding: 4px 14px 30px; /* +14 px: el borde redondeado del chat monta sobre el menú */
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(30, 58, 46, .25) transparent;
}
.cargando { padding: 40px 0; text-align: center; color: var(--gris); }
.seccion h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 26px;
  margin: 18px 2px 10px;
  color: var(--selva);
  display: flex; align-items: center; gap: 10px;
}
.seccion h2::after { content: ""; flex: 1; height: 1px; background: var(--linea); }
.tarjeta {
  position: relative;
  margin: 0 0 16px;
  border-radius: var(--radio);
  background: #fff;
  box-shadow: 0 1px 0 var(--linea), 0 6px 18px rgba(30, 58, 46, .08);
  overflow: hidden;
  scroll-margin: 12px;
  transition: box-shadow .3s ease, transform .3s ease;
}
.tarjeta img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; background: var(--selva); }
.tarjeta-cuerpo { padding: 12px 14px 14px; }
.tarjeta-fila { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.tarjeta h3 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 19px; line-height: 1.2; color: var(--carbon); }
.precio { font-weight: 700; color: var(--terracota-osc); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tarjeta p { margin: 6px 0 8px; font-size: 14px; line-height: 1.45; color: var(--gris); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.chip { font-size: 11.5px; padding: 3px 8px; border-radius: 999px; background: #EEF3E4; color: #3E6B26; }
.chip.alerta { background: #FBEDE6; color: var(--terracota-osc); }
.tarjeta-acciones { display: flex; justify-content: flex-end; }
.btn-agregar {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--terracota);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}
.btn-agregar:hover { background: var(--terracota-osc); }
.paso {
  display: inline-flex; align-items: center;
  border: 1px solid var(--linea);
  border-radius: 999px;
  overflow: hidden;
  background: var(--papel);
}
.paso button { width: 34px; height: 34px; border: 0; background: transparent; font-size: 18px; color: var(--selva); }
.paso button:hover { background: var(--maiz); }
.paso span { min-width: 26px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.tarjeta.resaltado { animation: resaltar 2.6s ease; }
@keyframes resaltar {
  0% { box-shadow: 0 0 0 0 rgba(196, 83, 45, .0); transform: scale(1); }
  15% { box-shadow: 0 0 0 4px var(--terracota), 0 12px 30px rgba(196, 83, 45, .35); transform: scale(1.015); }
  70% { box-shadow: 0 0 0 4px var(--terracota), 0 12px 30px rgba(196, 83, 45, .25); transform: scale(1); }
  100% { box-shadow: 0 1px 0 var(--linea), 0 6px 18px rgba(30, 58, 46, .08); }
}
.recomendado-cinta {
  position: absolute; top: 12px; left: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--oro);
  color: var(--carbon);
  font-size: 12px; font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
}

/* ---------- Pastilla de pedido ----------
   Terracota = pedir (igual que «Agregar» y «Confirmar»): el carrito no se confunde ni con el menú ni con el chat. */
.pastilla-pedido {
  position: absolute;
  right: 14px;
  bottom: calc(var(--alto-chat, 140px) + 12px);
  z-index: 5;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px;
  padding: 0 18px 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--terracota);
  color: #fff;
  font-size: 14px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 8px 20px rgba(27, 26, 23, .24), 0 2px 4px rgba(27, 26, 23, .12);
}
.pastilla-pedido:hover { background: var(--terracota-osc); }

/* ---------- Chat ----------
   La conversación vive en su propia superficie: un panel selva elevado sobre el menú (que es papel claro),
   con cabecera propia (avatar del mesero, estado, rótulo para abrir/ocultar). Acento del chat: oro. */
.chat {
  --chat-fondo: var(--selva);
  --chat-texto: var(--maiz);
  --chat-tenue: rgba(244, 234, 219, .72);
  flex: none;
  position: relative;
  display: flex;
  flex-direction: column;
  margin-top: -14px; /* monta el borde redondeado sobre el menú */
  background: var(--chat-fondo);
  color: var(--chat-texto);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -1px 0 rgba(244, 234, 219, .06) inset, 0 -14px 32px rgba(20, 30, 24, .28), 0 -2px 6px rgba(20, 30, 24, .12);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 6;
}
.chat-asa {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 16px 14px 10px;
  border: 0;
  border-radius: 22px 22px 0 0;
  background: transparent;
  color: inherit;
  text-align: left;
}
.chat-asa:focus-visible { outline-offset: -3px; }
.agarre {
  position: absolute; top: 6px; left: 50%;
  width: 38px; height: 4px;
  margin-left: -19px;
  border-radius: 2px;
  background: rgba(244, 234, 219, .32);
}
.avatar {
  flex: none;
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--maiz);
  color: var(--selva);
  box-shadow: 0 0 0 2px var(--selva), 0 0 0 3.5px rgba(224, 163, 58, .7);
}
.avatar svg, .simbolo { fill: currentColor; }
.avatar .puerta, .simbolo .puerta { fill: var(--oro); }
.chat-titulo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.chat-nombre { font-family: var(--serif); font-size: 17px; line-height: 1.15; }
.chat-titulo small { font-size: 12px; color: #A9D69A; }
.chat-titulo small::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #8FD07A; margin-right: 6px; vertical-align: 1px; }
.chat-accion {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 10px 0 12px;
  border: 1px solid rgba(244, 234, 219, .26);
  border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
  color: var(--maiz);
}
.chat-asa:hover .chat-accion { background: rgba(244, 234, 219, .08); border-color: rgba(244, 234, 219, .4); }
.chevron { transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.chat:not(.compacto) .chevron { transform: rotate(180deg); }
.chat-log {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 12px 8px;
  max-height: 34cqh;
  transition: max-height .32s cubic-bezier(.2, .8, .2, 1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(244, 234, 219, .28) transparent;
}
.chat.compacto .chat-log { max-height: 64px; }
/* Plegado: un desvanecido arriba indica que hay más conversación encima */
.chat.compacto .chat-log { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 18px); mask-image: linear-gradient(to bottom, transparent 0, #000 18px); }
.burbuja {
  max-width: 86%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.42;
  white-space: pre-wrap;
  word-wrap: break-word;
}
/* Mesero: papel, a la izquierda. Cliente: oro, a la derecha (el mismo oro del botón de enviar). */
.burbuja.mesero { align-self: flex-start; background: var(--papel); border-bottom-left-radius: 5px; color: var(--tinta); }
.burbuja.cliente { align-self: flex-end; background: var(--oro); color: var(--carbon); border-bottom-right-radius: 5px; }
.burbuja.sistema { align-self: center; background: transparent; color: var(--chat-tenue); font-size: 12.5px; text-align: center; padding: 2px 8px; }
.escribiendo { display: inline-flex; gap: 4px; padding: 12px 14px; }
.escribiendo i { width: 7px; height: 7px; border-radius: 50%; background: var(--gris); opacity: .5; animation: punto 1s infinite; }
.escribiendo i:nth-child(2) { animation-delay: .15s; }
.escribiendo i:nth-child(3) { animation-delay: .3s; }
@keyframes punto { 50% { opacity: 1; transform: translateY(-3px); } }

.mini-fila { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: thin; scrollbar-color: rgba(244, 234, 219, .28) transparent; align-self: stretch; }
.mini {
  flex: none;
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 4px 9px;
  width: 232px;
  padding: 7px;
  border-radius: 14px;
  background: #fff;
  color: var(--tinta);
}
.mini img { grid-row: span 2; width: 54px; height: 54px; border-radius: 10px; object-fit: cover; }
.mini-nombre { font-weight: 600; font-size: 13.5px; line-height: 1.2; color: var(--carbon); background: none; border: 0; padding: 0; text-align: left; text-decoration: underline; text-decoration-color: rgba(43, 40, 35, .25); text-underline-offset: 3px; }
.mini-nombre:hover { text-decoration-color: currentColor; }
.mini-pie { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.mini-pie .precio { font-size: 13px; }
.mini .btn-agregar { padding: 5px 11px; font-size: 12.5px; }
.mini .btn-agregar[disabled] { background: #3E6B26; cursor: default; }
.agregados { align-self: flex-start; font-size: 12.5px; color: #C9E8BD; background: rgba(143, 208, 122, .16); padding: 5px 10px; border-radius: 10px; }

.chat-form {
  display: flex;
  gap: 8px;
  padding: 6px 12px 12px;
}
.chat-form input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--papel);
  color: var(--tinta);
  caret-color: var(--terracota);
  font-size: 16px; /* evita el zoom en iOS */
  outline: none;
}
.chat-form input::placeholder { color: var(--gris); }
.chat-form input:focus { border-color: var(--oro); box-shadow: 0 0 0 3px rgba(224, 163, 58, .35); }
.chat-form button {
  flex: none;
  width: 44px; height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--oro);
  color: var(--carbon);
  display: grid; place-items: center;
}
.chat-form button:hover { background: #EBB459; }
.chat-form button[disabled] { opacity: .5; cursor: default; }
.chat :focus-visible { outline-color: var(--oro); }

/* ---------- Hojas (carrito y confirmación) ---------- */
.hoja-fondo { position: absolute; inset: 0; background: rgba(20, 28, 24, .45); z-index: 20; }
.hoja {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: 88%;
  display: flex;
  flex-direction: column;
  padding: 16px 18px calc(18px + env(safe-area-inset-bottom));
  background: var(--papel);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -20px 40px rgba(0, 0, 0, .2);
  z-index: 21;
  animation: subir .28s ease;
}
@keyframes subir { from { transform: translateY(40px); opacity: 0; } }
.hoja-cab { display: flex; justify-content: space-between; align-items: center; }
.hoja h2 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 24px; color: var(--selva); }
.btn-cerrar { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--maiz); font-size: 22px; line-height: 1; }
.carrito-lista { list-style: none; margin: 12px 0; padding: 0; overflow-y: auto; }
.carrito-lista li { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--linea); }
.carrito-lista img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; }
.carrito-lista .nombre { font-weight: 600; font-size: 14.5px; }
.carrito-lista .sub { font-size: 13px; color: var(--gris); font-variant-numeric: tabular-nums; }
.carrito-lista.resumen li { grid-template-columns: 1fr auto; padding: 6px 0; }
.carrito-vacio { color: var(--gris); font-size: 14px; margin: 18px 0; }
.carrito-pie { border-top: 1px solid var(--linea); padding-top: 10px; }
.carrito-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 18px; }
.carrito-total strong { font-size: 22px; color: var(--carbon); font-variant-numeric: tabular-nums; }
.nota { font-size: 12px; color: var(--gris); margin: 4px 0 12px; }
.btn-primario {
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 14px;
  background: var(--terracota);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}
.btn-primario:hover { background: var(--terracota-osc); }
.btn-primario[disabled] { opacity: .45; cursor: default; }
.confirmado { text-align: center; align-items: stretch; }
.conf-icono { display: grid; place-items: center; margin: 8px 0 6px; }
.conf-icono svg { animation: pop .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.conf-sub { margin: 4px 0 6px; color: var(--gris); }
.confirmado .carrito-lista { text-align: left; }

/* ---------- Aviso (venta adicional y mensajes cortos) ---------- */
.aviso {
  position: absolute;
  left: 12px; right: 12px;
  top: 112px;
  z-index: 15;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  color: var(--tinta);
  border: 1px solid var(--linea);
  font-size: 14px;
  box-shadow: 0 12px 28px rgba(30, 58, 46, .18), 0 2px 6px rgba(30, 58, 46, .08);
  animation: subir .25s ease;
}
html.marco .aviso { top: 158px; }
.aviso img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; }
.aviso span { flex: 1; }
.aviso button { flex: none; border: 0; border-radius: 999px; padding: 6px 12px; background: var(--terracota); color: #fff; font-weight: 700; font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
.aviso .aviso-cerrar { background: transparent; color: inherit; padding: 4px 6px; font-size: 18px; }
.chat-log > * { flex-shrink: 0; }

/* ---------- Selector de idioma (EN / ES) ---------- */
.idioma {
  display: flex;
  margin-left: auto;
  margin-right: 10px;
  padding: 2px;
  border: 1px solid rgba(244, 234, 219, .22);
  border-radius: 999px;
}
.idioma button {
  min-width: 30px; height: 24px;
  padding: 0 7px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--maiz);
  font-size: 11px; font-weight: 600; letter-spacing: .08em;
  opacity: .62;
}
.idioma button:hover { opacity: .9; }
.idioma button[aria-pressed="true"] { background: rgba(244, 234, 219, .16); opacity: 1; }
/* El lema en inglés es más largo: una sola línea también a 375 px */
.marca { min-width: 0; }
.marca > div { min-width: 0; }
.marca-lema { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 400px) {
  .marca-lema { letter-spacing: .1em; font-size: 10px; }
  .idioma { margin-right: 8px; }
}
/* La silueta de celular mide lo mismo que un móvil: el mismo lema compacto */
html.marco .marca-lema { letter-spacing: .1em; font-size: 10px; }
