/* ============ Encuesta estilo conversacional (una pregunta por pantalla) ============ */
html, body { height: 100%; }
body.tf { overflow: hidden; background: var(--fondo); }

.tf-top {
  position: fixed; inset: 0 0 auto 0; z-index: 60;
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  pointer-events: none;
}
.tf-top img { height: 46px; background: #fff; border-radius: 8px; padding: 5px 10px;
  box-shadow: 0 1px 5px rgba(43,38,64,.12); }
.tf-progress { position: fixed; top: 0; left: 0; right: 0; height: 4px; z-index: 70; background: rgba(43,38,64,.08); }
.tf-progress div { height: 100%; width: 0%; background: var(--azul); transition: width .4s ease; }

/* pila de pantallas */
.tf-slides { position: fixed; inset: 0; }
.tf-slide {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 70px 20px 110px;
  opacity: 0; visibility: hidden;
  transform: translateY(60vh);
  transition: transform .5s cubic-bezier(.4,0,.2,1), opacity .4s ease, visibility 0s .5s;
  overflow-y: auto;
}
.tf-slide.activa {
  opacity: 1; visibility: visible; transform: translateY(0);
  transition: transform .5s cubic-bezier(.4,0,.2,1), opacity .4s ease .05s, visibility 0s;
  z-index: 10;
}
.tf-slide.pasada { transform: translateY(-60vh); }

.tf-inner { width: 100%; max-width: 640px; margin: auto; }

/* cabecera de la pregunta */
.tf-kicker {
  font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--azul-oscuro); margin: 0 0 10px;
}
.tf-qtexto { font-size: clamp(20px, 3.4vw, 26px); font-weight: 700; line-height: 1.3; margin: 0 0 6px; }
.tf-qtexto .tf-num { color: var(--azul-oscuro); font-weight: 800; margin-right: 10px; white-space: nowrap; }
.tf-qtexto .q-obl { color: var(--error); }
.q-nota { font-size: 14px; color: var(--tinta-suave); margin: 0 0 8px; }

/* bienvenida y final */
.tf-idiomas { display: flex; gap: 8px; margin-bottom: 22px; }
.tf-idiomas a {
  font-size: 13px; font-weight: 700; text-decoration: none; color: var(--tinta-suave);
  border: 1.5px solid var(--borde); border-radius: 999px; padding: 7px 14px;
  background: var(--blanco); transition: all .12s;
}
.tf-idiomas a:hover { border-color: var(--azul); }
.tf-idiomas a.sel { background: var(--tinta); border-color: var(--tinta); color: #fff; }

.tf-bienvenida h1 { font-size: clamp(26px, 5vw, 38px); font-weight: 800; line-height: 1.2; margin: 0 0 14px; }
.tf-bienvenida h1 .acento { color: var(--azul); }
.tf-bienvenida p { color: var(--tinta-suave); font-size: 16px; }
.meta-pills { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 26px; }
.pill { font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: #EAF6FD; color: #16729E; }
.tf-final h2 { font-size: clamp(22px, 4vw, 30px); font-weight: 800; margin: 0 0 12px; }
.tf-final p { color: var(--tinta-suave); }
.tf-colabora {
  margin-top: 40px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.tf-colabora span { font-size: 12px; color: var(--tinta-suave); }
.tf-colabora img { height: 30px; opacity: .85; }

/* controles (mismos que el diseño base, tamaño conversacional) */
.opciones { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.opt {
  display: flex; align-items: center; gap: 12px;
  border: 1.5px solid var(--borde); border-radius: 10px;
  padding: 13px 15px; cursor: pointer; font-size: 15.5px;
  background: var(--blanco);
  transition: border-color .15s, background .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.opt:hover { border-color: var(--azul); }
.opt.sel, .opt:has(input:checked) { border-color: var(--azul-oscuro); background: #EAF6FD; }
.opt.flash { animation: flash .35s; }
@keyframes flash { 50% { background: #CFEBFA; } }
.opt input { accent-color: var(--azul-oscuro); width: 18px; height: 18px; flex: none; margin: 0; position: absolute; opacity: 0; pointer-events: none; }
.opt-letra {
  width: 26px; height: 26px; flex: none; border: 1.5px solid var(--borde); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 800; color: var(--tinta-suave); background: #fff;
}
.opt.sel .opt-letra, .opt:has(input:checked) .opt-letra {
  background: var(--azul-oscuro); border-color: var(--azul-oscuro); color: #fff;
}
.opt .otro-input {
  flex: 1; border: none; border-bottom: 1.5px solid var(--borde);
  font: inherit; padding: 2px 4px; background: transparent; min-width: 90px;
}
.opt .otro-input:focus { outline: none; border-color: var(--azul); }

.escala { margin-top: 20px; }
.escala-botones { display: flex; gap: 6px; flex-wrap: wrap; }
.escala-botones button {
  flex: 1 0 42px; min-width: 42px; height: 52px;
  border: 1.5px solid var(--borde); border-radius: 10px;
  background: var(--blanco); font: inherit; font-weight: 700; font-size: 16px;
  cursor: pointer; color: var(--tinta); transition: all .12s;
}
.escala-botones button:hover { border-color: var(--azul); }
.escala-botones button.sel { background: var(--azul-oscuro); border-color: var(--azul-oscuro); color: #fff; transform: scale(1.08); }
.escala-etiquetas { display: flex; justify-content: space-between; font-size: 13px; color: var(--tinta-suave); margin-top: 8px; }

.matriz { margin-top: 14px; }
.matriz-fila { padding: 11px 0; border-top: 1px solid var(--borde); }
.matriz-fila:first-child { border-top: none; }
.matriz-fila .mf-nombre { font-size: 14.5px; font-weight: 600; margin-bottom: 8px; }
.mf-opts { display: flex; gap: 6px; flex-wrap: wrap; }
.mf-opts button {
  flex: 1 0 auto; padding: 8px 10px; font: inherit; font-size: 12.5px; font-weight: 600;
  border: 1.5px solid var(--borde); border-radius: 999px; background: var(--blanco);
  cursor: pointer; color: var(--tinta-suave); white-space: nowrap;
}
.mf-opts button.sel { background: var(--tinta); border-color: var(--tinta); color: #fff; }

.ranking-lista { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.rk-item {
  display: flex; align-items: center; gap: 12px;
  border: 1.5px solid var(--borde); border-radius: 10px; padding: 13px 15px;
  cursor: pointer; font-size: 15px; background: var(--blanco);
  transition: border-color .15s, background .15s;
}
.rk-item:hover { border-color: var(--azul); }
.rk-item .rk-num {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  border: 2px dashed var(--borde);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: var(--tinta-suave);
}
.rk-item.sel { border-color: var(--azul-oscuro); background: #EAF6FD; }
.rk-item.sel .rk-num { border: none; background: var(--azul-oscuro); color: #fff; }
.rk-reset { margin-top: 10px; background: none; border: none; color: var(--azul-oscuro);
  font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; padding: 4px 0; }

textarea.q-libre {
  width: 100%; min-height: 120px; border: none; border-bottom: 2px solid var(--borde);
  padding: 12px 2px; font: inherit; font-size: 17px; resize: none; margin-top: 14px;
  background: transparent; color: var(--tinta);
}
textarea.q-libre:focus { outline: none; border-color: var(--azul); }

/* botón OK + pista Enter */
.tf-ok { display: flex; align-items: center; gap: 12px; margin-top: 22px; }
.btn-ok {
  background: var(--azul-oscuro); color: #fff; border: none; border-radius: 10px;
  font: inherit; font-size: 16px; font-weight: 700; padding: 12px 26px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(31,143,216,.3);
  transition: transform .12s;
}
.btn-ok:hover { transform: translateY(-1px); }
.btn-ok:disabled { opacity: .6; cursor: wait; }
.tf-hint { font-size: 12.5px; color: var(--tinta-suave); }
.tf-hint b { font-weight: 700; }
@media (hover: none) { .tf-hint { display: none; } }

.tf-error { display: none; color: var(--error); font-size: 14px; font-weight: 600; margin-top: 14px; }
.tf-slide.con-error .tf-error { display: block; }
.tf-slide.con-error .tf-inner { animation: sacudida .4s; }
@keyframes sacudida {
  20% { transform: translateX(-8px); } 40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); } 80% { transform: translateX(5px); }
}

/* navegación flotante */
.tf-nav {
  position: fixed; right: 16px; bottom: 16px; z-index: 60;
  display: flex; align-items: center; gap: 10px;
}
.tf-contador {
  font-size: 12.5px; font-weight: 700; color: var(--tinta-suave);
  background: #fff; padding: 8px 14px; border-radius: 999px;
  box-shadow: 0 2px 8px rgba(43,38,64,.12);
}
.tf-contador:empty { display: none; }
.tf-nav button {
  width: 42px; height: 42px; border: none; border-radius: 10px;
  background: var(--azul-oscuro); color: #fff; font-size: 17px; cursor: pointer;
  box-shadow: 0 2px 8px rgba(31,143,216,.35);
}
.tf-nav button:disabled { opacity: .35; cursor: default; }

/* aviso ya respondida */
.aviso {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 80;
  background: #FFF6E5; border: 1px solid #F0D9A8; color: #7A5A16;
  border-radius: 12px; padding: 10px 16px; font-size: 13.5px;
  max-width: min(92vw, 560px); text-align: center;
  box-shadow: 0 4px 14px rgba(43,38,64,.15);
}
.aviso a { color: inherit; font-weight: 700; }

@media (max-width: 640px) {
  .tf-slide { padding: 60px 18px 120px; }
  .tf-contador { display: none; }
}
