/* Identidad de marca Ensaya English: Deep Violet, Lila, Amber, Cream, Gray. Tipografia: Poppins. */
:root {
  --deep-teal: #3b1d7a; /* violeta profundo (nombre de variable conservado) */
  --mint: #8a67d8; /* lila */
  --amber: #f2b66d;
  --cream: #f7f5fb;
  --gray: #e5e7eb;

  --bg: var(--cream);
  --surface: #ffffff;
  --ink: #231646;
  --muted: #5a5075;
  --line: var(--gray);
  --brand: var(--deep-teal);
  --brand-ink: #ffffff;
  --mint-soft: #efe9fb;
  --mint-line: #d3c4f3;
  --amber-soft: #fdf0dc;
  --amber-line: #f2d39f;
  --amber-ink: #7a4a07;
  --danger: #b42318;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }

/* Los estilos con display (flex, grid) anulan el atributo hidden: esta regla lo hace valer siempre. */
[hidden] { display: none !important; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 16px;
  min-height: 62px;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: var(--deep-teal); }
.brand img { display: block; height: 32px; width: auto; }
.brand .light { font-weight: 400; }

main { max-width: 760px; margin: 0 auto; padding: 0 16px 48px; }

.hero-logo { display: block; width: min(300px, 78%); height: auto; margin: 8px 0 18px; }

h1 { font-size: 1.9rem; line-height: 1.25; margin: 8px 0 10px; letter-spacing: -0.01em; color: var(--deep-teal); font-weight: 700; }
h2 { font-size: .8rem; margin: 28px 0 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.lead { color: var(--muted); font-size: 1.02rem; margin: 0 0 8px; }
.note { color: var(--muted); font-size: .88rem; }
.tagline { text-align: center; color: var(--muted); margin-top: 22px; font-weight: 500; }

code { background: var(--mint-soft); padding: 1px 6px; border-radius: 6px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }

.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
#scenarios { grid-template-columns: repeat(2, 1fr); }
.choices.small { grid-template-columns: repeat(3, 1fr); }

.choice {
  text-align: left;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.choice strong { display: block; color: var(--deep-teal); font-weight: 600; }
.choice span { color: var(--muted); font-size: .88rem; }
.choice[aria-checked="true"] { border-color: var(--mint); background: var(--mint-soft); }
.choice:hover { border-color: var(--mint-line); }
.choice:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

button { font: inherit; cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }

.primary {
  background: var(--deep-teal);
  color: var(--brand-ink);
  border: 0;
  border-radius: 14px;
  padding: 12px 20px;
  font-weight: 600;
}
.primary:hover:not(:disabled) { background: #2d1560; }
.primary.big { width: 100%; margin-top: 26px; padding: 16px; font-size: 1.05rem; }

.secondary {
  background: var(--surface);
  color: var(--deep-teal);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 16px;
  font-weight: 500;
}
.secondary:hover:not(:disabled) { border-color: var(--mint); background: var(--mint-soft); }

.link { background: none; border: 0; color: var(--deep-teal); text-decoration: underline; padding: 6px; }

label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type="text"], input[type="password"] {
  width: 100%;
  font: inherit;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}
#form-key .primary { margin-top: 12px; }

.top-actions { display: flex; gap: 6px; }

#form-access input[type="text"], #form-access input[type="email"],
#form-waitlist input[type="email"], .feedback input[type="text"] { margin-bottom: 12px; }
input[type="email"] {
  width: 100%;
  font: inherit;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}
label.check { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; color: var(--muted); font-size: .92rem; margin: 4px 0 12px; }
label.check input { margin-top: 4px; }
label.check a { color: var(--deep-teal); }

.free-left {
  display: inline-block;
  background: var(--mint-soft);
  color: var(--deep-teal);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: .92rem;
  font-weight: 500;
  margin: 4px 0 0;
}
#screen-limit .secondary { margin-top: 16px; }

.feedback { margin-top: 16px; }
.feedback h3 { margin: 0 0 6px; color: var(--deep-teal); font-size: 1rem; }
.rating { display: flex; gap: 6px; margin-bottom: 14px; }
.star { background: none; border: 0; font-size: 2rem; line-height: 1; padding: 2px 4px; color: var(--amber); cursor: pointer; }
.star:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 8px; }

.msg { min-height: 1.4em; color: var(--muted); margin: 10px 0 0; font-size: .92rem; }
.msg.error { color: var(--danger); }

/* Practica */
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.chat-head strong { color: var(--deep-teal); }
.pill { background: var(--mint-soft); color: var(--deep-teal); border-radius: 999px; padding: 2px 10px; font-size: .78rem; margin-left: 8px; font-weight: 500; }
.toggle { display: flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; color: var(--muted); font-size: .9rem; }

.voice-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.voice-controls select {
  font: inherit;
  font-size: .88rem;
  max-width: 200px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.log {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  min-height: 300px;
  max-height: 54vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.row { display: flex; flex-direction: column; gap: 6px; max-width: 90%; }
.row.user { align-self: flex-end; align-items: flex-end; }
.row.tutor { align-self: flex-start; }

.bubble { padding: 10px 14px; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
.row.user .bubble { background: var(--deep-teal); color: var(--brand-ink); border-bottom-right-radius: 5px; }
.row.tutor .bubble { background: var(--mint-soft); color: var(--ink); border-bottom-left-radius: 5px; }
.bubble.typing { display: inline-flex; gap: 5px; align-items: center; padding: 14px 16px; }
.bubble.typing .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted);
  animation: typing-dot 1.2s infinite ease-in-out;
}
.bubble.typing .dot:nth-child(2) { animation-delay: 0.2s; }
.bubble.typing .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-dot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .bubble.typing .dot { animation: none; opacity: 0.6; }
}

/* Tarjeta de correccion: "You said" -> "A more natural way" -> "Why?" */
.fix {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  font-size: .93rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fix .label { display: block; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.fix .said { background: #f3f4f6; border-radius: 10px; padding: 8px 10px; }
.fix .was { color: var(--ink); }
.fix .better { display: flex; gap: 10px; align-items: flex-start; background: var(--mint-soft); border: 1px solid var(--mint-line); border-radius: 10px; padding: 8px 10px; }
.fix .check { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--deep-teal); color: #fff; display: grid; place-items: center; font-size: .8rem; margin-top: 2px; }
.fix .better .label { color: var(--deep-teal); }
.fix .now { font-weight: 600; color: var(--deep-teal); }
.fix .why { color: var(--muted); padding: 0 2px; }
.fix .why strong { color: var(--ink); font-weight: 600; }
.fix .fix-actions { display: flex; gap: 8px; }
.fix .fix-actions button { padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--deep-teal); font-size: .88rem; font-weight: 500; }
.fix .fix-actions button:hover { border-color: var(--mint); background: var(--mint-soft); }

.live { min-height: 1.6em; padding: 6px 4px; color: var(--muted); font-style: italic; }

.hints { display: flex; flex-wrap: wrap; gap: 8px; }
.hints:empty { display: none; }
.hint-chip { background: var(--amber-soft); border: 1px solid var(--amber-line); color: var(--amber-ink); border-radius: 14px; padding: 8px 12px; text-align: left; }

.controls { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.mic {
  flex: none;
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 3px solid var(--mint);
  background: var(--deep-teal);
  color: #fff;
  display: grid; place-items: center;
}
.mic.on { background: var(--deep-teal); border-color: var(--amber); animation: pulse 1.3s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(138,103,216,.55); } 100% { box-shadow: 0 0 0 18px rgba(138,103,216,0); } }
@media (prefers-reduced-motion: reduce) { .mic.on { animation: none; } }

.text-row { display: flex; gap: 8px; flex: 1; }
.actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

/* Resumen */
#summary h3 { margin: 18px 0 6px; font-size: 1rem; color: var(--deep-teal); }
#summary h3:first-child { margin-top: 0; }
#summary ul { margin: 0; padding-left: 20px; }
#summary li { margin: 4px 0; }
#summary .fix { margin: 8px 0; padding: 0; border: 0; }

@media (max-width: 520px) {
  h1 { font-size: 1.5rem; }
  #scenarios, .choices.small { grid-template-columns: 1fr; }
  .row { max-width: 96%; }
}
