If statment not working corretly

Greetings All,

i have a project with Attiny85.

have 2 input:

  1. From Brake
  2. From night light

have 3 output:

  1. Digital out for Brake light.
  2. PWM for night led.
  3. PWM for spoiler

condition.

  1. if brake HIGH then spoiler led and brake led are blinking several time continue light on.
  2. if night HIGH then spoiler and blue led is dim.
  3. if brake and night HIGH, spoiler led and brake are blinking several time continue light on but blue led is off.

conditin 1 and 2 running as expected.

condition number 3 not expected, blue led turn on (blinking rapidly) after spoiler led and brake led are blinking.

thank you in advance.. terima kasih.. matur nuwun

https://youtu.be/gPIMI0onZ1A
/* pinout attiny85
   pin 1 Reset 5/A0 PCINT5 PB5
   pin 2       3/A3 PCINT3 PB3
   pin 3 OC1B  4/A2 PCINT4 PB4
   pin 4 GND
   pin 5 DI MOSI 0 PCINT0 PB0
   pin 6 DO MISO 1 PCINT1 PB1
   pin 7 SCL SCK 2/A1 PCINT2 PB2
   pin 8 VCC +5V

*/

#define i_rem     4 //pb-3 kaki ic ke-2, untuk input dari REM 
#define i_senja   3 //pb-4 kaki ic ke-3, untuk input dari LAMPU KOTA
#define o_merah   2 //pb-2 kaki ic ke-7, untuk lampu REM, rating arus sampai 2A
#define o_biru    1 //pb-1 kaki ic ke-6, untuk lampu RGB, rating arus 1A
#define o_spoiler 0 //pb-0 kaki ic ke-5, untuk spoiler, rating arus 1A

bool senja_pb = LOW;
bool rem_pb   = LOW;

int ledLoopA = 0;
int ledLoopB = 0;

int tunda_ON = 50;
int tunda_OFF = 50;
int tundaA = 300;

void setup() {
  // put your setup code here, to run once:
  pinMode(i_senja, INPUT);
  pinMode(i_rem, INPUT);
  pinMode(o_merah, OUTPUT);
  pinMode(o_biru, OUTPUT);
  pinMode(o_spoiler, OUTPUT); 
}

void loop() {
  // put your main code here, to run repeatedly:
  senja_pb = digitalRead(i_senja);
  rem_pb = digitalRead(i_rem);
  
  if (senja_pb == HIGH) {
    analogWrite(o_spoiler, 150); //brightness 0 = off, 255 = full bright
    analogWrite(o_biru,    150); //brightness 0 = off, 255 = full bright
  }
  if (senja_pb == LOW) {
    analogWrite(o_spoiler, 0);
    analogWrite(o_biru, 0);
  }
  if (rem_pb == HIGH) {
    analogWrite(o_biru, 0);
    if (ledLoopA <= 4) {
      ledBLINK();
      ledBLINK();
      ledBLINK();
      ledBLINK();
      ledBLINK();
      delay(tundaA);
      ledLoopA++;
    }
    ledALL_ON();
  }

if ((rem_pb == HIGH && senja_pb == HIGH) || (senja_pb == HIGH && rem_pb == HIGH) ) {
    analogWrite(o_biru, 0);
    if (ledLoopA <= 4) {
      ledBLINK();
      ledBLINK();
      ledBLINK();
      ledBLINK();
      ledBLINK();
      delay(tundaA);
      ledLoopA++;
    }
    ledALL_ON();
  }
  
  if (rem_pb == LOW) {
    digitalWrite(o_merah, LOW);
    ledLoopA = 0;
  }
} // end loop

void ledALL_ON() {
  analogWrite(o_spoiler, 255);
  digitalWrite(o_merah, HIGH);
  analogWrite(o_biru, 0);
}

void ledBLINK() {
  analogWrite(o_spoiler, 255);
  digitalWrite(o_merah, HIGH);
  delay(tunda_ON);

  analogWrite(o_spoiler, 0);
  digitalWrite(o_merah, LOW);
  delay(tunda_OFF);
}

finally after re-write if statment
working as expected .. any improvement or suggestion for me, i do really appriciate

//khusus buat LED RGB dan spoiler

/* pinout attiny85
   pin 1 Reset 5/A0 PCINT5 PB5
   pin 2       3/A3 PCINT3 PB3
   pin 3 OC1B  4/A2 PCINT4 PB4
   pin 4 GND
   pin 5 DI MOSI 0 PCINT0 PB0
   pin 6 DO MISO 1 PCINT1 PB1
   pin 7 SCL SCK 2/A1 PCINT2 PB2
   pin 8 VCC +5V

*/

#define i_rem     4 //pb-3 kaki ic ke-2, untuk input dari REM 
#define i_senja   3 //pb-4 kaki ic ke-3, untuk input dari LAMPU KOTA
#define o_merah   2 //pb-2 kaki ic ke-7, untuk lampu REM, rating arus sampai 2A
#define o_biru    1 //pb-1 kaki ic ke-6, untuk lampu RGB, rating arus 1A
#define o_spoiler 0 //pb-0 kaki ic ke-5, untuk spoiler, rating arus 1A

bool senja_pb = LOW;
bool rem_pb   = LOW;

int ledLoopA = 0;
int ledLoopB = 0;

int tunda_ON = 50;
int tunda_OFF = 50;
int tundaA = 300;

void setup() {
  // put your setup code here, to run once:
  pinMode(i_senja, INPUT);
  pinMode(i_rem, INPUT);
  pinMode(o_merah, OUTPUT);
  pinMode(o_biru, OUTPUT);
  pinMode(o_spoiler, OUTPUT); 
}

void loop() {
  // put your main code here, to run repeatedly:
  senja_pb = digitalRead(i_senja);
  rem_pb = digitalRead(i_rem);
  
  if (senja_pb == HIGH and rem_pb == LOW) {
    analogWrite(o_spoiler, 150); //brightness 0 = off, 255 = full bright
    analogWrite(o_biru,    150); //brightness 0 = off, 255 = full bright
    digitalWrite(o_merah, LOW);
  }
  
  if (rem_pb == HIGH and senja_pb == LOW) {
    analogWrite(o_biru, 0);
    if (ledLoopA <= 4) {
      ledBLINK();
      ledBLINK();
      ledBLINK();
      ledBLINK();
      ledBLINK();
      delay(tundaA);
      ledLoopA++;
    }
    ledALL_ON();
  }

if (rem_pb == HIGH && senja_pb == HIGH) {
    analogWrite(o_biru, 0);
    if (ledLoopA <= 4) {
      ledBLINK();
      ledBLINK();
      ledBLINK();
      ledBLINK();
      ledBLINK();
      delay(tundaA);
      ledLoopA++;
    }
    ledALL_ON();
  }

  if (rem_pb == LOW) {
    ledLoopA = 0;
  }
} // end loop

void ledALL_ON() {
  analogWrite(o_spoiler, 255);
  digitalWrite(o_merah, HIGH);
  analogWrite(o_biru, 0);
}

void ledBLINK() {
  analogWrite(o_spoiler, 255);
  digitalWrite(o_merah, HIGH);
  delay(tunda_ON);

  analogWrite(o_spoiler, 0);
  digitalWrite(o_merah, LOW);
  delay(tunda_OFF);
}