*,*::before,*::after {
  box-sizing: border-box;
}

body {
  font-family: Raleway, Verdana, sans-serif;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: radial-gradient(circle at center, #111111 0%, #222222 100%);
  color: #ffffff;
  text-align: center;
  overflow: hidden;
}

/* ============= HOME PAGE ============= */
h1 {
  font-size: 2.5rem;
  margin-bottom: 3rem;
}

#mode-selection {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

#ar-btn {
  padding: 0.9rem 2.5rem;
  font-size: 1.2rem;
  cursor: pointer;
  border: 0.125rem solid #ffffff;
  border-radius: 0.6rem;
  background: transparent;
  color: #ffffff;
  transition: transform 0.2s;
}

#ar-btn:hover {
  transform: scale(1.05);
}


/* ======================== ISNTALL PROMPT =================== */

#install-prompt {
  display: none;
  font-size: 1rem;
}

.install-box {
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 2rem;
  max-width: 90%;
  color: #fff;
  background: #00000063;
  border: 0.1rem solid #fff;
  border-radius: 1rem;
  backdrop-filter: blur(0.5rem);
  text-align: center;
  z-index: 9999;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.install-box p {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  font-weight: bold;
}

.install-buttons {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
}

#install-btn {
  padding: 0.6rem 1.25rem;
  background: transparent;
  color: #fff;
  border: 2px solid white;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#dismiss-btn {
  padding: 0.6rem 1.25rem;
  background: #f4f4f4;
  color: #000;
  border: 0.0625rem solid #00000063;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* ======= MUTE KNOP ========= */


#mute-btn {
  position: fixed;
  top: clamp(1rem, env(safe-area-inset-top), 2rem);
  right: clamp(1rem, env(safe-area-inset-right), 2rem);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  background: #00000080;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(0.625rem);
  transition: all 0.3s ease;
}


/* ============= GAME PAGE ============= */

.ar-page {
  display: block;
  touch-action: none;
}

#loading {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ffffff;
  font-size: 1.1rem;
  z-index: 100;
  display: none;
  text-align: center;
  background: #000000e6;
  padding: 1.8rem;
  border-radius: 1rem;
}

#ar-container {
  width: 100vw;
  height: 100vh;
  position: relative;
  background: #000000;
}

.back-btn {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 10;
  background: #000000d9;
  color: #ffffff;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  text-decoration: none;
  backdrop-filter: blur(0.625rem);
  border: 1px solid #ffffff1a;
}

#info {
  position: absolute;
  top: 4.3rem; 
  left: 50%;
  transform: translateX(-50%);
  background: #000000d9;
  color: #ffffff;
  padding: 1rem 1.5rem;
  border-radius: 0.625rem;
  font-size: 0.9; 
  z-index: 10;
  text-align: center;
  backdrop-filter: blur(0.625rem);
  border: 1px solid #ffffff1a;
}

#stats {
  position: absolute;
  bottom: 6.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: #000000d9;
  color: #ffffff;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  z-index: 10;
  backdrop-filter: blur(0.6rem);
  border: 1px solid #ffffff1a;
  display: flex;
  gap: 1.25rem;
}

#controls {
  position: absolute;
  top: 1rem;
  right: 0.9rem;
  z-index: 10;
  display: flex;
  gap: 0.6rem; 
}

.control-btn {
  width: 3.125rem;
  height: 3.125rem;
  border-radius: 50%;
  border: none;
  background: #000000d9;
  color: #ffffff;
  font-size: 1.5rem;
  cursor: pointer;
  backdrop-filter: blur(0.625rem);
  border: 1px solid #ffffff1a;
}

.control-btn:active {
  transform: scale(0.8);
}

/* ============= QUIZ ============= */

#quiz-modal {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #000000f2;
  color: #ffffff;
  padding: 1.9rem;
  border-radius: 1rem;
  z-index: 100;
  max-width: 31.25rem;
  width: 90%;
  backdrop-filter: blur(0.625rem);
  border: 0.125rem solid #ffffff33;
}

#quiz-timer {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 1.25rem;
  color: #4caf50;
  font-weight: bold;
}

#quiz-timer.warning {
  color: #ff9800;
}

#quiz-timer.danger {
  color: #f44336;
  animation: pulse 0.5s infinite;
}

#quiz-question {
  font-size: 1.25rem;
  margin-bottom: 1.25rem;
  font-weight: bold;
  text-align: center;
}

.quiz-option {
  background: #667ee64d;
  padding: 1rem;
  margin: 0.625rem 0;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 0.125rem solid transparent;
}

.quiz-option:hover {
  background: #667ee680;
  border-color: #667eeccc;
}

.quiz-option.correct {
  background: #4caf5080;
  border-color: #4caf50;
}

.quiz-option.wrong {
  background: #f4433580;
  border-color: #f44336;
}


/* ============= GAME OVER ============= */

#game-over {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #000000e5;
  color: #FFFFFF;
  padding: 2.5rem;
  border-radius: 1rem;
  z-index: 200;
  max-width: 30rem;
  width: 90%;
  text-align: center;
  backdrop-filter: blur(0.625rem);
  border: 0.125rem solid #FFFFFF33;
}

#game-over h2 {
  font-size: 2.25rem;
  margin-bottom: 1.25rem;
  color: #F44336;
}

#final-score {
  font-size: 3rem;
  margin: 1.25rem 0;
  color: #FFFFFF;
}

#high-score {
  font-size: 1.5rem;
  margin-bottom: 1.8rem;
  color: #4CAF50;
}

#restart-btn {
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
  background: #FFFFFF;
  color: #000000;
  border: none;
  border-radius: 0.625rem;
  cursor: pointer;
  font-weight: bold;
  transition: transform 0.1s ease;
}

#restart-btn:active {
  transform: scale(0.95);
}

.menu-link {
  display: inline-block;
  color: #FFFFFF;
  text-decoration: none;
  padding: 0.625rem 1.25rem;
  background: #FFFFFF1A;
  border-radius: 0.5rem;
  margin-top: 0.625rem;
}



/* ============= CANVAS ============= */

video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

#p5-canvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  pointer-events: none;
}

#three-canvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* ============= RESPOSNIVE ============= */

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
    margin-bottom: 1.875rem;
  }
  button {
    padding: 0.75rem 1.875rem;
    font-size: 1rem;
  }
  #mute-btn {
    padding: 0.5rem;
    font-size: 0.875rem;
  }
}

@media (max-width: 480px) {
  #game-over {
    padding: 1.5rem;
  }
  #game-over h2 {
    font-size: 1.75rem;
  }
  #final-score {
    font-size: 2.25rem;
  }
  #high-score {
    font-size: 1.25rem;
  }
  #restart-btn {
    padding: 0.75rem 2rem;
    font-size: 1rem;
  }
}
