/* ===========================================================================
   Math Mastery · English (secondary) design
   Sits on top of kids.css: same tappable choices, checks, star bar and live-page
   fixes, with a more grown-up skin for secondary-school students, plus:
   word cards with pronunciation buttons, a read-aloud reading player, glossary
   pop-ups with Arabic meanings, and section tabs.
   Scope: .mk-lesson.en-lesson
   ========================================================================= */

.mk-lesson.en-lesson {
	--mk-ink: #141b34;
	--mk-ink-soft: #4b5578;
	--mk-bg: #f4f6fb;
	--mk-line: #e1e6f2;
	--mk-r: 16px;
	--mk-shadow-sm: 0 1px 0 rgba(20, 27, 52, .04), 0 10px 26px rgba(20, 27, 52, .07);
	--en-head: "Outfit", "Inter", system-ui, -apple-system, sans-serif;
	--en-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
	--en-ar: "Cairo", "Tajawal", "Segoe UI", Tahoma, sans-serif;
	--en-gold: #f5b83d;
	font-family: var(--en-body);
	font-size: 17px;
	line-height: 1.65;
}

/* themes ------------------------------------------------------------------ */
.en-lesson.en-theme-indigo { --mk-t1: #4f46e5; --mk-t2: #7c3aed; --mk-t3: #0ea5e9; }
.en-lesson.en-theme-teal   { --mk-t1: #0d9488; --mk-t2: #0284c7; --mk-t3: #22c55e; }
.en-lesson.en-theme-rose   { --mk-t1: #e11d48; --mk-t2: #7c3aed; --mk-t3: #f59e0b; }
.en-lesson.en-theme-ocean  { --mk-t1: #0369a1; --mk-t2: #4f46e5; --mk-t3: #06b6d4; }

/* type: grown-up headings everywhere in the lesson (beats the theme's h1/h2) */
.mk-lesson.mk-lesson.en-lesson h1,
.mk-lesson.mk-lesson.en-lesson h2,
.mk-lesson.mk-lesson.en-lesson h3,
.mk-lesson.mk-lesson.en-lesson h4,
.mk-lesson.mk-lesson.en-lesson h5 {
	font-family: var(--en-head) !important;
	font-weight: 700;
	letter-spacing: -.2px;
}
.mk-lesson.mk-lesson.en-lesson { font-family: var(--en-body); }
.en-lesson .mk-btn,
.en-lesson .mk-q-n,
.en-lesson .mk-sec-n,
.en-lesson .mk-card > .mk-head,
.en-lesson .mk-bar-title,
.en-lesson .mk-opt .ltr,
.en-lesson table.mk-table th { font-family: var(--en-head) !important; }

/* Arabic text: right-to-left, Arabic font ---------------------------------- */
.en-lesson .en-ar,
.en-lesson [lang="ar"] {
	font-family: var(--en-ar);
	direction: rtl;
	unicode-bidi: isolate;
	font-weight: 700;
}

/* ========================= hero =========================================== */
.en-lesson .mk-hero {
	background:
		radial-gradient(1200px 300px at 110% -10%, rgba(255, 255, 255, .18), transparent 60%),
		linear-gradient(130deg, #0f172a 0%, #1e1b4b 45%, var(--mk-t1) 100%);
	border-radius: 24px;
	padding: 34px 32px 34px;
	box-shadow: 0 18px 44px rgba(20, 27, 52, .26);
}
.en-lesson .mk-hero::before { background: radial-gradient(circle, rgba(124, 58, 237, .55), transparent 70%); width: 340px; height: 340px; top: -140px; right: -90px; }
.en-lesson .mk-hero::after { background: radial-gradient(circle, rgba(14, 165, 233, .35), transparent 70%); width: 260px; height: 260px; bottom: -130px; right: 160px; }
.en-lesson .mk-hero h1 { font-size: 40px; letter-spacing: -.6px; text-shadow: none; }
.en-lesson .mk-hero-sub { color: #dfe4ff; font-weight: 500; }
.en-lesson .mk-chip { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .28); font-family: var(--en-head); font-weight: 600; letter-spacing: .6px; font-size: 12.5px; }
.en-lesson .mk-stat { border-radius: 12px; box-shadow: none; font-family: var(--en-head); font-weight: 600; }
.en-lesson .mk-stat span.n { font-family: var(--en-head); color: var(--mk-t1); }
.en-lesson .mk-mascot { display: none; }

.en-badge {
	position: absolute;
	right: 30px;
	bottom: 26px;
	z-index: 2;
	width: 104px;
	height: 104px;
	border-radius: 24px;
	background: rgba(255, 255, 255, .1);
	border: 1px solid rgba(255, 255, 255, .3);
	backdrop-filter: blur(6px);
	display: grid;
	place-items: center;
	text-align: center;
	color: #fff;
	font-family: var(--en-head);
	line-height: 1.05;
}
.en-badge b { display: block; font-size: 38px; font-weight: 700; }
.en-badge span { font-size: 11.5px; letter-spacing: 1.2px; text-transform: uppercase; opacity: .85; }
@media (max-width: 720px) { .en-badge { display: none; } }

/* ========================= sticky bar with section tabs =================== */
.en-lesson .mk-bar { flex-wrap: wrap; padding-bottom: 0; }
.en-tabs {
	flex: 1 0 100%;
	display: flex;
	gap: 6px;
	overflow-x: auto;
	scrollbar-width: none;
	padding: 8px 0 10px;
	-webkit-overflow-scrolling: touch;
}
.en-tabs::-webkit-scrollbar { display: none; }
.en-tab {
	flex: none;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	border: 1px solid var(--mk-line);
	background: #fff;
	color: var(--mk-ink-soft);
	border-radius: 999px;
	padding: 7px 14px;
	font-family: var(--en-head);
	font-weight: 600;
	font-size: 14.5px;
	cursor: pointer;
	transition: background .15s, color .15s, border-color .15s;
	white-space: nowrap;
}
.en-tab:hover { border-color: var(--mk-t1); color: var(--mk-t1); }
.en-tab[aria-selected="true"] { background: var(--mk-t1); border-color: var(--mk-t1); color: #fff; }
.en-tab .cnt {
	font-size: 12px;
	font-weight: 700;
	background: rgba(20, 27, 52, .07);
	border-radius: 999px;
	padding: 1px 8px;
}
.en-tab[aria-selected="true"] .cnt { background: rgba(255, 255, 255, .22); }
.en-tab.done .cnt { background: #dcfce7; color: #166534; }
.en-tab[aria-selected="true"].done .cnt { background: #fff; color: #166534; }

.en-panel[hidden] { display: none !important; }
.en-panel-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; flex-wrap: wrap; }

/* ========================= sections and cards ============================= */
.en-lesson .mk-sec h2 { font-size: 26px; }
.en-lesson .mk-sec-n { border-radius: 14px; box-shadow: none; }
.en-lesson .mk-card { border-width: 1px; box-shadow: var(--mk-shadow-sm); border-radius: 18px; }
.en-lesson .mk-card.idea, .en-lesson .mk-card.key, .en-lesson .mk-card.example,
.en-lesson .mk-card.try, .en-lesson .mk-card.practice, .en-lesson .mk-card.curious,
.en-lesson .mk-card.quiz, .en-lesson .mk-card.challenge { border-left-width: 5px; }
.en-lesson .mk-card > .mk-head { font-size: 19px; }
.en-lesson .mk-q { border-width: 1px; border-radius: 16px; box-shadow: var(--mk-shadow-sm); }
.en-lesson .mk-q-n { border-radius: 10px; box-shadow: none; font-size: 15px; min-width: 34px; height: 34px; }
.en-lesson .mk-q-ask { font-weight: 500; }
.en-lesson .mk-opt { border-width: 1.5px; border-radius: 12px; box-shadow: none; font-weight: 600; }
.en-lesson .mk-opt:hover:not(:disabled) { box-shadow: 0 6px 16px rgba(20, 27, 52, .08); }
.en-lesson .mk-opt .ltr { border-radius: 8px; width: 30px; height: 30px; }
.en-lesson .mk-btn { border-radius: 12px; box-shadow: 0 6px 16px rgba(79, 70, 229, .22); }
.en-lesson .mk-btn.ghost { box-shadow: none; border-width: 1.5px; }
.en-lesson table.mk-table th, .en-lesson table.mk-table td { border-width: 1px; }
.en-lesson .mk-fb { border-width: 1px; }
.en-lesson .mk-word { border-width: 1.5px; box-shadow: none; }

/* ========================= vocabulary cards =============================== */
.en-vocab { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin: 6px 0 4px; }
.en-vcard {
	position: relative;
	background: #fff;
	border: 1px solid var(--mk-line);
	border-radius: 16px;
	padding: 14px 16px 13px;
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 4px 10px;
	align-items: start;
	box-shadow: var(--mk-shadow-sm);
	transition: transform .15s, box-shadow .15s, border-color .15s;
}
.en-vcard:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--mk-t1) 35%, var(--mk-line)); }
.en-vcard.speaking { border-color: var(--mk-t1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mk-t1) 20%, transparent); }
.en-w { font-family: var(--en-head); font-weight: 700; font-size: 19px; color: var(--mk-ink); line-height: 1.25; }
.en-pos {
	display: inline-block;
	margin-left: 6px;
	font-family: var(--en-head);
	font-size: 12px;
	font-weight: 600;
	color: var(--mk-t1);
	background: color-mix(in srgb, var(--mk-t1) 10%, #fff);
	border-radius: 999px;
	padding: 1px 8px;
	vertical-align: 2px;
}
.en-mean { grid-column: 1 / -1; font-size: 16.5px; color: #374151; text-align: right; }
.en-ex { grid-column: 1 / -1; font-size: 14.5px; color: var(--mk-ink-soft); border-top: 1px dashed var(--mk-line); padding-top: 7px; margin-top: 2px; }
.en-say { display: flex; gap: 6px; }

.en-sbtn {
	width: 36px;
	height: 36px;
	border-radius: 11px;
	border: 1px solid var(--mk-line);
	background: #f6f7fd;
	color: var(--mk-t1);
	display: inline-grid;
	place-items: center;
	cursor: pointer;
	padding: 0;
	font-size: 17px;
	line-height: 1;
	transition: background .15s, color .15s, transform .1s;
}
.en-sbtn:hover { background: var(--mk-t1); color: #fff; }
.en-sbtn:active { transform: scale(.94); }
.en-sbtn.slow { color: #b45309; }
.en-sbtn.slow:hover { background: #f59e0b; color: #fff; }
.en-sbtn svg { width: 18px; height: 18px; display: block; }

.en-vfilter { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 2px 0 12px; }
.en-vfilter .lab { font-family: var(--en-head); font-weight: 600; color: var(--mk-ink-soft); font-size: 14px; }

/* ========================= reading player ================================= */
.en-reader { background: #fff; border: 1px solid var(--mk-line); border-radius: 20px; box-shadow: var(--mk-shadow-sm); overflow: hidden; margin: 6px 0 18px; }
.en-player {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	padding: 12px 16px;
	background: linear-gradient(120deg, #0f172a, #1e1b4b 60%, var(--mk-t1));
	color: #fff;
}
.en-player .t { font-family: var(--en-head); font-weight: 600; font-size: 15px; margin-right: auto; display: flex; align-items: center; gap: 8px; }
.en-pbtn {
	border: 1px solid rgba(255, 255, 255, .3);
	background: rgba(255, 255, 255, .1);
	color: #fff;
	border-radius: 999px;
	padding: 7px 14px;
	font-family: var(--en-head);
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.en-pbtn:hover { background: rgba(255, 255, 255, .22); }
.en-pbtn.on { background: #fff; color: var(--mk-t1); border-color: #fff; }
.en-pbtn[disabled] { opacity: .45; cursor: default; }
.en-prog { flex: 1 0 100%; height: 4px; background: rgba(255, 255, 255, .18); border-radius: 99px; overflow: hidden; }
.en-prog i { display: block; height: 100%; width: 0; background: var(--en-gold); transition: width .3s; }

.en-text { padding: 20px 22px 8px; font-size: 18px; line-height: 1.85; color: #1f2937; }
.en-text h3 { font-size: 22px; margin: 0 0 10px; }
.en-text p { margin: 0 0 1em; }
.en-sent { border-radius: 6px; transition: background .2s; cursor: pointer; }
.en-sent:hover { background: #f3f4ff; }
.en-sent.now { background: #fff1c2; box-shadow: 0 0 0 3px #fff1c2; }

.en-gl {
	border: none;
	background: none;
	padding: 0;
	margin: 0;
	font: inherit;
	color: inherit;
	cursor: pointer;
	border-bottom: 2px dotted var(--mk-t1);
	line-height: inherit;
}
.en-gl sup { font-family: var(--en-head); font-size: 11px; color: var(--mk-t1); font-weight: 700; margin-left: 1px; }
.en-tip {
	position: absolute;
	z-index: 60;
	max-width: 260px;
	background: #111827;
	color: #fff;
	border-radius: 12px;
	padding: 9px 12px;
	font-size: 15px;
	line-height: 1.45;
	box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
}
.en-tip b { font-family: var(--en-head); }
.en-tip .en-ar { display: block; font-size: 17px; margin-top: 3px; }
.en-tip .en-sbtn { width: 30px; height: 30px; margin-top: 6px; background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .25); color: #fff; }

.en-gloss { border-top: 1px solid var(--mk-line); padding: 14px 22px 18px; background: #fafbff; }
.en-gloss h4 { font-size: 15px; margin: 0 0 8px; color: var(--mk-ink-soft); }
.en-gloss ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px 18px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.en-gloss li { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; border-bottom: 1px dashed var(--mk-line); padding: 3px 0; }
.en-gloss li b { font-family: var(--en-head); font-weight: 600; }
.en-gloss li .n { color: var(--mk-t1); font-family: var(--en-head); font-weight: 700; margin-right: 6px; }

/* toast when the browser has no speech ------------------------------------ */
.en-toast {
	position: fixed;
	left: 50%;
	bottom: 22px;
	transform: translateX(-50%);
	background: #111827;
	color: #fff;
	border-radius: 12px;
	padding: 10px 16px;
	font-size: 15px;
	z-index: 9999;
	box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}

/* ========================= grammar / writing notes ======================== */
.en-rule { display: grid; gap: 10px; }
.en-rule-row { display: grid; grid-template-columns: 140px 1fr; gap: 12px; align-items: start; padding: 10px 12px; border-radius: 12px; background: #f7f8fe; }
.en-rule-row .k { font-family: var(--en-head); font-weight: 700; color: var(--mk-t1); }
.en-eg { display: block; margin-top: 4px; color: var(--mk-ink-soft); font-style: italic; }
.en-eg b, .en-eg strong { color: var(--mk-ink); font-style: normal; }
@media (max-width: 560px) { .en-rule-row { grid-template-columns: 1fr; gap: 4px; } }

/* ========================= small screens ================================= */
@media (max-width: 640px) {
	.mk-lesson.en-lesson { font-size: 16.5px; }
	.en-lesson .mk-hero { padding: 26px 20px; border-radius: 20px; }
	.en-lesson .mk-hero h1 { font-size: 30px; }
	.en-vocab { grid-template-columns: 1fr; }
	.en-text { padding: 16px 16px 6px; font-size: 17px; }
	.en-gloss { padding: 12px 16px 16px; }
	.en-player { padding: 10px 12px; }
}

/* phone: lighter hero and a one-line star bar ------------------------------ */
@media (max-width: 640px) {
	.en-lesson .mk-hero-chips { gap: 6px; }
	.en-lesson .mk-chip { font-size: 11px; padding: 4px 10px; letter-spacing: .3px; }
	.en-lesson .mk-hero-sub { font-size: 15.5px; line-height: 1.55; }
	.en-lesson .mk-hero-stats { gap: 8px; margin-top: 16px; }
	.en-lesson .mk-stat { font-size: 13.5px; padding: 7px 12px; }
	.en-lesson .mk-bar { gap: 8px; padding-top: 8px; }
	.en-lesson .mk-bar-title { flex: 1 1 0; font-size: 14px; }
	.en-lesson .mk-track { flex: 0 0 34%; min-width: 0; height: 10px; }
	.en-lesson .mk-score { font-size: 13.5px; }
	.en-lesson .en-tab { padding: 6px 12px; font-size: 13.5px; }
}

/* the word pool for a random matching task: read by kids.js, never shown */
.en-lesson .mk-m-pool { display: none; }

/* room for the pair number so it never sits on top of the text; on an Arabic
   (right-to-left) card the number moves to the left-hand side */
.en-lesson .mk-m-l,
.en-lesson .mk-m-r { padding-right: 44px; }
.en-lesson .mk-m-r.en-ar {
	text-align: right;
	padding-right: 14px;
	padding-left: 44px;
	line-height: 1.5;
}
.en-lesson .mk-m-r.en-ar[data-n]::after { right: auto; left: 10px; }
