.tqm-quiz-app {
    font-family: "Tahoma", "Segoe UI", sans-serif;
    max-width: 720px;
    margin: 0 auto;
    direction: rtl;
    text-align: right;
    --tqm-teal-dark: #0e3a53;
    --tqm-teal: #14587c;
    --tqm-teal-light: #1c6f9c;
    --tqm-accent-green: #3ddc84;
    --tqm-blue-select: #1c6f9c;
    --tqm-blue-select-bg: #eaf4fa;
}

.tqm-intro-screen {
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 10px;
    padding: 28px;
}
.tqm-meta { list-style: none; padding: 0; margin: 16px 0; }
.tqm-meta li { padding: 4px 0; }

.tqm-btn {
    padding: 10px 20px;
    border-radius: 6px;
    border: 1px solid #ccc;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 15px;
}
.tqm-btn:focus-visible { outline: 3px solid #2271b1; outline-offset: 2px; }
.tqm-btn-primary { background: var(--tqm-teal); color: #fff; border-color: var(--tqm-teal); }
.tqm-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Exam screen shell ---- */
.tqm-exam-screen {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    background: #fff;
}

.tqm-header-bar {
    background: linear-gradient(180deg, var(--tqm-teal-dark), var(--tqm-teal));
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
}
.tqm-exam-title { font-weight: bold; font-size: 16px; }
.tqm-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 20px;
    font-weight: bold;
    color: var(--tqm-accent-green);
    direction: ltr;
}
.tqm-timer-icon { font-size: 18px; }

.tqm-progress-band {
    background: linear-gradient(180deg, #e9f3f8, #ffffff);
    text-align: center;
    padding: 12px;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #eee;
}

.tqm-question-card {
    padding: 28px 24px 12px;
}
.tqm-question-area h3 {
    text-align: center;
    font-size: 17px;
    line-height: 1.8;
    margin-bottom: 24px;
}

.tqm-choices { display: flex; flex-direction: column; gap: 12px; padding: 0 4px 20px; }
.tqm-choice {
    display: block;
    padding: 14px 18px;
    border: 2px solid #dbe4ea;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    font-size: 15px;
}
.tqm-choice:hover { border-color: #b7cede; }
.tqm-choice.tqm-selected {
    border-color: var(--tqm-blue-select);
    background: var(--tqm-blue-select-bg);
    font-weight: 600;
}
.tqm-choice input { accent-color: var(--tqm-blue-select); margin-left: 10px; }

/* ---- Bottom action bar (matches reference: 3 segments, dark teal) ---- */
.tqm-bottom-bar {
    display: flex;
    background: var(--tqm-teal-dark);
    color: #fff;
}
.tqm-bottom-btn {
    flex: 1;
    background: transparent;
    border: none;
    border-left: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    padding: 16px 8px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.tqm-bottom-btn:last-child { border-left: none; }
.tqm-bottom-btn:hover { background: rgba(255,255,255,0.08); }
.tqm-bottom-btn-primary { background: var(--tqm-teal-light); font-weight: bold; }
.tqm-bottom-btn-primary:hover { background: var(--tqm-teal-light); filter: brightness(1.1); }
.tqm-flag-icon { font-size: 16px; }
.tqm-flag-active .tqm-flag-icon { color: #ffce54; }

.tqm-secondary-nav {
    display: flex;
    justify-content: space-between;
    padding: 10px 16px;
    background: #fafafa;
    border-top: 1px solid #eee;
}
.tqm-link-btn {
    background: none;
    border: none;
    color: var(--tqm-teal);
    cursor: pointer;
    font-size: 13px;
    text-decoration: underline;
}
.tqm-submit-link { color: #b3261e; }

/* ---- Question grid overlay ---- */
.tqm-grid-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center; z-index: 9998;
    padding: 20px;
}
.tqm-grid-panel {
    background: #fff; border-radius: 10px; padding: 20px; max-width: 480px; width: 100%;
    max-height: 80vh; overflow-y: auto;
}
.tqm-grid-panel-header {
    display: flex; justify-content: space-between; align-items: center;
    font-weight: bold; font-size: 16px; margin-bottom: 12px;
}
.tqm-close-btn { background: none; border: none; font-size: 22px; cursor: pointer; line-height: 1; }
.tqm-legend { display: flex; gap: 14px; font-size: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.tqm-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: 4px; }
.tqm-dot-answered { background: #3ddc84; }
.tqm-dot-flagged { background: #ffce54; }
.tqm-dot-unanswered { background: #dbe4ea; }

.tqm-question-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
    gap: 8px;
}
.tqm-grid-item {
    aspect-ratio: 1;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
}
.tqm-grid-item.answered { background: var(--tqm-accent-green); border-color: var(--tqm-accent-green); color: #fff; }
.tqm-grid-item.flagged { background: #ffce54; border-color: #ffce54; }
.tqm-grid-item.current { outline: 2px solid var(--tqm-teal); outline-offset: 1px; }

.tqm-modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.tqm-modal-box { background: #fff; padding: 24px; border-radius: 8px; max-width: 400px; text-align: center; }

.tqm-result-screen {
    background: #fff; border: 1px solid #e2e2e2; border-radius: 10px; padding: 28px; text-align: center;
}

@media (max-width: 600px) {
    .tqm-quiz-app { padding: 0 6px; }
    .tqm-bottom-btn { font-size: 12px; padding: 12px 4px; }
    .tqm-question-card { padding: 20px 14px 8px; }
}

/* ---- Exam card carousel ([tadreab_exam_list]) ---- */
.tqm-carousel-wrap {
    direction: rtl;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 900px;
    margin: 0 auto;
    font-family: "Tahoma", "Segoe UI", sans-serif;
}
.tqm-carousel-track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 8px 4px 16px;
    flex: 1;
}
.tqm-carousel-track::-webkit-scrollbar { height: 6px; }
.tqm-carousel-track::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.tqm-exam-card {
    scroll-snap-align: start;
    flex: 0 0 240px;
    background: linear-gradient(180deg, #0e3a53, #14587c);
    color: #fff;
    border-radius: 12px;
    padding: 20px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform .15s;
}
.tqm-exam-card:hover { transform: translateY(-3px); }
.tqm-exam-card-title { font-size: 16px; font-weight: bold; line-height: 1.5; }
.tqm-exam-card-meta { display: flex; gap: 12px; font-size: 13px; opacity: 0.85; }
.tqm-exam-card-cta { margin-top: auto; font-size: 13px; font-weight: 600; color: #3ddc84; }

.tqm-carousel-arrow {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}
.tqm-carousel-arrow:hover { background: #f0f0f0; }
