/* QuizMala Home */
.qmh {
	--qmh-accent: #4f46e5;
	--qmh-soft: rgba(79, 70, 229, .10);
	--qmh-mid: rgba(79, 70, 229, .35);
	--qmh-cols: 4;
	--qmh-cols-t: 3;
	--qmh-adh: 250px;
	--qmh-text: #1f2937;
	--qmh-muted: #6b7280;
	--qmh-border: #e5e7eb;
	color: var(--qmh-text);
	line-height: 1.5;
	box-sizing: border-box;
	width: 100%;
}
.qmh *, .qmh *::before, .qmh *::after { box-sizing: border-box; }
.qmh a { text-decoration: none; box-shadow: none; }
.qmh .qmh-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.qmh .qmh-sec { margin: 0 0 34px; }

/* ---------- Hero + search ---------- */
.qmh .qmh-hero {
	margin: 0 0 28px; padding: 38px 24px; border-radius: 20px; text-align: center; color: #fff;
	background: linear-gradient(135deg, rgba(255,255,255,.14), rgba(0,0,0,.22)), var(--qmh-accent);
	box-shadow: 0 10px 30px rgba(15, 23, 42, .15);
}
.qmh .qmh-hero-t { margin: 0 0 8px; color: #fff; font-size: 2em; line-height: 1.25; font-weight: 800; }
.qmh .qmh-hero-s { margin: 0 0 20px; color: rgba(255,255,255,.92); font-size: 1.05em; }
.qmh .qmh-search { display: flex; max-width: 560px; margin: 0 auto; background: #fff; border-radius: 999px; padding: 5px; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.qmh input.qmh-input {
	flex: 1 1 auto; min-width: 0; height: 46px; margin: 0; padding: 0 18px;
	border: 0; outline: 0; background: transparent; color: var(--qmh-text);
	font: inherit; font-size: 1em; box-shadow: none; border-radius: 999px;
}
.qmh button.qmh-sbtn {
	appearance: none; -webkit-appearance: none; flex: 0 0 auto; height: 46px; padding: 0 22px; margin: 0;
	border: 0; border-radius: 999px; background: var(--qmh-accent); color: #fff;
	font: inherit; font-weight: 700; cursor: pointer; box-shadow: none; text-transform: none; letter-spacing: normal;
}
.qmh button.qmh-sbtn:hover { opacity: .92; }
.qmh .qmh-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; margin-top: 18px; font-size: .9em; font-weight: 600; color: rgba(255,255,255,.95); }
.qmh .qmh-search-only { margin: 0 0 24px; }
.qmh .qmh-search-only .qmh-search { border: 2px solid var(--qmh-mid); box-shadow: none; }

/* ---------- Headings ---------- */
.qmh .qmh-sh { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; padding-bottom: 10px; border-bottom: 2px solid var(--qmh-border); position: relative; }
.qmh .qmh-sh::after { content: ""; position: absolute; left: 0; bottom: -2px; width: 70px; height: 4px; border-radius: 4px; background: var(--qmh-accent); }
.qmh .qmh-subject .qmh-sh::after { background: hsl(var(--h, 230), 60%, 52%); }
.qmh .qmh-h { margin: 0; font-size: 1.3em; line-height: 1.3; color: var(--qmh-text); }
.qmh a.qmh-more { flex: 0 0 auto; padding: 6px 14px; border-radius: 999px; background: var(--qmh-soft); color: var(--qmh-accent); font-weight: 700; font-size: .9em; white-space: nowrap; }
.qmh a.qmh-more:hover { background: var(--qmh-accent); color: #fff; }

/* ---------- Subject buttons ---------- */
.qmh .qmh-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.qmh a.qmh-chip {
	--h: 230;
	display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px;
	background: hsl(var(--h), 80%, 96%); border: 1px solid hsl(var(--h), 55%, 84%); color: hsl(var(--h), 50%, 24%);
	font-weight: 700; font-size: .93em; line-height: 1.2; white-space: nowrap;
	transition: transform .12s, box-shadow .12s, background .12s;
}
.qmh a.qmh-chip:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(15, 23, 42, .10); background: hsl(var(--h), 80%, 92%); }
.qmh .qmh-dot { width: 10px; height: 10px; border-radius: 50%; background: hsl(var(--h), 60%, 52%); flex: 0 0 auto; }

/* ---------- Cards ---------- */
.qmh .qmh-grid { display: grid; grid-template-columns: repeat(var(--qmh-cols), minmax(0, 1fr)); gap: 18px; }
.qmh a.qmh-card {
	display: flex; flex-direction: column; overflow: hidden; background: #fff; color: var(--qmh-text);
	border: 1px solid var(--qmh-border); border-radius: 14px; box-shadow: 0 4px 16px rgba(15, 23, 42, .06);
	transition: transform .15s, box-shadow .15s, border-color .15s;
}
.qmh a.qmh-card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(15, 23, 42, .12); border-color: var(--qmh-mid); }
.qmh .qmh-thumb { display: block; position: relative; aspect-ratio: 16 / 9; background: var(--qmh-soft); overflow: hidden; }
.qmh .qmh-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; margin: 0; border-radius: 0; }
.qmh .qmh-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2.6em; background: linear-gradient(135deg, var(--qmh-soft), var(--qmh-mid)); }
.qmh .qmh-new { position: absolute; top: 8px; left: 8px; padding: 2px 9px; border-radius: 999px; background: #ef4444; color: #fff; font-size: .7em; font-weight: 800; letter-spacing: .5px; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.qmh .qmh-body { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; padding: 14px; }
.qmh .qmh-cat { align-self: flex-start; padding: 2px 10px; border-radius: 999px; background: var(--qmh-soft); color: var(--qmh-accent); font-size: .76em; font-weight: 700; }
.qmh .qmh-title {
	display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
	font-weight: 700; font-size: 1em; line-height: 1.4; color: var(--qmh-text);
}
.qmh .qmh-btn { margin-top: auto; padding-top: 6px; color: var(--qmh-accent); font-weight: 700; font-size: .9em; }

/* ---------- Ads (reserved space, no layout shift) ---------- */
.qmh .qmh-ad { clear: both; margin: 8px auto 34px; max-width: 100%; text-align: center; overflow: hidden; }
.qmh .qmh-ad-label { display: block; margin-bottom: 4px; color: var(--qmh-muted); font-size: .72em; letter-spacing: .5px; text-transform: uppercase; }
.qmh .qmh-ad-box { min-height: var(--qmh-adh); display: flex; align-items: center; justify-content: center; max-width: 100%; }
.qmh .qmh-ad-box ins.adsbygoogle { width: 100%; }
.qmh .qmh-ad:has(ins[data-ad-status="unfilled"]) { display: none; }

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
	.qmh .qmh-grid { grid-template-columns: repeat(var(--qmh-cols-t, 3), minmax(0, 1fr)); }
}
@media (max-width: 800px) {
	.qmh .qmh-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Mobile ---------- */
@media (max-width: 560px) {
	.qmh .qmh-sec { margin-bottom: 26px; }
	.qmh .qmh-hero { padding: 24px 14px; border-radius: 16px; margin-bottom: 20px; }
	.qmh .qmh-hero-t { font-size: 1.4em; }
	.qmh .qmh-hero-s { font-size: .95em; margin-bottom: 14px; }
	.qmh input.qmh-input { height: 42px; padding: 0 12px; font-size: .95em; }
	.qmh button.qmh-sbtn { height: 42px; padding: 0 16px; }
	.qmh .qmh-sbtn-t { display: none; }
	.qmh .qmh-stats { font-size: .8em; gap: 6px 12px; margin-top: 12px; }
	.qmh .qmh-h { font-size: 1.12em; }
	.qmh a.qmh-more { padding: 5px 11px; font-size: .82em; }
	/* Subject buttons: one swipeable row */
	.qmh .qmh-chips { flex-wrap: nowrap; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -2px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
	.qmh a.qmh-chip { scroll-snap-align: start; padding: 8px 14px; font-size: .88em; }
	/* Cards: 2 columns with full 16:9 thumbnail */
	.qmh .qmh-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
	.qmh a.qmh-card { border-radius: 12px; }
	.qmh .qmh-body { padding: 10px; gap: 5px; }
	.qmh .qmh-cat { font-size: .68em; padding: 2px 8px; }
	.qmh .qmh-title { font-size: .86em; line-height: 1.35; }
	.qmh .qmh-btn { font-size: .84em; padding-top: 4px; }
	.qmh .qmh-new { top: 6px; left: 6px; font-size: .62em; padding: 2px 7px; }
	.qmh .qmh-ad { margin-bottom: 26px; }
}
@media (max-width: 340px) {
	.qmh .qmh-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
	.qmh *, .qmh *::before, .qmh *::after { transition: none !important; }
}
