/* Carta pública · pedido del cliente (órdenes M-2, M-2b y M-2c):
   barra verde "Ver mi pedido", Mi pedido y Resumen, como el lienzo aprobado. */

/* Espacio al final para que la barra no tape el último producto */
body.ct-con-pedido { padding-bottom: 10rem; }

/* Barra del pedido */
.ct-barra {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 1040;
  width: min(calc(100% - 24px), 576px);
  min-height: 52px;  /* orden M-2d */
  border: none;
  border-radius: 14px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #1a7a72;
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 16px;
}
.ct-barra[hidden] { display: none; }
.ct-barra-cant {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  background: #fff;
  color: #1a7a72;
  display: grid;
  place-items: center;
}
.ct-barra-texto { flex: 1; text-align: left; }
.ct-pulso { animation: ct-pulso 0.45s ease-out; }
@keyframes ct-pulso {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) { .ct-pulso { animation: none; } }

/* Aviso corto: arriba, bajo la cabecera y las pestañas (orden M-2d). No
   recibe toques: nunca tapa un botón. */
.ct-toast {
  position: fixed;
  left: 50%;
  top: 108px;
  transform: translate(-50%, -6px);
  z-index: 1100;
  max-width: calc(100% - 32px);
  padding: 8px 14px;
  border-radius: 12px;
  background: #1a1a1a;
  color: #fff;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.ct-toast-visible { opacity: 1; transform: translate(-50%, 0); }
/* Con una hoja abierta (Mi pedido, Pedido enviado), bajo su cabecera. */
body.ct-hoja-abierta .ct-toast, body.cc-abierto .ct-toast { top: 76px; }

/* Hojas: Mi pedido y Resumen (pantalla completa en el celular) */
body.ct-hoja-abierta { overflow: hidden; }
.ct-hoja-fondo { position: fixed; inset: 0; z-index: 1080; background: rgba(20, 18, 16, 0.55); }
.ct-hoja-fondo[hidden], .ct-hoja[hidden] { display: none !important; }
.ct-hoja {
  position: fixed;
  inset: 0;
  z-index: 1081;
  display: flex;
  flex-direction: column;
  background: #f0efed;
  color: #1a1a1a;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 16px;
}
@media (min-width: 768px) {
  .ct-hoja { left: 50%; width: 480px; transform: translateX(-50%); box-shadow: 0 0 40px rgba(0, 0, 0, 0.25); }
}
.ct-hoja button { font-family: inherit; cursor: pointer; }
.ct-hoja button:focus-visible, .ct-hoja textarea:focus-visible { outline: 3px solid #1a7a72; outline-offset: 2px; }

.ct-hoja-cabecera {
  flex: none;
  background: #fff;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #c9c4c0;
}
.ct-volver {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 22px;
  border: 1px solid #c9c4c0;
  background: #fff;
  color: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ct-hoja-textos { display: flex; flex-direction: column; flex: 1; }
.ct-hoja-titulo {
  margin: 0;
  font-family: 'Changa One', sans-serif;
  font-weight: 400;
  font-size: 24px;
  line-height: 1.1;
  color: #a30013;
}
.ct-hoja-sub { font-size: 15px; color: #5a5550; }
.ct-hoja-cuerpo {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
}
#ctPedidoLleno, #ctPedidoLista { display: flex; flex-direction: column; gap: 12px; }
#ctPedidoLleno[hidden], .ct-vacio[hidden], .ct-hoja-pie[hidden] { display: none; }
.ct-hoja-pie {
  flex: none;
  background: #fff;
  border-top: 1px solid #c9c4c0;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.08);
}

.ct-tarjeta, .ct-linea {
  background: #fff;
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ct-tarjeta-cabeza { display: flex; align-items: center; gap: 8px; }
.ct-tarjeta-titulo { margin: 0; font-family: 'Changa One', sans-serif; font-weight: 400; font-size: 20px; }
.ct-pista { margin: 0; font-size: 14px; color: #5a5550; }

.ct-linea-arriba { display: flex; justify-content: space-between; gap: 8px; }
.ct-linea-textos { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ct-linea-nombre { font-weight: 800; font-size: 17px; }
.ct-linea-detalle { font-size: 15px; color: #5a5550; line-height: 1.4; }
.ct-linea-precio { font-weight: 800; font-size: 17px; white-space: nowrap; }
.ct-linea-abajo { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ct-linea-acciones { display: flex; gap: 8px; }
.ct-btn-chico {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 22px;
  border: 1px solid #c9c4c0;
  background: #fff;
  font-size: 15px;
  font-weight: 700;
  color: #1a1a1a;
}
.ct-btn-quitar {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 22px;
  border: 0;
  background: transparent;
  font-size: 15px;
  font-weight: 700;
  color: #a30013;
}
.ct-cantidad { display: flex; align-items: center; gap: 4px; font-size: 17px; font-weight: 800; }
.ct-cantidad > span { min-width: 28px; text-align: center; }
.ct-redondo {
  width: 44px;
  height: 44px;
  border-radius: 22px;
  border: 1px solid #c9c4c0;
  background: #fff;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: #1a1a1a;
}
.ct-redondo:disabled { opacity: 0.4; cursor: default; }

.ct-dos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ct-opcion {
  min-height: 52px;
  border-radius: 12px;
  border: 1px solid #c9c4c0;
  background: #fff;
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
}
.ct-elegido { border: 2px solid #a30013; background: #fff7f7; font-weight: 800; }

.ct-nota {
  border: 1px solid #c9c4c0;
  border-radius: 12px;
  padding: 12px;
  font-size: 16px;
  font-family: inherit;
  resize: none;
  width: 100%;
}

.ct-total { display: flex; align-items: baseline; justify-content: space-between; }
.ct-total span { font-size: 16px; font-weight: 700; }
.ct-total strong { font-size: 24px; font-weight: 800; color: #a30013; }
.ct-total-linea { border-top: 1px solid #c9c4c0; padding-top: 12px; }

.ct-btn-principal, .ct-btn-secundario {
  width: 100%;
  border-radius: 14px;
  font-weight: 800;
}
.ct-btn-principal { min-height: 56px; border: 0; background: #a30013; color: #fff; font-size: 18px; }
.ct-btn-secundario { min-height: 48px; border: 1px solid #c9c4c0; background: #fff; color: #1a1a1a; font-size: 16px; font-weight: 700; }

.ct-vacio { text-align: center; padding: 40px 8px; display: flex; flex-direction: column; gap: 16px; }
.ct-vacio p { margin: 0; font-size: 17px; color: #5a5550; }

/* Resumen */
.ct-resumen .ct-hoja-cuerpo { padding: 0; }
.ct-resumen-cabecera {
  position: relative;
  background: #1a7a72;
  color: #fff;
  padding: calc(24px + env(safe-area-inset-top)) 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.ct-resumen-cabecera h2 { margin: 0; font-family: 'Changa One', sans-serif; font-weight: 400; font-size: 28px; line-height: 1.1; }
.ct-resumen-cabecera p { margin: 0; font-size: 16px; line-height: 1.4; }
.ct-volver-claro {
  position: absolute;
  left: 12px;
  top: calc(12px + env(safe-area-inset-top));
  border-color: rgba(255, 255, 255, 0.6);
  background: transparent;
  color: #fff;
}
.ct-resumen-contenido { padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.ct-resumen-modo { margin: 0; text-align: center; font-size: 16px; font-weight: 800; color: #11504b; }
.ct-resumen-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ct-resumen-lista li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid #e4e1de;
  font-size: 16px;
}
.ct-resumen-lista li:first-child { padding-top: 0; }
.ct-resumen-nombre small { display: block; font-size: 14px; color: #5a5550; line-height: 1.4; }
.ct-resumen-precio { font-weight: 700; white-space: nowrap; }
.ct-resumen-nota { margin: 0; padding: 10px 12px; border-radius: 10px; background: #fff3e0; color: #8a4500; font-size: 15px; }
.ct-resumen-nota[hidden] { display: none; }

/* ===== Enviar el pedido y llamar al mesero (orden M-3) ===== */

/* "Mesero" en la cabecera, al lado de la lupa: una etiqueta de 32 px (orden
   M-2d) que se toca en 44 px gracias a un relleno invisible. */
.cr-mesero {
  position: relative;
  height: 32px;
  max-width: 140px;
  padding: 0 10px 0 8px;
  border-radius: 16px;
  border: 0;
  background: #a30013;
  color: #fff;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  white-space: nowrap;
}
.cr-mesero::after { content: ''; position: absolute; inset: -6px -2px; }
.cr-mesero svg { width: 16px; height: 16px; flex-shrink: 0; }
.cr-mesero span { overflow: hidden; text-overflow: ellipsis; }
.cr-mesero:focus-visible { outline: 3px solid #1a7a72; outline-offset: 2px; }
.cr-mesero-avisado { background: #fff; color: #a30013; box-shadow: inset 0 0 0 2px #a30013; }
.cr-mesero-camino { background: #0c8536; }
.cr-mesero-apagado { background: #e4e1de; color: #3d3a37; }

/* Cinta de local cerrado (M3-3) */
.ct-cerrado {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff3e0;
  border: 1px solid #f0c98a;
  color: #8a4500;
}
.ct-cerrado[hidden] { display: none; }
.ct-cerrado svg { flex-shrink: 0; width: 20px; height: 20px; }
.ct-cerrado div { display: flex; flex-direction: column; gap: 2px; }
.ct-cerrado strong { font-size: 14px; font-weight: 800; }
.ct-cerrado span { font-size: 13px; color: #6b3600; line-height: 1.35; }

/* Mi pedido: mesa, errores, campo trampa */
.ct-mesa-elegida {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #e3f1ee;
  color: #11504b;
  font-size: 16px;
  font-weight: 800;
}
.ct-mesa-elegida[hidden], .ct-envio-error[hidden], .ct-ver-enviado[hidden] { display: none; }
.ct-envio-error {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fdecee;
  color: #8a0010;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
.ct-envio-error p { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.4; }
.ct-trampa { position: absolute; left: -10000px; width: 1px; height: 1px; opacity: 0; }
.ct-btn-principal:disabled, .ct-btn-secundario:disabled { background: #e4e1de; color: #3d3a37; border-color: #e4e1de; cursor: not-allowed; }
.ct-btn-rojo { background: #a30013; color: #fff; }
.ct-btn-icono { display: flex; align-items: center; justify-content: center; gap: 8px; }
.ct-linea-mala { border: 2px solid #a30013; }
.ct-linea-error { margin: 0; font-size: 14px; font-weight: 700; color: #a30013; }
.ct-ver-enviado { align-self: center; }
.ct-barra-enviado .ct-barra-total { display: none; }

/* Hoja "¿En qué mesa estás?" (M3-1) */
.ct-zona { margin: 8px 0 8px; font-size: 14px; font-weight: 800; color: #5a5550; text-transform: uppercase; letter-spacing: 0.05em; }
.ct-mesas { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ct-mesa-btn {
  min-height: 56px;
  border-radius: 14px;
  border: 1px solid #c9c4c0;
  background: #f7f4f0;
  color: #1a1a1a;
  font-size: 22px;
  font-weight: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}
.ct-mesa-btn small { font-size: 11px; font-weight: 700; color: inherit; opacity: 0.85; }
.ct-mesa-btn.ct-elegido { border: 2px solid #a30013; background: #a30013; color: #fff; }
.ct-mesa-btn:focus-visible, .ct-mostrador:focus-visible { outline: 3px solid #1a7a72; outline-offset: 2px; }
.ct-o { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: #5a5550; font-size: 14px; }
.ct-o span { flex: 1; height: 1px; background: #e4e1de; }
.ct-mostrador {
  width: 100%;
  min-height: 56px;
  border-radius: 14px;
  border: 1px solid #c9c4c0;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  color: #1a1a1a;
  text-align: left;
}
.ct-mostrador span { display: flex; flex-direction: column; }
.ct-mostrador strong { font-size: 16px; }
.ct-mostrador small { font-size: 13px; color: #5a5550; }
.ct-campo { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; font-size: 15px; font-weight: 700; }
.ct-campo[hidden], #ctMostradorBloque[hidden], .ct-mesa-error[hidden] { display: none; }
.ct-campo input { min-height: 48px; border-radius: 12px; border: 1px solid #c9c4c0; padding: 0 14px; font-size: 16px; font-family: inherit; }
.ct-campo input:focus { outline: none; border-color: #a30013; box-shadow: 0 0 0 3px rgba(163, 0, 19, 0.15); }
.ct-mesa-error { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: #fdecee; color: #8a0010; font-size: 15px; font-weight: 700; }

/* Hoja "Pedido enviado" (M3-2) */
.ct-enviado-chip { margin-top: 4px; font-size: 15px; font-weight: 800; background: #fff; color: #1a7a72; border-radius: 999px; padding: 6px 14px; }
.ct-cabecera-gris { background: #5a5550; }
.ct-cabecera-gris .ct-enviado-chip { color: #5a5550; }
.ct-enviado-aviso { padding: 14px 16px; border-radius: 16px; background: #fff3e0; color: #8a4500; font-size: 16px; font-weight: 700; line-height: 1.4; }
.ct-enviado-aviso[hidden], .ct-qr[hidden], #ctEstado[hidden], #ctOtros[hidden], #ctLlamarEnviado[hidden] { display: none; }
.ct-pasos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.ct-paso { display: flex; gap: 12px; align-items: flex-start; color: #5a5550; }
.ct-paso strong { display: block; font-size: 16px; font-weight: 600; }
.ct-paso small { display: block; font-size: 14px; color: #5a5550; }
.ct-paso-marca { width: 28px; height: 28px; border-radius: 14px; border: 2px solid #c9c4c0; flex-shrink: 0; position: relative; }
.ct-paso-hecho { color: #1a1a1a; }
.ct-paso-hecho strong { font-weight: 700; }
.ct-paso-hecho .ct-paso-marca { background: #1a7a72; border-color: #1a7a72; }
.ct-paso-hecho .ct-paso-marca::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 4px;
  width: 8px;
  height: 13px;
  border: solid #fff;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}
.ct-paso-actual strong { font-weight: 800; color: #11504b; }
.ct-paso-actual .ct-paso-marca { border: 3px solid #1a7a72; background: #e8f4f2; }
.ct-qr { flex-direction: row; align-items: center; gap: 14px; }
.ct-qr-img { width: 104px; height: 104px; flex-shrink: 0; background: #fff; }
.ct-qr-img svg { width: 100%; height: 100%; display: block; }
.ct-qr div:last-child { display: flex; flex-direction: column; gap: 4px; }
.ct-qr strong { font-size: 16px; }
.ct-qr span { font-size: 14px; color: #5a5550; line-height: 1.4; }
.ct-ver-detalle {
  width: 100%;
  min-height: 44px;
  border: 0;
  background: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
}
.ct-ver-detalle-texto { color: #a30013; font-size: 15px; }
.ct-otros-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }

/* ===== Juegos para esperar (orden M-5): la tarjeta de "Pedido enviado" ===== */
.ct-jugar { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 8px; min-height: 150px; padding: 18px 130px 18px 18px; border: 0; border-radius: 20px; background: #a30013; color: #fff; text-align: left; font-family: 'Plus Jakarta Sans', sans-serif; cursor: pointer; }
.ct-jugar img { position: absolute; right: -6px; bottom: -4px; width: 140px; height: 140px; }
.ct-jugar-titulo { font-family: 'Changa One', sans-serif; font-size: 26px; line-height: 1.05; }
.ct-jugar-juegos { font-size: 14px; line-height: 1.4; }
.ct-jugar-boton { margin-top: 4px; padding: 6px 14px; border-radius: 999px; background: #fff; color: #a30013; font-size: 15px; font-weight: 800; }
.ct-jugar[aria-busy="true"] .ct-jugar-boton { opacity: .6; }
.ct-jugar:focus-visible { outline: 3px solid #1a7a72; outline-offset: 3px; }
/* Con el pedido cancelado o vencido no se invita a jugar. */
.ct-enviado-aviso:not([hidden]) ~ .ct-jugar { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .ct-jugar { animation: ctJugarLate 1.4s ease-in-out infinite; }
  @keyframes ctJugarLate { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
}
@media (max-width: 359px) { .ct-jugar { padding-right: 110px; } .ct-jugar img { width: 120px; height: 120px; } }
