.qms-portal {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 900px;
    margin: 0 auto;
    color: #1e293b;
}
.qms-portal-header { margin-bottom: 24px; text-align: center; }
.qms-portal-header h2 { font-size: 26px; margin-bottom: 4px; color: #1e1b4b; }
.qms-portal-header p { color: #64748b; }

.qms-box {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 2px 10px rgba(30,27,75,.06);
    border: 1px solid #f1f5f9;
}
.qms-empty-box { text-align: center; color: #94a3b8; padding: 40px; }
.qms-login-prompt { text-align: center; padding: 40px; }

/* Quiz grid / cards */
.qms-quiz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.qms-quiz-card {
    background: linear-gradient(160deg, #ffffff, #f8f9ff);
    border: 1px solid #eef0fb;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 4px 16px rgba(99,102,241,.08);
    display: flex;
    flex-direction: column;
    transition: transform .15s ease, box-shadow .15s ease;
}
.qms-quiz-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(99,102,241,.18);
}
.qms-quiz-card-top {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #16a34a;
    letter-spacing: .04em;
    margin-bottom: 10px;
}
.qms-live-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 rgba(34,197,94,.5);
    animation: qms-pulse 1.6s infinite;
}
@keyframes qms-pulse {
    0% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
    70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
    100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.qms-quiz-card h3 { margin: 0 0 8px; font-size: 19px; color: #1e1b4b; }
.qms-quiz-desc { color: #64748b; font-size: 14px; flex-grow: 1; margin-bottom: 14px; }
.qms-quiz-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12.5px;
    color: #475569;
    background: #f1f5f9;
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 16px;
}
.qms-quiz-instructions {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 14px;
    font-size: 13px;
    color: #78350f;
}
.qms-quiz-instructions strong { display: block; margin-bottom: 4px; font-size: 12.5px; }
.qms-quiz-instructions p { margin: 0; color: #92400e; }
.qms-quiz-instructions-full { text-align: left; margin: 18px 0; }

/* Registration / Profile forms */
.qms-form-box { max-width: 640px; margin: 0 auto; text-align: left; }
.qms-pform-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.qms-pfield-full { grid-column: 1 / -1; }
.qms-pfield { display: flex; flex-direction: column; }
.qms-pfield label { font-size: 13px; font-weight: 600; color: #334155; margin-bottom: 6px; }
.qms-pfield input, .qms-pfield select {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 11px 13px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
}
.qms-pfield input:focus, .qms-pfield select:focus {
    outline: none;
    border-color: var(--qms-primary, #6366f1);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.qms-pfield input:disabled { background: #f8fafc; color: #94a3b8; }
.qms-pform-actions { margin-top: 22px; text-align: center; }
.qms-pform-actions .qms-btn-take { width: 100%; }
@media (max-width: 640px) {
    .qms-pform-grid { grid-template-columns: 1fr; }
}

/* ===== Student Login Page ===== */
.qms-login-page {
    display: flex;
    justify-content: center;
    padding: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.qms-login-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    max-width: 820px;
    width: 100%;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(30,27,75,.1);
    border: 1px solid #f1f5f9;
}
.qms-login-motivate {
    background: linear-gradient(160deg, var(--qms-primary, #6366f1), var(--qms-secondary, #8b5cf6));
    color: #fff;
    padding: 40px 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.qms-login-emoji { font-size: 42px; margin-bottom: 16px; }
.qms-login-quote { font-size: 17px; font-weight: 600; line-height: 1.5; margin: 0 0 30px; }
.qms-login-motivate-stats { display: flex; flex-direction: column; gap: 12px; font-size: 13.5px; opacity: .95; }
.qms-login-motivate-stats div { display: flex; align-items: center; gap: 10px; }
.qms-login-motivate-stats span { font-size: 16px; }

.qms-login-form-side { padding: 40px 32px; }
.qms-login-form-side h2 { margin: 0 0 4px; font-size: 22px; color: #1e1b4b; }
.qms-login-subtitle { color: #64748b; font-size: 13.5px; margin: 0 0 22px; }
.qms-login-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    margin: 4px 0 20px;
}
.qms-login-remember { display: flex; align-items: center; gap: 6px; color: #475569; }
.qms-login-row a { color: var(--qms-primary, #6366f1); text-decoration: none; font-weight: 600; }
.qms-login-row a:hover { text-decoration: underline; }
.qms-login-submit { width: 100%; }
.qms-login-signup { text-align: center; margin-top: 18px !important; }
.qms-login-signup a { color: var(--qms-primary, #6366f1); font-weight: 700; text-decoration: none; }
.qms-login-signup a:hover { text-decoration: underline; }

@media (max-width: 720px) {
    .qms-login-card { grid-template-columns: 1fr; border-radius: 16px; }
    .qms-login-motivate { padding: 28px 24px; text-align: center; }
    .qms-login-emoji { font-size: 34px; }
    .qms-login-quote { font-size: 15px; margin-bottom: 20px; }
    .qms-login-motivate-stats { flex-direction: row; justify-content: center; flex-wrap: wrap; gap: 16px; }
    .qms-login-form-side { padding: 28px 22px; }
    .qms-login-card { box-shadow: none; border: none; }
    .qms-login-page { padding: 0; }
}
@media (max-width: 400px) {
    .qms-login-motivate-stats { flex-direction: column; align-items: center; }
}
.qms-btn-take {
    display: inline-block;
    text-align: center;
    background: linear-gradient(135deg, var(--qms-primary, #6366f1), var(--qms-secondary, #8b5cf6));
    color: #fff !important;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    box-shadow: 0 4px 14px rgba(99,102,241,.35);
    transition: all .15s ease;
}
.qms-btn-take:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(99,102,241,.45); color: #fff; }
.qms-leaderboard-link {
    display: block;
    text-align: center;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--qms-primary, #6366f1);
    text-decoration: none;
}
.qms-leaderboard-link:hover { text-decoration: underline; }
.qms-powered-by {
    text-align: center;
    font-size: 11.5px;
    color: #cbd5e1;
    margin-top: 30px;
}

/* Dashboard */
.qms-dash-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}
.qms-dash-stat {
    background: linear-gradient(135deg, #eef2ff, #faf5ff);
    border-radius: 14px;
    padding: 22px;
    text-align: center;
    border: 1px solid #eef0fb;
}
.qms-dash-num { display: block; font-size: 30px; font-weight: 800; color: var(--qms-primary, #6366f1); }
.qms-dash-label { font-size: 13px; color: #64748b; margin-top: 4px; display: block; }
.qms-section-title { margin: 30px 0 12px; font-size: 18px; color: #1e1b4b; }

.qms-public-table { width: 100%; border-collapse: collapse; }
.qms-public-table th {
    text-align: left; font-size: 12px; text-transform: uppercase; color: #94a3b8;
    padding: 10px 12px; border-bottom: 2px solid #f1f5f9;
}
.qms-public-table td { padding: 14px 12px; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
.qms-pill { padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.qms-pill-pass { background: #dcfce7; color: #166534; }
.qms-pill-fail { background: #fee2e2; color: #991b1b; }
.qms-empty { text-align: center; color: #94a3b8; padding: 30px !important; }
.qms-top-rank td { background: #fffbeb; }
.qms-rank-cell { font-size: 18px; }
.qms-text-success { color: #16a34a; font-weight: 700; }
.qms-text-danger { color: #dc2626; font-weight: 700; }

/* Quiz taking */
.qms-intro-box { text-align: center; }
.qms-intro-box h2 { margin-top: 0; color: #1e1b4b; }
.qms-quiz-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1e1b4b;
    color: #fff;
    padding: 14px 20px;
    border-radius: 12px 12px 0 0;
    position: sticky;
    top: 32px;
    z-index: 10;
}
.qms-quiz-title-small { font-weight: 700; }
.qms-timer {
    background: rgba(255,255,255,.15);
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-size: 16px;
}
.qms-timer.qms-timer-warning { background: #ef4444; }

#qms-questions-container {
    background: #fff;
    border: 1px solid #f1f5f9;
    border-top: none;
    padding: 10px 0;
}
.qms-question-block {
    padding: 22px 26px;
    border-bottom: 1px solid #f1f5f9;
}
.qms-question-block:last-child { border-bottom: none; }
.qms-question-number {
    display: inline-block;
    background: #eef2ff;
    color: var(--qms-primary, #6366f1);
    font-weight: 700;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 10px;
}
.qms-question-text { font-size: 16px; font-weight: 600; color: #1e1b4b; margin-bottom: 14px; }
.qms-option-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all .12s ease;
    font-size: 14.5px;
}
.qms-option-label:hover { border-color: #a5b4fc; background: #f8f9ff; }
.qms-option-label input { accent-color: var(--qms-primary, #6366f1); }
.qms-option-label.qms-option-selected { border-color: var(--qms-primary, #6366f1); background: #eef2ff; }

.qms-quiz-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border: 1px solid #f1f5f9;
    border-top: none;
    padding: 18px 26px;
    border-radius: 0 0 12px 12px;
}
#qms-progress-text { color: #64748b; font-size: 14px; }

/* Result screen */
.qms-result-card {
    text-align: center;
    padding: 50px 30px;
    border-radius: 18px;
    background: #fff;
    border: 1px solid #f1f5f9;
    box-shadow: 0 4px 20px rgba(0,0,0,.06);
}
.qms-result-icon { font-size: 56px; margin-bottom: 10px; }
.qms-result-card h2 { color: #1e1b4b; margin-bottom: 6px; }
.qms-quiz-name { color: #64748b; margin-bottom: 24px; }
.qms-result-score { font-size: 42px; font-weight: 800; color: var(--qms-primary, #6366f1); }
.qms-result-pct { font-size: 16px; color: #64748b; margin-bottom: 20px; }
.qms-result-breakdown { display: flex; justify-content: center; gap: 24px; font-size: 15px; }
.qms-result-lb-btn { display: inline-block; margin-top: 24px; }
.qms-result-pass { border-top: 6px solid #22c55e; }
.qms-result-fail { border-top: 6px solid #f59e0b; }

/* ===== Quiz Summary dashboard result page ===== */
.qms-summary-portal { max-width: 1000px; }
.qms-summary-header {
    background: #fff;
    border: 1px solid #f1f5f9;
    border-radius: 14px;
    padding: 20px 24px;
    margin-bottom: 18px;
}
.qms-summary-header h2 { margin: 0 0 14px; font-size: 20px; color: #1e1b4b; }
.qms-summary-quiztitle-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.qms-summary-quiz-icon {
    width: 44px;
    height: 44px;
    background: #fef3c7;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.qms-summary-quiz-name { font-size: 15.5px; font-weight: 700; color: #1e1b4b; margin: 0; }
.qms-summary-meta { font-size: 12.5px; color: #94a3b8; margin: 3px 0 0; }
.qms-summary-score-mini {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--qms-primary, #6366f1);
}
.qms-summary-mini-bar {
    width: 90px;
    height: 6px;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
    display: inline-block;
}
.qms-summary-mini-bar span { display: block; height: 100%; background: var(--qms-primary, #6366f1); }

.qms-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}
.qms-card-wide { grid-column: span 2; }
.qms-summary-card {
    position: relative;
    border-radius: 14px;
    padding: 20px;
    overflow: hidden;
}
.qms-card-indigo { background: #e8eaff; }
.qms-card-amber { background: #ffedcf; }
.qms-summary-card-icon { font-size: 22px; margin-bottom: 8px; }
.qms-summary-card-label { font-size: 13.5px; font-weight: 600; color: #475569; margin-bottom: 10px; }
.qms-summary-card-value { font-size: 30px; font-weight: 800; color: #1e1b4b; }
.qms-summary-card-value span { font-size: 13px; font-weight: 600; color: #64748b; margin-left: 4px; }
.qms-summary-pill {
    display: inline-block;
    margin-top: 12px;
    background: #fff;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
}
.qms-summary-subvalue { display: block; margin-top: 8px; font-size: 15px; font-weight: 700; color: #92400e; }

.qms-summary-breakdown {
    background: #fff;
    border: 1px solid #f1f5f9;
    border-radius: 14px;
    padding: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 18px;
}
.qms-summary-pie-block { display: flex; align-items: center; gap: 24px; }
.qms-summary-pie {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    flex-shrink: 0;
}
.qms-summary-legend { list-style: none; margin: 0; padding: 0; font-size: 13.5px; color: #334155; }
.qms-summary-legend li { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.qms-summary-legend strong { margin-left: auto; }
.qms-legend-dot {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    color: #fff;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.qms-summary-selection-block { border-left: 1px solid #f1f5f9; padding-left: 24px; }
.qms-selection-heading { text-align: center; font-size: 13.5px; font-weight: 700; color: #1e1b4b; margin: 0 0 14px; }
.qms-selection-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}
.qms-selection-num {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12.5px;
    font-weight: 700;
    background: #f1f5f9;
    color: #94a3b8;
}
.qms-selection-correct { background: #dcfce7; color: #166534; }
.qms-selection-wrong { background: #fee2e2; color: #b91c1c; }
.qms-selection-unanswered { background: #f1f5f9; color: #94a3b8; }

.qms-summary-actions { display: flex; justify-content: center; gap: 16px; align-items: center; }
.qms-btn-ghost-link { color: var(--qms-primary, #6366f1); text-decoration: none; font-weight: 600; font-size: 14px; }
.qms-btn-ghost-link:hover { text-decoration: underline; }

@media (max-width: 720px) {
    .qms-summary-grid { grid-template-columns: 1fr 1fr; }
    .qms-card-wide { grid-column: span 2; }
    .qms-summary-breakdown { grid-template-columns: 1fr; }
    .qms-summary-selection-block { border-left: none; padding-left: 0; border-top: 1px solid #f1f5f9; padding-top: 20px; }
    .qms-summary-score-mini { margin-left: 0; width: 100%; }
}

@media (max-width: 640px) {
    .qms-dash-stats { grid-template-columns: 1fr; }
    .qms-quiz-grid { grid-template-columns: 1fr; }
}

/* ===== Course-style Resources Page (dark hero + category course grid) ===== */
.qms-course-page {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: -20px;
}

/* Hero */
.qms-course-hero {
    background: #0D0F14;
    padding: 56px 24px 48px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.qms-course-hero::before {
    content: '';
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse 55% 65% at 50% 0%, rgba(99,102,241,.22) 0%, transparent 65%),
        radial-gradient(ellipse 35% 40% at 90% 80%, rgba(20,184,166,.12) 0%, transparent 60%),
        radial-gradient(ellipse 30% 35% at 5% 85%, rgba(139,92,246,.12) 0%, transparent 60%);
}
.qms-course-hero-inner { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; }
.qms-course-eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(99,102,241,.12); border: 1px solid rgba(99,102,241,.3);
    border-radius: 100px; padding: 6px 16px; margin-bottom: 20px;
    font-size: 11px; font-weight: 700; color: #a5b4fc;
    letter-spacing: .08em; text-transform: uppercase;
}
.qms-course-hero h1 { font-size: clamp(26px,4.5vw,42px); font-weight: 800; color: #fff; line-height: 1.18; margin: 0 0 14px; }
.qms-course-hero h1 em { color: #818cf8; font-style: normal; }
.qms-course-hero p { font-size: 15px; color: rgba(255,255,255,.55); line-height: 1.7; max-width: 460px; margin: 0 auto 34px; }
.qms-course-hero-stats {
    display: flex; justify-content: center;
    background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1);
    border-radius: 16px; overflow: hidden; max-width: 520px; margin: 0 auto;
}
.qms-hero-stat { flex: 1; padding: 18px 10px; text-align: center; border-right: 1px solid rgba(255,255,255,.08); }
.qms-hero-stat:last-child { border-right: none; }
.qms-hero-stat-val { font-size: 21px; font-weight: 800; color: #fff; }
.qms-hero-stat-val span { color: #818cf8; }
.qms-hero-stat-label { font-size: 10.5px; color: rgba(255,255,255,.4); margin-top: 3px; }

/* Filter bar */
.qms-course-filter-bar {
    background: #fff; border-bottom: 1px solid var(--qms-divider, #eef0f4);
    position: sticky; top: 32px; z-index: 20;
    box-shadow: 0 2px 12px rgba(0,0,0,.04);
    padding: 0 20px;
}
.qms-course-filter-inner { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0; scrollbar-width: none; }
.qms-course-filter-inner::-webkit-scrollbar { display: none; }
.qms-course-filter-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 100px;
    font-size: 12.5px; font-weight: 700;
    border: 1.5px solid var(--qms-divider, #eef0f4); color: #64748b;
    text-decoration: none !important;
    background: #fbfbfe; white-space: nowrap;
    text-decoration: none; transition: all .2s;
    flex-shrink: 0;
}
.qms-course-filter-btn:hover { border-color: var(--qms-primary, #6366f1); color: var(--qms-primary, #6366f1); background: #eef2ff; }
.qms-course-filter-btn.qms-filter-active { background: var(--qms-primary, #6366f1); color: #fff; border-color: var(--qms-primary, #6366f1); box-shadow: 0 2px 10px rgba(99,102,241,.3); }
.qms-filter-count { font-size: 10.5px; opacity: .75; }

.qms-course-shell {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    max-width: 1180px;
    margin: 0 auto;
    padding: 36px 20px 60px;
}
.qms-course-main { flex: 1; min-width: 0; }

.qms-ad-sidebar { width: 170px; flex-shrink: 0; position: sticky; top: 90px; }
.qms-ad-slot {
    width: 100%; aspect-ratio: 9/16;
    background: #fff; border: 1px solid #f1f5f9; border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; box-shadow: 0 2px 10px rgba(30,27,75,.05);
}
.qms-ad-placeholder-text { font-size: 12px; color: #cbd5e1; text-align: center; font-weight: 600; line-height: 1.5; }

/* Category sections */
.qms-cat-section { margin-bottom: 52px; }
.qms-cat-header { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.qms-cat-icon-wrap { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.qms-cat-eyebrow { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 2px; }
.qms-cat-name { font-size: 19px; font-weight: 800; color: #1e1b4b; }
.qms-cat-divider { flex: 1; height: 1px; background: var(--qms-divider, #eef0f4); }
.qms-cat-count { font-size: 11.5px; font-weight: 700; color: #94a3b8; white-space: nowrap; }

/* Course card grid */
.qms-courses-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

.qms-course-card {
    background: #fff; border: 1px solid var(--qms-divider, #eef0f4); border-radius: 18px;
    overflow: hidden; display: flex; flex-direction: column;
    transition: box-shadow .25s, transform .25s, border-color .25s;
}
.qms-course-card:hover { box-shadow: 0 14px 34px rgba(30,27,75,.1); transform: translateY(-4px); border-color: transparent; }

.qms-course-thumb {
    height: 130px; display: flex; align-items: center; justify-content: center;
    position: relative; text-decoration: none;
}
.qms-thumb-icon { font-size: 42px; position: relative; z-index: 1; }
.qms-course-thumb-has-image { position: relative; }
.qms-course-thumb-has-image::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.15) 0%, rgba(0,0,0,.05) 40%, rgba(0,0,0,.15) 100%);
    pointer-events: none;
    z-index: 0;
}
.qms-thumb-badge {
    position: absolute; top: 10px; left: 10px;
    padding: 4px 9px; border-radius: 6px;
    font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
    color: #fff;
    z-index: 2;
}
.qms-badge-featured { background: #ef4444; }
.qms-badge-new { background: #16a34a; }
.qms-badge-quiz { background: #1e1b4b; }
.qms-badge-live { background: #ef4444; }
.qms-duration-badge {
    position: absolute; top: 10px; right: 10px;
    background: rgba(0,0,0,.45); backdrop-filter: blur(4px);
    border-radius: 6px; padding: 4px 9px;
    font-size: 10.5px; font-weight: 700; color: #fff;
    z-index: 2;
}

.qms-course-inner { display: flex; flex-direction: column; flex: 1; }
.qms-course-body { padding: 16px 18px; flex: 1; }
.qms-course-cat-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }
.qms-course-title-link { text-decoration: none; }
.qms-course-title { font-size: 15px; font-weight: 700; color: #1e1b4b; margin-bottom: 8px; line-height: 1.35; }
.qms-course-desc { font-size: 12.5px; color: #64748b; line-height: 1.55; margin-bottom: 12px; }
.qms-course-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.qms-chip { font-size: 10.5px; font-weight: 600; padding: 3px 9px; border-radius: 6px; background: #fbfbfe; color: #64748b; border: 1px solid var(--qms-divider, #eef0f4); }

.qms-course-footer {
    padding: 12px 18px; border-top: 1px solid var(--qms-divider, #eef0f4);
    display: flex; align-items: center; justify-content: space-between;
}
.qms-course-meta { display: flex; gap: 12px; }
.qms-course-meta span { font-size: 11px; color: #94a3b8; }
.qms-course-enroll { font-size: 12.5px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.qms-course-enroll:hover { text-decoration: underline; }

/* Featured card (wide) */
.qms-course-card-featured { grid-column: span 2; flex-direction: row; }
.qms-course-card-featured .qms-course-thumb { width: 200px; height: auto; flex-shrink: 0; }
.qms-course-card-featured .qms-thumb-icon { font-size: 54px; }
.qms-course-card-featured .qms-course-body { padding: 22px 24px; }
.qms-course-card-featured .qms-course-title { font-size: 18px; }

/* CTA banner */
.qms-course-cta {
    margin-top: 20px;
    background: linear-gradient(120deg, var(--qms-primary, #6366f1) 0%, var(--qms-secondary, #8b5cf6) 100%);
    border-radius: 20px; padding: 40px 44px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 30px; position: relative; overflow: hidden;
}
.qms-course-cta::before { content: ''; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.08); }
.qms-course-cta-text h2 { font-size: 22px; font-weight: 800; color: #fff; margin: 0 0 6px; }
.qms-course-cta-text p { font-size: 13.5px; color: rgba(255,255,255,.8); margin: 0; }
.qms-course-cta-btn {
    padding: 12px 26px; background: #fff; border-radius: 12px;
    font-size: 14px; font-weight: 700; color: var(--qms-primary, #6366f1); text-decoration: none;
    white-space: nowrap; flex-shrink: 0; position: relative; z-index: 1;
    box-shadow: 0 4px 16px rgba(0,0,0,.14); transition: transform .15s;
}
.qms-course-cta-btn:hover { transform: translateY(-2px); color: var(--qms-primary, #6366f1); }

@media (max-width: 1050px) {
    .qms-ad-sidebar { display: none; }
    .qms-courses-grid { grid-template-columns: repeat(2, 1fr); }
    .qms-course-card-featured { grid-column: span 2; }
}
@media (max-width: 640px) {
    .qms-course-hero { padding: 40px 16px 36px; }
    .qms-course-filter-bar { top: 0; }
    .qms-course-shell { padding: 24px 14px 40px; }
    .qms-courses-grid { grid-template-columns: 1fr; gap: 14px; }
    .qms-course-card-featured { grid-column: span 1; flex-direction: column; }
    .qms-course-card-featured .qms-course-thumb { width: 100%; height: 130px; }
    .qms-course-cta { flex-direction: column; text-align: center; padding: 30px 24px; }
    .qms-course-cta-btn { width: 100%; text-align: center; }
}


/* Single article page */
.qms-article-portal { max-width: 800px; }
.qms-article-box { text-align: left; }
.qms-article-title { margin: 12px 0 18px; font-size: 26px; color: #1e1b4b; }
.qms-article-image { width: 100%; border-radius: 12px; margin-bottom: 20px; }
.qms-article-content { font-size: 15.5px; line-height: 1.75; color: #334155; }
.qms-article-content h2, .qms-article-content h3 { color: #1e1b4b; margin-top: 28px; }
.qms-article-content pre, .qms-article-content code {
    background: #1e1b4b;
    color: #e0e7ff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13.5px;
}
.qms-article-content pre { padding: 16px; overflow-x: auto; }
.qms-topic-quiz-cta {
    margin-top: 36px;
    padding: 26px;
    background: linear-gradient(135deg, #eef2ff, #faf5ff);
    border-radius: 14px;
    text-align: center;
}
.qms-topic-quiz-cta h3 { margin-top: 0; color: #1e1b4b; }

/* ===== New Resource Page Layout (breadcrumbs, sidebar, TOC, sticky bar) ===== */
.qms-resource-page {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 70px; /* room for sticky bar */
}
.qms-breadcrumbs {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 18px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.qms-breadcrumbs a { color: var(--qms-primary, #6366f1); text-decoration: none; }
.qms-breadcrumbs a:hover { text-decoration: underline; }
.qms-breadcrumb-current { color: #94a3b8; }

.qms-resource-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    align-items: start;
}
.qms-resource-sidebar {
    background: #fff;
    border: 1px solid #f1f5f9;
    border-radius: 14px;
    padding: 18px;
    position: sticky;
    top: 20px;
    max-height: 80vh;
    overflow-y: auto;
}
.qms-sidebar-heading {
    font-weight: 700;
    font-size: 14px;
    color: #1e1b4b;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}
.qms-sidebar-list { list-style: none; margin: 0; padding: 0; }
.qms-sidebar-list li { margin-bottom: 4px; }
.qms-sidebar-list a {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13.5px;
    color: #475569;
    text-decoration: none;
}
.qms-sidebar-list a:hover { background: #f8fafc; color: #1e1b4b; }
.qms-sidebar-current a { background: #eef2ff; color: var(--qms-primary, #6366f1) !important; font-weight: 700; }

.qms-resource-main { min-width: 0; }
.qms-article-submeta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 20px;
}
.qms-toc-box {
    background: #f8f9ff;
    border: 1px solid #eef0fb;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
}
.qms-toc-heading { font-weight: 700; color: #1e1b4b; margin-bottom: 10px; font-size: 14px; }
.qms-toc-box ul { list-style: none; margin: 0; padding: 0; }
.qms-toc-box li { margin-bottom: 6px; }
.qms-toc-box a { color: var(--qms-primary, #6366f1); text-decoration: none; font-size: 13.5px; }
.qms-toc-box a:hover { text-decoration: underline; }
.qms-toc-level-3 { margin-left: 18px; }

.qms-sticky-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 16px rgba(0,0,0,.06);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 12px 20px;
    z-index: 100;
}
.qms-sticky-item {
    font-size: 13.5px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    padding: 8px 14px;
    border-radius: 20px;
    background: #f1f5f9;
    user-select: none;
}
.qms-sticky-item:hover { background: #e2e8f0; }
.qms-sticky-quiz-btn {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #fff !important;
    text-decoration: none;
    font-weight: 700;
    padding: 10px 26px;
    border-radius: 20px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(245,158,11,.35);
}

@media (max-width: 900px) {
    .qms-resource-layout { grid-template-columns: 1fr; }
    .qms-resource-sidebar { position: static; max-height: none; order: 2; }
}

.qms-sidebar-num { color: #a5b4fc; font-weight: 700; margin-right: 2px; }
.qms-sidebar-current .qms-sidebar-num { color: var(--qms-primary, #6366f1); }

.qms-chapter-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid #f1f5f9;
}
.qms-chapter-nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    text-decoration: none;
    color: #1e1b4b;
    transition: all .15s ease;
}
.qms-chapter-nav-btn:hover { border-color: var(--qms-primary, #6366f1); background: #f8f9ff; color: #1e1b4b; }
.qms-chapter-nav-next { justify-content: flex-end; text-align: right; margin-left: auto; }
.qms-chapter-nav-arrow { font-size: 20px; color: var(--qms-primary, #6366f1); flex-shrink: 0; }
.qms-chapter-nav-label { display: block; font-size: 11px; text-transform: uppercase; color: #94a3b8; font-weight: 700; letter-spacing: .03em; }
.qms-chapter-nav-title { display: block; font-size: 14px; font-weight: 600; margin-top: 2px; }
@media (max-width: 640px) {
    .qms-chapter-nav { grid-template-columns: 1fr; }
    .qms-chapter-nav-next { margin-left: 0; }
}

/* ===== Leaderboard — podium design ===== */
.qms-lb-page {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 760px;
    margin: 0 auto;
}
.qms-lb-header {
    text-align: center;
    background: linear-gradient(160deg, var(--qms-primary, #6366f1), var(--qms-secondary, #8b5cf6));
    border-radius: 20px;
    padding: 34px 24px;
    margin-bottom: 26px;
    color: #fff;
}
.qms-lb-header-icon { font-size: 34px; margin-bottom: 6px; }
.qms-lb-header h2 { margin: 0 0 4px; font-size: 22px; font-weight: 800; }
.qms-lb-quiz-name { margin: 0 0 16px; font-size: 14px; opacity: .9; }
.qms-lb-stats { display: flex; justify-content: center; gap: 20px; font-size: 12.5px; font-weight: 600; opacity: .95; flex-wrap: wrap; }

.qms-lb-podium {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
    align-items: end;
    margin-bottom: 30px;
}
.qms-lb-podium-card {
    background: #fff;
    border: 1px solid #f1f5f9;
    border-radius: 16px;
    padding: 20px 14px 16px;
    text-align: center;
    position: relative;
}
.qms-lb-podium-rank-1 { padding-top: 28px; box-shadow: 0 12px 30px rgba(250,204,21,.25); border-color: #fde68a; order: 2; }
.qms-lb-podium-rank-2 { order: 1; }
.qms-lb-podium-rank-3 { order: 3; }
.qms-lb-podium-medal { font-size: 30px; margin-bottom: 6px; }
.qms-lb-podium-rank-1 .qms-lb-podium-medal { font-size: 38px; }
.qms-lb-avatar { display: flex; justify-content: center; margin-bottom: 10px; }
.qms-lb-avatar img { border-radius: 50%; border: 3px solid #f1f5f9; }
.qms-lb-podium-rank-1 .qms-lb-avatar img { border-color: #fde68a; }
.qms-lb-podium-name { font-size: 13.5px; font-weight: 700; color: #1e1b4b; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qms-lb-podium-score { font-size: 20px; font-weight: 800; color: var(--qms-primary, #6366f1); }
.qms-lb-podium-score span { font-size: 12px; font-weight: 600; color: #94a3b8; }
.qms-lb-podium-pct { font-size: 11.5px; color: #94a3b8; margin-top: 2px; }
.qms-lb-podium-bar { height: 5px; border-radius: 999px; margin-top: 12px; background: #f1f5f9; }
.qms-lb-podium-rank-1 .qms-lb-podium-bar { background: linear-gradient(90deg, #facc15, #f59e0b); }
.qms-lb-podium-rank-2 .qms-lb-podium-bar { background: linear-gradient(90deg, #cbd5e1, #94a3b8); }
.qms-lb-podium-rank-3 .qms-lb-podium-bar { background: linear-gradient(90deg, #fb923c, #ea580c); }
.qms-lb-you-tag {
    display: inline-block;
    background: var(--qms-primary, #6366f1);
    color: #fff;
    font-size: 9.5px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
    vertical-align: middle;
}

.qms-lb-list {
    background: #fff;
    border: 1px solid #f1f5f9;
    border-radius: 16px;
    overflow: hidden;
}
.qms-lb-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid #f8fafc;
}
.qms-lb-row:last-child { border-bottom: none; }
.qms-lb-row:hover { background: #fbfbfe; }
.qms-lb-row.qms-lb-is-me { background: #eef2ff; }
.qms-lb-rank { font-size: 12.5px; font-weight: 700; color: #94a3b8; width: 28px; flex-shrink: 0; }
.qms-lb-avatar-sm img { border-radius: 50%; }
.qms-lb-row-name { font-size: 13.5px; font-weight: 600; color: #1e1b4b; width: 130px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qms-lb-row-bar-wrap { flex: 1; height: 6px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.qms-lb-row-bar { height: 100%; background: linear-gradient(90deg, var(--qms-primary, #6366f1), var(--qms-secondary, #8b5cf6)); border-radius: 999px; }
.qms-lb-row-score { font-size: 12.5px; font-weight: 700; color: #1e1b4b; width: 55px; text-align: right; flex-shrink: 0; }

@media (max-width: 560px) {
    .qms-lb-podium-name { font-size: 12px; }
    .qms-lb-row-name { width: 90px; }
    .qms-lb-header { padding: 26px 16px; }
}

/* ===== Proctored Exam ===== */
.qms-btn-ghost {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 8px;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    color: #475569;
    font-weight: 700;
    font-size: 13.5px;
    cursor: pointer;
}
.qms-btn-ghost:hover { border-color: var(--qms-primary, #6366f1); color: var(--qms-primary, #6366f1); }
.qms-btn-ghost:disabled { opacity: .6; cursor: default; }

.qms-exam-badge {
    display: inline-block;
    background: #fef2f2;
    color: #dc2626;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .05em;
    padding: 5px 14px;
    border-radius: 999px;
    margin-bottom: 14px;
}
.qms-exam-requirements {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11.5px;
    color: #92400e;
    background: #fffbeb;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 14px;
}
.qms-exam-rules-box {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 16px 18px;
    margin: 18px 0;
    text-align: left;
    font-size: 13.5px;
    color: #7f1d1d;
}
.qms-exam-rules-box strong { display: block; margin-bottom: 8px; }
.qms-exam-rules-box ul { margin: 0; padding-left: 20px; }
.qms-exam-rules-box li { margin-bottom: 6px; line-height: 1.5; }

.qms-exam-permission-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid #f1f5f9;
    text-align: left;
}
.qms-exam-permission-row strong { display: block; font-size: 14.5px; color: #1e1b4b; margin-bottom: 3px; }
.qms-exam-permission-row p { margin: 0; font-size: 12.5px; color: #64748b; }
#qms-exam-camera-preview {
    width: 100%;
    max-width: 260px;
    border-radius: 12px;
    margin: 14px auto 0;
    display: block;
    border: 2px solid #e2e8f0;
}

.qms-exam-violation-banner {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 12px 18px;
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 14px;
    text-align: center;
}
.qms-exam-live-cam {
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    padding: 5px 12px;
    border-radius: 999px;
    animation: qms-rec-pulse 1.6s infinite;
}
@keyframes qms-rec-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .6; }
}

/* ===== Quiz/Exam runner: horizontal single-question layout + side panel ===== */
.qms-runner-layout {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    background: #fff;
    border: 1px solid #f1f5f9;
    border-top: none;
    padding: 0;
}
.qms-runner-main { flex: 1; min-width: 0; }
.qms-runner-main #qms-questions-container {
    border: none;
}
.qms-runner-main .qms-question-block { border-bottom: none; }

.qms-question-nav-buttons {
    display: flex;
    justify-content: space-between;
    padding: 16px 26px 22px;
    gap: 12px;
}
.qms-question-nav-buttons button { min-width: 130px; }

.qms-runner-sidebar {
    width: 220px;
    flex-shrink: 0;
    padding: 18px 18px 18px 0;
    position: sticky;
    top: 90px;
}

.qms-runner-camera-box {
    position: relative;
    background: #0D0F14;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
    aspect-ratio: 4/3;
}
#qms-runner-camera-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.qms-runner-camera-label {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 999px;
    animation: qms-rec-pulse 1.6s infinite;
}

.qms-question-palette-box {
    background: #fbfbfe;
    border: 1px solid #f1f5f9;
    border-radius: 14px;
    padding: 16px;
}
.qms-palette-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid #eef0f4;
    font-size: 12px;
}
.qms-palette-stats > div { display: flex; justify-content: space-between; align-items: center; }
.qms-palette-stats span { font-weight: 800; font-size: 14px; color: #1e1b4b; }
.qms-palette-stats label { color: #94a3b8; }
.qms-stat-answered span { color: #16a34a; }
.qms-stat-unanswered span { color: #dc2626; }

.qms-palette-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}
.qms-palette-item {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1/1;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    color: #64748b;
    transition: transform .1s ease;
}
.qms-palette-item:hover { transform: scale(1.08); }
.qms-palette-answered { background: #dcfce7; border-color: #bbf7d0; color: #166534; }
.qms-palette-unanswered { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.qms-palette-current { background: var(--qms-primary, #6366f1); border-color: var(--qms-primary, #6366f1); color: #fff; box-shadow: 0 0 0 3px rgba(99,102,241,.2); }

@media (max-width: 900px) {
    .qms-runner-layout { flex-direction: column; }
    .qms-runner-sidebar { width: 100%; position: static; padding: 14px 20px 20px; }
    .qms-runner-camera-box { max-width: 220px; margin: 0 auto 16px; }
    .qms-palette-grid { grid-template-columns: repeat(8, 1fr); }
}

/* ===== Exam identity verification (selfie + ID capture) ===== */
.qms-exam-id-capture-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid #f1f5f9;
    text-align: left;
}
.qms-exam-id-capture-col strong { display: block; font-size: 14.5px; color: #1e1b4b; margin-bottom: 3px; }
.qms-exam-id-capture-col p { margin: 0 0 10px; font-size: 12px; color: #64748b; }
.qms-id-preview-img {
    display: block;
    width: 100%;
    max-width: 160px;
    border-radius: 10px;
    margin-top: 10px;
    border: 2px solid #22c55e;
}
.qms-id-upload-label {
    display: block;
    font-size: 11.5px;
    color: #94a3b8;
    margin-top: 8px;
}
.qms-id-upload-label input[type=file] {
    font-size: 11px;
    max-width: 160px;
}
@media (max-width: 560px) {
    .qms-exam-id-capture-row { grid-template-columns: 1fr; }
}

/* ===== Question / option images ===== */
.qms-question-image {
    display: block;
    max-width: 100%;
    max-height: 320px;
    border-radius: 12px;
    margin: 12px 0 16px;
    border: 1px solid #e2e8f0;
}
.qms-option-image {
    display: block;
    max-width: 100%;
    max-height: 160px;
    border-radius: 8px;
    margin-top: 8px;
    border: 1px solid #e2e8f0;
}
.qms-option-label { flex-wrap: wrap; }
.qms-option-label .qms-option-image { flex-basis: 100%; margin-left: 26px; width: calc(100% - 26px); max-width: 320px; }

/* ===== Strict Lockdown Mode ===== */
body.qms-lockdown-active #qms-exam-runner,
body.qms-lockdown-active #qms-exam-runner * {
    user-select: none;
    -webkit-user-select: none;
}
.qms-fullscreen-prompt {
    position: fixed;
    inset: 0;
    background: rgba(13,15,20,.92);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.qms-fullscreen-prompt-box {
    background: #fff;
    border-radius: 16px;
    padding: 34px 30px;
    text-align: center;
    max-width: 320px;
}
.qms-fullscreen-prompt-box p { font-size: 15px; color: #1e1b4b; margin: 0 0 18px; line-height: 1.5; }
