/* english-coach — diseño "libreta contable, edición de lujo"
   tinta #0B3947 · papel cálido · verde libro mayor #0E7C6B · ámbar #C98A0B */

:root {
  --ink: #0B3947;
  --ink-soft: #1E4E5C;
  --paper: #EEF5F3;
  --card: #FFFFFF;
  --accent: #0E7C6B;
  --accent-dark: #0A5F52;
  --accent-deep: #084A40;
  --accent-soft: #E3F1EE;
  --amber: #C98A0B;
  --amber-soft: #FBF3E2;
  --danger: #B4432E;
  --danger-soft: #FBEAE6;
  --muted: #5E7278;
  --line: #D7E5E2;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(11, 57, 71, .06), 0 2px 8px rgba(11, 57, 71, .05);
  --shadow-md: 0 2px 6px rgba(11, 57, 71, .07), 0 10px 28px rgba(11, 57, 71, .09);
  --shadow-accent: 0 6px 18px rgba(14, 124, 107, .32);
  --grad-accent: linear-gradient(135deg, #129A85 0%, var(--accent) 45%, var(--accent-dark) 100%);
  --grad-ink: linear-gradient(135deg, #14586B 0%, var(--ink) 70%);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Atkinson Hyperlegible", system-ui, sans-serif;
  --font-mono: "Spline Sans Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(14, 124, 107, .14), transparent 60%),
    radial-gradient(700px 420px at -15% 30%, rgba(201, 138, 11, .10), transparent 55%),
    radial-gradient(800px 600px at 110% 95%, rgba(14, 124, 107, .08), transparent 60%),
    var(--paper);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.5;
  padding-bottom: 108px;
  min-height: 100dvh;
}
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }
.dim { opacity: .55; }

#app { max-width: 560px; margin: 0 auto; padding: 24px 18px 8px; }

/* --- vistas: entrada suave --- */
.view { animation: view-in .32s cubic-bezier(.2, .7, .3, 1); }
@keyframes view-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* --- banners --- */
.banner {
  background: linear-gradient(135deg, #DA9A15, var(--amber));
  color: #fff; padding: 11px 16px; font-size: .9rem; text-align: center;
  font-weight: 700; letter-spacing: .01em;
}
#banner-key { background: linear-gradient(135deg, #C4573F, var(--danger)); }

/* --- regla de libro mayor (firma tipográfica) --- */
.rule {
  height: 7px; margin: 12px 0 16px;
  border-top: 2px solid var(--accent);
  border-bottom: 1px solid var(--ink);
  opacity: .5; border-radius: 1px;
}

/* --- hoy / hero --- */
.eyebrow {
  text-transform: uppercase; letter-spacing: .16em;
  font-size: .76rem; font-weight: 700; color: var(--accent);
  margin-bottom: 8px;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 700; font-size: 2.25rem; line-height: 1.1;
  background: var(--grad-ink);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--ink);
}
.sub { color: var(--muted); margin-top: 8px; font-size: 1.02rem; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 18px; }
.chip {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 14px; font-size: .86rem; font-weight: 700;
  color: var(--ink-soft); box-shadow: var(--shadow-sm);
}
.hint { color: var(--muted); font-size: .88rem; margin-top: 8px; }

.today-blocks { display: grid; gap: 12px; margin-top: 24px; }
.block {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; font-size: 1rem; font-weight: 700;
  color: var(--ink); text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.block:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }
.block:active { transform: scale(.985); }
.block small { margin-left: auto; color: var(--muted); font-weight: 400; white-space: nowrap; }
.block-n {
  font-family: var(--font-mono); color: #fff;
  background: var(--grad-accent);
  border: none; border-radius: 10px; font-size: .95rem;
  width: 34px; height: 34px; display: grid; place-items: center; flex: none;
  box-shadow: 0 3px 8px rgba(14, 124, 107, .30);
}

/* --- botones --- */
.btn-primary {
  background: var(--grad-accent); color: #fff; border: none;
  border-radius: var(--radius-sm); padding: 13px 20px; font-weight: 700;
  letter-spacing: .01em; box-shadow: var(--shadow-accent);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: scale(.97); box-shadow: 0 3px 10px rgba(14, 124, 107, .28); }
.btn-primary.big { width: 100%; padding: 17px; font-size: 1.08rem; margin-top: 8px; border-radius: var(--radius); }
.btn-primary:disabled { opacity: .5; box-shadow: none; }
.btn-ghost {
  background: var(--accent-soft); border: 1.5px solid transparent;
  color: var(--accent-dark); border-radius: var(--radius-sm); padding: 11px 18px; font-weight: 700;
  transition: border-color .15s ease, transform .15s ease;
}
.btn-ghost:hover { border-color: var(--accent); }
.btn-ghost:active { transform: scale(.97); }
.btn-danger {
  background: var(--danger-soft); border: 1.5px solid transparent;
  color: var(--danger); border-radius: var(--radius-sm); padding: 11px 18px; font-weight: 700;
  transition: border-color .15s ease, transform .15s ease;
}
.btn-danger:hover { border-color: var(--danger); }
.btn-danger:active { transform: scale(.97); }
.link { background: none; border: none; color: var(--muted); text-decoration: underline; }

/* --- pantallas --- */
.screen-title {
  font-family: var(--font-display); font-weight: 700; font-size: 1.65rem;
}
.screen-title.small { font-size: 1.2rem; margin-top: 30px; }
.stack { display: grid; gap: 12px; margin-top: 14px; }

/* --- chat --- */
#chat { display: flex; flex-direction: column; gap: 12px; padding: 8px 0 16px; min-height: 30vh; }
.msg {
  max-width: 86%; padding: 12px 16px; border-radius: 18px;
  animation: rise .22s cubic-bezier(.2, .7, .3, 1);
  box-shadow: var(--shadow-sm);
}
.msg.user {
  align-self: flex-end; background: var(--grad-ink); color: #fff;
  border-bottom-right-radius: 6px;
}
.msg.bot {
  align-self: flex-start; background: var(--card);
  border: 1px solid var(--line); border-bottom-left-radius: 6px;
}
.replay {
  display: block; margin-top: 8px; background: none; border: none;
  color: var(--accent); font-weight: 700; padding: 0; text-decoration: underline;
}
@keyframes rise { from { transform: translateY(6px); opacity: 0; } }

.speed-row { display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
.speed-row input { flex: 1; accent-color: var(--accent); }

.composer {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow-md);
}
.composer-right { flex: 1; min-width: 0; }
.lang-row { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.lang {
  border: 1.5px solid var(--line); background: var(--card); color: var(--muted);
  border-radius: 8px; padding: 3px 11px; font-size: .8rem; font-weight: 700;
  transition: all .15s ease;
}
.lang.active {
  border-color: transparent; color: #fff; background: var(--grad-accent);
  box-shadow: 0 2px 6px rgba(14, 124, 107, .30);
}
.lang-row .link { margin-left: auto; font-size: .8rem; }
.input-row { display: flex; gap: 8px; }
textarea, select, input[type="date"], input[type="password"], input[type="text"], .num-input {
  width: 100%; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 13px; font: inherit; background: var(--card); color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea:focus, select:focus, input:focus, .num-input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 4px rgba(14, 124, 107, .12);
  outline: none;
}
#login-code {
  font-family: var(--font-mono); font-size: 1.35rem; text-align: center;
  letter-spacing: .35em; padding: 14px;
}
textarea { resize: none; }

/* --- micrófono (elemento firma) --- */
.mic {
  width: 76px; height: 76px; border-radius: 50%; flex: none;
  background: var(--grad-accent); color: #fff; border: none;
  display: grid; place-items: center; position: relative;
  box-shadow: 0 6px 20px rgba(14, 124, 107, .40), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .15s ease, box-shadow .15s ease;
}
.mic:active { transform: scale(.94); }
.mic.listening {
  background: linear-gradient(135deg, #E0A21C, var(--amber));
  box-shadow: 0 6px 22px rgba(201, 138, 11, .45), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.mic.listening::after {
  content: ""; position: absolute; inset: -8px; border-radius: 50%;
  border: 3px solid var(--amber); animation: pulse 1.2s ease-out infinite;
}
.mic.disabled { opacity: .35; pointer-events: none; }
@media (max-width: 430px) {
  .mic { width: 64px; height: 64px; }
  .composer { gap: 10px; padding: 12px; }
}
@keyframes pulse { from { transform: scale(.9); opacity: .9; } to { transform: scale(1.3); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .mic.listening::after { animation: none; }
  .msg, .view { animation: none; }
  .block, .btn-primary, .btn-ghost, .btn-danger, .mic { transition: none; }
}

/* --- flashcards --- */
.flashcard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 22px; margin-top: 10px; position: relative; overflow: hidden;
  box-shadow: var(--shadow-md);
}
.flashcard::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: var(--grad-accent);
}
.fc-count { color: var(--muted); font-size: .85rem; margin-bottom: 12px; }
.fc-word { font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; line-height: 1.15; }
.fc-front { display: flex; align-items: center; gap: 14px; justify-content: space-between; flex-wrap: wrap; }
.fc-back { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 14px; display: grid; gap: 7px; }
.fc-es { font-size: 1.3rem; font-weight: 700; color: var(--accent-dark); }
.fc-actions { display: flex; gap: 10px; margin-top: 20px; }
.fc-actions button { flex: 1; }
.empty {
  text-align: center; padding: 38px 18px; display: grid; gap: 14px; justify-items: center;
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
  margin-top: 10px;
}

/* --- números y dictado --- */
#num-wrap, #dic-wrap { display: grid; gap: 14px; margin-top: 10px; }
.num-input { font-size: 1.6rem; text-align: center; letter-spacing: .05em; padding: 14px; }
.feedback {
  border-radius: var(--radius-sm); padding: 14px 16px; font-size: 1.05rem;
  border: 1.5px solid var(--line); background: var(--card); box-shadow: var(--shadow-sm);
  animation: rise .22s cubic-bezier(.2, .7, .3, 1);
}
.feedback.ok { border-color: var(--accent); background: var(--accent-soft); }
.feedback.err { border-color: var(--danger); background: var(--danger-soft); }
.feedback small { color: var(--muted); }
.w-ok { color: var(--accent-dark); font-weight: 700; }
.w-err { color: var(--danger); font-weight: 700; text-decoration: underline; }

/* --- progreso --- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 12px 0 20px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 8px 14px; text-align: center; display: grid; gap: 3px;
  font-size: .8rem; font-weight: 700; color: var(--muted);
  box-shadow: var(--shadow-sm);
}
.stat-n {
  font-size: 2rem; font-weight: 500;
  background: var(--grad-accent);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--accent);
}
.prog-list { list-style: none; display: grid; gap: 8px; padding: 0; }
.prog-list li {
  display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 11px 14px; font-size: .9rem;
  box-shadow: var(--shadow-sm);
}

/* --- ajustes --- */
.field { display: grid; gap: 6px; font-size: .9rem; font-weight: 700; color: var(--ink-soft); }

/* --- nav inferior flotante --- */
#nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px;
  max-width: 560px; margin: 0 auto 12px; padding: 8px;
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 22px;
  box-shadow: 0 8px 30px rgba(11, 57, 71, .16);
}
@supports not (backdrop-filter: blur(1px)) { #nav { background: var(--card); } }
@media (max-width: 600px) {
  #nav { margin: 0 10px calc(10px + env(safe-area-inset-bottom)); }
}
#nav button {
  background: none; border: none; color: var(--muted);
  font-size: .72rem; font-weight: 700; letter-spacing: .01em;
  padding: 8px 2px 7px; border-radius: 15px;
  display: grid; justify-items: center; gap: 3px;
  transition: color .15s ease, background .15s ease;
}
#nav button svg { width: 22px; height: 22px; }
#nav button.active {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--amber); outline-offset: 2px;
}

/* --- portadas: login y bienvenida --- */
.cover {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px;
}
.cover-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 24px;
  padding: 36px 28px; max-width: 420px; width: 100%;
  display: grid; gap: 13px; position: relative; overflow: hidden;
  box-shadow: 0 6px 16px rgba(11, 57, 71, .08), 0 24px 60px rgba(11, 57, 71, .14);
  animation: view-in .4s cubic-bezier(.2, .7, .3, 1);
}
.cover-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 6px;
  background: linear-gradient(90deg, var(--accent), #2AA58F 55%, var(--amber));
}
.cover-card::after {
  content: ""; position: absolute; top: -70px; right: -70px;
  width: 190px; height: 190px; border-radius: 50%;
  background: radial-gradient(circle, rgba(14, 124, 107, .12), transparent 70%);
  pointer-events: none;
}
.cover-title {
  font-family: var(--font-display); font-weight: 700; font-size: 2.6rem; line-height: 1.05;
  background: var(--grad-ink);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--ink);
}
.err-text { color: var(--danger); }
.fc-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-ghost.rec { background: var(--amber-soft); color: var(--amber); border-color: var(--amber); }
