html, body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  width: 100%;
  height: 100%;
  /*background: black; */
}

canvas {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  z-index: 1;
}

#instruction {
  position: absolute;
  bottom: 80px; 
  left: 50%;
  transform: translateX(-50%);
  
  text-align: center;
  font-size: 20px;
  color: white;
  z-index: 10;
}


#stateLabel {
  position: absolute;
  top: 20px;
  width: 100%;
  text-align: center;
  font-size: 30px;
  font-weight: bold;
  z-index: 10;
}

#progressBar {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 10px;
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  overflow: hidden;
  z-index: 10;
}

#progressBar::after {
  content: "";
  display: block;
  height: 100%;
  width: 0%;
  background: white;
  transition: width 0.1s linear;
}

#whiteFade {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.5s ease;
  z-index: 999;
    inset: 0;
}

#introScreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  overflow: hidden;
}

#introImage {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.6);
}

#introContent {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: rgba(219, 219, 219, 0.9);
}

#introContent h1 {
  font-size: 4rem;
  letter-spacing: 2px;
  margin-bottom: 30px;
  text-shadow: 0 0 20px rgba(0,0,0,0.8);
}

#beginButton {
  background: none;
  border: none;
  padding: 0;
  
  font-size: 1.5rem;
  font-family: inherit; /* same as title */
  color: rgba(219, 219, 219, 0.9);
  cursor: pointer;

  position: relative;
  margin-top: 10px;

  letter-spacing: 1px;
}

#beginButton::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 100%;
  height: 2px;
  background: rgba(219, 219, 219, 0.9);

  transform: scaleX(1);
  transform-origin: left;
  transition: transform 0.3s ease;
}

#beginButton:hover {
  color: rgba(255,255,255,0.5);
  transform: scale(1.05);
}

/* fade-out animation */
.fadeOut {
  opacity: 0;
  transition: opacity 1.5s ease;
  
}

#questionScreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
    inset: 0;

  background: black;

  display: flex;
  justify-content: center;
  align-items: center;

  z-index: 999;
}

#questionBox {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  gap: 25px;

  text-align: center;
}

/* QUESTION TEXT */
#questionText {
  color: white;
  font-size: 1.6rem;
  letter-spacing: 1px;
  max-width: 600px;
  line-height: 1.4;
}

/* INPUT */
#answerInput {
  width: 320px;

  background: transparent;
  border: none;
  border-bottom: 2px solid white;

  outline: none;

  color: white;
  font-size: 1.2rem;
  text-align: center;

  padding: 10px;
}

/* BUTTON */
#nextButton {
  background: none;
  border: none;

  color: white;
  font-size: 1.2rem;
  font-family: inherit;

  cursor: pointer;
  position: relative;

  letter-spacing: 1px;
}

#nextButton::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;

  width: 100%;
  height: 2px;
  background: white;
}

#nextButton::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 100%;
  height: 2px;
  background: rgba(219, 219, 219, 0.9);

  transform: scaleX(1);
  transform-origin: left;
  transition: transform 0.3s ease;
}

#nextButton:hover {
  color: rgba(255,255,255,0.5);
  transform: scale(1.05);
}

#beginMeditationButton {
  margin-top: 20px;

  background: none;
  border: none;

  font-size: 1.3rem;
  font-family: inherit;
  color: rgba(219, 219, 219, 0.9);

  cursor: pointer;
  position: relative;
}

#beginMeditationButton::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 100%;
  height: 2px;
  background: rgba(219, 219, 219, 0.9);
}

#questionText,
#answerInput,
#nextButton {
  opacity: 1;
  transition: opacity 0.3s ease;
}

#endScreen {
  position: fixed;
  inset: 0;
  background: white;

  display: flex;
  justify-content: center;
  align-items: center;

  z-index: 1001; /* ABOVE whiteFade */

  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease;
}

#endBox {
  border: 2px solid black;
  padding: 40px;
  max-width: 500px;

  text-align: center;
  font-family: inherit;
}

#endText {
  font-size: 1.2rem;
  color: black;
  margin-bottom: 25px;
  line-height: 1.5;
}

#restartButton {
  background: none;
  border: none;

  font-size: 1.2rem;
  font-family: inherit;
  color: black;

  cursor: pointer;
  position: relative;
}

#restartButton::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 100%;
  height: 2px;
  background: black;
}

#restartButton:hover {
  opacity: 0.6;
}

#seeAnswersButton {
  background: none;
  border: none;

  font-size: 1.2rem;
  font-family: inherit;
  color: black;

  cursor: pointer;
  position: relative;
  margin-top: 15px;
}

#seeAnswersButton::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 100%;
  height: 2px;
  background: black;
}

#seeAnswersButton:hover {
  opacity: 0.6;
}

/* ================= ANSWERS VIEWER SCREEN ================= */
#answersScreen {
  position: fixed;
  inset: 0;
  background: white;
  z-index: 1002;
  
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease;
  
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#answersScreen.visible {
  opacity: 1;
  pointer-events: auto;
}

#answersHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30px 40px;
  border-bottom: 2px solid black;
  flex-shrink: 0;
}

#answersHeader h2 {
  margin: 0;
  font-size: 1.8rem;
  color: black;
}

#backButton {
  background: none;
  border: none;
  font-size: 1.2rem;
  font-family: inherit;
  color: black;
  cursor: pointer;
  position: relative;
}

#backButton:hover {
  opacity: 0.6;
}

#answersContainer {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 30px 40px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-content: flex-start;
}

.userResponseBox {
  background: black;
  color: white;
  padding: 25px;
  border-radius: 8px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.qaPair {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qaQuestion {
  font-weight: bold;
  font-size: 0.85rem;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.3;
}

.qaAnswer {
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.5;
}

.answerBox {
  background: black;
  color: white;
  padding: 25px;
  border-radius: 8px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  font-size: 1rem;
  line-height: 1.5;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.answerBox .questionNumber {
  font-weight: bold;
  font-size: 0.9rem;
  opacity: 0.8;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.answerBox .answer {
  font-size: 1.1rem;
}