.quiz-flow-display {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: calc(100vh - 60px);
  padding: 20px;
  box-sizing: border-box;
  overflow-y: auto;
}

.container:has(#quiz-flow-page:not(.hidden)) {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: center !important;
  min-height: 100% !important;
}

.quiz-flow-wrapper {
  display: grid;
  grid-template-areas:
    "progress-bar"
    "navigate-buttons"
    "question"
    "options"
    "next-btn";
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: min-content min-content min-content auto min-content;
  width: clamp(300px, 95vw, 750px);
  margin-bottom: auto;
  background-color: #2b2b50;
  border-radius: 25px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  padding: 2.2rem;
  gap: 1.2rem;
  height: auto;
  box-sizing: border-box;
}

.quiz-flow-wrapper::-webkit-scrollbar {
  width: 6px;
}

.quiz-flow-wrapper::-webkit-scrollbar-thumb {
  background: rgba(141, 134, 201, 0.3);
  border-radius: 10px;
}

.quiz-flow-header {
  width: clamp(300px, 95vw, 750px);
  box-sizing: border-box;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 10px 22px;
  margin-top: auto;
  margin-bottom: 0.8rem;
  background-color: rgba(43, 43, 80, 0.6);
  border: 1px solid rgba(141, 134, 201, 0.15);
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 1.5px;
  color: #8d86c9;
}

.quiz-counter-label {
  opacity: 0.8;
  margin-right: 4px;
}

.quiz-current {
  color: #4cc9fe;
  font-size: 1.25rem;
  font-weight: 800;
  text-shadow: 0 0 10px rgba(76, 201, 254, 0.3);
}

.quiz-separator {
  color: #8d86c9;
  opacity: 0.5;
  font-size: 1.1rem;
}

.quiz-total {
  color: #fbf6e9;
  opacity: 0.7;
  font-size: 1rem;
  font-weight: 600;
}

.progress-wrapper {
  display: flex;
  align-items: center;
  min-height: 50px;
}

progress {
  width: 100%;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
}

progress::-webkit-progress-bar {
  background-color: #2a2d3e;
  border-radius: 6px;
}

progress::-webkit-progress-value {
  background-image: linear-gradient(to right, #4a6cf7, #3f5bdc);
  border-radius: 6px;
  transition: width 0.3s ease;
}

progress::-moz-progress-bar {
  background-image: linear-gradient(to right, #4a6cf7, #3f5bdc);
  border-radius: 6px;
}

.next-btn {
  grid-area: next-btn;
  justify-self: end;
  width: clamp(100px, 30vw, 150px);
  height: clamp(40px, 6vh, 50px);
  margin-top: 10px;
  border: none;
  border-radius: 10px;
  background-color: #fbf6e9;
  color: #3b38a0;
  font-size: clamp(1rem, 2vw, 1.2em);
  font-weight: bold;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
}
.next-btn:hover {
  transform: scale(1.05);
}

.navigate-block {
  grid-area: navigate-buttons;
  display: flex;
  align-items: center;
  height: 50px;
  gap: 1rem;
}

.navigate-block .close-btn {
  margin-left: auto;
}

.navigate-button {
  background-color: rgba(255, 255, 255, 0.05);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 1.5rem;
  width: clamp(70px, 8vw, 90px);
  height: 44px;
  border: 1px solid rgba(141, 134, 201, 0.2);
  border-radius: 10px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.navigate-button:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  background-color: rgba(255, 255, 255, 0.1);
}

.return-btn {
  background-image: url("../../icons/arrow_left.png");
}

.forward-btn {
  background-image: url("../../icons/arrow_right.png");
}

.close-btn {
  background-image: url("../../icons/close.png");
}

form.quiz-options {
  grid-area: options;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-height: 0;
  width: 100%;
}

.question {
  grid-area: question;
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  color: #fbf6e9;
  margin: 0;
  text-align: left;
  display: block !important;
  width: 100%;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}

.quiz-options label {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 12px 15px;
  border-radius: 12px;
  transition: background 0.2s;
  min-width: 0;
}

.quiz-options label:hover,
.quiz-options label:has(input:checked) {
  background-color: rgba(255, 255, 255, 0.05);
}

.quiz-options label:hover .label-text,
.quiz-options input:checked + .label-text {
  color: #4cc9fe !important;
  text-shadow: 0 0 8px rgba(76, 201, 254, 0.4);
}

.quiz-options label:has(input:checked) {
  border: 1px solid rgba(76, 201, 254, 0.3);
}

.quiz-options label.hidden {
  display: none !important;
}

.quiz-flow-display .label-text {
  display: block !important;
  width: 100%;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  padding-left: 45px !important;
  line-height: 1.35;
  font-size: 1.1rem;
  transition: color 0.2s ease;
  flex: 1;
  min-width: 0;
}

.quiz-flow-display .label-text::before,
.quiz-flow-display .label-text::after {
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 24px !important;
  height: 24px !important;
  background-size: contain !important;
  background-position: center !important;
}

@media (min-width: 850px) and (hover: hover) and (pointer: fine) {
  .quiz-flow-display {
    overflow-y: hidden;
    height: calc(100vh - 60px);
    min-height: auto;
  }

  .quiz-flow-wrapper {
    max-height: calc(100vh - 180px);
    overflow-y: auto;
  }

  .quiz-flow-display .label-text {
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important;
    -webkit-box-orient: vertical;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    padding-right: 15px !important;
  }
}

@media (max-height: 850px) {
  .quiz-flow-display {
    padding: 20px 15px;
  }

  .quiz-flow-wrapper {
    padding: 1.5rem;
    gap: 1rem;
  }

  .question {
    font-size: 1.25rem;
  }

  .quiz-options label {
    padding: 10px 12px;
  }

  .navigate-block {
    height: 40px;
  }
}

@media (max-width: 600px) {
  * {
    box-sizing: border-box;
  }

  .quiz-flow-display {
    padding: 15px 0;
    justify-content: center;
    min-height: calc(100vh - 60px);
  }

  .quiz-flow-header {
    width: calc(100% - 30px);
    margin-top: 0;
    margin-bottom: 10px;
    justify-content: center;
  }

  .quiz-flow-wrapper {
    width: 100%;
    background-color: transparent;
    box-shadow: none;
    border-radius: 0;
    padding: 0 15px 30px 15px;
    margin-top: 0;
    margin-bottom: 0;
  }

  .question,
  .quiz-flow-display .label-text {
    display: block !important;
    -webkit-line-clamp: unset !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
    height: auto !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
  }

  .navigate-block {
    display: flex;
    align-items: center;
    height: 50px;
    gap: 0.8rem;
    flex-shrink: 0;
  }

  .navigate-button {
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 75px;
    height: 48px;
    border-radius: 12px;
    background-size: 1.3rem;
    background-color: rgba(141, 134, 201, 0.1);
    border: 1px solid rgba(141, 134, 201, 0.2);
  }

  form.quiz-options {
    gap: 0.7rem;
    width: 100%;
  }

  .quiz-options label {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(141, 134, 201, 0.2);
    padding: 12px 15px;
    min-height: 50px;
    width: 100%;
  }

  .next-btn {
    width: 100%;
    margin-top: 15px;
    margin-bottom: 20px;
    padding: 15px;
    height: 60px;
    border-radius: 12px;
    background-color: #fbf6e9;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
  }
}
