/* VARIABLES */
#ee-app-container {
    --primary: #2563eb; --primary-hover: #1d4ed8;
    --accent: #f59e0b; /* Orange for motivation */
    --bg-grad: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    --card-bg: #ffffff;
    --text-main: #1e293b; --text-sub: #64748b;
    --border: #e2e8f0;
    --success-bg: #d1fae5; --success-border: #10b981; --success-text: #065f46;
    --error-bg: #fee2e2; --error-border: #ef4444; --error-text: #991b1b;
}

/* FULLSCREEN APP MODE */
body.ee-mode-active { overflow: hidden !important; }

.ee-fullscreen-overlay {
    position: fixed !important; top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw; height: 100dvh; z-index: 999999;
    background: var(--bg-grad); overflow-y: auto;
    padding: 20px; display: flex; justify-content: center; align-items: flex-start;
}

.ee-fullscreen-overlay .ee-card {
    width: 100%; max-width: 700px; margin: 30px 0;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.ee-exit-btn {
    position: fixed; top: 15px; right: 15px; z-index: 1000000;
    background: white; border-radius: 50%; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 20px; color: #ef4444; border:none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}
.ee-exit-btn:hover { transform: scale(1.1); }

/* GENERAL UI */
#ee-app-container { max-width: 700px; margin: 40px auto; font-family: 'Segoe UI', Roboto, sans-serif; }
.ee-card { background: var(--card-bg); border-radius: 20px; padding: 0; border: 1px solid var(--border); overflow: hidden; box-shadow: 0 10px 30px -5px rgba(0,0,0,0.05); }
.fade-in { animation: fadeIn 0.4s ease-out forwards; }
@keyframes fadeIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }

/* NEW ENGAGING SETUP SCREEN */
.ee-hero {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    padding: 30px; text-align: center; color: white;
}
.ee-hero h3 { margin: 0; font-size: 24px; font-weight: 800; color:white; }
.ee-hero p { margin: 10px 0 0; opacity: 0.9; font-size: 14px; }

.ee-quote-box {
    background: rgba(255,255,255,0.15);
    border-radius: 8px; padding: 10px 15px; margin-top: 20px;
    font-size: 13px; font-style: italic; border-left: 3px solid var(--accent);
    text-align: left;
}

.ee-setup-body { padding: 30px; }
.ee-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 30px; }
.full-width { grid-column: span 2; }

/* DYNAMIC CATEGORY PICKER */
.ee-category-grid {
    display: flex; flex-wrap: wrap; gap: 8px;
    max-height: 160px; overflow-y: auto;
    padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: #f8fafc;
}
.ee-cat-chip {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 20px; border: 1px solid var(--border);
    background: #fff; font-size: 13px; cursor: pointer; transition: 0.15s; user-select: none;
}
.ee-cat-chip:hover { border-color: var(--primary); }
.ee-cat-chip input[type="checkbox"] { accent-color: var(--primary); margin: 0; }
.ee-cat-chip:has(input:checked) { background: #eff6ff; border-color: var(--primary); color: var(--primary); font-weight: 600; }
.ee-cat-loading { font-size: 13px; color: var(--text-sub); padding: 4px; }

.ee-input-group label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-sub); font-weight: 700; margin-bottom: 5px; }
#ee-app-container select { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: #f8fafc; font-weight: 500; color: #334155; transition: 0.2s; }
#ee-app-container select:focus { border-color: var(--primary); outline: none; background: #fff; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }

/* ANIMATED START BUTTON */
.ee-btn-primary { 
    background: var(--primary); color: white; border: none; padding: 16px 24px; 
    border-radius: 12px; font-weight: 700; cursor: pointer; display: flex; 
    align-items: center; justify-content: center; width: 100%; font-size: 16px;
    transition: all 0.2s; box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.4);
    position: relative; overflow: hidden;
}
.ee-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.4); }
.ee-btn-primary:active { transform: translateY(0); }

/* Pulse Animation */
.pulse-btn { animation: pulse-blue 2s infinite; }
@keyframes pulse-blue {
    0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(37, 99, 235, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* QUIZ & RESULT UI (Tweaked for the new Card style) */
.ee-quiz-body { padding: 30px; }
.ee-quiz-header { display: flex; justify-content: space-between; margin-bottom: 25px; }
.ee-progress-pill, .ee-timer-pill { background: #f1f5f9; padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; display:flex; gap:5px; align-items:center; }
.ee-timer-pill { background: #fff7ed; color: #c2410c; }

.ee-tag { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 6px; text-transform: uppercase; margin-bottom:10px; display:inline-block; margin-right:5px; }
.header-tag { background: #e0f2fe; color: #0369a1; }
.cat-tag { background: #f1f5f9; color: #475569; }
.type-tag-prob { background: #fef3c7; color: #b45309; }
.type-tag-obj { background: #dcfce7; color: #15803d; }

#question { margin: 15px 0 25px; font-size: 19px; line-height: 1.5; color: #0f172a; font-weight: 600; }
#choices { display: flex; flex-direction: column; gap: 12px; }

.choice-card { display: flex; gap: 15px; padding: 15px; border: 2px solid var(--border); border-radius: 12px; cursor: pointer; transition: 0.2s; background: #fff; align-items: center; }
.choice-card:hover { border-color: #94a3b8; background: #f8fafc; }
.choice-letter { width: 32px; height: 32px; flex-shrink: 0; background: #f1f5f9; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #64748b; }

.choice-card.selected { border-color: var(--primary); background: #eff6ff; }
.choice-card.selected .choice-letter { background: var(--primary); color: white; }
.choice-card.correct { border-color: var(--success-border); background: var(--success-bg); }
.choice-card.correct .choice-letter { background: var(--success-border); color: white; }
.choice-card.wrong { border-color: var(--error-border); background: var(--error-bg); opacity: 0.8; }
.choice-card.wrong .choice-letter { background: var(--error-border); color: white; }

.ee-explanation { margin-top: 20px; background: #fffbeb; border: 1px solid #fcd34d; border-radius: 10px; padding: 16px 18px; line-height: 2; }
#exp-content p, .review-exp p { margin: 0 0 .7em; }
#exp-content br, .review-exp br { content: ""; display: block; margin-top: .55em; }
.exp-source { margin-top: 10px; font-size: 12px; color: #92400e; font-style: italic; }
.result-header { text-align: center; margin-bottom: 30px; }
.score-circle { width: 120px; height: 120px; border-radius: 50%; border: 6px solid #ccc; display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 15px auto; font-size: 28px; font-weight: 800; }

.review-item { border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 20px; background:#fff; }
.review-item.correct { border-left: 5px solid var(--success-border); }
.review-item.wrong { border-left: 5px solid var(--error-border); }
.rev-opt { padding: 10px; margin-top:5px; background: #f8fafc; border-radius: 6px; font-size: 14px; display: flex; align-items:center; }
.rev-let { font-weight:bold; margin-right:10px; color:#64748b; }
.rev-text { flex:1; }
.rev-correct { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.rev-wrong { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

@media (max-width: 500px) {
    .ee-form-grid { grid-template-columns: 1fr; }
    .full-width { grid-column: span 1; }
    .ee-hero { padding: 20px; }
}

/* v4: photos, layout helpers */
.ee-label-note { font-weight: 400; text-transform: none; letter-spacing: 0; }
.ee-photo { display: block; max-width: 100%; height: auto; margin: 0 0 20px; border-radius: 10px; border: 1px solid var(--border); background: #fff; }
.ee-sol-photo { display: block; max-width: 100%; height: auto; margin-top: 12px; border-radius: 8px; border: 1px solid #fcd34d; background: #fff; }
.ee-footer-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 25px; }
.ee-footer-actions .ee-btn-primary { width: auto; }
.ee-btn-dark { background: #475569; }
.ee-btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.exp-title { font-weight: 700; margin-bottom: 8px; color: #92400e; }
.review-q { margin: 8px 0 12px; font-weight: 600; }
.review-exp { margin-top: 12px; background: #fffbeb; border: 1px solid #fcd34d; border-radius: 8px; padding: 14px 16px; font-size: 14px; line-height: 2; }
.review-meta { font-size: 12px; color: var(--text-sub); font-weight: 700; text-transform: uppercase; }
#exp-content mjx-container:not([display]), .review-exp mjx-container:not([display]) { display: inline-block; margin: .45em .1em; }
