/* ==============================================================================
   CREDIOLIMPIADAS / CREDIJUEGOS - ESTILOS CREDIRALLY Y CONTROL DE DISPOSITIVO
   Archivo: apps/juegos/public/styles/rally.css
   Estilos corporativos y responsive para validación de acceso móvil en CrediRally
   ============================================================================== */

/* --- Modal y Pantalla de Restricción para Escritorio --- */
.rally-desktop-view {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  background: linear-gradient(180deg, #EEF5FC 0%, #DCEAFC 100%);
  box-sizing: border-box;
}

.rally-block-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 44, 108, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1.25rem;
  box-sizing: border-box;
  animation: rallyFadeIn 0.25s ease-out;
}

@keyframes rallyFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.rally-desktop-card {
  background: #FFFFFF;
  border: 2px solid #D2E4F8;
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(0, 44, 108, 0.16);
  max-width: 520px;
  width: 100%;
  padding: 2.2rem 2rem;
  box-sizing: border-box;
  text-align: center;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.rally-desktop-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.25rem;
}

.rally-phone-icon-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #EBF4FC;
  border: 2px solid #B8DCF8;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
  box-shadow: 0 6px 16px rgba(0, 115, 207, 0.12);
}

.rally-phone-svg {
  width: 44px;
  height: 44px;
}

.rally-badge-pill {
  display: inline-block;
  background: #EBF4FC;
  color: #0073CF;
  border: 1px solid #B8DCF8;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  padding: 4px 14px;
  margin-bottom: 0.5rem;
}

.rally-desktop-title {
  color: #002C6C;
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0.25rem 0 0;
  letter-spacing: -0.3px;
  line-height: 1.25;
}

.rally-notice-box {
  background: #FEF3C7;
  border: 1.5px solid #F59E0B;
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  text-align: left;
  margin: 1rem 0;
}

.rally-notice-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.rally-notice-content strong {
  display: block;
  color: #92400E;
  font-size: 0.92rem;
  margin-bottom: 0.25rem;
}

.rally-notice-content p {
  margin: 0;
  color: #78350F;
  font-size: 0.86rem;
  line-height: 1.4;
}

.rally-explanation-text {
  color: #475569;
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0.75rem 0 1.25rem;
  text-align: left;
}

.rally-steps-card {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.4rem;
  text-align: left;
}

.rally-step-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
  font-size: 0.86rem;
  color: #334155;
}

.rally-step-item:last-child {
  margin-bottom: 0;
}

.rally-step-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #0073CF;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
}

.rally-desktop-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.btn-rally-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  background: #0073CF;
  color: #FFFFFF;
  border: none;
  border-radius: 10px;
  padding: 0.85rem 1.25rem;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  box-shadow: 0 4px 12px rgba(0, 115, 207, 0.24);
}

.btn-rally-copy:hover {
  background: #005FA8;
  transform: translateY(-1px);
}

.btn-rally-back {
  width: 100%;
  background: #E2E8F0;
  color: #1E293B;
  border: none;
  border-radius: 10px;
  padding: 0.85rem 1.25rem;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-rally-back:hover {
  background: #CBD5E1;
}

/* --- Vista Móvil Oficial de CrediRally --- */
.rally-mobile-view {
  min-height: 100vh;
  background: #F1F5F9;
  padding: 1rem;
  box-sizing: border-box;
  font-family: 'Segoe UI', system-ui, sans-serif;
  max-width: 600px;
  margin: 0 auto;
}

.rally-mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #E2E8F0;
}

.btn-rally-back-header {
  background: #FFFFFF;
  border: 1.5px solid #CBD5E1;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font-weight: 700;
  color: #002C6C;
  font-size: 0.82rem;
  cursor: pointer;
}

.rally-header-titles {
  text-align: right;
}

.rally-header-tag {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: #0073CF;
  letter-spacing: 0.5px;
}

.rally-header-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: #002C6C;
}

.rally-status-card {
  background: #FFFFFF;
  border: 1.5px solid #D2E4F8;
  border-radius: 14px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 14px rgba(0, 44, 108, 0.06);
}

.rally-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.rally-status-badge {
  background: #EBF4FC;
  color: #0073CF;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}

.rally-status-badge--live {
  background: #DCFCE7;
  color: #166534;
}

.rally-circuit-title {
  margin: 0.35rem 0 0.25rem;
  font-size: 1.05rem;
  color: #002C6C;
  font-weight: 700;
}

.rally-circuit-desc {
  margin: 0;
  font-size: 0.84rem;
  color: #64748B;
  line-height: 1.4;
}

.rally-header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.rally-btn-header-back {
  padding: 0.55rem 1rem;
  font-size: 0.8rem;
  min-height: 40px;
}

.rally-scanner-grid {
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  align-items: start;
  width: 100%;
}

@media (max-width: 920px) {
  .penales-master-grid.rally-scanner-grid,
  .rally-scanner-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
}

.rally-scanner-col-info,
.rally-scanner-col-camera {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
  width: 100%;
}

.rally-scanner-viewport {
  background: radial-gradient(circle at center, #0F204C 0%, #050B1A 100%);
  border: 3px solid #039BE5;
  border-radius: 20px;
  width: 100%;
  height: clamp(235px, 42vh, 315px);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 40, 85, 0.28), 0 0 22px rgba(3, 155, 229, 0.25);
  cursor: pointer;
  box-sizing: border-box;
}

.rally-camera-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  display: none;
  background: #000000;
}

.rally-camera-placeholder {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  max-width: 100%;
}

.rally-scanner-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  box-sizing: border-box;
}

.rally-camera-status-pill {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 20px);
  background: rgba(10, 20, 51, 0.88);
  border: 1.5px solid rgba(130, 206, 250, 0.65);
  color: #FFFFFF;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.25;
  padding: 0.32rem 0.75rem;
  border-radius: 999px;
  white-space: normal;
  text-align: center;
  word-break: break-word;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

.rally-scanner-reticle {
  width: clamp(135px, 42vw, 185px);
  height: clamp(135px, 42vw, 185px);
  position: relative;
  margin: 14px auto 0;
  box-shadow: 0 0 0 9999px rgba(5, 11, 26, 0.22);
  border-radius: 12px;
}

.reticle-corner {
  position: absolute;
  width: 26px;
  height: 26px;
  border-color: #6AE87A;
  border-style: solid;
  filter: drop-shadow(0 0 6px rgba(106, 232, 122, 0.7));
}

.reticle-corner--tl { top: 0; left: 0; border-width: 4px 0 0 4px; border-top-left-radius: 8px; }
.reticle-corner--tr { top: 0; right: 0; border-width: 4px 4px 0 0; border-top-right-radius: 8px; }
.reticle-corner--bl { bottom: 0; left: 0; border-width: 0 0 4px 4px; border-bottom-left-radius: 8px; }
.reticle-corner--br { bottom: 0; right: 0; border-width: 0 4px 4px 0; border-bottom-right-radius: 8px; }

.reticle-laser {
  position: absolute;
  top: 10%;
  left: 6%;
  right: 6%;
  height: 2.5px;
  background: #F28C28;
  box-shadow: 0 0 10px #F28C28, 0 0 20px #FFA858;
  animation: laserScan 2s infinite ease-in-out alternate;
}

@keyframes laserScan {
  0% { top: 10%; }
  100% { top: 90%; }
}

.rally-camera-prompt {
  color: #E2E8F0;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  margin: 0;
  max-width: 260px;
  line-height: 1.35;
}

.rally-camera-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  width: 100%;
}

.rally-camera-controls .btn-arcade {
  width: 100%;
  min-height: 46px;
  padding: 0.6rem 0.85rem;
  font-size: 0.82rem;
  white-space: normal;
  word-break: break-word;
  text-align: center;
  line-height: 1.25;
}

.rally-camera-controls #btn-native-camera-capture {
  grid-column: 1 / -1;
}

.rally-sim-panel {
  background: #F8FAFC;
  border: 1.5px solid #D2E4F8;
  border-radius: 16px;
  padding: 0.85rem 0.95rem;
  width: 100%;
  box-sizing: border-box;
}

.rally-sim-panel__title {
  font-size: 0.72rem;
  font-weight: 800;
  color: #0A1433;
  text-transform: uppercase;
  margin-bottom: 0.55rem;
  letter-spacing: 0.04em;
  line-height: 1.3;
}

.rally-sim-panel__buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  width: 100%;
}

.rally-sim-panel__buttons > button {
  width: 100%;
  min-width: 0;
  padding: 0.6rem 0.75rem;
  font-size: 0.78rem;
  white-space: normal;
  line-height: 1.25;
  text-align: center;
}

.rally-questions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem;
  width: 100%;
}

@media (max-width: 820px) {
  .rally-questions-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
}

/* Radar & Retícula */
.rally-assigned-radar {
  background: linear-gradient(135deg, #002C6C 0%, #001A44 100%);
  color: #FFFFFF;
  border-radius: 18px;
  padding: 1.15rem;
  box-shadow: 0 8px 24px rgba(0, 44, 108, 0.22);
  position: relative;
  overflow: hidden;
  border: 2px solid #039BE5;
  width: 100%;
  box-sizing: border-box;
}

.rally-radar-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
  position: relative;
  z-index: 2;
}

.rally-radar-tag {
  font-size: 0.7rem;
  font-weight: 800;
  background: rgba(0, 115, 207, 0.45);
  padding: 3px 9px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  color: #FFFFFF;
  line-height: 1.25;
}

.rally-radar-code {
  font-size: 0.82rem;
  font-weight: 800;
  color: #82CEFA;
  white-space: nowrap;
}

.rally-radar-dept {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0 0 0.35rem;
  color: #FFFFFF;
  line-height: 1.25;
  word-break: break-word;
  position: relative;
  z-index: 2;
}

.rally-radar-station-name {
  font-size: 0.86rem;
  color: #CBD5E1;
  margin-bottom: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  position: relative;
  z-index: 2;
}

.rally-radar-hint {
  background: rgba(0, 0, 0, 0.3);
  border-left: 3.5px solid #38BDF8;
  padding: 0.55rem 0.8rem;
  border-radius: 0 10px 10px 0;
  font-size: 0.82rem;
  color: #F1F5F9;
  line-height: 1.35;
  word-break: break-word;
  position: relative;
  z-index: 2;
}

.radar-pulse-ring {
  position: absolute;
  right: -20px;
  top: -20px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 2px solid rgba(0, 115, 207, 0.35);
  animation: radarPulse 3s infinite linear;
  pointer-events: none;
}

@keyframes radarPulse {
  0% { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Cuestionario de 2 Preguntas */
.rally-question-card {
  background: #F8FAFC;
  border: 2px solid #D2E4F8;
  border-radius: 18px;
  padding: 1.15rem;
  box-shadow: 0 4px 16px rgba(0, 44, 108, 0.05);
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.rally-q-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  margin-bottom: 0.6rem;
  line-height: 1.25;
}

.rally-q-badge--inst {
  background: #EBF4FC;
  color: #0073CF;
  border: 1px solid #B8DCF8;
}

.rally-q-badge--cult {
  background: #FEF3C7;
  color: #B45309;
  border: 1px solid #FDE68A;
}

.rally-q-title {
  font-size: 1rem;
  font-weight: 800;
  color: #002C6C;
  line-height: 1.38;
  margin: 0 0 0.85rem;
  word-break: break-word;
}

.rally-options-grid {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 100%;
}

.rally-option-btn {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: #F8FAFC;
  border: 1.5px solid #CBD5E1;
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.rally-option-btn:hover {
  background: #EFF6FF;
  border-color: #93C5FD;
}

.rally-option-btn.is-selected {
  background: #EBF4FC;
  border-color: #0073CF;
  box-shadow: 0 0 0 2px rgba(0, 115, 207, 0.25);
}

.rally-option-btn.is-correct {
  background: #DCFCE7 !important;
  border-color: #10B981 !important;
}

.rally-option-btn.is-wrong {
  background: #FEE2E2 !important;
  border-color: #EF4444 !important;
}

.rally-option-letter {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #002C6C;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.rally-option-btn.is-selected .rally-option-letter {
  background: #0073CF;
  box-shadow: 0 0 8px rgba(0, 115, 207, 0.45);
}

.rally-option-text {
  font-size: 0.86rem;
  color: #1E293B;
  font-weight: 600;
  line-height: 1.32;
  word-break: break-word;
  flex: 1;
}

/* Podio de Victoria */
.rally-victory-card {
  background: #FFFFFF;
  border: 3px solid #10B981;
  border-radius: 20px;
  padding: 1.75rem 1.25rem;
  text-align: center;
  box-shadow: 0 16px 40px rgba(16, 185, 129, 0.18);
  margin-bottom: 1.25rem;
  box-sizing: border-box;
}

.rally-trophy-icon {
  font-size: 3.6rem;
  margin-bottom: 0.65rem;
  display: inline-block;
  animation: trophyFloat 2s ease-in-out infinite alternate;
}

@keyframes trophyFloat {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}

.rally-bonus-chip {
  display: inline-block;
  background: #DCFCE7;
  color: #15803D;
  border: 2px solid #86EFAC;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1.05rem;
  padding: 0.4rem 1.15rem;
  margin: 0.65rem 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* --- Ajustes Responsivos Móviles para CrediRally (<= 640px y <= 480px) --- */
@media (max-width: 640px) {
  .rally-header-actions {
    width: 100%;
    justify-content: space-between;
    gap: 0.5rem;
  }

  .rally-header-actions .penales-tickets-pill {
    flex: 1;
    min-width: 0;
  }

  .rally-camera-controls {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .rally-sim-panel__buttons {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .rally-assigned-radar {
    padding: 0.9rem 0.85rem;
    border-radius: 14px;
  }

  .rally-radar-dept {
    font-size: 1.02rem;
  }

  .rally-question-card {
    padding: 0.9rem 0.85rem;
    border-radius: 14px;
  }

  .rally-q-title {
    font-size: 0.92rem;
  }

  .rally-option-btn {
    padding: 0.6rem 0.7rem;
    gap: 0.55rem;
  }

  .rally-option-text {
    font-size: 0.82rem;
  }
}

@media (max-width: 480px) {
  .rally-desktop-card {
    padding: 1.35rem 1rem;
    border-radius: 16px;
  }

  .rally-desktop-title {
    font-size: 1.12rem;
  }

  .rally-scanner-viewport {
    height: clamp(215px, 38vh, 265px);
    border-radius: 16px;
  }

  .rally-camera-status-pill {
    font-size: 0.62rem;
    padding: 0.25rem 0.6rem;
    top: 8px;
  }

  .rally-scanner-reticle {
    width: 135px;
    height: 135px;
    margin-top: 18px;
  }

  .rally-camera-controls .btn-arcade {
    font-size: 0.75rem;
    padding: 0.5rem 0.65rem;
    min-height: 42px;
  }

  .rally-bonus-chip {
    font-size: 0.92rem;
    padding: 0.35rem 0.85rem;
  }
}


