body {
  margin: 0;
  padding: 1rem;
  height: calc(100vh - 2rem);
  width: calc(100vw - 2rem);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  font-family: 'poppins', sans-serif;
  font-weight: 400;
  font-style: normal;
  font-size: 16px;
  line-height: 1.8rem;
}

h1 {
  font-family: 'poppins', sans-serif;
  font-weight: 700;
  font-style: normal;
  line-height: 3rem;
  font-size: 2rem;
}

button.primary,
a.primary,
button.secondary,
a.secondary {
  padding: 0.5rem 1rem;
  font-size: 1em;
  color: black;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: left;
  font-size: 2rem;
  cursor: pointer;
  border: 0;
  background-color: #fa0;
  color: #000;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: 1.65px;
  text-transform: uppercase;
  transition: all 0.3s ease;
  will-change: transform;
  transform: scale(1);
  backface-visibility: hidden;
  margin: 0 0.5rem;
  text-decoration: none;
}
button.secondary,
a.secondary {
  background-color: #dfdad6;
}
button#start-quiz-button {
  width: 16rem;
}
button#reset-button {
  padding: 0.5rem 1rem;
  font-size: 1em;
  width: 100%;
  background-color: #ffffffbb;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: left;
  font-size: 2rem;
  cursor: pointer;
  border: 0;
  color: #000;
  background-color: #fa0;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: 1.65px;
  text-transform: uppercase;
  margin: 1rem 0 0;
  transition: all 0.3s ease;
  will-change: transform;
  backface-visibility: hidden;
  z-index: 999;
}
button.selectLanguage {
  margin: 0 auto 1rem;
}
/* Ensure links in the home overview have proper spacing and padding */
.overview-content > a {
  margin: 0.5rem 0.5rem 0 0.5rem; /* add vertical gap when wrapping */
}
#logo {
  position: fixed;
  right: 1rem;
  top: 1rem;
  width: 100%;
  height: 5%;
  z-index: 999;
  background-position: right;
  background-repeat: no-repeat;
  background-size: contain;
}
#powergraphic {
  width: 100vh;
  height: 100%;
  position: absolute;
  background-size: 210%;
  background-position: 0% 0%;
  background-repeat: no-repeat;
  opacity: 0.5;
  transform: rotate(90deg);
  top: 0;
  z-index: 555;
  right: 0;
}

#group-name-label {
  display: none;
}

#group-name {
  font-size: 2rem;
  background-color: #ffffff;
  color: black;
  border-color: #fa0;
  border-radius: 0.5rem;
  cursor: pointer;
  padding: 0.5rem 1rem;
  max-width: calc(100vw - 6rem);
}

.view {
  display: none;
  overflow: hidden;
}
.answer-letter {
  font-size: 3rem;
  font-weight: 700;
  line-height: 3rem;
  color: #fa0;
  transform: translateY(10%);
  margin-right: 1rem;
  font-family: 'poppins', sans-serif;
}
.active {
  display: flex;
}

#myVideo {
  position: fixed;
  right: 0;
  bottom: 0;
  min-width: 100%;
  min-height: 100%;
}
#language-selection,
#group-name-form,
#home-view {
  width: 100%;
  height: calc(100% - 4rem);
  justify-content: center;
  align-items: center;
  text-align: center;
  margin: auto;
  position: relative;
  z-index: 999;
}
#group-name-form form#group-form-name-element {
  width: calc(100vw - 4rem);
}
#quiz-view {
  width: 100%;
  justify-content: center;
  align-items: center;
  text-align: center;
  margin: auto;
  position: relative;
  flex-direction: column;
  z-index: 999;
}
.language-content,
.form-content,
.overview-content {
  padding: 1rem 1rem 2rem 1rem;
  color: #ffffff;
  display: grid;
  row-gap: 1rem;
}
#puzzle-container {
  /* Critical: make the puzzle canvas match its parent panel height
     so measurements reflect the visible orange area, not the viewport */
  height: 100%;
}
#question-text {
  font-size: 1.8rem;
  margin: 0;
  color: #fa0;
  line-height: 2.2rem;
}
#questions-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: left;
}
.question-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: center;
  text-align: left;
  padding: 1rem;
}
.question-content button {
  text-align: left;
  display: grid;
  grid-template-columns: auto 8fr;
}
span#answerA,
span#answerB,
span#answerC,
span#answerD {
  height: 100%;
  align-content: center;
  font-size: 1.2rem;
}
#questions-panel button {
  background-color: rgba(235, 130, 0, 0.1);
  color: black;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  opacity: 0.8;
  padding: 0.5rem 1rem;
}
h2.result-title {
  text-align: left;
  color: #fa0;
}
#questions-panel {
  width: 100%;
}

#result-display {
  width: 100%;
  text-align: right;
}
#result-display img {
  border-radius: 0.5rem;
}
#result-display .result {
  font-weight: 700;
  margin: 0;
  font-size: 0.8rem;
  text-align: left;
  line-height: 1rem;
  color: #fa0;
}
.result-content {
  text-align: left;
  font-size: 0.8rem;
  line-height: 1.2rem;
}
#result-display .total-time {
  font-size: 4rem;
  font-weight: 700;
  margin: 0;
  text-align: right;
}
#puzzle-container,
#puzzle-overlay {
  width: calc(100% - 2rem);
  height: calc(40vh - 2rem);
  margin: 0 auto;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
#puzzle-panel {
  height: 70%;
}
#puzzle-overlay {
  position: absolute;
  top: 0;
  left: 0;
}

/* Icons inside primary buttons/links */
.btn-icon {
  width: 1.25rem;
  height: 1.25rem;
  margin-right: 0.5rem;
  fill: currentColor;
  flex: 0 0 auto;
}
#configuration-button {
  margin: 0;
  width: calc(100% - 2rem);
}

#quiz-container {
  width: 100%;
  display: flex;
  gap: 0;
  flex-direction: column;
}

#puzzle-panel {
  flex: 1;
  position: relative;
  border-radius: 0.5rem;
  background-color: #fa0;
  min-height: 50vh;
  padding: 1rem 0;
}
#feedback {
  background: transparent;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  align-items: center;
  font-size: 1.2rem;
}
#feedback.correct {
  background-color: #b0c313;
}
#feedback.incorrect {
  background-color: #ee7f00;
}
#timer {
  position: relative;
  padding: 1rem 0;
  font-size: 2em;
  font-family: 'poppins', sans-serif;
  font-weight: 700;
  text-align: center;
  width: 100%;
  color: #ee7f00;
  line-height: 3rem;
  margin: 1rem 0;
  border-top: 1px solid #ee7f00;
  border-bottom: 1px solid #ee7f00;
}
#group-name-error {
  padding: 0.5rem;
  margin: 1rem;
}
#group-name-error.error-active {
  background-color: #ba2c00;
  color: white;
}
.full-screen {
  text-align: center;
}

#puzzle-container canvas {
  display: block;
  margin: auto;
}
footer {
  /* border-top: .5rem solid #f7941d; */
  top: 0;
  width: fit-content;
  z-index: 999;
  left: 1rem;
  padding: 2rem 0;
  position: relative;
}

#quit-button {
  padding: 0.5rem 1rem;
  font-size: 1em;
  background-color: #fa0; /* ORANGE */
  color: white;
  border: 1px solid white;
  border-radius: 0.5rem;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.3s, background-color 0.3s;
  width: 100%;
}

#quit-button:disabled {
  cursor: not-allowed;
  background-color: #ccc; /* Grey */
}

#quit-button:hover:enabled {
  opacity: 1;
  background-color: #d32f2f; /* Darker Red */
}
@media screen and (min-width: 756px) and (max-width: 1024px) {
  #puzzle-panel {
    min-height: 40vh;
    max-height: 45vh;
  }
}
@media screen and (min-width: 1024px) {
  body {
    overflow: scroll;
  }
  #feedback {
    margin-bottom: 4rem;
  }
  #result-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 2rem;
    text-align: left;
  }
  #result-display img {
    grid-column: 1;
    grid-row: 1 / 6;
  }
  #result-display h2,
  #result-display p,
  #result-display div,
  #result-display button {
    grid-column: 2;
  }
  #result-display h2 {
    margin-top: 0;
  }

  #result-display #reset-button,
  #result-display #configuration-button {
    width: fit-content;
  }
  #quiz-container {
    display: grid;
    grid-template-columns: 3fr 2fr;
    column-gap: 1rem;
  }
  #quiz-container.quiz-over {
    display: block;
  }
  #quiz-container.quiz-over #timer {
    left: 1rem;
    width: calc(100% - 4rem);
  }
  #quiz-container #timer,
  #quiz-container #questions-panel {
    grid-column: 2;
  }
  #quiz-container #timer {
    position: fixed;
    left: 1rem;
    bottom: 1rem;
    width: 5rem;
    padding: 0 1rem;
    margin: 0;
    line-height: 3rem;
    z-index: 999;
  }
  #quiz-container #puzzle-panel {
    grid-column: 1;
    grid-row: 1 / 3;
    height: 80vh;
    position: fixed;
    left: 1rem;
    width: calc(60% - 2rem);
  }
  footer {
    width: fit-content;
    padding: 2rem 1rem;
    position: fixed;
  }
}
