/* EducationGuard — Student Question Bank (builds on courses.css) */

.eg-question-bank {
    --eg-qb-success: #1f9d61;
    --eg-qb-success-soft: rgba(31, 157, 97, 0.12);
    --eg-qb-success-line: rgba(31, 157, 97, 0.4);
    --eg-qb-danger: #d64545;
    --eg-qb-danger-soft: rgba(214, 69, 69, 0.1);
    --eg-qb-danger-line: rgba(214, 69, 69, 0.38);
    --eg-qb-surface-2: #f8f4ef;
    --eg-qb-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-bs-theme="dark"] .eg-question-bank {
    --eg-qb-success: #3ecf8e;
    --eg-qb-success-soft: rgba(62, 207, 142, 0.14);
    --eg-qb-success-line: rgba(62, 207, 142, 0.34);
    --eg-qb-danger: #ff7a7a;
    --eg-qb-danger-soft: rgba(255, 122, 122, 0.12);
    --eg-qb-danger-line: rgba(255, 122, 122, 0.32);
    --eg-qb-surface-2: #2b2030;
}

/* Soft floating orbs behind content */
.eg-qb-float {
    position: absolute;
    border-radius: 50%;
    filter: blur(48px);
    pointer-events: none;
    opacity: 0.45;
    animation: eg-qb-drift 14s ease-in-out infinite alternate;
}

.eg-qb-float--1 {
    width: 18rem;
    height: 18rem;
    top: 12%;
    inset-inline-end: 8%;
    background: radial-gradient(circle, rgba(243, 147, 24, 0.45), transparent 70%);
}

.eg-qb-float--2 {
    width: 14rem;
    height: 14rem;
    bottom: 18%;
    inset-inline-start: 6%;
    background: radial-gradient(circle, rgba(70, 30, 56, 0.28), transparent 70%);
    animation-delay: -4s;
    animation-duration: 18s;
}

@keyframes eg-qb-drift {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(-18px, 22px) scale(1.08); }
}

.eg-qb-main {
    max-width: 940px;
}

.eg-qb-hero {
    margin-bottom: 1.75rem;
}

.eg-qb-stat {
    animation: eg-qb-pulse 2.8s ease-in-out infinite;
}

.eg-qb-stat-solved .eg-courses-stat-num,
html[data-bs-theme="dark"] .eg-qb-stat-solved .eg-courses-stat-num {
    color: var(--eg-qb-success);
}

.eg-qb-stat-solved:hover {
    border-color: var(--eg-qb-success-line);
}

@keyframes eg-qb-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

/* ── Toolbar: semester chips + search + progress ── */
.eg-qb-toolbar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.85rem;
    animation: eg-courses-fade-up 0.65s var(--eg-qb-ease) 0.08s both;
}

.eg-qb-semesters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.55rem;
}

.eg-qb-semester {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1.05rem;
    border-radius: 2rem;
    border: 1.5px solid color-mix(in srgb, var(--eg-border) 90%, transparent);
    background: var(--eg-surface);
    color: var(--eg-text-muted);
    font-family: inherit;
    font-weight: 800;
    font-size: 0.88rem;
    cursor: pointer;
    overflow: hidden;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    translate: 0 0;
}

.eg-qb-semester i {
    font-size: 0.95rem;
    color: var(--eg-primary);
    transition: transform 0.35s var(--eg-qb-ease);
}

.eg-qb-semester:hover {
    border-color: var(--eg-primary);
    color: var(--eg-secondary);
    translate: 0 -2px;
    box-shadow: 0 8px 20px rgba(243, 147, 24, 0.18);
}

html[data-bs-theme="dark"] .eg-qb-semester:hover {
    color: var(--eg-primary-light);
}

.eg-qb-semester.is-active {
    background: linear-gradient(135deg, var(--eg-primary-light), var(--eg-primary) 55%, var(--eg-primary-dark));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 10px 24px rgba(243, 147, 24, 0.38);
}

.eg-qb-semester.is-active i {
    color: #fff;
    transform: rotate(12deg) scale(1.08);
}

.eg-qb-search {
    margin-inline: auto;
    max-width: 520px;
    width: 100%;
}

/* Progress meter */
.eg-qb-progress {
    width: 100%;
    max-width: 520px;
    margin-inline: auto;
}

.eg-qb-progress-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.eg-qb-progress-title {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--eg-text-muted);
}

.eg-qb-progress-title i {
    color: var(--eg-primary);
}

.eg-qb-progress-value {
    font-size: 0.9rem;
    font-weight: 900;
    color: var(--eg-secondary);
}

html[data-bs-theme="dark"] .eg-qb-progress-value {
    color: var(--eg-primary-light);
}

.eg-qb-progress-value em {
    margin-inline: 0.15rem;
    font-style: normal;
    opacity: 0.45;
}

.eg-qb-progress-track {
    position: relative;
    height: 0.5rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--eg-secondary) 10%, transparent);
    overflow: hidden;
}

html[data-bs-theme="dark"] .eg-qb-progress-track {
    background: rgba(255, 255, 255, 0.08);
}

.eg-qb-progress-fill {
    position: relative;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--eg-primary-light), var(--eg-primary) 55%, var(--eg-qb-success));
    box-shadow: 0 0 14px rgba(243, 147, 24, 0.5);
    transition: width 0.7s var(--eg-qb-ease);
}

.eg-qb-progress-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
    animation: eg-qb-sweep 2.2s linear infinite;
}

@keyframes eg-qb-sweep {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

/* ── Alerts / empty ── */
.eg-qb-alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.15rem;
    border-radius: var(--eg-radius);
    background: var(--eg-qb-danger-soft);
    border: 1.5px solid var(--eg-qb-danger-line);
    color: #b33a3a;
    font-weight: 700;
    animation: eg-courses-fade-up 0.45s ease both;
}

html[data-bs-theme="dark"] .eg-qb-alert {
    color: #ffb4b4;
}

.eg-qb-empty {
    animation: eg-courses-fade-up 0.55s ease both;
}

.eg-qb-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4.5rem;
    height: 4.5rem;
    margin-bottom: 0.75rem;
    border-radius: 50%;
    background: var(--eg-primary-soft);
    color: var(--eg-primary);
    font-size: 2rem;
    animation: eg-qb-wiggle 3.5s ease-in-out infinite;
}

@keyframes eg-qb-wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-6deg); }
    75% { transform: rotate(6deg); }
}

/* ── Question cards ── */
.eg-qb-list {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.eg-qb-card {
    position: relative;
    padding: 1.2rem 1.35rem 1.25rem;
    padding-inline-start: 1.6rem;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--eg-primary) 5%, var(--eg-surface)), var(--eg-surface) 42%);
    border: 1.5px solid var(--eg-border);
    border-radius: calc(var(--eg-radius) + 4px);
    box-shadow: var(--eg-shadow);
    overflow: hidden;
    opacity: 0;
    transform: translateY(24px);
    animation: eg-qb-card-in 0.6s var(--eg-qb-ease) var(--eg-qb-delay, 0ms) forwards;
    transition: border-color 0.35s ease, box-shadow 0.35s ease, translate 0.35s var(--eg-qb-ease), background 0.35s ease;
    translate: 0 0;
}

@keyframes eg-qb-card-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Difficulty rail */
.eg-qb-card-rail {
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    overflow: hidden;
    background: linear-gradient(180deg, var(--eg-primary-light), var(--eg-primary));
    transition: background 0.4s ease;
}

.eg-qb-card-rail.is-easy {
    background: linear-gradient(180deg, #6fdcaa, var(--eg-qb-success));
}

.eg-qb-card-rail.is-hard {
    background: linear-gradient(180deg, #ff9a8b, var(--eg-qb-danger));
}

.eg-qb-card-rail::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    top: -40%;
    height: 40%;
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.85), transparent);
    animation: eg-qb-rail-run 3.4s ease-in-out infinite;
}

@keyframes eg-qb-rail-run {
    0% { top: -45%; }
    60%, 100% { top: 105%; }
}

/* Hover glow + diagonal sheen */
.eg-qb-card-glow {
    position: absolute;
    inset-inline-end: -6rem;
    top: -6rem;
    width: 16rem;
    height: 16rem;
    border-radius: 50%;
    background: radial-gradient(circle, var(--eg-primary-soft), transparent 68%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s ease, transform 0.6s var(--eg-qb-ease);
    transform: scale(0.75);
}

.eg-qb-card-sheen {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(115deg, transparent 34%, rgba(255, 255, 255, 0.32) 50%, transparent 64%);
    transform: translateX(-130%);
    opacity: 0;
}

html[data-bs-theme="dark"] .eg-qb-card-sheen {
    background: linear-gradient(115deg, transparent 34%, rgba(255, 255, 255, 0.09) 50%, transparent 64%);
}

.eg-qb-card:hover {
    border-color: color-mix(in srgb, var(--eg-primary) 55%, var(--eg-border));
    box-shadow: var(--eg-shadow-lg);
    translate: 0 -4px;
}

.eg-qb-card:hover .eg-qb-card-glow {
    opacity: 1;
    transform: scale(1);
}

.eg-qb-card:hover .eg-qb-card-sheen {
    opacity: 1;
    animation: eg-qb-sheen 0.9s var(--eg-qb-ease);
}

@keyframes eg-qb-sheen {
    from { transform: translateX(-130%); }
    to { transform: translateX(130%); }
}

.eg-qb-card.is-expanded {
    border-color: var(--eg-primary);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--eg-primary) 35%, transparent), var(--eg-shadow-lg);
}

.eg-qb-card.is-revealed .eg-qb-card-rail,
.eg-qb-card.is-right .eg-qb-card-rail {
    background: linear-gradient(180deg, #6fdcaa, var(--eg-qb-success));
}

.eg-qb-card.is-wrong .eg-qb-card-rail {
    background: linear-gradient(180deg, #ff9a8b, var(--eg-qb-danger));
}

.eg-qb-card.is-right {
    border-color: var(--eg-qb-success-line);
    background: linear-gradient(180deg, var(--eg-qb-success-soft), var(--eg-surface) 42%);
}

.eg-qb-card.is-wrong {
    border-color: var(--eg-qb-danger-line);
    background: linear-gradient(180deg, var(--eg-qb-danger-soft), var(--eg-surface) 42%);
}

/* Head: index + meta pills + state icon */
.eg-qb-card-head {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 0.85rem;
}

.eg-qb-index {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.85rem;
    background: linear-gradient(135deg, var(--eg-primary-light), var(--eg-primary) 60%, var(--eg-primary-dark));
    color: #fff;
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    box-shadow: 0 6px 16px rgba(243, 147, 24, 0.32);
    transition: transform 0.4s var(--eg-qb-ease), box-shadow 0.35s ease;
}

.eg-qb-card:hover .eg-qb-index {
    transform: rotate(-6deg) scale(1.06);
}

.eg-qb-card.is-right .eg-qb-index {
    background: linear-gradient(135deg, #6fdcaa, var(--eg-qb-success));
    box-shadow: 0 6px 16px rgba(31, 157, 97, 0.34);
}

.eg-qb-card.is-wrong .eg-qb-index {
    background: linear-gradient(135deg, #ff9a8b, var(--eg-qb-danger));
    box-shadow: 0 6px 16px rgba(214, 69, 69, 0.3);
}

.eg-qb-card-meta {
    flex: 1 1 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.eg-qb-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    padding: 0.26rem 0.65rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    background: color-mix(in srgb, var(--eg-secondary) 8%, transparent);
    color: var(--eg-secondary);
    transition: transform 0.25s var(--eg-qb-ease), background 0.25s ease;
}

.eg-qb-card:hover .eg-qb-pill {
    transform: translateY(-1px);
}

html[data-bs-theme="dark"] .eg-qb-pill {
    background: rgba(243, 147, 24, 0.12);
    color: var(--eg-primary-light);
}

.eg-qb-pill--diff.is-easy {
    background: var(--eg-qb-success-soft);
    color: var(--eg-qb-success);
    border-color: color-mix(in srgb, var(--eg-qb-success) 26%, transparent);
}

.eg-qb-pill--diff.is-medium {
    background: var(--eg-primary-soft);
    color: var(--eg-primary-dark);
    border-color: color-mix(in srgb, var(--eg-primary) 30%, transparent);
}

.eg-qb-pill--diff.is-hard {
    background: var(--eg-qb-danger-soft);
    color: #c0392b;
    border-color: color-mix(in srgb, var(--eg-qb-danger) 28%, transparent);
}

html[data-bs-theme="dark"] .eg-qb-pill--diff.is-medium {
    color: var(--eg-primary-light);
}

html[data-bs-theme="dark"] .eg-qb-pill--diff.is-hard {
    color: var(--eg-qb-danger);
}

/* Difficulty level bars */
.eg-qb-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 0.7rem;
}

.eg-qb-bars > span {
    width: 3px;
    border-radius: 2px;
    background: currentColor;
    opacity: 0.22;
    transform-origin: bottom;
    animation: eg-qb-bar-grow 0.5s var(--eg-qb-ease) both;
}

.eg-qb-bars > span:nth-child(1) { height: 40%; animation-delay: 0.05s; }
.eg-qb-bars > span:nth-child(2) { height: 70%; animation-delay: 0.12s; }
.eg-qb-bars > span:nth-child(3) { height: 100%; animation-delay: 0.19s; }

.eg-qb-bars[data-level="1"] > span:nth-child(-n+1),
.eg-qb-bars[data-level="2"] > span:nth-child(-n+2),
.eg-qb-bars[data-level="3"] > span:nth-child(-n+3) {
    opacity: 1;
}

@keyframes eg-qb-bar-grow {
    from { transform: scaleY(0.2); }
    to { transform: scaleY(1); }
}

.eg-qb-pill--type i,
.eg-qb-pill--sem i,
.eg-qb-pill--cat i {
    font-size: 0.78rem;
    opacity: 0.85;
}

/* Right-hand state glyph */
.eg-qb-status {
    flex: 0 0 auto;
    position: relative;
    width: 1.4rem;
    height: 1.4rem;
    font-size: 1.25rem;
    line-height: 1;
}

.eg-qb-status i {
    position: absolute;
    inset: 0;
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 0.3s ease, transform 0.4s var(--eg-qb-ease);
}

.eg-qb-status--right { color: var(--eg-qb-success); }
.eg-qb-status--wrong { color: var(--eg-qb-danger); }
.eg-qb-status--seen { color: var(--eg-text-muted); font-size: 1rem; }

.eg-qb-card.is-right .eg-qb-status--right,
.eg-qb-card.is-wrong .eg-qb-status--wrong,
.eg-qb-card.is-revealed .eg-qb-status--seen {
    opacity: 1;
    transform: scale(1);
}

.eg-qb-card.is-right .eg-qb-status--right {
    animation: eg-qb-stamp 0.55s var(--eg-qb-ease);
}

@keyframes eg-qb-stamp {
    0% { transform: scale(1.8) rotate(-18deg); opacity: 0; }
    60% { transform: scale(0.92) rotate(4deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* Question text (clickable) */
.eg-qb-question-btn {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    width: 100%;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    font-family: inherit;
    text-align: start;
    cursor: pointer;
}

.eg-qb-question-btn:focus-visible {
    outline: 2px solid var(--eg-primary);
    outline-offset: 4px;
    border-radius: 0.6rem;
}

.eg-qb-quote {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    margin-top: 0.1rem;
    border-radius: 50%;
    background: var(--eg-primary-soft);
    color: var(--eg-primary-dark);
    font-size: 0.85rem;
    transition: transform 0.4s var(--eg-qb-ease), background 0.3s ease, color 0.3s ease;
}

html[data-bs-theme="dark"] .eg-qb-quote {
    color: var(--eg-primary-light);
}

.eg-qb-question-btn:hover .eg-qb-quote {
    transform: rotate(-10deg) scale(1.12);
    background: var(--eg-primary);
    color: #fff;
}

.eg-qb-question {
    flex: 1 1 auto;
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.6;
    color: var(--eg-text);
}

/* Foot: choice count + toggle */
.eg-qb-card-foot {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.9rem;
}

.eg-qb-count {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--eg-text-muted);
}

.eg-qb-count i {
    color: var(--eg-primary);
}

.eg-qb-toggle {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    border-radius: 2rem;
    border: 1.5px solid color-mix(in srgb, var(--eg-primary) 40%, transparent);
    background: var(--eg-primary-soft);
    color: var(--eg-secondary);
    font-family: inherit;
    font-weight: 800;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, translate 0.2s ease;
    translate: 0 0;
}

html[data-bs-theme="dark"] .eg-qb-toggle {
    color: var(--eg-primary-light);
}

.eg-qb-toggle:hover {
    background: var(--eg-primary);
    color: #fff;
    translate: 0 -1px;
    box-shadow: 0 8px 18px rgba(243, 147, 24, 0.35);
}

.eg-qb-toggle i {
    transition: transform 0.35s var(--eg-qb-ease);
}

.eg-qb-card.is-expanded .eg-qb-toggle i {
    transform: rotate(180deg);
}

/* ── Collapsible body (grid-rows transition) ── */
.eg-qb-collapse {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: 0fr;
    visibility: hidden;
    transition: grid-template-rows 0.45s var(--eg-qb-ease), visibility 0s linear 0.45s;
}

.eg-qb-card.is-expanded .eg-qb-collapse {
    grid-template-rows: 1fr;
    visibility: visible;
    transition: grid-template-rows 0.45s var(--eg-qb-ease), visibility 0s;
}

.eg-qb-collapse-inner {
    min-height: 0;
    overflow: hidden;
}

.eg-qb-body {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed color-mix(in srgb, var(--eg-border) 85%, transparent);
}

.eg-qb-prompt {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 0.7rem;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--eg-text-muted);
}

.eg-qb-prompt i {
    color: var(--eg-primary);
}

.eg-qb-card.is-revealed .eg-qb-prompt,
.eg-qb-card.is-right .eg-qb-prompt,
.eg-qb-card.is-wrong .eg-qb-prompt {
    display: none;
}

/* ── Choices ── */
.eg-qb-choices {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.eg-qb-card.is-expanded .eg-qb-choices > li {
    animation: eg-qb-choice-in 0.45s var(--eg-qb-ease) var(--eg-qb-choice-delay, 0ms) both;
}

@keyframes eg-qb-choice-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.eg-qb-choice {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.72rem 0.9rem;
    border-radius: 0.95rem;
    border: 1.5px solid var(--eg-border);
    background: var(--eg-qb-surface-2);
    color: inherit;
    font-family: inherit;
    text-align: start;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease, translate 0.25s var(--eg-qb-ease);
    translate: 0 0;
}

.eg-qb-choice::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--eg-primary-soft), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.eg-qb-choice:not(:disabled):hover {
    border-color: var(--eg-primary);
    translate: 0 -2px;
    box-shadow: 0 10px 22px rgba(243, 147, 24, 0.16);
}

.eg-qb-choice:not(:disabled):hover::before {
    opacity: 1;
}

.eg-qb-choice:not(:disabled):active {
    translate: 0 0;
    scale: 0.99;
}

.eg-qb-choice:focus-visible {
    outline: 2px solid var(--eg-primary);
    outline-offset: 2px;
}

.eg-qb-choice:disabled {
    cursor: default;
    opacity: 1;
}

.eg-qb-choice:disabled .eg-qb-choice-text {
    -webkit-text-fill-color: var(--eg-text);
}

.eg-qb-choice:disabled .eg-qb-choice-ord {
    -webkit-text-fill-color: #fff;
}

.eg-qb-choice.is-correct {
    border-color: var(--eg-qb-success-line);
    background: var(--eg-qb-success-soft);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--eg-qb-success) 12%, transparent);
    animation: eg-qb-correct-pop 0.5s var(--eg-qb-ease);
}

.eg-qb-choice.is-wrong {
    border-color: var(--eg-qb-danger-line);
    background: var(--eg-qb-danger-soft);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--eg-qb-danger) 10%, transparent);
    animation: eg-qb-shake 0.45s ease;
}

.eg-qb-choice.is-dim {
    opacity: 0.5;
}

@keyframes eg-qb-correct-pop {
    0% { transform: scale(0.97); }
    55% { transform: scale(1.025); }
    100% { transform: scale(1); }
}

@keyframes eg-qb-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-7px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(2px); }
}

.eg-qb-choice-ord {
    position: relative;
    flex: 0 0 auto;
    width: 1.95rem;
    height: 1.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.65rem;
    background: var(--eg-secondary);
    color: #fff;
    font-weight: 900;
    font-size: 0.8rem;
    transition: background 0.3s ease, transform 0.35s var(--eg-qb-ease);
}

.eg-qb-choice:not(:disabled):hover .eg-qb-choice-ord {
    background: var(--eg-primary);
    transform: rotate(-8deg);
}

.eg-qb-choice.is-correct .eg-qb-choice-ord {
    background: var(--eg-qb-success);
}

.eg-qb-choice.is-wrong .eg-qb-choice-ord {
    background: var(--eg-qb-danger);
}

.eg-qb-choice-text {
    position: relative;
    flex: 1 1 auto;
    font-weight: 600;
    color: var(--eg-text);
    line-height: 1.45;
}

.eg-qb-choice-state {
    position: relative;
    flex: 0 0 auto;
    font-size: 1.2rem;
    line-height: 1;
    animation: eg-qb-check-in 0.45s var(--eg-qb-ease) both;
}

.eg-qb-choice.is-correct .eg-qb-choice-state { color: var(--eg-qb-success); }
.eg-qb-choice.is-wrong .eg-qb-choice-state { color: var(--eg-qb-danger); }

@keyframes eg-qb-check-in {
    from {
        opacity: 0;
        transform: scale(0.4) rotate(-30deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

/* ── Feedback banner ── */
.eg-qb-feedback {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.9rem;
    padding: 0.7rem 0.9rem;
    border-radius: 0.9rem;
    font-weight: 800;
    font-size: 0.9rem;
    animation: eg-qb-rise 0.45s var(--eg-qb-ease) both;
}

.eg-qb-feedback.is-right {
    background: var(--eg-qb-success-soft);
    border: 1.5px solid var(--eg-qb-success-line);
    color: var(--eg-qb-success);
}

.eg-qb-feedback.is-wrong {
    background: var(--eg-qb-danger-soft);
    border: 1.5px solid var(--eg-qb-danger-line);
    color: var(--eg-qb-danger);
}

.eg-qb-feedback-icon {
    font-size: 1.15rem;
    line-height: 1;
}

.eg-qb-feedback.is-right .eg-qb-feedback-icon {
    animation: eg-qb-bounce 0.9s var(--eg-qb-ease) 0.1s;
}

@keyframes eg-qb-bounce {
    0%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px) scale(1.12); }
    60% { transform: translateY(0) scale(1); }
}

@keyframes eg-qb-rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Reveal CTA & answer panel ── */
.eg-qb-reveal {
    margin-top: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.7rem 1.2rem 0.7rem 0.7rem;
    border: none;
    border-radius: 2rem;
    background: linear-gradient(135deg, var(--eg-primary-light), var(--eg-primary) 50%, var(--eg-primary-dark));
    color: #fff;
    font-family: inherit;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(243, 147, 24, 0.38);
    transition: box-shadow 0.25s ease, translate 0.2s ease;
    translate: 0 0;
}

.eg-qb-reveal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    transition: transform 0.35s var(--eg-qb-ease);
}

.eg-qb-reveal:hover {
    translate: 0 -2px;
    box-shadow: 0 14px 30px rgba(243, 147, 24, 0.48);
}

.eg-qb-reveal:hover .eg-qb-reveal-icon {
    transform: scale(1.12);
}

.eg-qb-reveal:active {
    translate: 0 0;
    scale: 0.98;
}

.eg-qb-answer {
    margin-top: 0.95rem;
    padding: 1rem 1.05rem;
    border-radius: 1rem;
    background: var(--eg-qb-success-soft);
    border: 1.5px solid var(--eg-qb-success-line);
    animation: eg-qb-rise 0.45s var(--eg-qb-ease) 0.08s both;
}

.eg-qb-answer-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    font-weight: 700;
    color: var(--eg-text);
}

.eg-qb-answer-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.95rem;
    padding: 0.15rem 0.6rem;
    border-radius: 0.55rem;
    background: var(--eg-qb-success);
    color: #fff;
    font-weight: 900;
    animation: eg-qb-key-in 0.5s var(--eg-qb-ease) 0.15s both;
}

@keyframes eg-qb-key-in {
    from { opacity: 0; transform: translateY(-6px) rotate(-8deg); }
    to { opacity: 1; transform: translateY(0) rotate(0); }
}

.eg-qb-explanation {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--eg-qb-success-line);
    color: var(--eg-text);
}

.eg-qb-explanation strong {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.eg-qb-explanation strong i {
    color: var(--eg-primary);
}

.eg-qb-explanation p {
    margin: 0.35rem 0 0;
    font-weight: 600;
    line-height: 1.6;
    color: var(--eg-text-muted);
}

.eg-qb-hide-answer {
    margin-top: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--eg-qb-success);
    font-family: inherit;
    font-weight: 800;
    font-size: 0.85rem;
    cursor: pointer;
}

.eg-qb-hide-answer i {
    transition: transform 0.4s var(--eg-qb-ease);
}

.eg-qb-hide-answer:hover {
    text-decoration: underline;
}

.eg-qb-hide-answer:hover i {
    transform: rotate(-180deg);
}

.eg-qb-card.is-wrong .eg-qb-answer {
    background: color-mix(in srgb, var(--eg-qb-success) 7%, transparent);
}

@media (max-width: 640px) {
    .eg-qb-card {
        padding: 1rem 1rem 1.05rem;
        padding-inline-start: 1.3rem;
    }

    .eg-qb-card-head {
        flex-wrap: wrap;
    }

    .eg-qb-card-meta {
        order: 3;
        flex-basis: 100%;
    }

    .eg-qb-status {
        margin-inline-start: auto;
    }

    .eg-qb-question {
        font-size: 1rem;
    }

    .eg-qb-semester {
        font-size: 0.82rem;
        padding: 0.5rem 0.85rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .eg-qb-float,
    .eg-qb-stat,
    .eg-qb-toolbar,
    .eg-qb-card,
    .eg-qb-card-rail::after,
    .eg-qb-card-sheen,
    .eg-qb-card.is-expanded .eg-qb-choices > li,
    .eg-qb-choice,
    .eg-qb-choice.is-correct,
    .eg-qb-choice.is-wrong,
    .eg-qb-choice-state,
    .eg-qb-feedback,
    .eg-qb-feedback-icon,
    .eg-qb-reveal,
    .eg-qb-answer,
    .eg-qb-answer-key,
    .eg-qb-bars > span,
    .eg-qb-progress-fill::after,
    .eg-qb-status i,
    .eg-qb-empty-icon {
        animation: none !important;
        transition: none !important;
    }

    .eg-qb-card,
    .eg-qb-card.is-expanded .eg-qb-choices > li {
        opacity: 1;
        transform: none;
    }

    .eg-qb-collapse {
        transition: none;
    }

    .eg-qb-card:hover,
    .eg-qb-semester:hover,
    .eg-qb-toggle:hover,
    .eg-qb-choice:not(:disabled):hover,
    .eg-qb-reveal:hover {
        translate: none;
        transform: none;
    }
}
