/* =========================================================
   LQ Quiz — Modern UI Theme (Drop-in)
   ========================================================= */

.lq-aq-quiz {
  /* Design Tokens */
  --lq-bg: #ffffff;
  --lq-surface: #ffffff;
  --lq-surface-2: #f8fafc;
  --lq-border: #e5e7eb;
  --lq-text: #0f172a;
  --lq-muted: #64748b;

  --lq-primary: #9b79b4;
  --lq-primary-2: #8865a2;
  --lq-primary-soft: rgba(155, 121, 180, 0.14);

  --lq-success: #bad480;
  --lq-danger: #ec646b;

  --lq-radius: 14px;
  --lq-radius-sm: 10px;

  --lq-shadow: 0 10px 30px rgba(2, 6, 23, 0.08);
  --lq-shadow-sm: 0 6px 18px rgba(2, 6, 23, 0.08);

  --lq-ring: 0 0 0 4px rgba(155, 121, 180, 0.22);

  max-width: 100%;
  margin: 2rem auto;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--lq-text);
}

/* Optional: Dark mode (falls dein Theme das unterstützt) 
@media (prefers-color-scheme: dark) {
  .lq-aq-quiz {
    --lq-bg: #0b1220;
    --lq-surface: #0f172a;
    --lq-surface-2: #111c33;
    --lq-border: rgba(148, 163, 184, 0.18);
    --lq-text: #e2e8f0;
    --lq-muted: #94a3b8;
    --lq-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
    --lq-shadow-sm: 0 10px 28px rgba(0, 0, 0, 0.25);
  }
}
*/

/* Karten */
.lq-aq-question-card {
  background: var(--lq-surface);
  border-radius: var(--lq-radius);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--lq-border);
  box-shadow: var(--lq-shadow);
}

/* Ruhiger, “eingebetteter” Look falls gewünscht */
.lq-aq-no-shadow .lq-aq-question-card {
  box-shadow: none;
  background: transparent;
  border: 1px solid var(--lq-border);
}

/* Header */
.lq-aq-question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  margin-bottom: .65rem;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--lq-muted);
}

.lq-aq-question-type-label {
  padding: .2rem .6rem;
  border-radius: 999px;
  background: var(--lq-primary-soft);
  color: var(--lq-primary);
  font-size: .72rem;
  font-weight: 650;
}

/* Frage */
.lq-aq-question-text {
  font-size: 1.05rem;
  line-height: 1.45;
  margin-bottom: .55rem;
}

.lq-aq-question-description {
  font-size: .98rem;
  font-weight: 400;
  line-height: 1.45;
  margin-bottom: .55rem;
  color: var(--lq-text);
}

/* Hint Badge */
.lq-aq-question-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .25rem .7rem;
  border-radius: 999px;
  background: rgba(155, 121, 180, 0.12);
  color: var(--lq-primary);
  font-size: .82rem;
  font-weight: 650;
  margin-bottom: .95rem;
}

/* Antworten Grid */
.lq-aq-answers {
  display: grid;
  gap: .75rem;
}

.lq-aq-answers.lq-aq-answers-horizontal {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
  gap: .75rem !important;
}

@media (max-width: 700px) {
  .lq-aq-answers.lq-aq-answers-horizontal {
    grid-template-columns: 1fr !important;
  }
}

/* Antwort-Kachel */
.lq-aq-answer-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: .75rem;
  padding: 1rem 1rem;
  border-radius: var(--lq-radius);
  border: 1px solid var(--lq-border);
  background: var(--lq-surface);
  cursor: pointer;
  box-shadow: var(--lq-shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; /* schneller Tap auf Mobile */
  min-height: 80px; /* Mindesthöhe für bessere Darstellung */
}

/* Text-only Kacheln: zentriert und ausfüllend */
.lq-aq-answer-option:not(:has(.lq-aq-answer-image-wrap)) {
  justify-content: center;
  align-items: center;
  min-height: 100px;
}

.lq-aq-answer-option:not(:has(.lq-aq-answer-image-wrap)) .lq-aq-answer-text {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  flex: 1;
}

/* Hover (Desktop) */
@media (hover: hover) {
  .lq-aq-answer-option:hover {
    border-color: rgba(155, 121, 180, 0.45);
    box-shadow: 0 12px 28px rgba(155, 121, 180, 0.18);
    transform: translateY(-1px);
  }
}

/* Focus sichtbar (Keyboard) */
.lq-aq-answer-option:focus-visible {
  outline: none;
  box-shadow: var(--lq-shadow-sm), var(--lq-ring);
  border-color: rgba(155, 121, 180, 0.55);
}

/* Input unsichtbar */
.lq-aq-answer-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Selected */
.lq-aq-answer-option:has(input:checked) {
  border-color: rgba(155, 121, 180, 0.75);
  box-shadow: 0 16px 34px rgba(155, 121, 180, 0.22);
  background: linear-gradient(180deg, rgba(155, 121, 180, 0.10), transparent 42%);
}

/* Bild */
.lq-aq-answer-image-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.lq-aq-answer-image-wrap img {
  width: 100%;
  max-width: 240px;
  height: auto;
  border-radius: var(--lq-radius-sm);
  object-fit: contain; /* Ändere von cover zu contain, damit Bild vollständig sichtbar */
  display: block;
  border: 1px solid var(--lq-border);
}

/* Antwort-Kachel mit Bild: passt sich Bildgröße an */
.lq-aq-answer-option:has(.lq-aq-answer-image-wrap) {
  align-items: flex-start;
  justify-content: flex-start;
  min-height: auto;
}

.lq-aq-answer-option:has(.lq-aq-answer-image-wrap) .lq-aq-answer-content {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: .5rem;
}

.lq-aq-answer-option:has(.lq-aq-answer-image-wrap) .lq-aq-answer-text {
  text-align: center;
  padding-top: .5rem;
}

/* Disabled States */
.lq-aq-answer-option.lq-aq-answer-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  background: var(--lq-surface-2);
  border-color: var(--lq-border);
  box-shadow: none;
}

/* Feedback */
.lq-aq-question-feedback {
  margin-top: .75rem;
  font-size: .95rem;
  padding: .55rem .75rem;
  border-radius: var(--lq-radius-sm);
  border: 1px solid transparent;
  background: var(--lq-surface-2);
  color: var(--lq-text);
  display: none;
}

.lq-aq-question-feedback:not(:empty) {
  display: block;
}

.lq-aq-feedback-correct {
  background: rgba(186, 212, 128, 0.18);
  border-color: rgba(186, 212, 128, 0.55);
  color: var(--lq-text);
}

.lq-aq-feedback-incorrect {
  background: rgba(236, 100, 107, 0.14);
  border-color: rgba(236, 100, 107, 0.55);
  color: var(--lq-text);
}

/* Markierungen */
.lq-aq-ans-correct,
.lq-aq-drop-correct,
.lq-aq-sort-correct {
  border-color: rgba(186, 212, 128, 0.95) !important;
  background: rgba(186, 212, 128, 0.16) !important;
}

.lq-aq-ans-incorrect,
.lq-aq-drop-incorrect,
.lq-aq-sort-incorrect {
  border-color: rgba(236, 100, 107, 0.95) !important;
  background: rgba(236, 100, 107, 0.12) !important;
}

/* Buttons */
.lq-aq-question-eval,
.lq-aq-quiz-submit {
  border: none;
  border-radius: 999px;
  background: var(--lq-primary);
  color: white;
  font-weight: 650;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  box-shadow: 0 12px 24px rgba(155, 121, 180, 0.22);
  -webkit-tap-highlight-color: transparent;
}

.lq-aq-question-eval {
  margin-top: .85rem;
  padding: .55rem 1.15rem;
  font-size: .95rem;
  align-self: flex-end;
}

.lq-aq-quiz-submit {
  margin-top: 1.1rem;
  padding: .7rem 1.5rem;
  font-size: 1rem;
}

@media (hover: hover) {
  .lq-aq-question-eval:hover,
  .lq-aq-quiz-submit:hover {
    background: var(--lq-primary-2);
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(155, 121, 180, 0.28);
  }
}

.lq-aq-question-eval:active,
.lq-aq-quiz-submit:active {
  transform: translateY(0px) scale(0.99);
}

.lq-aq-question-eval:focus-visible,
.lq-aq-quiz-submit:focus-visible {
  outline: none;
  box-shadow: 0 16px 30px rgba(155, 121, 180, 0.28), var(--lq-ring);
}

/* Quiz Ergebnis-Box */
.lq-aq-quiz-result {
  margin-top: 1.1rem;
  font-size: 1rem;
  padding: 1.25rem;
  border-radius: var(--lq-radius);
  background: #f3f0ff;
  color: #6b21a8;
  border: 1px solid #c4b5fd;
  display: none;
}

.lq-aq-quiz-result.lq-aq-quiz-result-visible {
  display: block;
}

.lq-aq-quiz-result-summary {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #c4b5fd;
}

.lq-aq-quiz-result-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.lq-aq-quiz-result-item {
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--lq-radius-sm);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lq-aq-quiz-result-item:hover {
  background: #f9fafb;
  border-color: #cbd5e1;
}

.lq-aq-quiz-result-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.lq-aq-quiz-result-item-title {
  flex: 1;
  font-weight: 500;
  font-size: 0.95rem;
}

.lq-aq-quiz-result-item-status {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.lq-aq-quiz-result-item-status.correct {
  background: rgba(186, 212, 128, 0.28);
  color: #4d5c1f;
  border: 1px solid #bad480;
}

.lq-aq-quiz-result-item-status.incorrect {
  background: rgba(236, 100, 107, 0.22);
  color: #7f1d1d;
  border: 1px solid #ec646b;
}

.lq-aq-quiz-result-item-toggle {
  font-size: 0.9rem;
  color: #6b7280;
  transition: transform 0.2s ease;
}

.lq-aq-quiz-result-item.expanded .lq-aq-quiz-result-item-toggle {
  transform: rotate(180deg);
}

.lq-aq-quiz-result-item-feedback {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
  display: none;
  font-size: 0.9rem;
  line-height: 1.5;
}

.lq-aq-quiz-result-item.expanded .lq-aq-quiz-result-item-feedback {
  display: block;
}

.lq-aq-quiz-result-item-feedback.correct {
  color: #4d5c1f;
}

.lq-aq-quiz-result-item-feedback.incorrect {
  color: #7f1d1d;
}

/* =========================================================
   Matching / Cloze / Sort — Touch-friendly improvements
   ========================================================= */

/* Größere Touch Targets + weniger "zitteriges" Verhalten */
.lq-aq-match-right-item,
.lq-aq-cloze-answer-card,
.lq-aq-sort-item {
  touch-action: none; /* wichtig für Pointer-Drag */
  min-height: 44px; /* Mindestgröße für Touch-Targets */
  min-width: 44px;
  -webkit-tap-highlight-color: transparent; /* Entferne Standard-Tap-Highlight */
  user-select: none; /* Verhindere Textauswahl beim Ziehen */
}

/* Touch-Feedback während des Ziehens */
.lq-aq-match-right-item.dragging,
.lq-aq-cloze-answer-card.dragging,
.lq-aq-sort-item.dragging {
  opacity: 0.5;
  transform: scale(0.95);
  transition: opacity 0.1s, transform 0.1s;
}

/* Größere Touch-Targets für Dropzones */
.lq-aq-match-dropzone,
.lq-aq-cloze-gap {
  min-height: 44px;
  min-width: 44px;
  touch-action: none;
}

/* Matching Grid besser auf Tablet */
.lq-aq-match-column {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
  justify-items: center;
}

/* =========================================================
   MATCH – Layout: Links oben als Box (Text/Bild + Dropzone daneben)
   Unten: Pool mit rechten Kacheln (zum Ziehen)
   ========================================================= */

.lq-aq-match-slot-number {
  display: none !important;
}

.lq-aq-question-card[data-question-type="match"] .lq-aq-match-columns {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Obere Box */
.lq-aq-question-card[data-question-type="match"] .lq-aq-match-left {
  order: 1;
  display: grid;
  grid-template-columns: 1fr;
  justify-items: stretch;
  gap: 0.75rem;
  padding: 0.9rem;
  background: var(--lq-surface-2);
  border: 1px solid var(--lq-border);
  border-radius: var(--lq-radius);
}

@media (min-width: 1000px) {
  /* Zwei Paare pro Reihe (Desktop) */
  .lq-aq-question-card[data-question-type="match"] .lq-aq-match-left {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
  }
}

/* Jede Zeile: links Inhalt, rechts Dropzone */
.lq-aq-question-card[data-question-type="match"] .lq-aq-match-left-item {
  display: grid;
  /* Inhalt + Dropzone direkt nebeneinander, Dropzone kompakter damit 2 pro Reihe passen */
  grid-template-columns: minmax(0, 1fr) clamp(150px, 42%, 220px);
  gap: 0;
  align-items: stretch;
  padding: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: var(--lq-surface);
  border: 1px solid var(--lq-border);
  border-radius: var(--lq-radius-sm);
  box-shadow: var(--lq-shadow-sm);
  overflow: hidden; /* gemeinsamer Rahmen (beide Kacheln) */
}

/* Linke Kachel (Inhalt) */
.lq-aq-question-card[data-question-type="match"] .lq-aq-match-left-cell {
  grid-column: 1;
  padding: 0.75rem;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lq-aq-question-card[data-question-type="match"] .lq-aq-match-left-image {
  flex: 0 0 auto;
}

.lq-aq-question-card[data-question-type="match"] .lq-aq-match-left-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.lq-aq-question-card[data-question-type="match"] .lq-aq-match-left-text {
  font-size: 1rem;
  font-weight: 650;
  color: var(--lq-text);
}

/* Dropzone in Spalte 2 (neben dem linken Inhalt) */
.lq-aq-question-card[data-question-type="match"] .lq-aq-match-dropzone {
  grid-column: 2;
  grid-row: 1;
  min-height: 110px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border-radius: 0;
  border: 2px dashed rgba(100, 116, 139, 0.45);
  background: rgba(148, 163, 184, 0.10);
  padding: 0.65rem;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  align-self: stretch;
  position: relative;
  justify-self: stretch;
  border-left: 1px solid var(--lq-border); /* optische Trennung der beiden Kacheln */
}

/* Locked state: wirklich nicht anklickbar/ziehbar wirken */
.lq-aq-match-dropzone.lq-aq-dropzone-disabled,
.lq-aq-cloze-gap.lq-aq-dropzone-disabled {
  pointer-events: none;
}

.lq-aq-match-right-item.lq-aq-match-item-disabled {
  cursor: default;
  opacity: 0.9;
  pointer-events: none;
}

.lq-aq-question-card[data-question-type="match"] .lq-aq-match-dropzone:empty::before {
  content: "Karte hier ablegen";
  color: var(--lq-muted);
  font-size: 0.92rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lq-aq-question-card[data-question-type="match"] .lq-aq-match-dropzone.lq-aq-drop-hover {
  border-color: rgba(155, 121, 180, 0.9);
  background: rgba(155, 121, 180, 0.12);
  transform: none; /* überschreibt globale Dropzone-Scale, die sonst raus ragt */
}

/* Visuelles "abgeblendet" wenn eine Match-Frage gesperrt ist */
.lq-aq-question-card.lq-aq-match-disabled .lq-aq-match-right {
  opacity: 0.65;
}
.lq-aq-question-card.lq-aq-match-disabled .lq-aq-match-left {
  opacity: 0.85;
}

/* Unten: Pool der rechten Kacheln */
.lq-aq-question-card[data-question-type="match"] .lq-aq-match-right {
  order: 2;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  gap: 1rem;
  padding: 0.5rem 0.25rem;
}

.lq-aq-question-card[data-question-type="match"] .lq-aq-match-right-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 120px;
  min-width: 200px;
  flex: 0 0 auto;
  padding: 1rem;
  border-radius: var(--lq-radius-sm);
  border: 1px solid var(--lq-border);
  background: var(--lq-surface);
  cursor: grab;
  box-shadow: var(--lq-shadow-sm);
}

/* Wenn im Slot: Pool-Kachel soll verschwinden */
.lq-aq-question-card[data-question-type="match"] .lq-aq-match-column.lq-aq-match-right > .lq-aq-match-right-item.lq-aq-match-used {
  display: none !important;
}

/* Kachel in Dropzone füllt die Fläche */
.lq-aq-question-card[data-question-type="match"] .lq-aq-match-dropzone > .lq-aq-match-right-item {
  width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
  cursor: pointer;
  margin: 0;
}

@media (max-width: 900px) {
  .lq-aq-question-card[data-question-type="match"] .lq-aq-match-left-item {
    grid-template-columns: 1fr;
  }
  .lq-aq-question-card[data-question-type="match"] .lq-aq-match-dropzone {
    grid-column: 1;
    grid-row: auto;
    border-left: 0;
    border-top: 1px solid var(--lq-border);
  }
}

@media (max-width: 900px) {
  .lq-aq-match-column {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }
}

/* Dropzones deutlicher, aber ruhig */
.lq-aq-match-dropzone,
.lq-aq-cloze-gap {
  border: 2px dashed rgba(100, 116, 139, 0.45);
  background: rgba(148, 163, 184, 0.10);
}

.lq-aq-match-dropzone.lq-aq-drop-hover,
.lq-aq-cloze-gap.lq-aq-drop-hover {
  border-color: rgba(155, 121, 180, 0.9);
  background: rgba(155, 121, 180, 0.12);
  transform: scale(1.02);
}

/* Sort-Referenzbild */
.lq-aq-sort-reference-image-wrapper {
  width: 100%;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.lq-aq-sort-reference-image {
  width: 100%;
  text-align: center;
  padding: 1rem;
  background: var(--lq-surface-2);
  border-radius: var(--lq-radius-sm);
  border: 1px solid var(--lq-border);
}

.lq-aq-sort-reference-image img {
  max-width: 100%;
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: var(--lq-radius-sm);
  object-fit: contain;
}

/* Nummerierte Auswahl-Reihe für Sort-Fragen */
.lq-aq-sort-wrapper {
  display: flex;
  flex-direction: column;
}

/* Auswahl zuerst (Reihenfolge ist sofort sichtbar), verfügbare Karten darunter */
.lq-aq-sort-wrapper > .lq-aq-sort-selected-items {
  order: 1;
}
.lq-aq-sort-wrapper > .lq-aq-sort-items {
  order: 2;
}

.lq-aq-sort-selected-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 0 0.25rem;
  margin-top: 0.5rem;
}

/* Slots = fixe Felder (1..n), in die Kacheln gelegt werden */
.lq-aq-sort-slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  padding: 0.25rem 0;
}

.lq-aq-sort-slot {
  position: relative;
  min-height: 120px;
  border: 2px dashed var(--lq-border);
  border-radius: var(--lq-radius-sm);
  background: linear-gradient(180deg, var(--lq-surface-2), rgba(0,0,0,0));
  display: flex;
  align-items: stretch;
}

.lq-aq-sort-slot.is-over {
  border-color: var(--lq-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.lq-aq-sort-slot-number {
  position: absolute;
  top: -0.75rem;
  left: -0.75rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--lq-surface);
  color: var(--lq-muted);
  border: 1px solid var(--lq-border);
  border-radius: 50%;
  font-weight: bold;
  font-size: 1rem;
  z-index: 1;
}

.lq-aq-sort-selected-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 120px;
  min-width: 0;
  width: 100%;
  padding: 1rem;
  border-radius: var(--lq-radius-sm);
  background: var(--lq-surface-2);
  border: 2px solid var(--lq-primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Wenn Kacheln in Slots liegen: volle Breite/Height */
.lq-aq-sort-slot > .lq-aq-sort-item {
  min-width: 0;
  width: 100%;
  height: 100%;
}

.lq-aq-sort-item-number {
  position: absolute;
  top: -0.75rem;
  left: -0.75rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--lq-primary);
  color: white;
  border-radius: 50%;
  font-weight: bold;
  font-size: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

/* Drag & Drop (Pointer) */
.lq-aq-sort-dragging {
  opacity: 0.25;
}

/* Während Drag: Touch-Scrolling/Selection deaktivieren (Tablet/iOS) */
.lq-aq-sort-dnd-active .lq-aq-sort-item,
.lq-aq-sort-dnd-active .lq-aq-sort-slot {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Browser-natives Image Drag deaktivieren (sonst blockiert es Pointer-DnD) */
.lq-aq-sort-item img {
  -webkit-user-drag: none;
  user-drag: none;
}

.lq-aq-sort-drag-ghost {
  position: fixed;
  z-index: 999999;
  pointer-events: none;
  opacity: 0.9;
  transform: translateZ(0);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

/* Sort Items: Standard in einer Reihe mit horizontalem Scrollen */
.lq-aq-sort-items {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  gap: 1rem;
  padding: 0.5rem 0; /* Etwas Padding für Scrollbar */
}

/* Sort-Item Basis-Styles */
.lq-aq-sort-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 120px;
  min-width: 200px;
  flex: 0 0 auto; /* Nicht wachsen oder schrumpfen */
  padding: 1rem;
  border-radius: var(--lq-radius-sm);
  border: 1px solid var(--lq-border);
  background: var(--lq-surface);
  cursor: pointer;
  box-shadow: var(--lq-shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease;
}

.lq-aq-sort-item.lq-aq-sort-item-disabled,
.lq-aq-sort-disabled .lq-aq-sort-item {
  cursor: default;
  opacity: 0.92;
}

/* Visuelles "abgeblendet" wenn eine Sort-Frage gesperrt ist */
.lq-aq-question-card.lq-aq-sort-disabled .lq-aq-sort-wrapper {
  opacity: 0.85;
}

/* Sort-Item mit Bild: passt sich Bildgröße an */
.lq-aq-sort-item:has(.lq-aq-sort-item-image) {
  align-items: center;
  justify-content: flex-start;
  min-height: auto;
  gap: .5rem;
}

.lq-aq-sort-item:has(.lq-aq-sort-item-image) .lq-aq-sort-item-image {
  flex-shrink: 0;
}

.lq-aq-sort-item:has(.lq-aq-sort-item-image) .lq-aq-sort-item-image img {
  object-fit: contain; /* Ändere von cover zu contain, damit Bild vollständig sichtbar */
  width: 100%;
  height: 100%;
}

.lq-aq-sort-item:has(.lq-aq-sort-item-image) .lq-aq-sort-item-label {
  text-align: center;
  padding-top: .5rem;
  font-size: .95rem;
}

/* Text-only Sort-Items: zentriert und ausfüllend */
.lq-aq-sort-item:not(:has(.lq-aq-sort-item-image)) {
  justify-content: center;
  align-items: center;
  min-height: 100px;
}

.lq-aq-sort-item:not(:has(.lq-aq-sort-item-image)) .lq-aq-sort-item-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  flex: 1;
  font-size: 1rem;
  font-weight: 500;
}

/* Sort Items: Mehrzeilig (wenn explizit deaktiviert) */
.lq-aq-sort-items:not(.lq-aq-sort-single-row) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  overflow: visible;
  flex-wrap: wrap;
}

.lq-aq-sort-items:not(.lq-aq-sort-single-row) .lq-aq-sort-item {
  min-width: auto;
  flex: 1 1 auto;
}

/* Fragetitel ausblenden */
.lq-aq-hide-question-title .lq-aq-question-text {
  display: none !important;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .lq-aq-quiz * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================
   LQ Quiz – Tablet Tile Fix (Cloze + Matching)
   (unter dein bestehendes CSS setzen)
   ========================================================= */

/* ---------- CLOZE: Text + Lücken als Kachel-Grid ---------- */

/* Der Fließtext bleibt normal, aber die Lücken werden als Tiles gerendert */
.lq-aq-question-card[data-question-type="cloze"] .lq-aq-cloze-text-wrapper{
  line-height: 1.7;
}

/* Optional: Wenn du die Lücken NICHT im Fließtext "inline" willst,
   sondern als eigene Kachel-Zeile/Block: */
.lq-aq-question-card[data-question-type="cloze"] .lq-aq-cloze-text-wrapper{
  display: block;
}

/* Die Lücke selbst als echte Kachel */
.lq-aq-question-card[data-question-type="cloze"] .lq-aq-cloze-gap{
  display: flex;                 /* statt inline-block */
  align-items: center;
  justify-content: center;
  text-align: center;

  /* Tile */
  min-width: 160px;
  min-height: 88px;
  padding: 0.75rem;
  margin: 0.35rem 0.35rem;       /* damit es nicht “quetscht” */
  border-radius: 12px;

  /* Look */
  border: 2px dashed #cbd5e1;
  background: #f9fafb;

  /* Tablet-friendly */
  touch-action: none;
}

/* Placeholder zentriert */
.lq-aq-question-card[data-question-type="cloze"] .lq-aq-cloze-gap:empty::before{
  content: "Karte hier ablegen";
  color: #9ca3af;
  font-size: 0.9rem;
}

/* Wenn eine Karte in der Lücke liegt: sauber ausfüllen */
.lq-aq-question-card[data-question-type="cloze"] .lq-aq-cloze-gap:not(:empty){
  border-style: solid;
  padding: 0.5rem;
}

/* Cloze Antworten Wrapper = Kachelbereich */
.lq-aq-question-card[data-question-type="cloze"] .lq-aq-cloze-answers-wrapper{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
  align-items: stretch;

  padding: 1rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

/* Antwortkarte als echte Kachel */
.lq-aq-question-card[data-question-type="cloze"] .lq-aq-cloze-answer-card{
  display: flex;                 /* statt inline */
  align-items: center;
  justify-content: center;
  text-align: center;

  min-height: 88px;
  padding: 0.85rem 1rem;

  border-radius: 12px;
  border: 2px solid #e5e7eb;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);

  user-select: none;
  touch-action: none;
}

/* Karte in Gap: nicht inline klein schrumpfen lassen */
.lq-aq-question-card[data-question-type="cloze"] .lq-aq-cloze-gap > .lq-aq-cloze-answer-card{
  width: 100%;
  min-height: 74px;
  padding: 0.6rem 0.75rem;

  border: 1px solid #e5e7eb;
  background: #ffffff;
  box-shadow: none;
  display: flex;                 /* WICHTIG: nicht inline-block */
}

/* Hover nur Desktop */
@media (hover: hover) {
  .lq-aq-question-card[data-question-type="cloze"] .lq-aq-cloze-answer-card:hover{
    transform: translateY(-2px);
    border-color: #9b79b4;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  }
}

/* Tablet: Kacheln größer + weniger Spalten */
@media (max-width: 900px){
  .lq-aq-question-card[data-question-type="cloze"] .lq-aq-cloze-answers-wrapper{
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }
}
@media (max-width: 600px){
  .lq-aq-question-card[data-question-type="cloze"] .lq-aq-cloze-answers-wrapper{
    grid-template-columns: 1fr;
  }
  .lq-aq-question-card[data-question-type="cloze"] .lq-aq-cloze-gap{
    min-width: 100%;
    margin: 0.35rem 0;
  }
}

/* ---------- MATCHING: Legacy Tile-Regeln (nur Pool-Kacheln) ---------- */

/* Diese Regeln galten für ein älteres Grid-Layout. In der aktuellen UI ist die linke Seite
   eine volle Zeile (linke Option + Dropzone daneben). Deshalb hier nur noch für die rechte Pool-Reihe. */

.lq-aq-question-card[data-question-type="match"] .lq-aq-match-column.lq-aq-match-right{
  gap: 1rem;
}

/* Inhalt der Dropzone (geklohnte rechte Karte) soll die Fläche füllen */
.lq-aq-question-card[data-question-type="match"] .lq-aq-match-dropzone > .lq-aq-match-right-item{
  width: 100% !important;
  max-width: 100% !important;
  aspect-ratio: auto !important;     /* sonst quetscht */
  min-height: 96px;
  padding: 0.75rem;
}

/* Rechte Karten als Tiles: weniger “quadratisch erzwingen” auf Tablet */
.lq-aq-question-card[data-question-type="match"] .lq-aq-match-right-item,
/* Linke Zeilen dürfen NICHT auf 220px begrenzt werden (sonst überlappt die Dropzone). */
.lq-aq-question-card[data-question-type="match"] .lq-aq-match-left-item{
  max-width: 100%;
  min-height: 0;
}

@media (max-width: 900px){
  .lq-aq-question-card[data-question-type="match"] .lq-aq-match-right-item,
  .lq-aq-question-card[data-question-type="match"] .lq-aq-match-left-item{
    max-width: none;
  }
}

/* Hover Effekt nur Desktop */
@media (hover: hover) {
  .lq-aq-question-card[data-question-type="match"] .lq-aq-match-right-item:hover{
    transform: translateY(-2px);
  }
}
