/**
 * MQ Advanced Quiz - Styles
 * Wersja 0.4.0
 * 
 * Zawiera:
 * - Style bazowe
 * - Tryb ciemny
 * - Tryb nauki
 * - System kredytów
 * - Powtórka błędów
 * - Responsywność
 * - Style do druku
 */

/* =============================
 *  ZMIENNE CSS
 * ============================= */

.mq-quiz-root {
    --mq-primary: #2563eb;
    --mq-primary-dark: #1d4ed8;
    --mq-success: #22c55e;
    --mq-success-dark: #16a34a;
    --mq-danger: #ef4444;
    --mq-danger-dark: #dc2626;
    --mq-warning: #f59e0b;
    --mq-warning-dark: #d97706;
    
    --mq-bg: #ffffff;
    --mq-bg-secondary: #f9fafb;
    --mq-bg-tertiary: #f3f4f6;
    --mq-text: #111827;
    --mq-text-secondary: #4b5563;
    --mq-text-muted: #6b7280;
    --mq-border: #e5e7eb;
    --mq-border-light: #d1d5db;
    
    --mq-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --mq-shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.15);
    --mq-radius: 10px;
    --mq-radius-sm: 6px;
}

/* =============================
 *  TRYB CIEMNY
 * ============================= */

.mq-quiz-root.mq-dark-mode {
    --mq-bg: #1f2937;
    --mq-bg-secondary: #111827;
    --mq-bg-tertiary: #374151;
    --mq-text: #f9fafb;
    --mq-text-secondary: #d1d5db;
    --mq-text-muted: #9ca3af;
    --mq-border: #374151;
    --mq-border-light: #4b5563;
    
    --mq-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --mq-shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
}

/* =============================
 *  BAZOWE USTAWIENIA
 * ============================= */

.mq-quiz-root {
    max-width: 960px;
    margin: 24px auto;
    padding: 0 12px;
    font-family: inherit;
    font-size: inherit;
    color: var(--mq-text);
}

.mq-quiz-root *,
.mq-quiz-root *::before,
.mq-quiz-root *::after {
    box-sizing: border-box;
}

/* =============================
 *  EKRANY / KARTY
 * ============================= */

.mq-screen {
    background: var(--mq-bg);
    border-radius: var(--mq-radius);
    padding: 20px 20px 18px;
    box-shadow: var(--mq-shadow);
    border: 1px solid var(--mq-border);
}

.mq-screen + .mq-screen {
    margin-top: 16px;
}

.mq-screen h2 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 22px;
    font-weight: 600;
    color: var(--mq-text);
}

/* =============================
 *  NAGŁÓWKI Z PRZYCISKAMI
 * ============================= */

.mq-config-header,
.mq-quiz-header,
.mq-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.mq-config-header h2,
.mq-quiz-header h2,
.mq-summary-header h2 {
    margin-bottom: 0;
    flex: 1;
}

/* =============================
 *  POLA FORMULARZY
 * ============================= */

.mq-field {
    margin-bottom: 14px;
}

.mq-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--mq-text);
}

.mq-field input[type="text"],
.mq-field input[type="number"],
.mq-field input[type="email"],
.mq-field select,
.mq-field textarea {
    width: 100%;
    padding: 8px 10px;
    background: var(--mq-bg-secondary);
    border-radius: var(--mq-radius-sm);
    border: 1px solid var(--mq-border-light);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    font-size: 14px;
    color: var(--mq-text);
}

.mq-field input:focus,
.mq-field select:focus,
.mq-field textarea:focus {
    outline: none;
    border-color: var(--mq-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
    background: var(--mq-bg);
}

.mq-field-checkbox label {
    display: inline-flex;
    align-items: center;
    font-weight: 400;
    cursor: pointer;
}

.mq-field-checkbox input[type="checkbox"] {
    margin-right: 8px;
}

/* Błędy pól */
.mq-field-error label {
    color: var(--mq-danger);
}

.mq-field-error input,
.mq-field-error select {
    border-color: var(--mq-danger);
    background: rgba(239, 68, 68, 0.05);
}

.mq-error-text {
    margin-top: 4px;
    font-size: 12px;
    color: var(--mq-danger);
}

.mq-error-summary {
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.1);
    color: var(--mq-danger);
    padding: 8px 10px;
    margin-bottom: 12px;
    font-size: 14px;
}

.mq-error-summary ul {
    margin: 4px 0 0;
    padding-left: 18px;
}

/* =============================
 *  INSTRUKCJE
 * ============================= */

.mq-instruction {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(37, 99, 235, 0.3);
    background: rgba(37, 99, 235, 0.05);
    color: var(--mq-text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

.mq-dark-mode .mq-instruction {
    background: rgba(37, 99, 235, 0.15);
    border-color: rgba(37, 99, 235, 0.4);
}

.mq-instruction ul {
    margin: 8px 0;
    padding-left: 20px;
}

.mq-instruction li {
    margin-bottom: 4px;
}

/* =============================
 *  PRZYCISKI
 * ============================= */

.mq-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 4px 6px 4px 0;
    padding: 0.6em 1.1em;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    border: 1px solid var(--mq-border-light);
    border-radius: var(--mq-radius-sm);
    background: var(--mq-bg);
    color: var(--mq-text);
    transition: all 0.15s ease;
}

.mq-btn:hover {
    background: var(--mq-bg-secondary);
    border-color: var(--mq-primary);
}

.mq-btn-primary {
    background: var(--mq-primary);
    border-color: var(--mq-primary);
    color: #ffffff;
}

.mq-btn-primary:hover {
    background: var(--mq-primary-dark);
    border-color: var(--mq-primary-dark);
}

.mq-btn-danger {
    background: var(--mq-danger);
    border-color: var(--mq-danger);
    color: #ffffff;
}

.mq-btn-danger:hover {
    background: var(--mq-danger-dark);
    border-color: var(--mq-danger-dark);
}

.mq-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.mq-btn-small {
    font-size: 0.85em;
    padding: 0.4em 0.8em;
}

.mq-btn-icon {
    padding: 0.4em 0.6em;
    font-size: 16px;
    line-height: 1;
}

/* =============================
 *  SYSTEM KREDYTÓW
 * ============================= */

.mq-credits-info {
    margin-bottom: 12px;
}

.mq-credits-badge {
    display: inline-block;
    padding: 6px 12px;
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.3);
    border-radius: 20px;
    font-size: 14px;
    color: var(--mq-primary);
}

.mq-dark-mode .mq-credits-badge {
    background: rgba(37, 99, 235, 0.2);
}

.mq-screen-credits {
    text-align: center;
}

.mq-credits-box {
    max-width: 400px;
    margin: 20px auto;
    padding: 20px;
    border-radius: var(--mq-radius);
    border: 2px solid var(--mq-border);
}

.mq-credits-box.mq-credits-ok {
    border-color: var(--mq-success);
    background: rgba(34, 197, 94, 0.05);
}

.mq-credits-box.mq-credits-insufficient {
    border-color: var(--mq-danger);
    background: rgba(239, 68, 68, 0.05);
}

.mq-credits-box p {
    margin: 8px 0;
    font-size: 16px;
}

.mq-credits-status {
    font-weight: 600;
    margin-top: 12px !important;
}

.mq-credits-ok .mq-credits-status {
    color: var(--mq-success);
}

.mq-credits-insufficient .mq-credits-status {
    color: var(--mq-danger);
}

.mq-credits-buttons {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* =============================
 *  PASEK CZASU
 * ============================= */

.mq-timebar {
    position: relative;
    height: 20px;
    background: var(--mq-bg-tertiary);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 12px;
}

.mq-timebar-inner {
    height: 100%;
    transition: width 0.3s linear;
}

.mq-timebar-green {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

.mq-timebar-orange {
    background: linear-gradient(90deg, #f97316, #ea580c);
}

.mq-timebar-red {
    background: linear-gradient(90deg, #ef4444, #b91c1c);
}

.mq-timebar-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* =============================
 *  LICZNIK NARUSZEŃ
 * ============================= */

.mq-violation-counter {
    padding: 8px 12px;
    margin-bottom: 10px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--mq-radius-sm);
    color: var(--mq-danger);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

.mq-violation-summary {
    padding: 10px 14px;
    margin: 10px 0;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--mq-radius-sm);
    color: var(--mq-danger);
    font-size: 14px;
}

/* =============================
 *  NAWIGACJA
 * ============================= */

.mq-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
    gap: 8px;
}

/* =============================
 *  PYTANIE I ODPOWIEDZI
 * ============================= */

.mq-question-block {
    border-radius: var(--mq-radius);
    border: 1px solid var(--mq-border);
    background: var(--mq-bg-secondary);
    padding: 14px 16px;
    margin: 10px 0;
}

.mq-question-number {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--mq-primary);
    font-size: 14px;
}

.mq-question-text {
    margin-bottom: 12px;
    line-height: 1.6;
}

.mq-question-text > div {
    color: var(--mq-text);
    white-space: pre-line; /* pokaż Enter jako nową linię */
}

/* kontener mediów w pytaniu */
.mq-question-media {
    text-align: center;  /* centrowanie obrazów/wideo w pytaniu */
}

/* tylko media w pytaniu mają być na środku */
.mq-question-media .mq-media-question {
    display: inline-block;  /* działa z text-align:center */
    margin: 0 auto;
}
/* obraz/wideo w pytaniu oraz w odpowiedziach jako elementy blokowe */
.mq-media-question,
 {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.mq-question-id {
    margin-top: 10px;
    font-size: 12px;
    color: var(--mq-text-muted);
}

/* Odpowiedzi */
.mq-answers {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mq-answer {
    display: block;
    padding: 10px 12px;
    border-radius: var(--mq-radius-sm);
    border: 1px solid var(--mq-border-light);
    background: var(--mq-bg);
    cursor: pointer;
    transition: all 0.15s ease;
}

.mq-answer:hover {
    border-color: var(--mq-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.mq-answer-letter {
    font-weight: 700;
    margin-right: 6px;
    color: var(--mq-primary);
}

.mq-answer input[type="radio"] {
    margin-right: 8px;
    accent-color: var(--mq-primary);
}

.mq-answer-text {
    color: var(--mq-text);
}

/* Odpowiedzi w powtórce - podświetlenia */
.mq-answer-correct-highlight {
    background: rgba(34, 197, 94, 0.15) !important;
    border-color: var(--mq-success) !important;
}

.mq-answer-wrong-highlight {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: var(--mq-danger) !important;
}

/* MEDIA W PYTANIU */
.mq-media-question {
    /* brak sztywnego rozmiaru – zachowuje proporcje */
    width: auto;
    height: auto;

    /* ograniczamy tylko maksymalny rozmiar */
    max-width: 100%;
    max-height: 320px;

    object-fit: contain;

    /* brak czarnego tła */
    background: transparent !important;

    border-radius: 6px;
    cursor: pointer;
}

/* MEDIA W ODPOWIEDZIACH */
.mq-media-answer {
    width: auto;
    height: auto;

    max-width: 100%;
    max-height: 160px;

    object-fit: contain;

    background: transparent !important;

    border-radius: 4px;
    cursor: pointer;
}

.mq-media-clickable {
    transition: opacity 0.15s ease;
}

.mq-media-clickable:hover {
    opacity: 0.85;
}

/* =============================
 *  PASEK POSTĘPU
 * ============================= */

.mq-progress-bar,
.mq-summary-progress-bar {
    position: relative;
    height: 14px;
    background: var(--mq-bg-tertiary);
    border-radius: 999px;
    margin: 12px 0 6px;
    overflow: hidden;
}

.mq-progress-inner {
    height: 100%;
    background: linear-gradient(90deg, var(--mq-primary), var(--mq-primary-dark));
    transition: width 0.3s ease;
    border-radius: 999px;
}

.mq-progress-label {
    font-size: 12px;
    margin-top: 4px;
    color: var(--mq-text-muted);
}

/* =============================
 *  KAFELKI PYTAŃ
 * ============================= */

.mq-tiles-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 12px 0 8px;
}

.mq-tile {
    width: 32px;
    height: 32px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 4px;
    border: 1px solid var(--mq-border-light);
    background: var(--mq-bg);
    color: var(--mq-text);
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s ease;
}

.mq-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}

.mq-tile-empty {
    background: var(--mq-bg);
}

.mq-tile-answered {
    background: var(--mq-success);
    border-color: var(--mq-success-dark);
    color: #ffffff;
}

.mq-tile-review {
    background: var(--mq-warning);
    border-color: var(--mq-warning-dark);
    color: #1f2937;
}

.mq-tile-explained {
    background: var(--mq-danger);
    border-color: var(--mq-danger-dark);
    color: #ffffff;
}

/* Legenda */
.mq-tiles-legend {
    margin: 8px 0 12px;
    font-size: 13px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    color: var(--mq-text-muted);
}

.mq-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.mq-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid var(--mq-border-light);
}

.mq-legend-empty { background: var(--mq-bg); }
.mq-legend-answered { background: var(--mq-success); }
.mq-legend-review { background: var(--mq-warning); }
.mq-legend-explained { background: var(--mq-danger); }

/* =============================
 *  DOLNE AKCJE
 * ============================= */

.mq-bottom-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 14px;
    gap: 10px;
    flex-wrap: wrap;
}

/* =============================
 *  TRYB NAUKI
 * ============================= */

.mq-learning-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: var(--mq-bg-secondary);
    border-radius: var(--mq-radius-sm);
    border: 1px solid var(--mq-border);
}

.mq-stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.mq-stat-known {
    background: rgba(34, 197, 94, 0.15);
    color: var(--mq-success);
}

.mq-stat-review {
    background: rgba(245, 158, 11, 0.15);
    color: var(--mq-warning-dark);
}

.mq-stat-unknown {
    background: rgba(239, 68, 68, 0.15);
    color: var(--mq-danger);
}

.mq-stat-remaining {
    background: var(--mq-bg-tertiary);
    color: var(--mq-text-secondary);
}

.mq-attempt-info {
    font-size: 13px;
    color: var(--mq-text-muted);
    margin-bottom: 10px;
    text-align: center;
}

.mq-learning-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    justify-content: center;
}

.mq-result-correct {
    color: var(--mq-success);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
}

.mq-result-wrong {
    color: var(--mq-danger);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
}

.mq-learning-explanation {
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--mq-bg-secondary);
    border-radius: var(--mq-radius-sm);
    border-left: 3px solid var(--mq-primary);
    font-size: 14px;
}

/* Podsumowanie nauki */
.mq-learning-summary {
    margin: 15px 0;
    padding: 14px;
    background: var(--mq-bg-secondary);
    border-radius: var(--mq-radius);
    border: 1px solid var(--mq-border);
}

.mq-learning-summary h3 {
    margin: 0 0 12px;
    font-size: 16px;
    color: var(--mq-text);
}

.mq-learning-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.mq-ls-item {
    text-align: center;
    padding: 12px;
    border-radius: var(--mq-radius-sm);
}

.mq-ls-known { background: rgba(34, 197, 94, 0.1); }
.mq-ls-review { background: rgba(245, 158, 11, 0.1); }
.mq-ls-unknown { background: rgba(239, 68, 68, 0.1); }

.mq-ls-icon {
    display: block;
    font-size: 24px;
    margin-bottom: 4px;
}

.mq-ls-label {
    display: block;
    font-size: 12px;
    color: var(--mq-text-muted);
    margin-bottom: 2px;
}

.mq-ls-value {
    display: block;
    font-size: 22px;
    font-weight: 700;
}

.mq-ls-known .mq-ls-value { color: var(--mq-success); }
.mq-ls-review .mq-ls-value { color: var(--mq-warning-dark); }
.mq-ls-unknown .mq-ls-value { color: var(--mq-danger); }

/* =============================
 *  POWTÓRKA BŁĘDÓW
 * ============================= */

.mq-screen-retry {
    /* Dziedziczenie stylów */
}

.mq-retry-info {
    text-align: center;
    font-size: 13px;
    color: var(--mq-text-muted);
    margin-bottom: 12px;
    font-style: italic;
}

.mq-retry-stats {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 12px;
    padding: 8px;
    background: var(--mq-bg-secondary);
    border-radius: var(--mq-radius-sm);
}

.mq-retry-correct-count {
    color: var(--mq-success);
    font-weight: 600;
}

.mq-retry-wrong-count {
    color: var(--mq-danger);
    font-weight: 600;
}

.mq-retry-result {
    text-align: center;
    padding: 12px;
    margin: 12px 0;
    border-radius: var(--mq-radius-sm);
    font-size: 16px;
    font-weight: 600;
}

.mq-retry-correct {
    background: rgba(34, 197, 94, 0.15);
    color: var(--mq-success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.mq-retry-wrong {
    background: rgba(239, 68, 68, 0.15);
    color: var(--mq-danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.mq-retry-explanation {
    margin-top: 10px;
    padding: 10px 12px;
    background: var(--mq-bg-secondary);
    border-radius: var(--mq-radius-sm);
    border-left: 3px solid var(--mq-primary);
    font-size: 14px;
    text-align: left;
}

.mq-retry-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* =============================
 *  PODSUMOWANIE
 * ============================= */

.mq-summary-intro {
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--mq-text-secondary);
    text-align: center;
}

.mq-summary-main {
    margin-bottom: 16px;
}

.mq-summary-score {
    text-align: center;
    margin-bottom: 12px;
}

.mq-summary-score-number {
    font-size: 36px;
    font-weight: 700;
    color: var(--mq-text);
}

.mq-summary-score-percent {
    font-size: 20px;
    color: var(--mq-primary);
    font-weight: 500;
}

.mq-email-info {
    margin: 10px 0;
    padding: 8px 12px;
    background: rgba(6, 182, 212, 0.1);
    border-radius: var(--mq-radius-sm);
    border: 1px solid rgba(6, 182, 212, 0.3);
    font-size: 13px;
    color: var(--mq-text-secondary);
}

.mq-time-info {
    margin: 10px 0;
    font-size: 13px;
    color: var(--mq-text-muted);
}

.mq-time-info p {
    margin: 4px 0;
}

/* Notatka użytkownika */
.mq-user-note-section {
    margin: 16px 0;
}

.mq-user-note-section h3 {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--mq-text-secondary);
}

.mq-user-note-section textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    border: 1px solid var(--mq-border);
    border-radius: var(--mq-radius-sm);
    background: var(--mq-bg-secondary);
    color: var(--mq-text);
    font-size: 14px;
    resize: vertical;
}

.mq-user-note-section textarea:focus {
    outline: none;
    border-color: var(--mq-primary);
}

/* Przyciski podsumowania */
.mq-summary-details-toggle {
    margin: 12px 0;
    text-align: center;
}

.mq-summary-bottom-buttons {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

/* Tabela */
.mq-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 14px;
    background: var(--mq-bg);
    border-radius: var(--mq-radius);
    overflow: hidden;
}

.mq-table th,
.mq-table td {
    border: 1px solid var(--mq-border);
    padding: 8px 10px;
    text-align: left;
}

.mq-table th {
    background: var(--mq-bg-tertiary);
    font-weight: 600;
    color: var(--mq-text);
}

.mq-table tbody tr:nth-child(even) {
    background: var(--mq-bg-secondary);
}

/* Szczegóły pytań */
.mq-details-list {
    margin-top: 16px;
}

.mq-detail-question {
    border: 1px solid var(--mq-border);
    border-radius: var(--mq-radius-sm);
    padding: 12px 14px;
    margin-bottom: 12px;
    background: var(--mq-bg-secondary);
}

.mq-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.mq-detail-q-number {
    font-weight: 600;
    color: var(--mq-primary);
}

.mq-detail-points {
    font-weight: 700;
    font-size: 14px;
    padding: 2px 8px;
    border-radius: 4px;
}

.mq-detail-points.mq-points-correct {
    background: rgba(34, 197, 94, 0.15);
    color: var(--mq-success);
}

.mq-detail-points.mq-points-wrong {
    background: rgba(239, 68, 68, 0.15);
    color: var(--mq-danger);
}

.mq-detail-q-text {
    margin-bottom: 10px;
    line-height: 1.5;
  white-space: pre-line;
}

.mq-detail-answers {
    list-style: none;
    padding: 0;
    margin: 8px 0;
}

.mq-detail-answers li {
    padding: 6px 10px;
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 14px;
    border: 1px solid transparent;
}

.mq-detail-answers li.mq-correct {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.mq-detail-answers li.mq-wrong {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.mq-marker {
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
    padding: 2px 6px;
    border-radius: 3px;
}

.mq-marker-correct {
    background: var(--mq-success);
    color: #fff;
}

.mq-marker-wrong {
    background: var(--mq-danger);
    color: #fff;
}

.mq-marker-your {
    color: var(--mq-text-muted);
}

.mq-detail-explanation {
    margin-top: 10px;
    padding: 10px 12px;
    background: var(--mq-bg);
    border-radius: var(--mq-radius-sm);
    border-left: 3px solid var(--mq-primary);
    font-size: 14px;
}

/* =============================
 *  LIGHTBOX
 * ============================= */

.mq-lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.mq-lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-radius: var(--mq-radius);
    overflow: hidden;
}

.mq-lightbox-body {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mq-lightbox-media {
    max-width: 100%;
    max-height: 85vh;
}

.mq-lightbox-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 50%;
    transition: background 0.15s ease;
}

.mq-lightbox-close:hover {
    background: rgba(239, 68, 68, 0.8);
}

/* =============================
 *  MODAL
 * ============================= */

.mq-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99998;
}

.mq-dark-mode .mq-modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

.mq-modal {
    background: var(--mq-bg);
    max-width: 520px;
    width: 92%;
    max-height: 80vh;
    border-radius: var(--mq-radius);
    box-shadow: var(--mq-shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.mq-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--mq-border);
    background: var(--mq-bg-secondary);
}

.mq-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--mq-text);
}

.mq-modal-close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    color: var(--mq-text-muted);
    transition: color 0.15s ease;
}

.mq-modal-close-btn:hover {
    color: var(--mq-danger);
}

.mq-modal-body {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--mq-text-secondary);
    overflow-y: auto;
    flex: 1;
}

.mq-modal-body p {
    margin: 8px 0;
}

.mq-modal-footer {
    padding: 10px 16px 12px;
    border-top: 1px solid var(--mq-border);
    text-align: right;
    background: var(--mq-bg-secondary);
}

.mq-modal-footer .mq-btn {
    margin-left: 8px;
    margin-right: 0;
}

/* =============================
 *  RESPONSYWNOŚĆ
 * ============================= */

@media (max-width: 768px) {
    .mq-quiz-root {
        margin: 12px auto;
    }

    .mq-screen {
        padding: 14px;
    }

    .mq-nav-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .mq-nav-bar .mq-btn {
        width: 100%;
        justify-content: center;
    }

    .mq-bottom-actions {
        flex-direction: column;
    }

    .mq-bottom-actions .mq-btn {
        width: 100%;
        justify-content: center;
    }

    .mq-summary-bottom-buttons {
        flex-direction: column;
    }

    .mq-summary-bottom-buttons .mq-btn {
        width: 100%;
    }

    .mq-lightbox-content {
        max-width: 95vw;
    }

    .mq-learning-summary-grid {
        grid-template-columns: 1fr;
    }

    .mq-credits-buttons {
        flex-direction: column;
    }

    .mq-credits-buttons .mq-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .mq-tiles-container {
        gap: 4px;
    }

    .mq-tile {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }

    .mq-tiles-legend {
        flex-direction: column;
        gap: 6px;
    }

    .mq-question-block {
        padding: 10px 12px;
    }

    .mq-summary-score-number {
        font-size: 28px;
    }

    .mq-config-header,
    .mq-quiz-header,
    .mq-summary-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .mq-dark-toggle {
        align-self: flex-end;
        margin-top: -30px;
    }
}

/* Media w podsumowaniu */
.mq-detail-question .mq-media-question {
    width: 350px;
    height: 230px;
}

.mq-detail-question .mq-media-answer {
    width: 180px;
    height: 90px;
}

/* =============================
 *  DRUKOWANIE
 * ============================= */

@media print {
    body * {
        visibility: hidden;
    }

    .mq-quiz-root,
    .mq-quiz-root * {
        visibility: visible;
    }

    .mq-quiz-root {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 10px;
        box-shadow: none;
        border: none;
    }

    .mq-screen {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    /* Ukryj elementy niepotrzebne w druku */
    .mq-nav-bar,
    .mq-bottom-actions,
    .mq-tiles-container,
    .mq-tiles-legend,
    .mq-summary-bottom-buttons,
    .mq-summary-details-toggle,
    .mq-timebar,
    .mq-progress-bar,
    .mq-user-note-section,
    .mq-dark-toggle,
    .mq-btn,
    .mq-modal-overlay,
    .mq-lightbox-overlay,
    .mq-violation-counter {
        display: none !important;
    }

    .mq-detail-question {
        page-break-inside: avoid;
        border: 1px solid #ccc;
        margin-bottom: 10px;
    }

    .mq-detail-answers li {
        page-break-inside: avoid;
    }

    /* Reset kolorów dla druku */
    .mq-quiz-root {
        --mq-bg: #fff;
        --mq-bg-secondary: #f9f9f9;
        --mq-text: #000;
        --mq-border: #ccc;
    }
}
/* trochę odstępu między tekstem odpowiedzi a mediami */
.mq-answer img.mq-media-answer,
.mq-answer video.mq-media-answer,
.mq-answer iframe.mq-media-answer {
    margin-top: 8px;
}
/* ===== Lightbox: krzyżyk w prawym górnym rogu obok obrazu ===== */

.mq-lightbox-content {
    position: relative;
    box-sizing: border-box;

    /* zostaw miejsce po prawej na przycisk X (żeby nie nachodził na obraz) */
    padding: 12px 62px 12px 12px;  /* top right bottom left */

    /* jeśli masz ustawione width/height na sztywno – zostaw, to działa niezależnie */
}

/* Centrowanie samego obrazu/wideo w lightboxie */
.mq-lightbox-body {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Przycisk zamknięcia: w prawym górnym rogu, 10–15px od krawędzi */
.mq-lightbox-close {
    position: absolute;
    top: 12px;
    right: 12px;

    background: rgba(15, 23, 42, 0.95);
    border: 2px solid #facc15;
    color: #fefce8;

    font-size: 28px;
    line-height: 1;
    cursor: pointer;

    padding: 4px 10px;
    border-radius: 999px;
    box-shadow: 0 0 8px rgba(0,0,0,0.85);
    z-index: 2;
}

.mq-lightbox-close:hover {
    background: #f97316;
    border-color: #fed7aa;
    color: #111827;
}

.mq-embedded-table-wrap {
    margin: 10px 0;
    overflow-x: auto;
}

.mq-embedded-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.mq-embedded-table th,
.mq-embedded-table td {
    border: 1px solid #e5e7eb;
    padding: 6px 8px;
    text-align: left;
    vertical-align: top;
}

.mq-embedded-table th {
    background: #f3f4f6;
    font-weight: 700;
}

.mq-learning-attempts{
    margin: 6px 0 10px;
    font-size: 13px;
    color: var(--mq-text-muted);
}
/* Pokazuj nowe linie w odpowiedziach */
.mq-answer-text {
    white-space: pre-line;
}

/* W podsumowaniu (lista odpowiedzi w szczegółach) */
.mq-detail-answers li {
    white-space: pre-line;
}
.mq-answer-text { white-space: pre-line; }
.mq-detail-answers li { white-space: pre-line; }

/* Formatowanie tekstu w odpowiedziach */
.mq-answer-text strong,
.mq-answer-text b {
    font-weight: 700;
}

.mq-answer-text u {
    text-decoration: underline;
}

.mq-answer-text sup {
    font-size: 0.75em;
    vertical-align: super;
    line-height: 0;
}

.mq-answer-text sub {
    font-size: 0.75em;
    vertical-align: sub;
    line-height: 0;
}

/* To samo dla treści pytania */
.mq-question-text strong,
.mq-question-text b {
    font-weight: 700;
}

.mq-question-text u {
    text-decoration: underline;
}

.mq-question-text sup {
    font-size: 0.75em;
    vertical-align: super;
    line-height: 0;
}

.mq-question-text sub {
    font-size: 0.75em;
    vertical-align: sub;
    line-height: 0;
}

/* Informacje o nauce */
.mq-learning-info {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    text-align: center;
}

.mq-learning-info p {
    margin: 4px 0;
    color: #0369a1;
}

.mq-learning-skipped {
    font-size: 13px;
    color: #9ca3af !important;
    font-style: italic;
}

/* Dark mode */
.mq-dark-mode .mq-learning-info {
    background: #1e3a5f;
    border-color: #3b82f6;
}

.mq-dark-mode .mq-learning-info p {
    color: #93c5fd;
}

.mq-dark-mode .mq-learning-skipped {
    color: #6b7280 !important;
}