/* Colores de la tienda online */
:root {
  --fondo: #F5F0E8;
  --texto: #1A1814;
  --dorado: #C9A96E;
  --hover: #E8DDD0;
  --suave: #6B655C;
  --linea: #D9CFC1;
  --blanco: #FFFFFF;
  --error: #9B2C2C;
  --aviso: #8A6D1F;
  --radio: 10px;
  --gutter: 16px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  /* Sin zoom al tocar dos veces rápido (teclado del PIN, botones); el zoom con dos dedos sigue funcionando. */
  touch-action: manipulation;
}

button, a, input, select, label { touch-action: manipulation; }

body {
  min-height: 100dvh;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

[hidden] { display: none !important; }

a { color: var(--texto); }
a:hover { color: var(--dorado); }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: 0.01em; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; }

/* ---------- Estructura ---------- */
.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px var(--gutter);
  background: var(--fondo);
  border-bottom: 1px solid var(--linea);
}
.topbar h1 { flex: 1; font-size: 1.1rem; }
.topbar .marca { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 1.25rem; }

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px var(--gutter) 40px;
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid var(--texto);
  border-radius: var(--radio);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-primario { background: var(--texto); color: var(--fondo); }
.btn-primario:hover, .btn-primario:active { background: var(--dorado); border-color: var(--dorado); color: var(--texto); }
.btn-secundario { background: transparent; color: var(--texto); }
.btn-secundario:hover, .btn-secundario:active { background: var(--hover); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-bloque { width: 100%; }
.btn-icono {
  min-height: 44px; min-width: 44px; padding: 0 10px;
  background: transparent; border-color: transparent; color: var(--texto);
}
.btn-icono:hover { background: var(--hover); }

/* ---------- Opciones tipo "variante" (chips) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--texto);
  border-radius: var(--radio);
  background: var(--fondo);
  color: var(--texto);
  font: inherit;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.chip:hover { background: var(--hover); border-color: var(--dorado); }
.chip[aria-pressed="true"] { background: var(--texto); color: var(--fondo); border-color: var(--texto); }
.chip[aria-pressed="true"]:hover { background: var(--dorado); border-color: var(--dorado); color: var(--texto); }

/* ---------- Formularios ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo label, .etiqueta-campo { font-size: .85rem; font-weight: 600; color: var(--suave); }
.campo input, .campo select {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  background: var(--blanco);
  color: var(--texto);
  font: inherit;
  font-size: 16px; /* evita el zoom automático de iOS */
}
.campo input:focus, .campo select:focus { outline: 2px solid var(--dorado); outline-offset: 1px; border-color: var(--dorado); }
.campo input:disabled { background: var(--hover); color: var(--suave); }
.campo input.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .03em; text-transform: uppercase; }
.ayuda { font-size: .8rem; color: var(--suave); }

.fila { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

.tarjeta {
  background: var(--blanco);
  border: 1px solid var(--linea);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mensajes { display: flex; flex-direction: column; gap: 6px; font-size: .88rem; }
.mensajes .error { color: var(--error); }
.mensajes .aviso { color: var(--aviso); }
.mensajes .ok { color: var(--suave); }

/* ---------- PIN ---------- */
.pin {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px var(--gutter);
  text-align: center;
}
.pin img { width: min(160px, 45vw); height: auto; border-radius: 24px; }
.pin-puntos { display: flex; gap: 14px; height: 18px; }
.pin-puntos span { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--texto); }
.pin-puntos span.lleno { background: var(--texto); }
.pin-puntos.mal { animation: temblor .35s; }
.pin-teclado { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px; }
.pin-teclado button {
  height: 72px; border-radius: 50%;
  border: 1px solid var(--texto); background: var(--fondo); color: var(--texto);
  font: inherit; font-size: 1.5rem; cursor: pointer;
}
.pin-teclado button:hover, .pin-teclado button:active { background: var(--hover); border-color: var(--dorado); }
.pin-teclado button.sin-borde { border-color: transparent; font-size: 1rem; }
.pin-error { min-height: 1.4em; color: var(--error); font-size: .9rem; }
@keyframes temblor { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- Inicio ---------- */
.herramientas { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.herramienta {
  display: flex; align-items: center; gap: 16px;
  padding: 20px;
  background: var(--blanco);
  border: 1px solid var(--linea);
  border-radius: 14px;
  text-decoration: none;
  color: var(--texto);
  transition: border-color .15s, background-color .15s;
}
.herramienta:hover { border-color: var(--dorado); background: var(--hover); color: var(--texto); }
.herramienta svg { flex: none; width: 36px; height: 36px; }
.herramienta strong { display: block; font-size: 1.05rem; }
.herramienta span { font-size: .85rem; color: var(--suave); }

.pie { margin-top: 32px; text-align: center; font-size: .8rem; color: var(--suave); }
