/* Responsivo: una columna centrada. La unidad base (--u) sale del lado limitante de la pantalla,
   así el mismo diseño sirve en celular, escritorio y el kiosco vertical 1080x1920. */
:root {
  --purple: #592bd4; --yellow: #ffb400; --cyan: #00bcd4; --ink: #303030;
  --u: min(1vw, 0.5625vh);
  --gap: clamp(12px, 2.2rem, 40px);
  font-size: clamp(16px, calc(var(--u) * 4), 46px);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--purple); color: #fff; }
body {
  font-family: "Myriad Pro", "Segoe UI", "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif;
  line-height: 1.3; -webkit-tap-highlight-color: transparent; overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}
.deco { position: fixed; pointer-events: none; z-index: 0; width: clamp(90px, 22vmin, 280px); height: auto; }
.deco-tr { top: 0; right: 0; }
.deco-bl { bottom: 0; left: 0; width: clamp(120px, 30vmin, 420px); }

#app { position: relative; z-index: 1; width: 100%; max-width: 36rem; margin: 0 auto; }

.panel {
  display: none; flex-direction: column; min-height: 100vh; min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + var(--gap)) calc(env(safe-area-inset-right) + var(--gap))
           calc(env(safe-area-inset-bottom) + var(--gap)) calc(env(safe-area-inset-left) + var(--gap));
}
.panel.active { display: flex; animation: fadein .5s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.panel > header { display: flex; justify-content: center; padding: .5rem 0 1.2rem; }
.logo { width: min(52%, 14rem); height: auto; display: block; }
.panel > .body { flex: 1; display: flex; flex-direction: column; }
.panel > .body.center { text-align: center; justify-content: center; align-items: center; }
.panel > footer { display: flex; justify-content: center; padding-top: 1.2rem; }

p { margin: 0 0 1em; }
h1 { font-size: 1.5rem; text-transform: uppercase; text-align: center; margin: 0 0 1rem; line-height: 1.15; }
.big { font-size: 1.15rem; }
.hint { color: var(--yellow); font-size: .75rem; font-weight: 700; }
.hl { color: var(--yellow); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: min(100%, 13rem); min-height: 2.9rem; padding: .35rem 2rem;
  font-family: "Century Gothic", "URW Gothic", "Futura", "Trebuchet MS", sans-serif;
  font-size: 1.45rem; letter-spacing: .02em; text-transform: uppercase; text-decoration: none;
  color: #fff; background: var(--cyan); border: 0; border-radius: 999px; cursor: pointer;
  touch-action: manipulation; transition: transform .1s, opacity .2s;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: default; }
.btn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.btn-alt { background: #fff; color: var(--purple); font-size: 1rem; margin-bottom: 1rem; }
.btn-small { font-size: .85rem; min-height: 2.2rem; min-width: 0; padding: .3rem 1.2rem; }

/* Formulario */
#form { display: flex; flex-direction: column; }
.lbl { color: var(--yellow); font-weight: 700; text-transform: uppercase; font-size: .75rem; text-align: center; margin: .4rem 0 .3rem; }
.req { color: var(--yellow); }
.field {
  width: 100%; height: 2.6rem; padding: 0 1rem; border: 0; border-radius: 999px; outline: none;
  background: #fff; color: var(--ink); font: inherit; font-size: max(16px, 1rem); /* ≥16px: iOS no hace zoom */
}
.field:focus { box-shadow: 0 0 0 3px var(--yellow); }
.field.invalid { box-shadow: 0 0 0 3px #ff5a5a; }
.note { color: var(--yellow); font-weight: 700; text-transform: uppercase; font-size: .65rem; text-align: center; margin: .6rem 0; }
#disclaimer {
  max-height: 32vh; max-height: 32dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  font-size: .7rem; line-height: 1.35; padding: .8rem 1rem; background: rgba(0,0,0,.14); border-radius: .8rem;
}
#disclaimer p { margin: 0 0 .6em; }
#disclaimer ul { margin: 0 0 .6em; padding-left: 1.3em; }
#disclaimer a { color: #fff; word-break: break-all; }
#aceptoLabel { display: flex; align-items: center; gap: .7rem; margin-top: .9rem; font-size: .85rem; cursor: pointer; min-height: 44px; }
#aceptoLabel input { position: absolute; opacity: 0; width: 1px; height: 1px; }
#aceptoLabel .chk {
  width: 1.5rem; height: 1.5rem; min-width: 24px; min-height: 24px; flex: none;
  border: 3px solid #fff; border-radius: .35rem; position: relative;
}
#aceptoLabel input:checked + .chk::after {
  content: ""; position: absolute; left: 28%; top: 6%; width: 32%; height: 62%;
  border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg);
}
#aceptoLabel input:focus-visible + .chk { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* Cámara */
.cambox { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 46vh; max-height: 46dvh;
  margin: 0 auto; border-radius: .6rem; overflow: hidden; background: #000; }
.cambox.portrait { aspect-ratio: 3 / 4; width: auto; height: 46vh; height: 46dvh; max-width: 100%; }
#PanelInstrucciones .cambox { width: 80%; max-height: 28vh; max-height: 28dvh; margin-top: .5rem; }
#PanelInstrucciones .cambox.portrait { width: auto; height: 28vh; height: 28dvh; }
.webcam { width: 100%; height: 100%; object-fit: cover; display: block; transform: scaleX(-1); }
.camerror { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; text-align: center; font-size: .85rem; padding: 1rem; background: rgba(0,0,0,.6); }
.camerror.show { display: flex; }

/* Preguntas */
.qhead { justify-content: space-between !important; align-items: center; font-size: .9rem; }
#grabando { display: inline-flex; align-items: center; gap: .45rem; text-transform: uppercase; font-size: .75rem; letter-spacing: .04em; }
#grabando .dot { width: .8rem; height: .8rem; border-radius: 50%; background: #ff1e1e; animation: blink 1.2s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
#claqueta {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35em;
  background: var(--purple); border: 2px solid rgba(255,180,0,.6); border-radius: .6rem;
  font-size: .85rem; color: #f2f2f2; text-align: center; padding: 1rem;
  opacity: 0; transition: opacity 1s linear; pointer-events: none;
}
#claqueta.show { opacity: 1; transition: none; }
#claqueta img { width: 38%; max-width: 10rem; margin-bottom: .5em; }
#claqueta #clTitulo { font-weight: 700; font-size: 1.05em; }
.timerow { display: flex; align-items: center; gap: .8rem; margin: .9rem 0 .4rem; }
#progressBg { flex: 1; height: .5rem; min-height: 6px; background: rgba(255,255,255,.25); border-radius: 999px; overflow: hidden; }
#progressFill { height: 100%; width: 100%; background: #fff; border-radius: 999px; }
#txtTiempo { font-size: 1.6rem; font-variant-numeric: tabular-nums; min-width: 2.2ch; text-align: right; }
#txtPregunta {
  flex: 1; display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 1.45rem; line-height: 1.2; min-height: 5em; transition: opacity .5s linear;
}
#txtPregunta.fade { opacity: 0; }

/* Gracias */
.qr { display: inline-block; background: #fff; border-radius: 1rem; padding: .3rem; margin: 0 0 1rem; }
.qr img { display: block; width: min(11rem, 50vw); height: auto; }
#uploadStatus { color: var(--yellow); font-size: .85rem; min-height: 1.3em; }
#uploadActions { display: none; gap: .6rem; justify-content: center; flex-wrap: wrap; margin-top: .6rem; }
#uploadActions.show { display: flex; }

/* Celular con pantalla táctil: botón al formulario en vez de QR */
.only-touch { display: none !important; }
@media (pointer: coarse) and (max-width: 820px) {
  .only-touch { display: inline-flex !important; }
  span.only-touch { display: inline !important; }
  .only-desk { display: none !important; }
}

/* Pantallas bajas (celular apaisado, teclado abierto) */
@media (max-height: 520px) and (orientation: landscape) {
  :root { font-size: 16px; }
  .panel > header { padding-bottom: .5rem; }
  .logo { width: 8rem; }
  #PanelPreguntas > .body { display: grid; grid-template-columns: 1.1fr 1fr; grid-template-rows: auto auto 1fr; column-gap: 1rem; }
  #PanelPreguntas .cambox { grid-row: 1 / 4; max-height: 70dvh; }
  #txtPregunta { font-size: 1.15rem; min-height: 0; }
  .deco { width: 70px; }
}

@media (prefers-reduced-motion: reduce) {
  .panel.active { animation: none; }
  #txtPregunta, #claqueta { transition: none; }
}
