.surahs-app {
	background: var(--bg);
	min-height: 100vh;
	padding: 0;
	margin: 0;
	border-radius: 0;
	box-shadow: none;
}
.surahs-header {
	padding: 24px 18px 8px 18px;
	background: var(--bg);
	color: var(--text);
	border-bottom: 1px solid var(--border);
}
.surahs-header h2 {
	font-size: 2rem;
	font-weight: 800;
	margin: 0;
}
.surah-list {
	background: var(--bg);
	padding: 0 0 32px 0;
}
.surah-list-row {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	background: var(--panel);
	border-radius: 16px;
	margin: 16px 18px 0 18px;
	padding: 18px 18px 18px 18px;
	cursor: pointer;
	transition: background 0.15s;
	border: 1px solid var(--border);
	position: relative;
}
.surah-list-row:hover {
	background: var(--panel-strong);
}
.surah-list-row .surah-num {
	min-width: 36px;
	height: 36px;
	background: var(--bg);
	border: 2px solid var(--accent);
	color: var(--accent);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 800;
	font-size: 1.1rem;
	margin-right: 18px;
}
.surah-list-row .surah-info {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.surah-list-row .surah-title-en {
	font-weight: 700;
	font-size: 1.1rem;
	color: var(--text);
}
.surah-list-row .surah-title-ar {
	font-family: var(--font-arabic);
	font-size: 1.1rem;
	direction: rtl;
	color: var(--accent);
}
.surah-list-row .surah-meta {
	font-size: 0.9rem;
	color: var(--muted);
	font-weight: 600;
}
.surah-list-row .surah-percent-badge {
	position: absolute;
	right: 18px;
	top: 50%;
	transform: translateY(-50%);
	margin-left: 0;
	width: 54px;
	height: 54px;
	font-size: 1.2rem;
}
.surahs-panel {
	padding: 0;
}
.surah-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: 60vh;
	overflow-y: auto;
	margin: 0 0 16px 0;
}
.surah-list-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: var(--panel);
	border-radius: 12px;
	padding: 12px 16px;
	cursor: pointer;
	transition: background 0.15s;
}
.surah-list-row:hover {
	background: rgba(62,198,255,0.08);
}
.surah-list-row .surah-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.surah-list-row .surah-title {
	font-weight: 700;
	font-size: 1.1rem;
}
.surah-list-row .surah-title-ar {
	font-family: var(--font-arabic);
	font-size: 1.1rem;
	direction: rtl;
}
.surah-list-row .surah-percent-badge {
	position: static;
	margin-left: 16px;
}
.surah-words-panel {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 12px 0 0 0;
}
.surah-word {
	font-size: 1.2rem;
	padding: 6px 12px;
	border-radius: 8px;
	background: var(--panel);
	color: var(--text);
	cursor: pointer;
	border: 1px solid transparent;
	transition: background 0.15s, color 0.15s, border 0.15s;
}
.surah-word.known {
	color: #1a7f2e;
	background: rgba(113,214,140,0.18);
	border-color: #1a7f2e;
}
.surah-word.unknown {
	color: #c92a2a;
	background: rgba(255,142,125,0.18);
	border-color: #c92a2a;
}
.surah-word.learning {
	color: #b08900;
	background: rgba(255, 221, 87, 0.18);
	border-color: #b08900;
}
.surah-percent-badge {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	border: 2px solid var(--accent);
	background: var(--panel);
	color: var(--accent);
	font-size: 1.1rem;
	font-weight: 800;
	position: absolute;
	right: 12px;
	top: 12px;
	flex-direction: column;
	box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.surah-percent-badge .percent {
	font-size: 1.1rem;
	font-weight: 800;
	line-height: 1.1;
}
.surah-percent-badge .label {
	font-size: 0.7rem;
	font-weight: 600;
	line-height: 1;
}
.surah-chip {
	position: relative;
	padding-right: 64px;
}
:root {
	color-scheme: dark;
	--bg: #0d1e17;
	--bg-alt: #153126;
	--panel: rgba(10, 28, 21, 0.82);
	--panel-strong: rgba(17, 44, 33, 0.94);
	--text: #f2f5ef;
	--muted: #b6c8bd;
	--border: rgba(181, 228, 204, 0.16);
	--accent: #c8f169;
	--accent-strong: #9ed932;
	--accent-ink: #16311f;
	--danger: #ff8e7d;
	--shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
	--font-sans: "Avenir Next", "Segoe UI", sans-serif;
	--font-arabic: "KFGQPC", "Noto Naskh Arabic", serif;
}

body[data-theme="light"] {
	color-scheme: light;
	--bg: #eef3eb;
	--bg-alt: #dbe8df;
	--panel: rgba(255, 255, 255, 0.84);
	--panel-strong: rgba(255, 255, 255, 0.96);
	--text: #143726;
	--muted: #597266;
	--border: rgba(6, 78, 59, 0.12);
	--accent: #0d7a53;
	--accent-strong: #09593d;
	--accent-ink: #ffffff;
	--danger: #c44c3b;
	--shadow: 0 24px 80px rgba(17, 49, 38, 0.12);
}

@font-face {
	font-family: "KFGQPC";
	src: url("../fonts/qcf-uthmanic-digital.woff2") format("woff2");
	font-display: swap;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	min-height: 100vh;
	font-family: var(--font-sans);
	background:
		radial-gradient(circle at top left, rgba(200, 241, 105, 0.14), transparent 28%),
		radial-gradient(circle at top right, rgba(93, 218, 175, 0.14), transparent 22%),
		linear-gradient(180deg, var(--bg-alt), var(--bg));
	color: var(--text);
}

button,
input,
select {
	font: inherit;
}

.hidden {
	display: none !important;
}

.page-shell {
	max-width: 1380px;
	margin: 0 auto;
	padding: 14px;
}

.hero {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	align-items: end;
	margin-bottom: 12px;
}

.eyebrow,
.section-label {
	margin: 0 0 6px;
	text-transform: uppercase;
	letter-spacing: 0.18em;
	font-size: 0.66rem;
	color: var(--muted);
	font-weight: 700;
}

.hero h1,
.panel-head h2,
.status-panel h2,
.status-panel h3 {
	margin: 0;
	font-size: clamp(1.55rem, 3.6vw, 2.5rem);
	line-height: 0.95;
}

.panel-head h2,
.status-panel h2,
.status-panel h3 {
	font-size: 1.35rem;
	line-height: 1.1;
}

.hero-copy,
.loading-copy,
.stat-copy,
.list-summary,
.prompt {
	color: var(--muted);
	line-height: 1.55;
}

.question-actions,
.tab-row,
.question-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: center;
}

.tab-row {
	justify-content: center;
	gap: 6px;
	flex-wrap: nowrap;
}

.card,
.loading-panel,
.status-panel {
	background: var(--panel);
	border: 1px solid var(--border);
	border-radius: 24px;
	box-shadow: var(--shadow);
	backdrop-filter: blur(20px);
}

.loading-panel,
.status-panel {
	padding: 24px;
	margin-bottom: 20px;
	display: flex;
	align-items: center;
	gap: 18px;
}

.status-panel.subtle {
	background: transparent;
	box-shadow: none;
	border-style: dashed;
	padding: 20px;
}

.loading-title,
.stat-label {
	margin: 0 0 6px;
	font-size: 0.9rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--muted);
}

.spinner {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	border: 4px solid rgba(255, 255, 255, 0.12);
	border-top-color: var(--accent);
	animation: spin 0.9s linear infinite;
	flex: 0 0 auto;
}

.app-grid {
	display: grid;
	grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr);
	gap: 20px;
	align-items: start;
	max-width: 1120px;
	margin-left: auto;
	margin-right: auto;
	margin-inline: auto;
}

.category-view {
	padding: 20px;
	display: grid;
	gap: 16px;
}

.category-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}

.category-card {
	text-align: left;
	padding: 18px;
	border-radius: 18px;
	border: 1px solid var(--border);
	background: rgba(255, 255, 255, 0.03);
	color: var(--text);
	display: grid;
	gap: 6px;
	cursor: pointer;
	transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.category-card:hover {
	transform: translateY(-1px);
	border-color: rgba(200, 241, 105, 0.42);
}

.category-card.featured {
	background: linear-gradient(135deg, rgba(200, 241, 105, 0.2), rgba(32, 74, 54, 0.72));
	border-color: rgba(200, 241, 105, 0.35);
}

.category-title {
	font-size: 1.05rem;
	font-weight: 800;
}

.category-copy {
	font-size: 0.9rem;
	line-height: 1.45;
	color: var(--muted);
}

.component-toolbar {
	grid-column: 1 / -1;
	padding: 8px;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	justify-content: space-between;
}

.component-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	justify-content: center;
	width: min(560px, 100%);
	margin-left: auto;
	margin-right: auto;
	margin-inline: auto;
}

.component-tab {
	padding: 9px 12px;
	border-radius: 999px;
	border: 1px solid var(--border);
	background: transparent;
	color: var(--muted);
	cursor: pointer;
	text-align: center;
}

.component-tabs .quiz-return-tab {
	grid-column: 1 / -1;
	justify-self: center;
}

.component-tab.is-active {
	background: var(--accent);
	color: var(--accent-ink);
	border-color: transparent;
	font-weight: 800;
}

.quiz-return-tab {
	padding: 6px 10px;
	font-size: 0.8rem;
	line-height: 1;
	background: rgba(200, 241, 105, 0.16);
	border-color: rgba(200, 241, 105, 0.35);
	color: var(--accent);
}

.bottom-actions-panel {
	grid-column: 1 / -1;
	padding: 12px;
	margin-top: 4px;
}

.bottom-actions-row {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: flex-end;
	align-items: center;
}

.quiz-panel,
.list-panel,
.stat-card {
	padding: 14px;
}

.quiz-panel .panel-head {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
	align-items: end;
}

.quiz-panel .panel-head > div:first-child {
	grid-column: 1 / -1;
}

.quiz-panel .field.compact {
	width: 100%;
	flex: initial;
}

.stats-panel {
	display: grid;
	gap: 20px;
}

.progress-stack {
	display: grid;
	gap: 20px;
}

.compact-head {
	margin-bottom: 12px;
}

.insights-panel {
	padding: 18px;
	display: grid;
	gap: 14px;
}

.insights-controls {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: end;
	justify-content: flex-end;
}

.toggle-line {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	border: 1px solid var(--border);
	border-radius: 12px;
	font-size: 0.88rem;
	color: var(--muted);
	background: rgba(255, 255, 255, 0.03);
	cursor: pointer;
}

.toggle-line input {
	accent-color: var(--accent-strong);
}

.insights-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}

.insight-tile {
	padding: 16px;
	border-radius: 16px;
	border: 1px solid var(--border);
	background: rgba(255, 255, 255, 0.03);
}

.insight-tile .stat-value {
	font-size: clamp(1.4rem, 2.8vw, 2.1rem);
	margin-bottom: 4px;
}

.surah-mastery-map {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
	gap: 8px;
	max-height: 240px;
	overflow: auto;
	padding-right: 4px;
}

.surah-chip {
	padding: 10px;
	border-radius: 12px;
	border: 1px solid var(--border);
	background: rgba(255, 255, 255, 0.02);
	display: grid;
	gap: 6px;
	cursor: pointer;
	transition: border-color 150ms, background 150ms;
}

.surah-chip:hover,
.surah-chip:active {
	border-color: var(--accent);
	background: rgba(134, 240, 174, 0.07);
}

.surah-chip-head {
	display: flex;
	justify-content: space-between;
	font-size: 0.78rem;
	color: var(--muted);
	font-weight: 700;
	letter-spacing: 0.03em;
}

.surah-chip-tap {
	font-size: 0.72rem;
	font-weight: 600;
	color: var(--accent);
	opacity: 0.75;
	letter-spacing: 0;
}

.surah-progress {
	width: 100%;
	height: 6px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.08);
	overflow: hidden;
}

.surah-progress > span {
	display: block;
	height: 100%;
	background: linear-gradient(90deg, var(--accent-strong), var(--accent));
	border-radius: inherit;
}

.stats-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px;
}

.stat-card.accent {
	background: linear-gradient(135deg, rgba(200, 241, 105, 0.22), rgba(29, 67, 49, 0.86));
	border-color: rgba(200, 241, 105, 0.28);
}

body[data-theme="light"] .stat-card.accent {
	background: linear-gradient(135deg, rgba(18, 113, 76, 0.14), rgba(255, 255, 255, 0.98));
	border-color: rgba(13, 122, 83, 0.18);
}

.stat-value {
	margin: 0 0 8px;
	font-size: clamp(1.8rem, 4vw, 2.9rem);
	font-weight: 800;
	line-height: 1;
}

.panel-head {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	align-items: start;
	margin-bottom: 10px;
}

.stack-on-mobile {
	align-items: end;
}

.field {
	display: grid;
	gap: 8px;
	font-size: 0.92rem;
	color: var(--muted);
}

.field.grow {
	flex: 1 1 240px;
}

.field.compact {
	width: min(220px, 100%);
	flex: 0 1 220px;
}

.fixed-value {
	width: 100%;
	padding: 13px 14px;
	border-radius: 14px;
	border: 1px solid var(--border);
	background: var(--panel-strong);
	color: var(--text);
	font-weight: 700;
}

select,
input[type="search"] {
	width: 100%;
	padding: 10px 12px;
	border-radius: 14px;
	border: 1px solid var(--border);
	background: var(--panel-strong);
	color: var(--text);
	outline: none;
}

select:focus,
input[type="search"]:focus {
	border-color: rgba(200, 241, 105, 0.5);
	box-shadow: 0 0 0 4px rgba(200, 241, 105, 0.12);
}

.question-card {
	display: grid;
	gap: 10px;
	padding: 12px;
	border-radius: 22px;
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
	border: 1px solid var(--border);
}

.pill {
	display: inline-flex;
	align-items: center;
	padding: 6px 10px;
	border-radius: 999px;
	font-size: 0.76rem;
	font-weight: 700;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid var(--border);
}

.pill.muted {
	color: var(--muted);
	font-weight: 600;
}

.arabic-word {
	margin: 4px 0;
	font-family: var(--font-arabic);
	font-size: clamp(2rem, 7vw, 3.2rem);
	line-height: 1.35;
	text-align: center;
	direction: rtl;
}

.word-transliteration {
	margin: -2px 0 0;
	text-align: center;
	font-size: 0.92rem;
	line-height: 1.4;
	color: var(--muted);
	font-weight: 600;
	letter-spacing: 0.01em;
}

.word-audio-row {
	display: flex;
	justify-content: center;
}

.icon-only {
	min-width: 48px;
	padding: 9px 11px;
	font-size: 1.05rem;
	line-height: 1;
	text-align: center;
}

.answers-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
}

.answer-button,
.ghost-button,
.solid-button,
.known-toggle,
.mini-button {
	border-radius: 16px;
	border: 1px solid var(--border);
	background: var(--panel-strong);
	color: var(--text);
	padding: 14px 16px;
	cursor: pointer;
	transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.answer-button {
	text-align: left;
	line-height: 1.45;
	min-height: 62px;
	padding: 10px 12px;
}

@media (max-height: 920px) {
	.hero-copy {
		display: none;
	}

	.hero {
		margin-bottom: 8px;
	}

	.question-actions {
		gap: 8px;
	}
}

.answer-button:hover,
.ghost-button:hover,
.solid-button:hover,
.known-toggle:hover,
.mini-button:hover {
	transform: translateY(-1px);
	border-color: rgba(200, 241, 105, 0.44);
}

.answer-button.correct {
	background: rgba(113, 214, 140, 0.18);
	border-color: rgba(113, 214, 140, 0.42);
}

.answer-button.wrong {
	background: rgba(255, 142, 125, 0.18);
	border-color: rgba(255, 142, 125, 0.42);
}

.solid-button {
	background: var(--accent);
	border-color: transparent;
	color: var(--accent-ink);
	font-weight: 800;
}

.ghost-button.danger {
	color: var(--danger);
	border-color: rgba(255, 142, 125, 0.25);
}

.feedback {
	padding: 14px 16px;
	border-radius: 16px;
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid var(--border);
	line-height: 1.5;
}

.feedback strong {
	display: block;
	margin-bottom: 4px;
}

.tab-button {
	padding: 6px 10px;
	border-radius: 999px;
	border: 1px solid var(--border);
	background: transparent;
	color: var(--muted);
	cursor: pointer;
	font-size: 0.82rem;
	white-space: nowrap;
}

.tab-button.is-active {
	background: var(--accent);
	color: var(--accent-ink);
	border-color: transparent;
	font-weight: 800;
}

.word-list {
	display: grid;
	gap: 12px;
	max-height: 58vh;
	overflow: auto;
	padding-right: 4px;
}

.word-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 14px;
	padding: 16px;
	border-radius: 18px;
	background: rgba(255, 255, 255, 0.035);
	border: 1px solid var(--border);
	align-items: center;
}

.word-row-main {
	display: grid;
	gap: 8px;
}

.word-row-top {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 10px;
	align-items: center;
}

.word-row-arabic {
	font-family: var(--font-arabic);
	font-size: 1.9rem;
	line-height: 1.25;
	direction: rtl;
}

.word-row-translation {
	font-size: 1rem;
	line-height: 1.5;
}

.word-row-meta,
.word-row-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

.mini-badge {
	padding: 6px 10px;
	border-radius: 999px;
	font-size: 0.8rem;
	border: 1px solid var(--border);
	color: var(--muted);
	background: rgba(255, 255, 255, 0.04);
}

.known-toggle.active {
	background: rgba(200, 241, 105, 0.2);
	border-color: rgba(200, 241, 105, 0.45);
	color: var(--text);
	font-weight: 800;
}

.mini-button {
	padding: 10px 12px;
	font-size: 0.84rem;
	min-width: 88px;
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

@media (max-width: 1100px) {
	.app-grid {
		grid-template-columns: 1fr;
	}

	.category-grid {
		grid-template-columns: 1fr;
	}

	.word-list {
		max-height: none;
	}
}

@media (max-width: 760px) {
	.page-shell {
		padding: 10px;
	}

	.hero,
	.stack-on-mobile,
	.word-row {
		grid-template-columns: 1fr;
		display: grid;
	}

	.question-actions,
	.stats-grid,
	.insights-grid {
		grid-template-columns: 1fr;
		display: grid;
	}

	.question-actions {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 7px;
	}

	.answers-grid {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 7px;
	}

	.bottom-actions-row {
		display: grid;
		grid-template-columns: 1fr;
		justify-content: stretch;
	}

	.component-tabs {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		width: min(520px, 100%);
		margin-left: auto;
		margin-right: auto;
		margin-inline: auto;
	}

	.quiz-panel .panel-head {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 6px;
	}

	.quiz-panel .field {
		font-size: 0.76rem;
		gap: 4px;
	}

	.quiz-panel .field > span {
		display: none;
	}

	.quiz-panel select {
		padding: 8px 7px;
		font-size: 0.8rem;
	}

	.question-card {
		gap: 8px;
		padding: 10px;
		min-height: calc(100vh - 290px);
	}

	.question-actions {
		margin-top: auto;
		padding-top: 12px;
		border-top: 1px solid rgba(181, 228, 204, 0.14);
	}

	.insights-controls {
		justify-content: start;
	}

	.hero h1 {
		font-size: 2rem;
	}

	.eyebrow {
		display: none;
	}

	.arabic-word {
		font-size: 2.5rem;
	}

	.answer-button {
		min-height: 52px;
		padding: 8px 9px;
		font-size: 0.92rem;
	}

	.ghost-button,
	.solid-button,
	.known-toggle,
	.mini-button {
		padding: 9px 10px;
		font-size: 0.98rem;
		border-radius: 14px;
	}
}

@media (min-width: 1200px) and (orientation: landscape) {
	.app-grid {
		max-width: 1260px;
		grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.35fr);
	}

	.quiz-panel,
	.list-panel,
	.stat-card {
		padding: 16px;
	}
}

@media (min-width: 1280px) and (min-height: 760px) and (orientation: landscape) {
	.page-shell {
		max-width: 1700px;
		padding: 18px 20px;
	}

	.app-grid {
		max-width: 1500px;
		grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.45fr);
		gap: 24px;
	}

	.hero {
		margin-bottom: 14px;
	}

	.arabic-word {
		font-size: clamp(2.4rem, 4.8vw, 3.6rem);
	}

	.answers-grid {
		gap: 10px;
	}
}

/* Center quiz panel on tablets/landscape when stats panel is hidden */
.app-grid[data-active-component="quiz"],
.app-grid[data-active-component="full"] {
	grid-template-columns: 1fr;
}

.app-grid[data-active-component="quiz"] #quizComponent,
.app-grid[data-active-component="full"] #quizComponent {
	max-width: 600px;
	margin-left: auto;
	margin-right: auto;
	width: 100%;
}