.quiz-embed-modal[hidden] {
  display: none;
}

.quiz-embed-modal__overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.72);
}

.quiz-embed-modal__dialog {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 51;
  display: grid;
  width: min(100vw - 24px, 620px);
  max-height: min(92vh, 760px);
  transform: translate(-50%, -50%);
  overflow: hidden;
  border: 1px solid hsl(var(--border));
  border-radius: 12px;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.34);
}

.quiz-embed-modal__head {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid hsl(var(--border));
  padding: 18px 20px 14px;
}

.quiz-embed-modal__title {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  line-height: 1.2;
}

.quiz-embed-modal__subtitle {
  margin: 5px 0 0;
  color: hsl(var(--muted-foreground));
  font-size: 14px;
  line-height: 1.4;
}

.quiz-embed-modal__close {
  display: inline-flex;
  height: 32px;
  width: 32px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: hsl(var(--foreground));
  cursor: pointer;
}

.quiz-embed-modal__close:hover {
  background: hsl(var(--accent));
}

.quiz-embed-modal__body {
  display: grid;
  gap: 18px;
  overflow-y: auto;
  padding: 18px 20px 20px;
}

.quiz-embed-modal__section {
  display: grid;
  gap: 10px;
}

.quiz-embed-modal__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
}

.quiz-embed-modal__copy {
  display: inline-flex;
  height: 30px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  padding: 0 11px;
}

.quiz-embed-modal__copy:hover {
  filter: brightness(0.96);
}

.quiz-embed-modal__code {
  min-height: 138px;
  width: 100%;
  resize: vertical;
  border: 1px solid hsl(var(--border));
  border-radius: 10px;
  background: hsl(var(--secondary) / 0.55);
  color: hsl(var(--foreground));
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
  outline: none;
  padding: 12px;
}

.quiz-embed-modal__code:focus {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 2px hsl(var(--primary) / 0.18);
}

.quiz-embed-modal__options {
  display: grid;
  gap: 8px;
}

.quiz-embed-modal__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-radius: 10px;
  background: hsl(var(--secondary) / 0.48);
  padding: 11px 12px;
}

.quiz-embed-modal__option-text {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.quiz-embed-modal__option-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
}

.quiz-embed-modal__option-description {
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  line-height: 1.35;
}

.quiz-embed-modal__switch {
  position: relative;
  display: inline-flex;
  height: 22px;
  width: 40px;
  flex: 0 0 auto;
  cursor: pointer;
  align-items: center;
}

.quiz-embed-modal__switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.quiz-embed-modal__switch span {
  position: relative;
  display: block;
  height: 22px;
  width: 40px;
  border-radius: 999px;
  background: hsl(var(--muted));
  transition: background-color 160ms ease;
}

.quiz-embed-modal__switch span::after {
  position: absolute;
  left: 3px;
  top: 3px;
  height: 16px;
  width: 16px;
  border-radius: 999px;
  background: hsl(var(--background));
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  content: "";
  transition: transform 160ms ease;
}

.quiz-embed-modal__switch input:checked + span {
  background: hsl(var(--primary));
}

.quiz-embed-modal__switch input:checked + span::after {
  transform: translateX(18px);
}

.quiz-embed-modal__terms {
  margin: 0;
  border-radius: 8px;
  background: hsl(var(--secondary) / 0.48);
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  line-height: 1.45;
  padding: 10px 11px;
}

.quiz-embed-modal__terms a {
  color: hsl(var(--foreground));
  font-weight: 600;
  text-decoration: none;
}

.quiz-embed-modal__terms a:hover {
  color: hsl(var(--primary));
}

@media (max-width: 640px) {
  .quiz-embed-modal__dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    border-radius: 10px;
  }

  .quiz-embed-modal__head,
  .quiz-embed-modal__body {
    padding-left: 14px;
    padding-right: 14px;
  }
}
