/* Buttons and switches */
button {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  padding: 7px 13px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.16s ease, background-color 0.16s ease, color 0.16s ease, opacity 0.16s ease;
}

.dark-mode button {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-dark);
}

.light-mode button {
  background: rgba(17, 24, 39, 0.06);
  color: var(--text-light);
}

button.active,
.toggle-practice.active {
  background: var(--accent);
  color: #fff;
}

.control-button.secondary {
  opacity: 1;
}

.control-button.secondary:disabled,
.control-button.secondary.is-disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
}

.segmented-control {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border-radius: 999px;
}

.switch-control {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  gap: 0;
  border: 1px solid transparent;
}

.dark-mode .switch-control {
  background: rgba(255, 255, 255, 0.075);
  border-color: rgba(255, 255, 255, 0.08);
}

.light-mode .switch-control {
  background: rgba(17, 24, 39, 0.06);
  border-color: rgba(17, 24, 39, 0.07);
}

.switch-control::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px) / 2);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  box-shadow: 0 8px 18px rgba(99, 144, 241, 0.28);
  transition: transform 0.24s cubic-bezier(.2, .8, .2, 1), box-shadow 0.24s ease;
}

.switch-control[data-active="fr"]::before,
.switch-control[data-active="light"]::before {
  transform: translateX(100%);
}

.switch-control button {
  position: relative;
  z-index: 1;
  min-width: 52px;
  min-height: 30px;
  padding: 5px 10px;
  background: transparent !important;
  color: inherit;
  transition: color 0.18s ease, opacity 0.18s ease, transform 0.16s ease;
}

.switch-control button.active {
  color: #fff;
}

.switch-control button:not(.active) {
  opacity: 0.72;
}

.toggle-practice {
  padding-inline: 15px;
}

/* 5. Quiz sections and cards */
.quiz-section {
  scroll-margin-top: var(--header-offset);
  padding: 4px 0 10px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.practice-heading {
  align-items: center;
}

h2 {
  margin: 0;
  font-size: clamp(1.55rem, 4vw, 2.35rem);
  line-height: 1.05;
  letter-spacing: -0.055em;
}

#corvni-questions,
#src-questions,
#practice-questions {
  display: grid;
  gap: 16px;
}

.question,
.empty-state {
  border: 1px solid;
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.dark-mode .question,
.dark-mode .empty-state {
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(255, 255, 255, 0.08);
}

.light-mode .question,
.light-mode .empty-state {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(17, 24, 39, 0.07);
}

.question-meta {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-bottom: 10px;
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(99, 144, 241, 0.14);
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.question-text {
  margin: 0;
  font-size: 1.04rem;
  font-weight: 750;
}

.empty-state {
  text-align: center;
}

.empty-state h4 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.empty-state p {
  margin: 0;
  opacity: 0.72;
}

/* Answer options and feedback */
.options {
  display: grid;
  gap: 9px;
  list-style: none;
  padding: 0;
  margin: 16px 0;
}

.options li {
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.dark-mode .options li {
  background: rgba(255, 255, 255, 0.045);
}

.light-mode .options li {
  background: rgba(17, 24, 39, 0.035);
}

label,
.options label,
.option-text {
  display: block;
  flex: 1;
  min-width: 0;
  font-size: 0.98rem;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.options.answered li {
  cursor: default;
}

.correct {
  color: var(--success);
}

.incorrect {
  color: var(--danger);
}

.options li.correct-answer {
  background: rgba(71, 192, 110, 0.16);
  border-color: rgba(71, 192, 110, 0.32);
}

.options li.incorrect-answer {
  background: rgba(255, 76, 76, 0.16);
  border-color: rgba(255, 76, 76, 0.32);
}

.light-mode .options li.correct-answer {
  background: rgba(71, 192, 110, 0.22);
}

.light-mode .options li.incorrect-answer {
  background: rgba(255, 76, 76, 0.22);
}

/* Animations and accessibility */
@media (hover: hover) and (pointer: fine) {
  .section-nav a:hover,
  button:hover {
    transform: translateY(-1px);
  }

  .dark-mode button:hover {
    background: rgba(255, 255, 255, 0.14);
  }

  .light-mode button:hover {
    background: rgba(17, 24, 39, 0.12);
  }

  .dark-mode .section-nav a:hover,
  .light-mode .section-nav a:hover {
    background: rgba(99, 144, 241, 0.22);
    border-color: rgba(99, 144, 241, 0.52);
  }

  .dark-mode button.active:hover,
  .light-mode button.active:hover,
  .dark-mode .toggle-practice.active:hover,
  .light-mode .toggle-practice.active:hover {
    background: var(--accent-strong);
    color: #fff;
  }

  .switch-control:hover::before {
    box-shadow: 0 10px 22px rgba(99, 144, 241, 0.36);
  }

  .dark-mode .switch-control button:hover,
  .light-mode .switch-control button:hover {
    background: transparent !important;
  }

  .options:not(.answered) li:hover {
    transform: translateY(-1px);
  }

  .dark-mode .options:not(.answered) li:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(99, 144, 241, 0.36);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
  }

  .light-mode .options:not(.answered) li:hover {
    background: rgba(99, 144, 241, 0.10);
    border-color: rgba(99, 144, 241, 0.32);
    box-shadow: 0 8px 18px rgba(17, 24, 39, 0.08);
  }
}

button:active,
.section-nav a:active {
  transform: translateY(0);
}

button:focus-visible,
.section-nav a:focus-visible,
.options li:focus-visible {
  outline: 3px solid rgba(99, 144, 241, 0.45);
  outline-offset: 3px;
}

@keyframes sectionButtonClick {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035), 0 0 0 rgba(99, 144, 241, 0);
  }
  45% {
    transform: translateY(1px) scale(0.965);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035), 0 0 0 6px rgba(99, 144, 241, 0.14);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035), 0 0 0 0 rgba(99, 144, 241, 0);
  }
}

@keyframes resetButtonClick {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: 0 0 0 rgba(99, 144, 241, 0);
  }
  45% {
    transform: translateY(1px) scale(0.955);
    box-shadow: 0 0 0 7px rgba(99, 144, 241, 0.16);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 0 0 0 rgba(99, 144, 241, 0);
  }
}

.section-nav a.nav-clicking {
  animation: sectionButtonClick 0.24s ease-out;
}

#reset.reset-clicking,
.practice-actions button.practice-clicking {
  animation: resetButtonClick 0.22s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* About page */
.about-page .quiz-section {
  max-width: 860px;
  margin: 0 auto;
}

.about-card {
  margin-top: 10px;
}

.about-card p {
  margin: 0;
}

.about-card p + p {
  margin-top: 10px;
}
