:root {
  /* COLOR */
  --clr-primary: #3eacdf;
  --clr-secondary: #ff2453;
  --clr-bg: rgba(62, 172, 223, 0.05);
  --clr-white: #ffffff;
  --clr-black: #111;
  --clr-border: var(--clr-primary);
  --clr-text: var(--clr-black);
}

.quiz {
  position: relative;
  width: 100%;
  /* max-width: 480px; */
  margin: 60px auto 0;
  padding: 24px 16px 32px;
  background: var(--clr-bg);
  color: var(--clr-text);
  box-sizing: border-box;
  border-radius: 8px;
}

.quiz *,
.quiz *::before,
.quiz *::after {
  box-sizing: border-box;
}

.quiz .o-grid {
  display: grid;
}

.quiz .o-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.quiz .o-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.quiz .quiz-wrap {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.quiz .quiz-header {
  width: 100%;
}

.quiz .quiz-title {
  margin: 0 0 30px !important;
  font-size: 20px !important;
  line-height: 1.4;
  font-weight: 700;
  text-align: center;
}

.quiz .quiz-progres-wrap {
  padding: 18px 8px;
  background: var(--clr-primary);
  border-radius: 8px;
}

.quiz .quiz-progress-head {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 5px;
  padding: 0 4px;
  color: var(--clr-white);
  font-size: 11px;
  line-height: 1.4;
  font-weight: 600;
}

.quiz .quiz-progress-head span:first-child {
  font-size: 14px;
}
.quiz .quiz-progress-head span:last-child {
  font-size: 11px;
}

.quiz .quiz-progress {
  position: relative;
  width: 85%;
  height: 9px;
  margin: 0 auto;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 20px;
}

.quiz .quiz-progress-bar {
  display: block;
  width: 25%;
  height: 100%;
  background: var(--clr-secondary);
  border-radius: inherit;
}

.quiz .quiz-hero {
  width: 100%;
  margin: 36px 0 26px;
  border-radius: 8px;
}

.quiz .quiz-hero img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  object-fit: contain;
}

.quiz .quiz-question {
  max-width: 330px;
  margin: 15px auto 0;
  font-size: 14px;
  line-height: 1.7;
  font-weight: 700;
  text-align: center;
  color: var(--clr-white);
}

.quiz .quiz-question-text {
  color: #111;
}

.quiz .quiz-answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  column-gap: 24px;
  row-gap: 22px;
  padding-top: 20px;
}

/* ======== ANSWER WHEN CLICK ======== */

.quiz .quiz-answer {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  appearance: none;
  border: 0;
  background: transparent;
  font-family: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  transition: transform 0.2s ease;
}

.quiz .quiz-answer input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.quiz .quiz-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 90px;
  padding: 10px;
  border: 2px solid transparent;
  border-radius: 8px;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
  will-change: transform;
}

.quiz .quiz-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1.2;
  overflow: hidden;
  border-radius: 8px;
}

.quiz .quiz-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.quiz .quiz-text {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1;
  margin-top: 5px;
  padding: 10px;
  font-size: 15px;
  line-height: 1.45;
  font-weight: 600;
  text-align: center;
  color: var(--clr-text);
  background: #ffa0a066;
  border-radius: 8px;
  overflow-wrap: break-word;
  word-break: break-word;
  white-space: normal;
  transition: color 0.2s ease;
}

.quiz .quiz-text::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: var(--clr-secondary);
  border-radius: 2px;
  transform: translateX(-50%);
  transition: width 0.25s ease;
}

.quiz .quiz-answer:hover .quiz-card {
  transform: translateY(-3px);
}
.quiz .quiz-answer:hover .quiz-text {
  color: var(--clr-secondary);
}
.quiz .quiz-answer:hover .quiz-text::after {
  width: 60%;
}
.quiz .quiz-answer:hover .quiz-image img {
  transform: scale(1.03);
}

.quiz .quiz-answer:active .quiz-card {
  transform: translateY(0) scale(0.97);
  background: #ece7ff;
  border-color: var(--clr-secondary);
  box-shadow: 0 2px 6px rgba(62, 172, 223, 0.18);
  transition:
    transform 0.08s ease,
    background-color 0.08s ease;
}
.quiz .quiz-answer:active .quiz-text {
  color: var(--clr-secondary);
}
.quiz .quiz-answer:active .quiz-text::after {
  width: 80%;
}

.quiz .quiz-answer:focus-visible .quiz-card {
  outline: 2px solid var(--clr-secondary);
  outline-offset: 2px;
}
.quiz .quiz-answer:focus .quiz-text::after,
.quiz .quiz-answer:focus-within .quiz-text::after {
  width: 80%;
}

.quiz .quiz-answer input:checked + .quiz-card {
  padding: 12px 10px 14px;
  margin: -12px -10px -14px;
  background: var(--clr-secondary);
  color: var(--clr-white);
  border: none;
  border-radius: 12px;
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.25);
  transform: translateY(-2px);
}

.quiz .quiz-answer input:checked + .quiz-card .quiz-image {
  border-radius: 8px;
}

.quiz .quiz-answer.active .quiz-card {
  border-color: var(--clr-secondary);
  background: #ece7ff;
}
.quiz .quiz-answer.active .quiz-text {
  color: var(--clr-secondary);
  font-weight: 700;
}

.quiz .quiz-answer.active .quiz-card::after {
  content: "✓";
  position: absolute;
  top: 8px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--clr-secondary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  animation: quiz-pop 0.25s ease;
}

@keyframes quiz-pop {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  70% {
    transform: scale(1.15);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

.quiz .quiz-footer {
  display: grid;
  grid-template-columns: 44px 44px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

.quiz .quiz-nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--clr-primary);
  color: var(--clr-white);
  font-family: inherit;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.quiz .quiz-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.quiz button.quiz-nav--prev::before,
.quiz button.quiz-nav--next::before {
  width: 30px;
  height: 30px;
  display: inline-block;
  vertical-align: middle;
}

.quiz button.quiz-nav--prev::before {
  content: url("data:image/svg+xml,%3Csvg width='30px' height='30px' viewBox='-1.2 -1.2 26.40 26.40' fill='none' xmlns='http://www.w3.org/2000/svg' stroke='%23fff' stroke-width='0.00024'%3E%3Cpath d='M14.2893 5.70708C13.8988 5.31655 13.2657 5.31655 12.8751 5.70708L7.98768 10.5993C7.20729 11.3805 7.2076 12.6463 7.98837 13.427L12.8787 18.3174C13.2693 18.7079 13.9024 18.7079 14.293 18.3174C14.6835 17.9269 14.6835 17.2937 14.293 16.9032L10.1073 12.7175C9.71678 12.327 9.71678 11.6939 10.1073 11.3033L14.2893 7.12129C14.6799 6.73077 14.6799 6.0976 14.2893 5.70708Z' fill='%23fff'/%3E%3C/svg%3E");
}

.quiz button.quiz-nav--next::before {
  content: url("data:image/svg+xml,%3Csvg width='30px' height='30px' viewBox='0 0 24.00 24.00' fill='none' xmlns='http://www.w3.org/2000/svg' stroke='%23fff' stroke-width='0.00024'%3E%3Cpath d='M9.71069 18.2929C10.1012 18.6834 10.7344 18.6834 11.1249 18.2929L16.0123 13.4006C16.7927 12.6195 16.7924 11.3537 16.0117 10.5729L11.1213 5.68254C10.7308 5.29202 10.0976 5.29202 9.70708 5.68254C9.31655 6.07307 9.31655 6.70623 9.70708 7.09676L13.8927 11.2824C14.2833 11.6729 14.2833 12.3061 13.8927 12.6966L9.71069 16.8787C9.32016 17.2692 9.32016 17.9023 9.71069 18.2929Z' fill='%23ffffff'/%3E%3C/svg%3E");
}

.quiz .quiz-button {
  width: 100%;
  min-height: 40px;
  padding: 10px 12px;
  appearance: none;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--clr-primary);
  color: var(--clr-white);
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.quiz .quiz-button:hover {
  background: var(--clr-secondary);
  color: var(--clr-white);
}

.quiz .quiz-button:active {
  transform: translateY(1px);
}

.quiz .quiz-button--primary {
  background: var(--clr-secondary);
  color: var(--clr-white);
  border-color: rgba(255, 255, 255, 0.08);
}

.quiz .quiz-button--secondary {
  background: transparent;
  color: #000;
  border-color: var(--clr-secondary);
}

.show {
  display: block;
}
.hide {
  display: none;
}

/* ======== SECTION SCORE ======== */

.quiz .quiz-result-trophy {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  margin: 8px 0;
}

.quiz .quiz-result-trophy img {
  display: block;
  width: 300px;
  height: auto;
  object-fit: cover;
}

.quiz .quiz-result-title {
  position: relative;
  z-index: 1;
  margin: 0 0 34px !important;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 700;
  text-align: center;
}

.quiz .quiz-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
}

.quiz .quiz-score-label {
  display: block;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600;
}

.quiz .quiz-score-number {
  display: flex;
  align-items: baseline;
  line-height: 1;
}

.quiz .quiz-score-number strong {
  font-size: 48px;
  font-weight: 700;
  color: #00a83b;
}

.quiz .quiz-score-number span {
  margin-left: 4px;
  font-size: 30px;
  font-weight: 600;
  color: var(--clr-text);
}

.quiz .quiz-result-message {
  margin-bottom: 14px;
  text-align: center;
}

.quiz .quiz-result-message strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 700;
}

.quiz .quiz-result-message p {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  font-weight: 600;
}

.quiz .quiz-stat {
  width: 100%;
  column-gap: 4px;
  margin-top: 0;
}

.quiz .quiz-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 87px;
  padding: 10px 5px;
  background: #e8e8e8;
  border-radius: 8px;
}

.quiz .quiz-stat-title {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.3;
  font-weight: 500;
}

.quiz .quiz-stat-value {
  display: block;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 700;
  color: #00a83b;
}

.quiz .quiz-stat-value--wrong {
  color: #ed1717;
}

.quiz .quiz-result-action {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  gap: 4px;
  margin-top: 20px;
}

/* ======== POPUP SECTION ======== */

.popup {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.popup .popup-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.popup .popup-box {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: calc(100% - 30px);
  max-width: 610px;
  max-height: 75vh;
  margin-top: 9%;
  overflow: hidden;
  background: var(--clr-white);
  border-radius: 4px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.25);
}

.popup .popup-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 10px 50px;
  background: var(--clr-white);
}

.popup .popup-title {
  margin: 0;
  color: var(--clr-text);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

.popup .popup-close {
  position: absolute;
  top: 50%;
  right: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--clr-text);
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-50%);
}

.popup .popup-content {
  flex: 1;
  overflow-y: auto;
  padding: 4px 15px 8px;
  scrollbar-width: thin;
}

.popup .popup-item {
  display: flex;
  align-items: flex-start;
  width: 100%;
  padding: 7px 0;
}

.popup .popup-number {
  flex: 0 0 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-top: 5px;
  margin-right: 12px;
  border-radius: 50%;
  color: var(--clr-white);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.popup .popup-number--correct {
  background: #079b28;
}
.popup .popup-number--wrong {
  background: #ed1717;
}

.popup .popup-item-body {
  position: relative;
  flex: 1;
  min-width: 0;
}

.popup .popup-question {
  display: flex;
  align-items: flex-start;
  min-height: 70px;
  padding-right: 80px;
}

.popup .popup-thumb {
  flex: 0 0 90px;
  display: block;
  width: 130px;
  height: 90px;
  margin-right: 12px;
  object-fit: cover;
  border-radius: 2px;
}

.popup .popup-answer {
  flex: 1;
  min-width: 0;
}

.popup .popup-answer p {
  margin: 0;
  color: var(--clr-text);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.45;
  word-break: break-word;
}

.popup .popup-result {
  position: absolute;
  top: 5px;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 65px;
  text-align: center;
}

.popup .popup-result strong,
.popup .popup-result span {
  display: block;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.popup .popup-result span {
  margin-top: 2px;
}

.popup .popup-result--correct {
  color: #079b28;
}
.popup .popup-result--wrong {
  color: #ed1717;
}

.popup .popup-explanation {
  margin-top: 8px;
  padding: 10px 12px 12px;
  background: #e5f9e8;
  border-radius: 3px;
}

.popup .popup-label {
  display: block;
  width: fit-content;
  margin: -2px auto 8px;
  padding: 7px 24px;
  border-radius: 5px;
  color: var(--clr-white);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.popup .popup-label--correct {
  background: #079b28;
}

.popup .popup-explanation-content {
  display: flex;
  align-items: flex-start;
}

.popup .popup-explanation-image {
  flex: 0 0 95px;
  width: 130px;
  height: 117px;
  margin-right: 12px;
  object-fit: cover;
  border-radius: 3px;
}

.popup .popup-explanation-content p {
  flex: 1;
  margin: 0;
  color: var(--clr-text);
  font-size: 14px;
  line-height: 1.5;
}

.popup .popup-footer {
  padding: 10px 15px 14px;
  background: var(--clr-white);
}

.popup .popup-retry {
  display: block;
  width: 100%;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: var(--clr-secondary);
  color: var(--clr-white);
  font-size: 13px;
  font-weight: 700;
  line-height: 38px;
  text-align: center;
  cursor: pointer;
}

/* ======== BREAKPOINT RESPONSIVE ======== */

@media (min-width: 481px) {
  .quiz {
    padding-right: 24px;
    padding-left: 24px;
  }

  .quiz .quiz-title {
    font-size: 15px;
  }
  .quiz .quiz-question {
    max-width: 400px;
    font-size: 16px;
  }
  .quiz .quiz-text {
    font-size: 16px;
  }

  .quiz .quiz-result-title {
    font-size: 22px;
  }
  .quiz .quiz-score-label {
    font-size: 14px;
  }
  .quiz .quiz-score-number strong {
    font-size: 52px;
  }
  .quiz .quiz-score-number span {
    font-size: 32px;
  }
  .quiz .quiz-result-message strong,
  .quiz .quiz-result-message p {
    font-size: 16px;
  }
  .quiz .quiz-stat-title {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .popup .popup-box {
    width: calc(100% - 12px);
    max-width: 800px;
    max-height: 94vh;
  }

  .popup .popup-header {
    min-height: 40px;
    padding: 8px 40px;
  }

  .popup .popup-title {
    font-size: 13px;
  }

  .popup .popup-close {
    right: 8px;
    width: 25px;
    height: 25px;
    font-size: 20px;
  }

  .popup .popup-content {
    padding: 3px 7px 5px;
  }
  .popup .popup-item {
    padding: 5px 0;
  }

  .popup .popup-number {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    margin-top: 3px;
    margin-right: 7px;
    font-size: 10px;
  }

  .popup .popup-question {
    min-height: 45px;
    padding-right: 50px;
  }

  .popup .popup-thumb {
    flex: 0 0 60px;
    width: 60px;
    height: 45px;
    margin-right: 8px;
  }

  .popup .popup-answer p {
    font-size: 9px;
    line-height: 1.35;
  }

  .popup .popup-result {
    top: 3px;
    width: 42px;
  }
  .popup .popup-result strong,
  .popup .popup-result span {
    font-size: 8px;
  }

  .popup .popup-explanation {
    margin-top: 5px;
    padding: 7px;
  }

  .popup .popup-label {
    margin: -7px auto 6px;
    padding: 3px 10px;
    font-size: 8px;
  }

  .popup .popup-explanation-image {
    flex: 0 0 60px;
    width: 60px;
    height: 60px;
    margin-right: 8px;
  }

  .popup .popup-explanation-content p {
    font-size: 8px;
    line-height: 1.4;
  }
  .popup .popup-footer {
    padding: 6px 7px 8px;
  }
  .popup .popup-retry {
    height: 28px;
    font-size: 9px;
    line-height: 28px;
  }
}

@media (max-width: 360px) {
  .quiz {
    padding-right: 12px;
    padding-left: 12px;
  }

  .quiz .quiz-footer {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    gap: 8px;
    margin-top: 40px;
  }

  .quiz .quiz-nav {
    width: 38px;
    height: 38px;
    font-size: 24px;
  }

  .quiz .quiz-button {
    padding: 13px 8px;
    font-size: 12px;
  }

  .quiz .quiz-title {
    margin-bottom: 32px;
    font-size: 12px;
  }

  .quiz .quiz-question {
    font-size: 13px;
  }

  .quiz .quiz-answers {
    column-gap: 16px;
    row-gap: 20px;
  }

  .quiz .quiz-card {
    min-height: 70px;
    padding: 12px;
  }

  .quiz .quiz-text {
    font-size: 11px;
  }

  .quiz .quiz-result-trophy {
    height: 170px;
  }
  .quiz .quiz-result-trophy img {
    width: 100px;
    height: 100px;
  }

  .quiz .quiz-result-title {
    margin-bottom: 28px !important;
    font-size: 19px;
  }

  .quiz .quiz-score {
    margin-bottom: 28px;
  }
  .quiz .quiz-score-number strong {
    font-size: 44px;
  }
  .quiz .quiz-score-number span {
    font-size: 27px;
  }
  .quiz .quiz-result-message strong,
  .quiz .quiz-result-message p {
    font-size: 13px;
  }
  .quiz .quiz-stat-item {
    min-height: 82px;
  }
  .quiz .quiz-stat-title {
    font-size: 13px;
  }
  .quiz .quiz-stat-value {
    font-size: 15px;
  }
  .quiz .quiz-button {
    font-size: 11px;
  }
}