/* ═══════════════════════════════════════════
	 LIGHT MODE — WCAG AA / AAA compliant
═══════════════════════════════════════════ */
:root {
	--primary: #0c5450;
	--primary-dark: #073c38;
	--primary-light: #177a73;
	--accent: #e6b731;
	--accent-dark: #b8881a;
	--accent-light: rgba(230,183,49,0.11);
	--accent-text: #7a5500;
	--bg: #edf2f1;
	--surface: #ffffff;
	--surface-muted: #f3f7f6;
	--surface-nav: rgba(255,255,255,0.92);
	--text: #0d1f1d;
	--text-secondary: #3a5956;
	--text-muted: #61817e;
	--text-disabled: #8faead;
	--success: #15803d;
	--success-light: #16a34a;
	--success-bg: rgba(21,128,61,0.1);
	--danger: #dc2626;
	--danger-light: #ef4444;
	--danger-bg: rgba(220,38,38,0.1);
	--border: rgba(15,91,85,0.14);
	--border-subtle: rgba(15,91,85,0.08);
	--track-bg: #dce8e6;
	--shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
	--shadow: 0 4px 16px rgba(15,91,85,0.09), 0 2px 6px rgba(0,0,0,0.06);
	--shadow-lg: 0 12px 32px rgba(15,91,85,0.13), 0 4px 12px rgba(0,0,0,0.07);
	--radius: 16px;
	--radius-sm: 10px;
	--radius-xs: 7px;
	--white: var(--surface);

	--nav-height: 64px;
	--container-pad: clamp(12px, 4vw, 24px);
	--container-max: 680px;
	--card-pad: clamp(14px, 3vw, 22px);
}

/* ═══════════════════════════════════════════
	 DARK MODE
═══════════════════════════════════════════ */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
	--primary: #2ab5ab;
	--primary-dark: #1e8a82;
	--primary-light: #3bcec4;
	--accent: #f0c040;
	--accent-dark: #d4a830;
	--accent-light: rgba(240,192,64,0.13);
	--accent-text: #f0c040;
	--bg: #0b1c1b;
	--surface: #152e2b;
	--surface-muted: #1d3a37;
	--surface-nav: rgba(15,40,38,0.94);
	--text: #e6f2f1;
	--text-secondary: #88b8b4;
	--text-muted: #517a77;
	--text-disabled: #345855;
	--success: #34d399;
	--success-light: #6ee7b7;
	--success-bg: rgba(52,211,153,0.13);
	--danger: #f87171;
	--danger-light: #fca5a5;
	--danger-bg: rgba(248,113,113,0.13);
	--border: rgba(255,255,255,0.12);
	--border-subtle: rgba(255,255,255,0.07);
	--track-bg: rgba(255,255,255,0.1);
	--shadow-sm: 0 1px 4px rgba(0,0,0,0.35), 0 1px 2px rgba(0,0,0,0.25);
	--shadow: 0 4px 20px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.2);
	--shadow-lg: 0 12px 36px rgba(0,0,0,0.45), 0 4px 14px rgba(0,0,0,0.3);
	--white: var(--surface);
}}

html[data-theme="dark"] {
	--primary: #2ab5ab;
	--primary-dark: #1e8a82;
	--primary-light: #3bcec4;
	--accent: #f0c040;
	--accent-dark: #d4a830;
	--accent-light: rgba(240,192,64,0.13);
	--accent-text: #f0c040;
	--bg: #0b1c1b;
	--surface: #152e2b;
	--surface-muted: #1d3a37;
	--surface-nav: rgba(15,40,38,0.94);
	--text: #e6f2f1;
	--text-secondary: #88b8b4;
	--text-muted: #517a77;
	--text-disabled: #345855;
	--success: #34d399;
	--success-light: #6ee7b7;
	--success-bg: rgba(52,211,153,0.13);
	--danger: #f87171;
	--danger-light: #fca5a5;
	--danger-bg: rgba(248,113,113,0.13);
	--border: rgba(255,255,255,0.12);
	--border-subtle: rgba(255,255,255,0.07);
	--track-bg: rgba(255,255,255,0.1);
	--shadow-sm: 0 1px 4px rgba(0,0,0,0.35), 0 1px 2px rgba(0,0,0,0.25);
	--shadow: 0 4px 20px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.2);
	--shadow-lg: 0 12px 36px rgba(0,0,0,0.45), 0 4px 14px rgba(0,0,0,0.3);
	--white: var(--surface);
}

html[data-theme="light"] {
	--primary: #0c5450;
	--primary-dark: #073c38;
	--primary-light: #177a73;
	--accent: #e6b731;
	--accent-dark: #b8881a;
	--accent-light: rgba(230,183,49,0.11);
	--accent-text: #7a5500;
	--bg: #edf2f1;
	--surface: #ffffff;
	--surface-muted: #f3f7f6;
	--surface-nav: rgba(255,255,255,0.92);
	--text: #0d1f1d;
	--text-secondary: #3a5956;
	--text-muted: #61817e;
	--text-disabled: #8faead;
	--success: #15803d;
	--success-light: #16a34a;
	--success-bg: rgba(21,128,61,0.1);
	--danger: #dc2626;
	--danger-light: #ef4444;
	--danger-bg: rgba(220,38,38,0.1);
	--border: rgba(15,91,85,0.14);
	--border-subtle: rgba(15,91,85,0.08);
	--track-bg: #dce8e6;
	--shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
	--shadow: 0 4px 16px rgba(15,91,85,0.09), 0 2px 6px rgba(0,0,0,0.06);
	--shadow-lg: 0 12px 32px rgba(15,91,85,0.13), 0 4px 12px rgba(0,0,0,0.07);
	--white: var(--surface);
}

/* ═══════════════════════════════════════════
	 RESET & BASE
═══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; }

body {
	font-family: 'Inter', sans-serif;
	margin: 0;
	background: var(--bg);
	color: var(--text);
	display: flex;
	min-height: 100vh;
	min-height: 100dvh;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}

/* ═══════════════════════════════════════════
	 PAGE LAYOUT
═══════════════════════════════════════════ */
.page-main {
	flex: 1;
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	min-width: 0;
	width: 100%;
}

/* ═══════════════════════════════════════════
	 TOP NAV
═══════════════════════════════════════════ */
.top-nav {
	height: var(--nav-height);
	padding: 0 var(--container-pad);
	display: flex;
	align-items: center;
	justify-content: space-between;
	position: sticky;
	top: 0;
	z-index: 80;
	background: var(--surface-nav);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	border-bottom: 1px solid var(--border-subtle);
	gap: 8px;
}

.top-nav-left, .top-nav-right {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

.top-nav-title {
	font-weight: 700;
	font-size: clamp(0.75rem, 2.5vw, 0.9rem);
	color: var(--primary-dark);
	letter-spacing: 0.01em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 40vw;
}

.icon-btn {
	width: 38px;
	height: 38px;
	min-width: 38px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--radius-xs);
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--text-secondary);
	cursor: pointer;
	text-decoration: none;
	transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
	touch-action: manipulation;
}

.icon-btn:hover {
	background: var(--accent-light);
	border-color: rgba(230,183,49,0.4);
}

.top-nav-badge {
	font-size: 10px;
	font-weight: 700;
	padding: 5px 10px;
	border-radius: 999px;
	background: var(--accent-light);
	border: 1px solid rgba(230,183,49,0.36);
	color: var(--accent-text);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	white-space: nowrap;
}

/* ═══════════════════════════════════════════
	 HERO HEADER
═══════════════════════════════════════════ */
.header {
	background: linear-gradient(145deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
	color: white;
	padding: clamp(28px, 5vw, 44px) var(--container-pad) clamp(48px, 7vw, 60px);
	text-align: center;
	position: relative;
	overflow: hidden;
}

.header::before {
	content: '';
	position: absolute;
	inset: 0;
	background: radial-gradient(ellipse 80% 60% at 50% 110%, rgba(230,183,49,0.18) 0%, transparent 70%);
	pointer-events: none;
}

.header-eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: clamp(9px, 2vw, 11px);
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: rgba(230,183,49,0.9);
	margin-bottom: 10px;
}

.header-eyebrow::before, .header-eyebrow::after {
	content: '';
	display: block;
	width: clamp(16px, 4vw, 24px);
	height: 1px;
	background: rgba(230,183,49,0.5);
}

.header h1 {
	margin: 0 0 8px;
	font-size: clamp(20px, 5vw, 28px);
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.2;
}

.header p {
	margin: 0;
	font-size: clamp(12px, 3vw, 14px);
	color: rgba(255,255,255,0.7);
	font-weight: 400;
	letter-spacing: 0.01em;
}

/* ═══════════════════════════════════════════
	 CONTAINER
═══════════════════════════════════════════ */
.container {
	width: 100%;
	max-width: var(--container-max);
	margin: -32px auto 48px;
	padding: 0 var(--container-pad);
	position: relative;
	z-index: 1;
}

/* ═══════════════════════════════════════════
	 GLOBAL PROGRESS CARD
═══════════════════════════════════════════ */
.global-progress {
	background: var(--surface);
	padding: var(--card-pad);
	border-radius: var(--radius);
	box-shadow: var(--shadow-lg);
	margin-bottom: 20px;
	border: 1px solid var(--border-subtle);
}

.progress-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
	gap: 8px;
}

.progress-label {
	font-size: clamp(12px, 3vw, 13px);
	font-weight: 700;
	color: var(--text);
	letter-spacing: 0.01em;
}

.progress-stats {
	font-size: clamp(11px, 2.5vw, 12px);
	font-weight: 600;
	color: var(--text-secondary);
	white-space: nowrap;
}

.progress-track {
	height: 8px;
	background: var(--track-bg);
	border-radius: 99px;
	overflow: hidden;
}

.progress-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--accent) 0%, #f5c842 100%);
	border-radius: 99px;
	width: 0%;
	transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.progress-meta {
	margin-top: 10px;
	display: flex;
	align-items: center;
	gap: 6px;
}

.progress-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--accent);
	flex-shrink: 0;
}

.progress-text {
	font-size: clamp(11px, 2.5vw, 12px);
	color: var(--text-secondary);
	font-weight: 500;
}

/* ═══════════════════════════════════════════
	 SECTION HEADING
═══════════════════════════════════════════ */
.section-heading {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
	padding: 0 2px;
	gap: 8px;
}

.section-title {
	font-size: clamp(13px, 3.5vw, 15px);
	font-weight: 800;
	color: var(--text);
	letter-spacing: -0.01em;
}

.section-count {
	font-size: clamp(11px, 2.5vw, 12px);
	font-weight: 600;
	color: var(--text-secondary);
	white-space: nowrap;
}

/* ═══════════════════════════════════════════
	 SET CARDS
═══════════════════════════════════════════ */
#sets { display: grid; gap: 10px; }

.set-card {
	background: var(--surface);
	padding: clamp(12px, 3vw, 18px) clamp(12px, 3vw, 18px) clamp(12px, 3vw, 18px) clamp(10px, 2.5vw, 16px);
	border-radius: var(--radius-sm);
	display: flex;
	align-items: center;
	justify-content: space-between;
	cursor: pointer;
	border: 1px solid var(--border-subtle);
	box-shadow: var(--shadow-sm);
	transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
	position: relative;
	overflow: hidden;
	gap: 10px;
	touch-action: manipulation;
}

.set-card::before {
	content: '';
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 4px;
	background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%);
	border-radius: 4px 0 0 4px;
	flex-shrink: 0;
}

.set-card:hover {
	transform: translateY(-1px);
	box-shadow: var(--shadow);
	border-color: var(--border);
}

.set-card:active { transform: translateY(0); }

.set-card.completed::before {
	background: linear-gradient(180deg, var(--success) 0%, #16a34a 100%);
}

.set-left {
	display: flex;
	align-items: center;
	gap: clamp(10px, 3vw, 14px);
	min-width: 0;
	flex: 1;
}

.set-icon {
	width: clamp(36px, 9vw, 42px);
	height: clamp(36px, 9vw, 42px);
	min-width: clamp(36px, 9vw, 42px);
	border-radius: var(--radius-xs);
	background: var(--accent-light);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	font-size: clamp(14px, 4vw, 18px);
	font-weight: 800;
	color: var(--accent-dark);
	border: 1px solid rgba(230,183,49,0.24);
}

.set-card.completed .set-icon {
	background: var(--success-bg);
	color: var(--success-light);
	border-color: rgba(34,197,94,0.24);
}

.set-info { min-width: 0; flex: 1; }

.set-title {
	font-weight: 700;
	font-size: clamp(12px, 3.5vw, 14px);
	color: var(--text);
	letter-spacing: -0.01em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.set-range {
	font-size: clamp(10px, 2.5vw, 12px);
	color: var(--text-secondary);
	margin-top: 2px;
	font-weight: 500;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.set-mini-track {
	height: 4px;
	background: var(--track-bg);
	border-radius: 99px;
	overflow: hidden;
	margin-top: 7px;
	width: 100%;
}

.set-mini-fill {
	height: 100%;
	border-radius: 99px;
	background: linear-gradient(90deg, var(--accent) 0%, #f5c842 100%);
	transition: width 0.5s ease;
}

.set-card.completed .set-mini-fill {
	background: linear-gradient(90deg, var(--success) 0%, #16a34a 100%);
}

.set-right {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 5px;
	flex-shrink: 0;
}

.set-right-row {
	display: flex;
	align-items: center;
	gap: 6px;
}

.status-badge {
	font-size: clamp(10px, 2.5vw, 11px);
	padding: 3px 8px;
	border-radius: 99px;
	font-weight: 700;
	letter-spacing: 0.02em;
	white-space: nowrap;
}

.status-pending {
	background: var(--surface-muted);
	color: var(--text-muted);
	border: 1px solid var(--border-subtle);
}

.status-done {
	background: var(--success-bg);
	color: var(--success-light);
	border: 1px solid rgba(34,197,94,0.24);
}

.status-inprogress {
	background: var(--accent-light);
	color: var(--accent-text);
	border: 1px solid rgba(230,183,49,0.32);
}

.set-best-score {
	font-size: clamp(10px, 2.5vw, 11px);
	font-weight: 700;
	color: var(--primary);
	display: flex;
	align-items: center;
	gap: 3px;
	white-space: nowrap;
}

.set-attempts {
	font-size: clamp(10px, 2.5vw, 11px);
	font-weight: 600;
	color: var(--text-secondary);
}

.set-arrow {
	color: var(--text-secondary);
	opacity: 0.4;
	transition: opacity 0.15s, transform 0.15s;
	flex-shrink: 0;
}

.set-card:hover .set-arrow {
	opacity: 0.8;
	transform: translateX(2px);
}

/* ═══════════════════════════════════════════
	 MODAL OVERLAY
═══════════════════════════════════════════ */
.modal {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(8,36,33,0.6);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	z-index: 10050;
	align-items: flex-end;
	justify-content: center;
	padding: max(6px, env(safe-area-inset-top)) clamp(6px, 2vw, 12px) calc(clamp(6px, 2vw, 12px) + env(safe-area-inset-bottom));
	animation: fadeIn 0.2s ease;
}

.modal[style*="block"] { display: flex !important; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-content {
	background: var(--bg);
	width: 100%;
	max-width: 540px;
	max-height: min(920px, calc(100dvh - max(12px, env(safe-area-inset-top)) - 12px - env(safe-area-inset-bottom)));
	border-radius: clamp(16px, 4vw, 24px);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	animation: slideUp 0.25s cubic-bezier(0.34, 1.2, 0.64, 1);
}

body.has-global-bottom-nav .modal {
	padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

/* ═══════════════════════════════════════════
	 QUIZ HEADER
═══════════════════════════════════════════ */
.quiz-header {
	background: var(--surface);
	padding: calc(clamp(12px, 3vw, 16px) + env(safe-area-inset-top)) clamp(14px, 3.5vw, 18px) clamp(12px, 3vw, 16px);
	border-bottom: 1px solid var(--border-subtle);
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	flex-shrink: 0;
	gap: 8px;
}

.quiz-header-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	flex: 1;
}

.quiz-title-text {
	font-size: clamp(12px, 3vw, 13px);
	font-weight: 700;
	color: var(--text);
	line-height: 1.3;
	display: -webkit-box;
	line-clamp: 2;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
	word-break: break-word;
}

.quiz-subtitle-text {
	font-size: clamp(10px, 2.5vw, 11px);
	font-weight: 500;
	color: var(--text-secondary);
}

.quiz-close-btn {
	width: 32px;
	height: 32px;
	min-width: 32px;
	border-radius: 50%;
	background: var(--surface-muted);
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--text-muted);
	transition: background 0.15s, color 0.15s;
	flex-shrink: 0;
	touch-action: manipulation;
	margin-top: 1px;
}

.quiz-close-btn:hover {
	background: var(--danger-bg);
	color: var(--danger);
}

/* ═══════════════════════════════════════════
	 QUIZ SCROLL AREA
═══════════════════════════════════════════ */
.quiz-scroll {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	padding-bottom: 8px;
	-webkit-overflow-scrolling: touch;
}

/* ═══════════════════════════════════════════
	 QUESTION CARD
═══════════════════════════════════════════ */
.question-card {
	background: var(--surface);
	margin: clamp(10px, 3vw, 14px) clamp(10px, 3vw, 14px) 8px;
	padding: clamp(14px, 4vw, 22px) clamp(14px, 4vw, 20px);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
	border: 1px solid var(--border-subtle);
}

/* ═══════════════════════════════════════════
	 IMAGE HOLDER
═══════════════════════════════════════════ */
.question-image-holder {
	width: 100%;
	min-height: clamp(120px, 30vw, 160px);
	border-radius: var(--radius-sm);
	border: 2px dashed var(--border);
	background: var(--surface-muted);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-bottom: 16px;
	position: relative;
	overflow: hidden;
	cursor: pointer;
	transition: border-color 0.2s, background 0.2s;
}

.question-image-holder:hover {
	border-color: var(--primary-light);
	background: var(--track-bg);
}

.question-image-holder.has-image {
	border: none;
	min-height: unset;
	background: none;
	cursor: default;
}

.question-image-holder.has-image:hover { background: none; }

.question-image-holder img {
	width: 100%;
	height: auto;
	max-height: clamp(160px, 40vw, 220px);
	object-fit: contain;
	border-radius: var(--radius-sm);
	display: block;
}

.img-placeholder-icon {
	width: 44px;
	height: 44px;
	border-radius: 12px;
	background: rgba(15,91,85,0.08);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--primary);
	flex-shrink: 0;
}

.img-placeholder-label {
	font-size: clamp(12px, 3vw, 13px);
	font-weight: 600;
	color: var(--primary);
	opacity: 0.7;
}

.img-placeholder-sub {
	font-size: clamp(10px, 2.5vw, 11px);
	font-weight: 500;
	color: var(--text-secondary);
	opacity: 0.7;
}

.img-remove-btn {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: rgba(0,0,0,0.45);
	border: none;
	cursor: pointer;
	display: none !important;
	align-items: center;
	justify-content: center;
	color: white;
	transition: background 0.15s;
	z-index: 2;
}

.question-image-holder.has-image:hover .img-remove-btn { display: none !important; }
.img-remove-btn:hover { background: rgba(239,68,68,0.85); }

.img-hidden-input {
	position: absolute;
	inset: 0;
	opacity: 0;
	cursor: pointer;
	width: 100%;
	height: 100%;
}

.question-image-holder.has-image .img-hidden-input { pointer-events: none; }

/* ═══════════════════════════════════════════
	 QUESTION TEXT
═══════════════════════════════════════════ */
.question-number {
	font-size: clamp(10px, 2.5vw, 11px);
	font-weight: 700;
	color: var(--primary);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	margin-bottom: 8px;
	display: flex;
	align-items: center;
	gap: 6px;
}

.question-number::before {
	content: '';
	display: block;
	width: 3px;
	height: 14px;
	background: var(--primary);
	border-radius: 2px;
	flex-shrink: 0;
}

.question-instruction {
	font-size: clamp(11px, 2.8vw, 12px);
	font-weight: 700;
	line-height: 1.45;
	color: var(--primary-dark);
	background: var(--accent-light);
	border: 1px solid rgba(230,183,49,0.36);
	border-radius: var(--radius-xs);
	padding: 8px 10px;
	margin-bottom: 12px;
}

.question-text {
	font-size: clamp(15px, 4vw, 17px);
	font-weight: 700;
	color: var(--text);
	line-height: 1.5;
	letter-spacing: -0.01em;
	margin-bottom: 16px;
	word-break: break-word;
}

/* ═══════════════════════════════════════════
	 OPTIONS
═══════════════════════════════════════════ */
.option {
	border: 2px solid var(--track-bg);
	padding: clamp(10px, 3vw, 14px) clamp(12px, 3.5vw, 16px);
	margin-bottom: 8px;
	border-radius: var(--radius-sm);
	cursor: pointer;
	font-size: clamp(13px, 3.5vw, 14px);
	font-weight: 500;
	color: var(--text);
	background: var(--surface);
	transition: border-color 0.15s, background 0.15s, transform 0.1s;
	display: flex;
	align-items: center;
	gap: 10px;
	user-select: none;
	touch-action: manipulation;
	word-break: break-word;
}

.option.locked { pointer-events: none; }

.option:hover:not(.correct):not(.wrong) {
	border-color: var(--primary-light);
	background: rgba(15,91,85,0.04);
	transform: translateX(2px);
}

.option.correct {
	background: var(--success-bg);
	border-color: var(--success);
	color: var(--success);
	transform: none;
}

.option.wrong {
	background: var(--danger-bg);
	border-color: var(--danger);
	color: var(--danger);
	transform: none;
}

/* ═══════════════════════════════════════════
	 QUESTION PALETTE
═══════════════════════════════════════════ */
.palette-wrapper {
	margin: 0 clamp(10px, 3vw, 14px) 10px;
	background: var(--surface);
	border-radius: var(--radius-sm);
	border: 1px solid var(--border-subtle);
	padding: clamp(10px, 3vw, 14px);
}

.palette-label {
	font-size: clamp(10px, 2.5vw, 11px);
	font-weight: 700;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.07em;
	margin-bottom: 10px;
}

.palette {
	display: grid;
	grid-template-columns: repeat(10, 1fr);
	gap: clamp(3px, 1vw, 5px);
}

.pbtn {
	background: var(--surface-muted);
	padding: 0;
	height: clamp(28px, 7vw, 30px);
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 6px;
	cursor: pointer;
	font-size: clamp(10px, 2.5vw, 11px);
	font-weight: 700;
	color: var(--text-muted);
	transition: background 0.15s, color 0.15s, transform 0.1s;
	border: 1.5px solid transparent;
	touch-action: manipulation;
}

.pbtn:hover { background: var(--track-bg); color: var(--text-secondary); }

.pbtn.active {
	border-color: var(--primary);
	background: var(--accent-light);
	color: var(--primary);
	transform: scale(1.08);
}

.pbtn.answered {
	background: var(--primary);
	color: white;
}

.pbtn.answered.active {
	background: var(--primary-dark);
	border-color: var(--primary-dark);
	color: white;
}

/* ═══════════════════════════════════════════
	 NAV BUTTONS
═══════════════════════════════════════════ */
.nav-buttons {
	display: flex;
	gap: 8px;
	padding: clamp(10px, 3vw, 12px) clamp(10px, 3vw, 14px) clamp(12px, 3.5vw, 14px);
	background: var(--surface);
	border-top: 1px solid var(--border-subtle);
	flex-shrink: 0;
}

.nav-buttons button {
	flex: 1;
	padding: clamp(11px, 3vw, 13px) clamp(8px, 2vw, 12px);
	border: none;
	border-radius: var(--radius-sm);
	font-weight: 700;
	font-size: clamp(12px, 3vw, 14px);
	cursor: pointer;
	transition: background 0.15s, transform 0.1s, opacity 0.15s;
	font-family: inherit;
	letter-spacing: 0.01em;
	white-space: nowrap;
	touch-action: manipulation;
}

.nav-buttons button:active { transform: scale(0.98); }

.btn-prev {
	background: var(--surface-muted);
	color: var(--text-secondary);
}

.btn-prev:hover { background: var(--track-bg); }

.btn-next {
	background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
	color: white;
	box-shadow: 0 3px 10px rgba(15,91,85,0.28);
}

.btn-next:hover { box-shadow: 0 5px 16px rgba(15,91,85,0.36); }

.btn-close-quiz {
	background: var(--surface-muted);
	color: var(--text-secondary);
	border: 1px solid var(--border-subtle);
}

.btn-close-quiz:hover {
	background: var(--danger-bg);
	color: var(--danger);
}

/* ═══════════════════════════════════════════
	 APP DIALOG
═══════════════════════════════════════════ */
.app-dialog {
	position: fixed;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(8,36,33,0.58);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	z-index: 10100;
	padding: clamp(14px, 4vw, 18px);
}

.app-dialog.show { display: flex; }

.app-dialog-card {
	width: 100%;
	max-width: 360px;
	background: var(--surface);
	border: 1px solid var(--border-subtle);
	border-radius: 16px;
	box-shadow: var(--shadow-lg);
	overflow: hidden;
}

.app-dialog-body { padding: clamp(14px, 4vw, 18px) clamp(14px, 4vw, 16px) 12px; }

.app-dialog-title {
	margin: 0 0 8px;
	font-size: clamp(13px, 3.5vw, 15px);
	font-weight: 800;
	color: var(--text);
}

.app-dialog-message {
	margin: 0;
	font-size: clamp(12px, 3vw, 13px);
	font-weight: 500;
	line-height: 1.5;
	color: var(--text-secondary);
}

.app-dialog-actions {
	display: flex;
	gap: 8px;
	padding: 10px clamp(12px, 3vw, 14px) clamp(12px, 3vw, 14px);
	border-top: 1px solid var(--border-subtle);
}

.app-dialog-actions button {
	flex: 1;
	border: none;
	border-radius: 10px;
	padding: 11px 10px;
	font-size: clamp(12px, 3vw, 13px);
	font-weight: 700;
	cursor: pointer;
	font-family: inherit;
	touch-action: manipulation;
}

.app-dialog-cancel {
	background: var(--surface-muted);
	color: var(--text-secondary);
}

.app-dialog-ok {
	background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
	color: #fff;
}

/* ═══════════════════════════════════════════
	 RESULT SCREEN
═══════════════════════════════════════════ */
#resultScreen {
	display: none;
	position: fixed;
	inset: 0;
	background: var(--bg);
	z-index: 10040;
	overflow-y: auto;
	overflow-x: hidden;
}

.result-inner {
	min-height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: clamp(40px, 8vw, 60px) clamp(16px, 5vw, 24px) clamp(32px, 7vw, 48px);
	text-align: center;
}

.result-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: clamp(10px, 2.5vw, 11px);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--primary);
	background: var(--surface-muted);
	padding: 6px 14px;
	border-radius: 99px;
	margin-bottom: 20px;
	border: 1px solid var(--border-subtle);
}

.result-title {
	font-size: clamp(20px, 5vw, 26px);
	font-weight: 800;
	color: var(--text);
	letter-spacing: -0.02em;
	margin-bottom: 8px;
}

.result-subtitle {
	font-size: clamp(12px, 3vw, 14px);
	color: var(--text-secondary);
	font-weight: 500;
	margin-bottom: 28px;
}

.score-ring {
	width: clamp(120px, 35vw, 160px);
	height: clamp(120px, 35vw, 160px);
	position: relative;
	margin: 0 auto 28px;
}

.score-ring svg {
	width: 100%;
	height: 100%;
	transform: rotate(-90deg);
}

.ring-bg { fill: none; stroke: var(--track-bg); stroke-width: 10; }

.ring-fill {
	fill: none;
	stroke: var(--accent);
	stroke-width: 10;
	stroke-linecap: round;
	stroke-dasharray: 408.41;
	stroke-dashoffset: 408.41;
	transition: stroke-dashoffset 1s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.score-center {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.score-number {
	font-size: clamp(22px, 6vw, 30px);
	font-weight: 800;
	color: var(--text);
	letter-spacing: -0.03em;
	line-height: 1;
}

.score-label {
	font-size: clamp(11px, 2.5vw, 12px);
	font-weight: 600;
	color: var(--text-secondary);
	margin-top: 4px;
}

.result-stats {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	width: 100%;
	max-width: min(300px, calc(100vw - 48px));
	margin: 0 auto 28px;
}

.stat-card-wide { grid-column: 1 / -1; }

.stat-card {
	background: var(--surface);
	border-radius: var(--radius-sm);
	padding: clamp(12px, 3.5vw, 16px) clamp(10px, 3vw, 12px);
	border: 1px solid var(--border-subtle);
	box-shadow: var(--shadow-sm);
}

.stat-value {
	font-size: clamp(18px, 5vw, 22px);
	font-weight: 800;
	color: var(--text);
	letter-spacing: -0.02em;
}

.stat-desc {
	font-size: clamp(10px, 2.5vw, 11px);
	font-weight: 600;
	color: var(--text-secondary);
	margin-top: 2px;
}

.result-btn {
	padding: clamp(12px, 3.5vw, 15px) clamp(28px, 7vw, 40px);
	background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
	color: white;
	border: none;
	border-radius: 99px;
	font-weight: 700;
	font-size: clamp(13px, 3.5vw, 15px);
	cursor: pointer;
	font-family: inherit;
	box-shadow: 0 6px 20px rgba(15,91,85,0.32);
	transition: box-shadow 0.2s, transform 0.15s;
	letter-spacing: 0.01em;
	touch-action: manipulation;
}

.result-btn:hover {
	box-shadow: 0 10px 28px rgba(15,91,85,0.4);
	transform: translateY(-1px);
}

.result-btn:active { transform: translateY(0); }

.result-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: center;
	margin-top: 20px;
}

.result-btn-secondary {
	background: var(--surface-muted);
	color: var(--text-secondary);
	border: 1px solid var(--border-subtle);
	padding: clamp(12px, 3.5vw, 15px) clamp(28px, 7vw, 40px);
	border-radius: 99px;
	font-weight: 700;
	font-size: clamp(13px, 3.5vw, 15px);
	cursor: pointer;
	font-family: inherit;
	transition: background 0.2s, transform 0.15s, border-color 0.2s;
	letter-spacing: 0.01em;
	touch-action: manipulation;
}

.result-btn-secondary:hover {
	background: var(--track-bg);
	border-color: var(--border);
	transform: translateY(-1px);
}

.result-btn-secondary:active { transform: translateY(0); }

#confettiCanvas {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 2100;
}

/* ═══════════════════════════════════════════
	 RESPONSIVE BREAKPOINTS
═══════════════════════════════════════════ */
@media (max-width: 359px) {
	.top-nav-badge { display: none; }
	.set-range { display: none; }
	.palette { grid-template-columns: repeat(10, 1fr); gap: 2px; }
	.nav-buttons button { font-size: 11px; padding: 10px 6px; }
	.result-buttons { flex-direction: column; align-items: center; }
	.result-btn, .result-btn-secondary { width: 100%; max-width: 260px; text-align: center; }
}

@media (max-width: 480px) {
	.top-nav-badge { display: none; }

	.modal {
		padding: max(4px, env(safe-area-inset-top)) 6px calc(6px + env(safe-area-inset-bottom));
		align-items: center;
	}

	body.has-global-bottom-nav .modal {
		padding-bottom: calc(88px + env(safe-area-inset-bottom));
	}

	.modal-content {
		max-height: calc(100vh - max(8px, env(safe-area-inset-top)) - 6px - env(safe-area-inset-bottom));
		max-height: calc(100svh - max(8px, env(safe-area-inset-top)) - 6px - env(safe-area-inset-bottom));
		max-height: calc(100dvh - max(8px, env(safe-area-inset-top)) - 6px - env(safe-area-inset-bottom));
		min-height: auto;
		height: auto;
		width: min(100%, 540px);
		border-radius: 18px;
	}

	.quiz-header {
		padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
		gap: 6px;
	}

	.quiz-subtitle-text {
		font-size: 10px;
		line-height: 1.25;
	}

	.quiz-close-btn {
		width: 34px;
		height: 34px;
		min-width: 34px;
	}
}

@media (max-width: 430px) and (max-height: 932px) {
	.modal {
		padding-top: max(8px, env(safe-area-inset-top));
	}

	.modal-content {
		max-height: calc(100vh - max(12px, env(safe-area-inset-top)) - 8px - env(safe-area-inset-bottom));
		max-height: calc(100svh - max(12px, env(safe-area-inset-top)) - 8px - env(safe-area-inset-bottom));
		max-height: calc(100dvh - max(12px, env(safe-area-inset-top)) - 8px - env(safe-area-inset-bottom));
	}
}

@media (max-width: 430px) and (max-height: 740px) {
	.modal {
		align-items: flex-start;
		overflow-y: auto;
		padding-top: max(4px, env(safe-area-inset-top));
		padding-bottom: calc(4px + env(safe-area-inset-bottom));
	}

	.modal-content {
		max-height: none;
		height: auto;
		min-height: 0;
	}

	.quiz-header {
		padding: 9px 10px;
	}

	.quiz-title-text {
		font-size: 12px;
	}

	.quiz-subtitle-text {
		font-size: 10px;
	}
}

@media (min-width: 600px) {
	:root {
		--container-max: 720px;
	}

	.palette { grid-template-columns: repeat(10, 1fr); }

	#sets {
		grid-template-columns: 1fr;
	}

	.modal {
		align-items: center;
		padding: clamp(16px, 4vw, 40px);
	}

	.modal-content {
		max-height: min(860px, calc(100dvh - 80px));
		min-height: auto;
		border-radius: 20px;
	}

	body.has-global-bottom-nav .modal {
		padding-bottom: calc(80px + env(safe-area-inset-bottom));
	}
}

@media (min-width: 1024px) {
	:root {
		--container-max: 760px;
	}

	.header {
		padding: 56px var(--container-pad) 72px;
	}

	.modal-content {
		max-height: min(800px, calc(100dvh - 100px));
	}

	.result-stats {
		max-width: 320px;
	}
}

@media (min-width: 1440px) {
	:root {
		--container-max: 800px;
	}
}

@media (hover: none) and (pointer: coarse) {
	.option {
		padding: 14px 16px;
		min-height: 48px;
	}

	.pbtn {
		height: 34px;
	}

	.icon-btn {
		width: 44px;
		height: 44px;
		min-width: 44px;
	}

	.nav-buttons button {
		min-height: 48px;
	}
}

@media (max-height: 500px) and (orientation: landscape) {
	.header {
		padding: 20px var(--container-pad) 36px;
	}

	.header h1 { font-size: 18px; }
	.header p { display: none; }

	.modal-content {
		max-height: calc(100dvh - 8px);
	}

	.question-image-holder {
		min-height: 80px;
	}

	.question-image-holder img {
		max-height: 100px;
	}
}

