// ══════════════════════════════════════════════════════════════════════
// screens-q.jsx — Pantallas del juego en curso
//
// Contiene:
//   · TimerRing    — círculo de cuenta atrás (amarillo → rojo en ≤3 s)
//   · ProgressDots — barra de progreso 01/10
//   · ScreenPreparado — cuenta atrás 5…1 antes de empezar
//   · ScreenPregunta  — pantalla de pregunta con 4 opciones
//   · ScreenCalculo   — animación de "calculando puntuación"
//
// Lógica de puntuación (definida en kiosco.html → calcScore):
//   Acierto con ≥5 s restantes → 9 + bonus (0–1 pt según rapidez)
//   Acierto con <5 s restantes → 9 pts fijos
//   Fallo / timeout            → 0 pts
//   Máximo posible             → 100 pts (10 preguntas × 10 pts)
// ══════════════════════════════════════════════════════════════════════

function TimerRing({ seconds = 10, running = true, onEnd, onTick, size = 180 }) {
  const [t, setT] = React.useState(seconds);
  React.useEffect(() => { setT(seconds); }, [seconds]);
  React.useEffect(() => {
    if (!running) return;
    if (t <= 0) { onEnd && onEnd(); return; }
    onTick && onTick(t);
    const id = setTimeout(() => setT(v => v - 0.1), 100);
    return () => clearTimeout(id);
  }, [t, running]);
  const pct = Math.max(0, t / seconds);
  const r = size / 2 - 10;
  const c = 2 * Math.PI * r;
  const warn = t <= 3;
  return (
    <div style={{ position: 'relative', width: size, height: size }}>
      <svg width={size} height={size} style={{ transform: 'rotate(-90deg)' }}>
        <circle cx={size/2} cy={size/2} r={r} fill="none" stroke="rgba(255,255,255,0.08)" strokeWidth="8"/>
        <circle cx={size/2} cy={size/2} r={r} fill="none"
          stroke={warn ? window.ERR : window.UNNIC_YELLOW}
          strokeWidth="8" strokeLinecap="round"
          strokeDasharray={c} strokeDashoffset={c * (1 - pct)}
          style={{ transition: 'stroke-dashoffset 100ms linear, stroke 300ms' }}/>
      </svg>
      <div style={{
        position: 'absolute', inset: 0, display: 'flex', flexDirection: 'column',
        alignItems: 'center', justifyContent: 'center',
        fontFamily: '"Space Grotesk", system-ui, sans-serif',
      }}>
        <div style={{ fontSize: size * 0.4, fontWeight: 700, color: warn ? window.ERR : window.TEXT, lineHeight: 1, fontVariantNumeric: 'tabular-nums' }}>
          {Math.ceil(t)}
        </div>
        <div style={{ fontSize: size * 0.08, color: window.TEXT_DIM, letterSpacing: '0.2em', marginTop: 4 }}>{window.t('seg')}</div>
      </div>
    </div>
  );
}

function ProgressDots({ current = 3, total = 10 }) {
  return (
    <div style={{ display: 'flex', flexDirection: 'column', gap: 14, alignItems: 'flex-start' }}>
      <div style={{ display: 'flex', alignItems: 'baseline', gap: 10, fontFamily: '"Space Grotesk", system-ui, sans-serif' }}>
        <span style={{ fontSize: 90, fontWeight: 700, color: window.TEXT, lineHeight: 1, fontVariantNumeric: 'tabular-nums' }}>
          {String(current).padStart(2,'0')}
        </span>
        <span style={{ fontSize: 44, color: window.TEXT_DIM, fontWeight: 500 }}>
          / {total}
        </span>
      </div>
      <div style={{ display: 'flex', gap: 7, width: '100%' }}>
        {Array.from({ length: total }).map((_, i) => (
          <div key={i} style={{
            flex: 1, height: 8, borderRadius: 4,
            background: i < current - 1 ? window.UNNIC_YELLOW :
                       i === current - 1 ? window.PRIMARY :
                       'rgba(255,255,255,0.1)',
            boxShadow: i === current - 1 ? `0 0 12px ${window.PRIMARY}` : 'none',
            transition: 'all 300ms',
          }}/>
        ))}
      </div>
    </div>
  );
}

// ══════════════════════════════════════════════════════════════
// 1b. PREPARADO — countdown 5…1 antes de la primera pregunta
// ══════════════════════════════════════════════════════════════
function ScreenPreparado({ onReady }) {
  const [count, setCount] = React.useState(5);
  const [dots, setDots] = React.useState(0);
  const [gone, setGone] = React.useState(false);

  const TIPS = [
    { icon: '✓', text: window.t('tip_accuracy') },
    { icon: '⚡', text: window.t('tip_speed') },
  ];

  // Tick each second
  React.useEffect(() => {
    if (count <= 0) {
      setGone(true);
      const t = setTimeout(() => onReady && onReady(), 600);
      return () => clearTimeout(t);
    }
    const t = setTimeout(() => setCount(c => c - 1), 1000);
    return () => clearTimeout(t);
  }, [count]);

  // Animated dots for "generando…"
  React.useEffect(() => {
    const t = setInterval(() => setDots(d => (d + 1) % 4), 350);
    return () => clearInterval(t);
  }, []);

  return (
    <ArcadeBG>
      <CornerMarks/>
      <style>{`
        @keyframes prep-pop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
        @keyframes prep-out { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(2); opacity: 0; } }
        @keyframes tip-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
      `}</style>

      {/* Logo */}
      <div style={{ position: 'absolute', top: 80, left: 60, right: 60, display: 'flex', justifyContent: 'center' }}>
        <UnnicLogo size={120}/>
      </div>

      {/* Generando preguntas */}
      <div style={{
        position: 'absolute', top: 280, left: 60, right: 60,
        display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 20,
      }}>
        <div style={{ fontSize: 18, letterSpacing: '0.3em', color: window.TEXT_DIM, fontWeight: 500 }}>
          {window.t('generando')}{'.'.repeat(dots)}
        </div>
        {/* Scanning bar */}
        <div style={{ width: '100%', height: 4, background: 'rgba(255,255,255,0.06)', borderRadius: 2, overflow: 'hidden' }}>
          <div style={{
            height: '100%', width: `${(6 - count) / 5 * 100}%`,
            background: window.UNNIC_YELLOW,
            boxShadow: `0 0 12px ${window.UNNIC_YELLOW}88`,
            transition: 'width 1200ms cubic-bezier(.25,0,.1,1)',
            borderRadius: 2,
          }}/>
        </div>
      </div>

      {/* Big countdown number */}
      <div style={{
        position: 'absolute', left: 0, right: 0, top: '42%', transform: 'translateY(-50%)',
        display: 'flex', flexDirection: 'column', alignItems: 'center',
      }}>
        <div key={count} style={{
          fontFamily: '"Space Grotesk", system-ui, sans-serif',
          fontSize: 360, fontWeight: 700, lineHeight: 1,
          color: count <= 1 ? window.UNNIC_YELLOW : window.TEXT,
          letterSpacing: '-0.06em',
          animation: gone ? 'prep-out 500ms forwards' : 'prep-pop 350ms cubic-bezier(.2,1.4,.4,1)',
          textShadow: count <= 1 ? `0 0 120px ${window.UNNIC_YELLOW}55` : 'none',
          transition: 'color 200ms, text-shadow 200ms',
        }}>
          {count > 0 ? count : window.t('ya')}
        </div>
      </div>

      {/* Two static tip cards */}
      <div style={{ position: 'absolute', bottom: 200, left: 80, right: 80, display: 'flex', flexDirection: 'column', gap: 16 }}>
        {TIPS.map((tip, i) => (
          <div key={i} style={{
            padding: '28px 36px',
            background: 'rgba(255,255,255,0.04)',
            border: `1px solid ${window.BORDER}`,
            borderRadius: 18,
            display: 'flex', alignItems: 'center', gap: 24,
            animation: `tip-in ${400 + i * 120}ms cubic-bezier(.2,.8,.2,1)`,
          }}>
            <div style={{ fontSize: 40, flexShrink: 0, width: 52, textAlign: 'center' }}>{tip.icon}</div>
            <div style={{
              fontFamily: '"Space Grotesk", system-ui, sans-serif',
              fontSize: 34, fontWeight: 500, lineHeight: 1.2, color: window.TEXT,
            }}>{tip.text}</div>
          </div>
        ))}
      </div>

      {/* Points system explainer */}
      <div style={{
        position: 'absolute', bottom: 100, left: 80, right: 80,
        display: 'flex', justifyContent: 'center', gap: 48,
        fontSize: 18, color: window.TEXT_DIM, letterSpacing: '0.12em',
      }}>
        <span>{window.t('pts_correct')} <span style={{ color: window.TEXT, fontWeight: 600 }}>9 pts</span></span>
        <span style={{ color: 'rgba(255,255,255,0.2)' }}>·</span>
        <span>{window.t('pts_bonus')} <span style={{ color: window.UNNIC_YELLOW, fontWeight: 600 }}>{window.t('pts_bonus_val')}</span></span>
        <span style={{ color: 'rgba(255,255,255,0.2)' }}>·</span>
        <span>{window.t('pts_wrong')} <span style={{ color: window.TEXT, fontWeight: 600 }}>0 pts</span></span>
      </div>
    </ArcadeBG>
  );
}

// ══════════════════════════════════════════════════════════════
function ScreenPregunta({
  current = 3, total = 10,
  secondsPerQ = 30,
  question = "Una fábrica produce 240 piezas por hora con 3 robots. Si se añaden 2 robots más operando al 80% de eficiencia, ¿cuántas piezas por hora producirá la línea?",
  options = [
    "320 piezas/hora",
    "368 piezas/hora",
    "400 piezas/hora",
    "448 piezas/hora",
  ],
  correct = 1,
  phase = 'answering', // 'answering' | 'suspense' | 'revealed'
  picked = null,
  aiPercents = [12, 58, 22, 8],
  humanPercents = [31, 24, 34, 11],
  onPick,
  onTimeout,
}) {
  const letters = ['A', 'B', 'C', 'D'];
  const suspense = phase === 'suspense';
  const revealed = phase === 'revealed';
  const locked = suspense || revealed;

  // Track timer value for urgency effect
  const [timerVal, setTimerVal] = React.useState(secondsPerQ);

  // Shake/scan pulse during suspense
  const [tick, setTick] = React.useState(0);
  React.useEffect(() => {
    if (!suspense) return;
    const id = setInterval(() => setTick(t => t + 1), 120);
    return () => clearInterval(id);
  }, [suspense]);

  return (
    <ArcadeBG>
      {/* Top bar — logo + timer row */}
      <div style={{ position: 'absolute', top: 60, left: 60, right: 60, display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
        <UnnicLogo size={100}/>
        <TimerRing seconds={secondsPerQ} running={!locked} size={160} onEnd={onTimeout}
          onTick={setTimerVal}/>
      </div>
      <div style={{ position: 'absolute', top: 250, left: 60, right: 60 }}>
        <ProgressDots current={current} total={total}/>
      </div>

      {/* Question + options as a centered block */}
      <div style={{
        position: 'absolute', left: 60, right: 60,
        top: 430, bottom: 60,
        display: 'flex', flexDirection: 'column', justifyContent: 'center', gap: 40,
      }}>
        <div>
          <div style={{ fontSize: 22, letterSpacing: '0.3em', color: suspense ? window.UNNIC_YELLOW : window.TEXT_DIM, fontWeight: 600, marginBottom: 24, transition: 'color 200ms' }}>
            {suspense ? window.t('analizando') : window.t('pregunta_n', { n: String(current).padStart(2, '0') })}
          </div>
          <h2 style={{
            fontFamily: '"Space Grotesk", system-ui, sans-serif',
            fontSize: 54, fontWeight: 600, lineHeight: 1.18,
            color: window.TEXT, margin: 0, textWrap: 'pretty',
          }}>
            {question}
          </h2>
        </div>

        {/* Options — single column stack for vertical */}
        <div style={{
          display: 'flex', flexDirection: 'column', gap: 18,
        }}>
        {options.map((opt, i) => {
          const isPicked    = picked === i;
          const isTimeout   = revealed && picked === -1;   // se agotó el tiempo
          // Distinción clave: respuesta correcta elegida por el jugador vs. revelada por timeout
          const isCorrect   = revealed && i === correct && !isTimeout;   // ✓ acertaste
          const isSkipped   = revealed && i === correct && isTimeout;    // → era esta, pero no respondiste
          const isWrong     = revealed && isPicked && i !== correct;     // ✕ fallaste
          const suspensePicked = suspense && isPicked;
          const pulseBorder = suspensePicked ? (tick % 2 ? window.UNNIC_YELLOW : '#fff') : null;

          // Colores según estado
          const bg = isCorrect ? `color-mix(in srgb, ${window.OK} 18%, ${window.SURFACE})`
                    : isSkipped ? `color-mix(in srgb, #4488cc 12%, ${window.SURFACE})`  // azul suave: "era esta"
                    : isWrong   ? `color-mix(in srgb, ${window.ERR} 20%, ${window.SURFACE})`
                    : (isPicked || suspensePicked) ? window.SURFACE_2 : window.SURFACE;
          const border = isCorrect ? window.OK
                       : isSkipped ? '#5599dd'
                       : isWrong   ? window.ERR
                       : pulseBorder ? pulseBorder
                       : isPicked ? window.UNNIC_YELLOW
                       : window.BORDER;
          // Opciones incorrectas en timeout: desvanecidas. Skipped: visible pero distinta del verde
          const faded = (suspense && !isPicked) || (isTimeout && !isSkipped);

          return (
            <button key={i} onClick={() => !locked && onPick && onPick(i, timerVal)}
              style={{
                position: 'relative', textAlign: 'left',
                padding: revealed ? '22px 28px' : '28px 32px',
                minHeight: revealed ? 170 : 118,
                background: bg, border: `2px solid ${border}`,
                borderRadius: 18, cursor: locked ? 'default' : 'pointer',
                color: window.TEXT, fontFamily: 'inherit',
                opacity: faded ? 0.3 : 1,
                boxShadow: isCorrect ? `0 0 0 4px ${window.OK}22, 0 0 40px ${window.OK}44`
                          : isSkipped ? `0 0 0 4px #5599dd22`
                          : isWrong   ? `0 0 0 4px ${window.ERR}22`
                          : suspensePicked ? `0 0 40px ${window.UNNIC_YELLOW}55`
                          : 'none',
                transform: suspensePicked ? `scale(${1 + (tick % 2) * 0.01})` : 'scale(1)',
                transition: 'background 280ms, border-color 180ms, box-shadow 280ms, opacity 300ms, transform 200ms, min-height 300ms',
                overflow: 'hidden',
              }}>
              <div style={{ display: 'flex', gap: 24, alignItems: 'center' }}>
                {/* Badge con letra / icono */}
                <div style={{
                  width: 72, height: 72, flexShrink: 0,
                  borderRadius: 14,
                  background: isCorrect ? window.OK
                            : isSkipped ? '#4488cc'
                            : isWrong   ? window.ERR
                            : (isPicked || suspensePicked) ? window.UNNIC_YELLOW
                            : 'rgba(255,255,255,0.06)',
                  color: (isCorrect || isSkipped || isWrong || isPicked || suspensePicked) ? window.BG : window.TEXT,
                  display: 'flex', alignItems: 'center', justifyContent: 'center',
                  fontFamily: '"Space Grotesk", system-ui, sans-serif',
                  fontSize: 36, fontWeight: 700,
                  transition: 'all 280ms',
                }}>
                  {isCorrect  ? '✓'
                  : isSkipped ? '→'   // "era esta pero no respondiste"
                  : isWrong   ? '✕'
                  : (isTimeout && !isSkipped) ? '—'
                  : suspensePicked ? (tick % 2 ? '?' : '•')
                  : letters[i]}
                </div>
                <div style={{ flex: 1 }}>
                  <div style={{ fontSize: 34, fontWeight: 500, lineHeight: 1.2 }}>{opt}</div>
                  {/* Etiqueta extra para timeout */}
                  {isSkipped && (
                    <div style={{ marginTop: 6, fontSize: 18, color: '#88aadd', fontWeight: 500, letterSpacing: '0.05em' }}>
                      {window.t('timeout_msg')}
                    </div>
                  )}
                </div>
              </div>

              {revealed && (
                <div style={{ marginTop: 20, display: 'flex', flexDirection: 'column', gap: 10 }}>
                  <ResultBar label={window.t('bar_ias')} value={aiPercents[i]} accent="#6fb39a" delay={0}/>
                  <ResultBar label={window.t('bar_humans')} value={humanPercents[i]} accent={window.UNNIC_YELLOW} delay={260}/>
                </div>
              )}
            </button>
          );
        })}
        </div>
      </div>

      {/* Urgency vignette — red glow from bottom when time is low */}
      {!locked && timerVal <= secondsPerQ * 0.4 && (
        <div style={{
          position: 'absolute', inset: 0, pointerEvents: 'none',
          background: `radial-gradient(ellipse 120% 60% at 50% 110%, rgba(220,38,38,${Math.max(0, (secondsPerQ * 0.4 - timerVal) / (secondsPerQ * 0.4) * 0.55)}) 0%, transparent 70%)`,
          animation: timerVal <= secondsPerQ * 0.2 ? 'danger-pulse 500ms ease-in-out infinite alternate' : 'none',
        }}/>
      )}
      <style>{`@keyframes danger-pulse { from { opacity: 0.6; } to { opacity: 1; } }`}</style>

      {/* suspense banner */}
      {suspense && (
        <div style={{
          position: 'absolute', top: 380, left: '50%', transform: 'translateX(-50%)',
          padding: '12px 28px', background: window.UNNIC_YELLOW, color: window.BG,
          fontFamily: '"Space Grotesk", system-ui, sans-serif', fontSize: 20, fontWeight: 700,
          letterSpacing: '0.2em', borderRadius: 8,
          animation: 'ss-pulse 600ms ease-in-out infinite alternate',
        }}>
          {window.t('es_correcta')}
          <style>{`@keyframes ss-pulse { from { opacity: .7; transform: translateX(-50%) scale(1); } to { opacity: 1; transform: translateX(-50%) scale(1.04); } }`}</style>
        </div>
      )}
    </ArcadeBG>
  );
}

// Animated count-up %, with bar fill synced
function useCountUp(target, duration = 900, delay = 0) {
  const [v, setV] = React.useState(0);
  React.useEffect(() => {
    let raf; let start;
    const t0 = performance.now();
    const tick = (now) => {
      if (now - t0 < delay) { raf = requestAnimationFrame(tick); return; }
      if (!start) start = now;
      const t = Math.min(1, (now - start) / duration);
      const eased = 1 - Math.pow(1 - t, 3);
      setV(target * eased);
      if (t < 1) raf = requestAnimationFrame(tick);
    };
    raf = requestAnimationFrame(tick);
    return () => cancelAnimationFrame(raf);
  }, [target, duration, delay]);
  return v;
}

function ResultBar({ label, value, accent, delay = 0 }) {
  const v = useCountUp(value, 1100, delay);
  return (
    <div style={{ display: 'flex', alignItems: 'center', gap: 16, fontSize: 18 }}>
      <div style={{ width: 110, color: window.TEXT_DIM, letterSpacing: '0.08em', fontWeight: 500, textTransform: 'uppercase', fontSize: 16 }}>
        {label}
      </div>
      <div style={{ flex: 1, height: 16, background: 'rgba(255,255,255,0.06)', borderRadius: 8, overflow: 'hidden', position: 'relative' }}>
        <div style={{
          height: '100%', width: `${v}%`,
          background: accent, borderRadius: 8,
          boxShadow: `0 0 12px ${accent}66`,
        }}/>
      </div>
      <div style={{ width: 70, textAlign: 'right', fontVariantNumeric: 'tabular-nums', fontWeight: 600, color: window.TEXT, fontSize: 20 }}>
        {Math.round(v)}%
      </div>
    </div>
  );
}

// ══════════════════════════════════════════════════════════════
// 3. CÁLCULO
// ══════════════════════════════════════════════════════════════
function ScreenCalculo() {
  const [dots, setDots] = React.useState(0);
  React.useEffect(() => {
    const t = setInterval(() => setDots(d => (d + 1) % 4), 400);
    return () => clearInterval(t);
  }, []);

  // fake scanning lines
  const [scan, setScan] = React.useState(0);
  React.useEffect(() => {
    let raf;
    const tick = () => { setScan(s => (s + 1) % 200); raf = requestAnimationFrame(tick); };
    raf = requestAnimationFrame(tick);
    return () => cancelAnimationFrame(raf);
  }, []);

  return (
    <ArcadeBG>
      <div style={{ position: 'absolute', inset: 0, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
        {/* rotating rings */}
        <div style={{ position: 'relative', width: 360, height: 360 }}>
          {[1, 0.78, 0.56].map((s, i) => (
            <div key={i} style={{
              position: 'absolute', inset: `${(1 - s) * 180}px`,
              borderRadius: '50%',
              border: `2px dashed ${i === 0 ? window.UNNIC_YELLOW : i === 1 ? window.PRIMARY : 'rgba(255,255,255,0.2)'}`,
              animation: `spin${i} ${6 + i * 2}s linear infinite ${i % 2 ? 'reverse' : ''}`,
            }}/>
          ))}
          <div style={{
            position: 'absolute', inset: 100,
            borderRadius: '50%',
            background: `radial-gradient(circle, ${window.PRIMARY} 0%, transparent 70%)`,
            opacity: 0.4 + Math.sin(scan / 20) * 0.2,
          }}/>
          <div style={{
            position: 'absolute', inset: 0, display: 'flex',
            alignItems: 'center', justifyContent: 'center',
            fontFamily: '"Space Grotesk", system-ui, sans-serif',
            fontSize: 120, fontWeight: 700, color: window.UNNIC_YELLOW,
          }}>
            <svg width="120" height="120" viewBox="0 0 24 24" fill="none">
              <path d="M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" stroke={window.UNNIC_YELLOW} strokeWidth="2.5" strokeLinecap="round"/>
              <circle cx="12" cy="12" r="4" fill={window.UNNIC_YELLOW}/>
            </svg>
          </div>
        </div>

        <style>{`
          @keyframes spin0 { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
          @keyframes spin1 { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
          @keyframes spin2 { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
        `}</style>

        <h2 style={{
          marginTop: 120,
          fontFamily: '"Space Grotesk", system-ui, sans-serif',
          fontSize: 66, fontWeight: 600, letterSpacing: '-0.02em',
          color: window.TEXT, margin: '120px 0 0', textAlign: 'center', padding: '0 60px',
        }}>
          {window.t('calculando1')}<br/>{window.t('calculando2')}{'.'.repeat(dots)}
        </h2>
        <div style={{ marginTop: 36, fontSize: 22, color: window.TEXT_DIM, letterSpacing: '0.15em', textAlign: 'center' }}>
          {window.t('comparando')}
        </div>

        {/* decode stream — 2 rows for vertical */}
        <div style={{
          marginTop: 72, padding: '0 60px',
          display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12,
          fontFamily: '"JetBrains Mono", ui-monospace, monospace',
          fontSize: 16, color: window.TEXT_DIM, letterSpacing: '0.15em',
          width: '100%', maxWidth: 860,
        }}>
          {['claude-opus-4.5', 'claude-sonnet-4.5', 'gpt-5', 'gpt-4', 'gpt-3.5', 'gpt-3', 'gpt-2'].map((m, i) => (
            <span key={m} style={{
              padding: '12px 18px',
              borderRadius: 8,
              border: `1px solid ${scan / 25 > i ? window.UNNIC_YELLOW : 'rgba(255,255,255,0.08)'}`,
              color: scan / 25 > i ? window.UNNIC_YELLOW : window.TEXT_DIM,
              transition: 'all 200ms', textAlign: 'center',
            }}>
              {m} ✓
            </span>
          ))}
        </div>
      </div>

      <CornerMarks/>
    </ArcadeBG>
  );
}

window.ScreenPreparado = ScreenPreparado;
window.TimerRing = TimerRing;
window.ProgressDots = ProgressDots;
window.ScreenPregunta = ScreenPregunta;
window.ScreenCalculo = ScreenCalculo;
