/* Zudam Cuestionarios — colores de la marca (marca/README.md): tinta, amarillo, hueso. */
:root {
  --tinta: #0E0D0B;
  --superficie: #191816;
  --superficie2: #23211d;
  --linea: #34312b;
  --hueso: #F2F2EF;
  --pale: #EBE7B9;
  --gris: #9A9891;
  --amarillo: #EEDB1E;
  --verde: #6fcf8f;
  --rojo: #ff7a6b;
  --radio: 16px;
  --abajo: env(safe-area-inset-bottom, 0px);
  --arriba: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--tinta); color: var(--hueso);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh; min-height: 100dvh;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--amarillo); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 24px; } h2 { font-size: 22px; } h3 { font-size: 17px; }
.oculto { display: none !important; }
.gris { color: var(--gris); } .chico { font-size: 14px; } .pale { color: var(--pale); }
.centro { text-align: center; }

#app { max-width: 720px; margin: 0 auto; padding: calc(var(--arriba) + 8px) 16px calc(92px + var(--abajo)); }
#app.sin-tabs { padding-bottom: calc(24px + var(--abajo)); }

/* Cabecera */
.cabecera { display: flex; align-items: center; gap: 10px; padding: 6px 0 14px; }
.cabecera img { width: 34px; height: 34px; border-radius: 9px; }
.cabecera h1 { font-size: 21px; flex: 1; min-width: 0; }
.cabecera .atras { font-size: 28px; line-height: 1; padding: 0 8px 4px 0; color: var(--amarillo); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--superficie2); color: var(--gris); white-space: nowrap; }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip.verde { color: var(--verde); } .chip.amarillo { color: var(--amarillo); } .chip.rojo { color: var(--rojo); }

/* Tarjetas y botones */
.card { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); padding: 16px; margin-bottom: 12px; }
.card.pulsable { width: 100%; text-align: left; display: block; }
.card.pulsable:active { background: var(--superficie2); }
.tit-seccion { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--gris); margin: 22px 2px 10px; font-weight: 700; }
.fila { display: flex; align-items: center; gap: 12px; }
.fila.sep { justify-content: space-between; }
.fila > .crece { flex: 1; min-width: 0; }
.rejilla { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 520px) { .rejilla.tres { grid-template-columns: 1fr 1fr 1fr; } }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 12px 18px; border-radius: 14px; background: var(--superficie2); border: 1px solid var(--linea); font-weight: 600; text-align: center; text-decoration: none; color: var(--hueso); width: 100%; }
.btn:active { transform: scale(.985); }
.btn.primario { background: var(--amarillo); border-color: var(--amarillo); color: var(--tinta); }
.btn.peligro { color: var(--rojo); border-color: #5b2a25; }
.btn.chico { min-height: 40px; padding: 8px 14px; font-size: 15px; width: auto; border-radius: 12px; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn.fantasma { background: transparent; }
.icono-btn { width: 40px; height: 40px; border-radius: 12px; background: var(--superficie2); display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }
.pildora { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--superficie2); color: var(--gris); }
.pildora.amarillo { background: #3a3510; color: var(--amarillo); } .pildora.verde { background: #163222; color: var(--verde); } .pildora.rojo { background: #3a1b17; color: var(--rojo); }
.barra { height: 8px; border-radius: 99px; background: var(--superficie2); overflow: hidden; flex: 1; }
.barra > i { display: block; height: 100%; background: var(--amarillo); border-radius: 99px; transition: width .2s; }
.vacio { text-align: center; color: var(--gris); padding: 28px 12px; }

/* Cuestionario en pantalla (una pregunta a la vez) */
.captura { min-height: calc(100dvh - 40px); display: flex; flex-direction: column; }
.cap-top { display: flex; align-items: center; gap: 12px; padding: 4px 0 14px; }
.cap-top .cuenta { font-size: 14px; color: var(--gris); min-width: 52px; text-align: right; }
.seccion { font-size: 13px; color: var(--amarillo); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 8px; }
.pregunta { font-size: 24px; font-weight: 700; margin: 4px 0 6px; }
.ayuda { color: var(--pale); font-size: 15px; margin: 0 0 12px; }
.aviso { background: #3a3510; border: 1px solid #6b611a; color: var(--pale); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 8px 0 12px; }
.aviso.rojo { background: #3a1b17; border-color: #6e3028; color: #ffc9c2; }
.entrada { flex: 1; margin-top: 10px; }
.pie { position: sticky; bottom: 0; display: flex; gap: 10px; padding: 14px 0 calc(8px + var(--abajo)); background: linear-gradient(transparent, var(--tinta) 30%); margin-top: 16px; }
.pie .btn { flex: 1; }
.pie .btn.secundario { flex: 0 0 38%; }
.opcion { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 62px; padding: 14px 16px; margin-bottom: 10px; border-radius: 16px; background: var(--superficie); border: 2px solid var(--linea); text-align: left; font-size: 18px; font-weight: 600; }
.opcion:active { background: var(--superficie2); }
.opcion .marca { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--gris); flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; color: var(--tinta); }
.opcion.multi .marca { border-radius: 8px; }
.opcion.sel { border-color: var(--amarillo); background: #25230c; }
.opcion.sel .marca { background: var(--amarillo); border-color: var(--amarillo); }
.opcion.sel .marca::after { content: "✓"; font-weight: 900; }
.opcion .pts { margin-left: auto; font-size: 13px; color: var(--gris); font-weight: 700; }
.cal { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cal .opcion { flex-direction: column; justify-content: center; text-align: center; gap: 4px; margin: 0; min-height: 96px; }
.cal .opcion b { font-size: 30px; }
.cal .opcion span { font-size: 14px; font-weight: 600; color: var(--gris); }
.cal .opcion.sel span { color: var(--pale); }

.campo { display: block; margin-bottom: 14px; }
.campo > span { display: block; font-size: 13px; color: var(--gris); font-weight: 600; margin: 0 2px 6px; }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=date], input[type=number], input[type=url], select, textarea {
  width: 100%; min-height: 54px; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--linea); background: var(--superficie); outline: none; font-size: 18px; -webkit-appearance: none; appearance: none;
}
textarea { min-height: 150px; resize: vertical; line-height: 1.4; }
input:focus, textarea:focus, select:focus { border-color: var(--amarillo); }
select { background-image: linear-gradient(45deg, transparent 50%, var(--gris) 50%), linear-gradient(135deg, var(--gris) 50%, transparent 50%); background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--amarillo); flex: none; }
.num { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; }
.num input { font-size: 26px; font-weight: 700; }
.casilla { display: flex; align-items: center; gap: 12px; padding: 8px 0; font-size: 16px; }
.elemento { background: var(--superficie); border: 1px solid var(--linea); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.elemento input { min-height: 46px; font-size: 16px; margin-bottom: 8px; }
.elemento label span { font-size: 12px; }

/* Revisión y detalle */
.resp { padding: 12px 0; border-bottom: 1px solid var(--linea); display: block; width: 100%; text-align: left; }
.resp:last-child { border-bottom: 0; }
.resp b { display: block; font-size: 14px; color: var(--gris); font-weight: 600; margin-bottom: 2px; }
.resp div { white-space: pre-wrap; word-break: break-word; }
.resp.falta b { color: var(--rojo); }
.nota-total { font-size: 38px; font-weight: 800; color: var(--amarillo); }
pre.texto { white-space: pre-wrap; word-break: break-word; font: 14px/1.45 ui-monospace, Menlo, monospace; background: var(--superficie); border: 1px solid var(--linea); border-radius: 12px; padding: 12px; max-height: 50vh; overflow: auto; margin: 8px 0 0; }
details > summary { cursor: pointer; padding: 10px 0; font-weight: 600; color: var(--pale); }

/* Navegación de abajo */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: rgba(14,13,11,.96); border-top: 1px solid var(--linea); padding: 6px 4px calc(6px + var(--abajo)); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; font-size: 11px; font-weight: 600; color: var(--gris); }
.tabs button svg { width: 26px; height: 26px; }
.tabs button.act { color: var(--amarillo); }

/* Hojas y avisos */
#hoja { position: fixed; inset: 0; z-index: 50; display: none; }
#hoja.abierta { display: block; }
#hoja .fondo { position: absolute; inset: 0; background: rgba(0,0,0,.65); }
#hoja .panel { position: absolute; left: 0; right: 0; bottom: 0; max-width: 720px; margin: 0 auto; max-height: 92dvh; overflow: auto; background: var(--superficie); border-radius: 22px 22px 0 0; border: 1px solid var(--linea); padding: 18px 16px calc(18px + var(--abajo)); }
#hoja .panel.completa { top: calc(var(--arriba) + 8px); max-height: none; }
#hoja .panel h2 { margin-bottom: 12px; }
#hoja .acciones { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
#aviso-toast { position: fixed; left: 16px; right: 16px; bottom: calc(96px + var(--abajo)); z-index: 60; display: flex; justify-content: center; pointer-events: none; }
#aviso-toast div { background: var(--hueso); color: var(--tinta); padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 15px; box-shadow: 0 8px 28px rgba(0,0,0,.5); max-width: 520px; pointer-events: auto; }
#aviso-toast div.error { background: var(--rojo); }
.editor-preg { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--linea); }
.editor-preg .t { flex: 1; min-width: 0; }
.editor-preg .t div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-preg .icono-btn { width: 36px; height: 36px; font-size: 16px; }
.etiquetas { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.fila-opcion { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.fila-opcion input[type=text] { min-height: 46px; font-size: 16px; }
.fila-opcion input.pts { width: 76px; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.chips button { padding: 8px 14px; border-radius: 999px; background: var(--superficie2); border: 1px solid var(--linea); font-size: 14px; font-weight: 600; }
.chips button.sel { background: var(--amarillo); color: var(--tinta); border-color: var(--amarillo); }
.spin { display: inline-block; width: 18px; height: 18px; border: 3px solid var(--linea); border-top-color: var(--amarillo); border-radius: 50%; animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
