/* Manos que hablan — Paleta: #1D1E22 (principal) · #36373C (secundario) · #FDC01A (terciario) */

:root {
  --bg: #1D1E22;
  --surface: #36373C;
  --surface-2: #2b2c31;
  --accent: #FDC01A;
  --text: #F5F5F6;
  --muted: #A9AAB0;
  --line: rgba(255, 255, 255, .09);
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --max: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }
main { flex: 1; padding-block: 28px 40px; }
.wrap { width: min(100% - 32px, var(--max)); margin-inline: auto; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: 600 .98rem var(--font-body); padding: 13px 22px; border-radius: 999px; border: 2px solid transparent;
  background: var(--surface); color: var(--text); cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--accent); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--bg); font-weight: 700; }
.btn.primary:hover:not(:disabled) { box-shadow: 0 8px 26px -8px rgba(253, 192, 26, .8); border-color: transparent; }
.btn svg { width: 20px; height: 20px; }

/* ---------- Encabezado ---------- */
.nav { position: sticky; top: 0; z-index: 10; background: rgba(29, 30, 34, .85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.marca { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo-plate { background: #fff; border-radius: 12px; padding: 5px 11px; display: inline-flex; flex: none; }
.logo-plate img { height: 32px; width: auto; }
.nombre { font: 800 1.25rem var(--font-display); letter-spacing: -.02em; white-space: nowrap; }
.enlace-nav { color: var(--muted); text-decoration: none; font-weight: 500; font-size: .95rem; }
.enlace-nav:hover { color: var(--accent); }

/* ---------- Aplicación ---------- */
.demo { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .8fr); gap: 20px; align-items: start; }
.demo:focus { outline: none; }
.visor-box, .panel { background: var(--surface-2); border: 1px solid var(--line); border-radius: 24px; }
.visor-box { padding: 12px; }
.visor { position: relative; background: #0e0e10; border-radius: 16px; overflow: hidden; aspect-ratio: 4 / 3; margin: 0 auto; }
.visor video, .visor canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; transform: scaleX(-1); }
.aviso { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); }
.aviso[hidden] { display: none; }
.aviso strong { display: block; color: var(--text); font: 700 1.25rem var(--font-display); margin-bottom: 6px; }
.aviso svg { width: 48px; height: 48px; color: var(--accent); margin: 0 auto 12px; }
.estado { position: absolute; left: 0; right: 0; bottom: 0; padding: 34px 16px 12px; background: linear-gradient(transparent, rgba(0, 0, 0, .82)); pointer-events: none; }
.letra { font: 800 clamp(1.5rem, 4vw, 2.2rem)/1.1 var(--font-display); color: var(--accent); }
.progress { height: 7px; background: rgba(255, 255, 255, .12); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; }
.controles { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 4px 4px; align-items: center; }
.controles select { flex: 1 1 200px; min-width: 0; font: inherit; font-size: .95rem; padding: 12px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
#depurar { color: var(--muted); font-size: .8rem; white-space: pre-wrap; margin: 8px 6px 0; }

.panel { padding: 22px; display: grid; gap: 16px; }
.panel h2 { font: 600 .85rem var(--font-body); color: var(--muted); letter-spacing: .1em; text-transform: uppercase; margin-bottom: 10px; }
.frase { background: #1a1b1e; border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; min-height: 9rem; font: 600 clamp(1.5rem, 2.6vw, 2rem)/1.3 var(--font-display); word-break: break-word; }
.frase:empty::before { content: "Tu frase aparecerá aquí…"; color: #6c6d73; font-weight: 500; font-size: 1.05rem; }
.acciones { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.acciones .btn { padding: 12px 14px; }
.acciones .wide { grid-column: 1 / -1; }
.atajos { font-size: .8rem; color: var(--muted); }
kbd { background: var(--surface); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 7px; font: .78rem var(--font-body); color: var(--text); }

/* ---------- Vocabulario ---------- */
.vocab { margin-top: 20px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 20px; }
.vocab summary { cursor: pointer; padding: 18px 22px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.vocab summary::-webkit-details-marker { display: none; }
.vocab summary::after { content: "+"; font-size: 1.5rem; color: var(--accent); line-height: 1; }
.vocab[open] summary::after { content: "–"; }
.grupos { display: grid; gap: 22px; padding: 4px 22px 24px; }
.cargando { color: var(--muted); }
.grupo h3 { font: 600 .8rem var(--font-body); color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 7px 14px; font-weight: 600; font-size: .95rem; }
.chip.letra-chip { min-width: 42px; text-align: center; font-family: var(--font-display); }
.chip.pronto { background: transparent; border-style: dashed; color: #77787e; font-weight: 500; }

/* ---------- Pie ---------- */
footer { border-top: 1px solid var(--line); padding: 22px 0; color: var(--muted); font-size: .9rem; }
footer .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.enlaces { display: flex; flex-wrap: wrap; gap: 8px 22px; }
footer a { color: var(--text); text-underline-offset: 4px; text-decoration-color: var(--accent); }
footer a:hover { color: var(--accent); }

@media (max-width: 900px) {
  .demo { grid-template-columns: 1fr; }
  .frase { min-height: 6rem; }
}
@media (max-width: 520px) {
  main { padding-top: 16px; }
  .logo-plate img { height: 26px; }
  .nombre { font-size: 1.05rem; }
  .enlace-nav { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Modo practica (solo aparece con ?practica) */
.practica .ayuda { color: var(--muted); font-size: .92rem; }
.opciones { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.opciones label { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.opciones input { width: 20px; height: 20px; accent-color: var(--accent); }
.practica .controles { padding: 0; }
button, select, summary { touch-action: manipulation; }

/* Carga, alternativas, frase editable y ajustes */
.carga { width: min(260px, 70%); height: 8px; margin: 14px auto 0; background: rgba(255, 255, 255, .14); border-radius: 99px; overflow: hidden; }
.carga i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .25s; }
.alt { color: var(--muted); font-size: .85rem; min-height: 1.2em; }
.mini { display: none; color: var(--text); font-size: 1.1rem; line-height: 1.3; margin-top: 2px; word-break: break-word; }
.frase[contenteditable]:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.ajustes .grupos { gap: 16px; }
.campo { display: grid; gap: 8px; font-weight: 600; font-size: .95rem; }
.campo output { color: var(--accent); margin-left: 6px; }
.campo select { font: inherit; font-weight: 400; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.campo input[type=range] { width: 100%; accent-color: var(--accent); }
.campo small { color: var(--muted); font-weight: 400; }
@media (max-width: 860px) { .mini { display: block; } }
@media (hover: none) { .atajos { display: none; } }
