/* ===== Colores de la marca: cámbielos aquí ===== */
:root {
  --naranja: #F47121;         /* naranja del texto del logo */
  --naranja-oscuro: #CF5A12;
  --naranja-suave: #FFEBD6;
  --ambar: #FFA600;           /* naranja dorado de la burbuja del logo */
  --azul: #1E2A3A;
  --azul-suave: #4A5768;
  --crema: #FFF8F0;
  --blanco: #FFFFFF;
  --borde: #F1DCC9;
  --verde: #1F8A4C;

  --texto: 20px;          /* tamaño base de letra */
  --radio: 22px;
  --sombra: 0 6px 20px rgba(30, 42, 58, .08);
  --fuente: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --fuente-titulo: "Fraunces", Georgia, "Times New Roman", serif;
}
html.size-1 { --texto: 23px; }
html.size-2 { --texto: 27px; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--crema);
  color: var(--azul);
  font-family: var(--fuente);
  font-size: var(--texto);
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
button, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 4px solid var(--azul); outline-offset: 3px; border-radius: 12px; }

/* ===== Barra superior ===== */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px clamp(14px, 4vw, 40px);
  background: var(--blanco);
  border-bottom: 4px solid var(--ambar);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--azul); }
.brand-name { font-family: var(--fuente-titulo); font-weight: 800; font-size: 1.15em; letter-spacing: -.01em; }
.brand-name em { font-style: normal; color: var(--naranja-oscuro); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-by { font-size: .55em; color: var(--azul-suave); letter-spacing: .02em; margin-top: 3px; }
.brand-by strong { color: var(--azul); }
.top-actions { display: flex; gap: 10px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 52px; padding: 8px 18px;
  background: var(--crema); border: 2px solid var(--borde); border-radius: 999px;
  font-size: .8em; font-weight: 700;
}
.pill:hover { border-color: var(--naranja); }
.a-small { font-size: .8em; } .a-big { font-size: 1.25em; margin-left: -4px; }

/* ===== Bienvenida ===== */
main { flex: 1; overflow-y: auto; padding: clamp(18px, 4vw, 40px) clamp(14px, 4vw, 40px) 24px; }
.welcome, .chat { max-width: 860px; margin: 0 auto; }
.hero-logo { display: block; width: clamp(90px, 14vw, 120px); height: auto; margin: 0 0 4px -6px; filter: drop-shadow(0 8px 14px rgba(244,113,33,.18)); }
.welcome h1 {
  font-family: var(--fuente-titulo); font-weight: 800;
  font-size: clamp(1.7em, 5vw, 2.4em); line-height: 1.12; margin: .2em 0 .35em;
}
.lead { font-size: 1.05em; color: var(--azul-suave); margin: 0 0 1.2em; max-width: 36em; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px; text-align: left;
  min-height: 0; padding: 18px 18px 20px; line-height: 1.3;
  background: var(--blanco); border: 2px solid var(--borde); border-radius: var(--radio);
  box-shadow: var(--sombra); font-weight: 700;
  transition: transform .12s ease, border-color .12s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--naranja); }
.card-icon {
  flex: none; width: 56px; height: 56px; display: grid; place-items: center;
  background: var(--naranja-suave); border-radius: 16px; font-size: 1.4em;
}
.tip {
  margin-top: 1.4em; padding: 14px 18px; border-radius: 16px;
  background: #FFF1E6; border-left: 6px solid var(--naranja); font-size: .9em;
}

/* ===== Conversación ===== */
.chat { display: flex; flex-direction: column; gap: 18px; }
.msg { display: flex; gap: 12px; align-items: flex-start; }
.msg.user { justify-content: flex-end; }
.avatar { flex: none; width: 46px; height: 46px; }
.bubble {
  max-width: min(680px, 88%);
  padding: 16px 20px; border-radius: var(--radio);
  overflow-wrap: anywhere;
}
.msg.bot .bubble { background: var(--blanco); border: 2px solid var(--borde); border-top-left-radius: 6px; box-shadow: var(--sombra); }
.msg.user .bubble { background: var(--azul); color: var(--blanco); border-top-right-radius: 6px; }
.bubble p { margin: 0 0 .6em; } .bubble p:last-child { margin-bottom: 0; }
.bubble ol, .bubble ul { margin: .3em 0 .7em; padding-left: 1.4em; }
.bubble li { margin: .35em 0; }
.bubble strong { color: var(--naranja-oscuro); }
.msg.user .bubble strong { color: inherit; }
.bubble img.sent { display: block; max-width: 100%; max-height: 280px; border-radius: 14px; margin-bottom: 8px; }
.bubble .error { color: #A12A12; font-weight: 700; }

.bot-actions { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.listen {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 46px; padding: 6px 16px;
  background: var(--naranja-suave); border: 0; border-radius: 999px;
  font-size: .8em; font-weight: 700;
}
.listen[aria-pressed="true"] { background: var(--naranja); color: var(--blanco); }

.typing { display: inline-flex; gap: 8px; padding: 6px 2px; }
.typing span { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #FFD36B, var(--ambar) 55%, #E08A00); box-shadow: 0 2px 3px rgba(0,0,0,.18); animation: bounce 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .15s; } .typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .45; } 40% { transform: translateY(-8px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing span { animation: none; opacity: 1; } .card { transition: none; } }

/* ===== Zona para escribir ===== */
.composer-wrap {
  background: var(--blanco); border-top: 2px solid var(--borde);
  padding: 12px clamp(10px, 4vw, 40px) calc(10px + env(safe-area-inset-bottom));
}
.composer { max-width: 860px; margin: 0 auto; display: flex; gap: 10px; align-items: flex-end; }
.composer textarea {
  flex: 1; min-height: 64px; max-height: 220px; resize: none;
  padding: 16px 18px; border: 3px solid var(--borde); border-radius: 20px;
  background: var(--crema); line-height: 1.4;
}
.composer textarea:focus { outline: none; border-color: var(--naranja); }
.icon-btn {
  flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 72px; height: 64px; border: 2px solid var(--borde); border-radius: 18px;
  background: var(--crema); cursor: pointer; font-size: 1.15em; line-height: 1;
}
.icon-btn:hover { border-color: var(--naranja); }
.icon-btn.listening { background: var(--naranja); border-color: var(--naranja); color: #fff; }
.icon-label { font-size: .55em; font-weight: 700; margin-top: 4px; }
.send {
  flex: none; height: 64px; padding: 0 26px;
  background: var(--naranja); color: var(--blanco); border: 0; border-radius: 20px;
  font-weight: 700; font-size: 1em; box-shadow: 0 4px 0 var(--naranja-oscuro);
}
.send:hover { background: var(--naranja-oscuro); }
.send:disabled { opacity: .5; cursor: wait; }
.safety { max-width: 860px; margin: 8px auto 0; text-align: center; font-size: .7em; color: var(--azul-suave); }

.preview { max-width: 860px; margin: 0 auto 10px; display: flex; align-items: center; gap: 12px; }
.preview img { height: 72px; border-radius: 12px; border: 2px solid var(--borde); }
.preview-remove { background: none; border: 2px solid var(--borde); border-radius: 999px; padding: 6px 14px; font-size: .75em; font-weight: 700; }

/* ===== Código de invitación ===== */
.gate { position: fixed; inset: 0; z-index: 20; background: var(--crema); display: grid; place-items: center; padding: 20px; }
.gate-box {
  width: min(460px, 100%); text-align: center; background: var(--blanco);
  border: 2px solid var(--borde); border-radius: 28px; box-shadow: var(--sombra); padding: 32px 26px;
}
.gate-box h2 { font-family: var(--fuente-titulo); font-size: 1.6em; margin: .2em 0 .2em; }
.gate-box p { margin: 0 0 1em; color: var(--azul-suave); }
.gate-box input {
  width: 100%; min-height: 64px; padding: 12px 18px; margin-bottom: 14px; text-align: center;
  border: 3px solid var(--borde); border-radius: 18px; background: var(--crema); font-size: 1.1em; letter-spacing: .04em;
}
.gate-box input:focus { outline: none; border-color: var(--naranja); }
.gate-box .send { width: 100%; }
.gate-error { color: #A12A12 !important; font-weight: 700; }

/* ===== Celular ===== */
@media (max-width: 640px) {
  .pill-label { display: none; }
  .pill { padding: 8px 14px; }
  .topbar { padding: 10px 14px; }
  .brand { gap: 8px; }
  .brand img { width: 40px; height: 40px; }
  .brand-name { font-size: .85em; white-space: nowrap; }
  .brand-by { font-size: .5em; }
  .pill { min-height: 48px; padding: 6px 12px; }
  .composer { flex-wrap: wrap; }
  .composer textarea { order: -1; flex: 1 1 100%; }
  .icon-btn { flex: 1; width: auto; height: 58px; flex-direction: row; gap: 8px; }
  .icon-label { font-size: .75em; margin-top: 0; }
  .send { flex: 1.4; height: 58px; padding: 0 16px; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card { gap: 8px; padding: 14px; font-size: .85em; }
  .hero-logo { width: 68px; margin-bottom: 0; }
  .welcome h1 { font-size: 1.5em; margin-top: .1em; }
  .lead { font-size: .9em; margin-bottom: 1em; }
  .card-icon { width: 46px; height: 46px; border-radius: 14px; }
  .avatar { width: 36px; height: 36px; }
  .bubble { max-width: 92%; }
}
