/* PracticePilot — Result view (Milestone 3C foundation, Milestone 3F
   Analysis/Solutions/Revision experience). Wide responsive desktop
   dashboard (~1180-1400px), purpose-built mobile stacking with a
   compact sticky navigator. Reuses ppilot-shared.css tokens plus a
   small set of result-specific tokens for correct/incorrect/neutral
   states — only ever used post-grading. Strongly scoped under
   .ppilot-result-app. These screenshots referenced for THIS milestone
   were used only to understand the workflow (summary -> analysis ->
   solutions -> navigator -> revision); none of their branding, colors,
   typography, or component styling were reproduced. */

.ppilot-result-app {
	--ppilot-result-correct: #16a34a;
	--ppilot-result-correct-bg: #f0fdf4;
	--ppilot-result-incorrect: #dc2626;
	--ppilot-result-incorrect-bg: #fef2f2;
	--ppilot-result-neutral: #64748b;
	--ppilot-result-neutral-bg: #f1f5f9;

	max-width: 1320px; width: 100%; margin: 0 auto;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	color: var(--ppilot-ink); line-height: 1.5;
}
.ppilot-result-app, .ppilot-result-app * { box-sizing: border-box; }
.ppilot-result-app ul, .ppilot-result-app ol { margin: 0; padding: 0; list-style: none; }

.ppilot-result-loading, .ppilot-result-error-state { display: flex; align-items: center; justify-content: center; min-height: 200px; padding: 30px; text-align: center; }

/* ---------- Mode tabs (Analysis / Solutions / Revision) ---------- */
.ppilot-result-mode-tabs { display: flex; gap: 4px; background: var(--ppilot-bg); border-radius: 10px; padding: 4px; margin-bottom: 18px; max-width: 460px; }
.ppilot-result-mode-tab { flex: 1; border: none; background: none; padding: 9px 12px; border-radius: 7px; font-size: 13.5px; font-weight: 600; color: var(--ppilot-muted); cursor: pointer; }
.ppilot-result-mode-tab.is-active { background: #fff; color: var(--ppilot-navy); box-shadow: 0 1px 3px rgba(16,24,40,0.08); }
.ppilot-result-mode-tab:focus-visible { outline: 2px solid var(--ppilot-navy); outline-offset: 2px; }

/* ---------- Analysis ---------- */
.ppilot-result-analysis-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.ppilot-result-check-icon { width: 46px; height: 46px; border-radius: 50%; background: var(--ppilot-result-correct-bg); color: var(--ppilot-result-correct); display: flex; align-items: center; justify-content: center; font-size: 22px; flex: 0 0 auto; }
.ppilot-result-title { margin: 0; font-size: 19px; font-weight: 700; }

.ppilot-result-metrics-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 18px; }
.ppilot-result-metric { background: var(--ppilot-bg); border-radius: 10px; padding: 12px 8px; text-align: center; min-width: 0; }
.ppilot-result-metric-primary { background: var(--ppilot-navy); }
.ppilot-result-metric-primary .ppilot-result-metric-value, .ppilot-result-metric-primary .ppilot-result-metric-label { color: #fff; }
.ppilot-result-metric-value { display: block; font-size: 18px; font-weight: 800; }
.ppilot-result-metric-label { display: block; font-size: 11px; color: var(--ppilot-muted); margin-top: 3px; }

.ppilot-result-breakdown-row { display: grid; grid-template-columns: 140px 1fr; gap: 20px; align-items: center; background: #fff; border: 1px solid var(--ppilot-border); border-radius: 12px; padding: 18px; margin-bottom: 18px; }
.ppilot-result-chart-wrap { display: flex; justify-content: center; }
.ppilot-result-donut { width: 120px; height: 120px; transform: rotate(-90deg); }
.ppilot-result-donut-seg { fill: none; stroke-width: 16; }
.ppilot-result-donut-correct { stroke: var(--ppilot-result-correct); }
.ppilot-result-donut-incorrect { stroke: var(--ppilot-result-incorrect); }
.ppilot-result-donut-unanswered { stroke: var(--ppilot-result-neutral); }

.ppilot-result-stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; }
.ppilot-result-stat-card { border-radius: 10px; padding: 12px; text-align: center; background: var(--ppilot-bg); }
.ppilot-result-stat-value { display: block; font-size: 18px; font-weight: 700; }
.ppilot-result-stat-label { display: block; font-size: 11px; color: var(--ppilot-muted); margin-top: 2px; }
.ppilot-result-stat-correct { background: var(--ppilot-result-correct-bg); } .ppilot-result-stat-correct .ppilot-result-stat-value { color: var(--ppilot-result-correct); }
.ppilot-result-stat-incorrect { background: var(--ppilot-result-incorrect-bg); } .ppilot-result-stat-incorrect .ppilot-result-stat-value { color: var(--ppilot-result-incorrect); }
.ppilot-result-stat-unanswered { background: var(--ppilot-result-neutral-bg); } .ppilot-result-stat-unanswered .ppilot-result-stat-value { color: var(--ppilot-result-neutral); }
.ppilot-result-stat-negative .ppilot-result-stat-value { color: var(--ppilot-result-incorrect); }

.ppilot-result-section-perf { background: #fff; border: 1px solid var(--ppilot-border); border-radius: 12px; padding: 18px; }
.ppilot-result-section-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; }
.ppilot-result-section-table { display: flex; flex-direction: column; gap: 8px; }
.ppilot-result-section-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr 70px; gap: 10px; align-items: center; padding: 10px 12px; background: var(--ppilot-bg); border-radius: 8px; font-size: 13px; }
.ppilot-result-section-name { font-weight: 600; }
.ppilot-result-section-accuracy { font-weight: 700; color: var(--ppilot-navy); text-align: right; }

/* ---------- Solutions / Revision: navigator + detail ---------- */
.ppilot-result-solutions { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }
.ppilot-result-navigator { background: #fff; border: 1px solid var(--ppilot-border); border-radius: 12px; padding: 16px; }
.ppilot-result-nav-filters { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; }
.ppilot-result-nav-filter { border: 1px solid var(--ppilot-border); background: #fff; border-radius: 999px; padding: 5px 11px; font-size: 11.5px; font-weight: 600; color: var(--ppilot-muted); cursor: pointer; }
.ppilot-result-nav-filter.is-active { background: var(--ppilot-navy); color: #fff; border-color: var(--ppilot-navy); }
.ppilot-result-nav-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-height: 320px; overflow-y: auto; }
.ppilot-result-nav-btn { aspect-ratio: 1; border-radius: 7px; border: 1.5px solid var(--ppilot-border); background: #fff; font-weight: 600; font-size: 12px; cursor: pointer; }
.ppilot-result-nav-btn.is-current { border: 2.5px solid var(--ppilot-navy); box-shadow: 0 0 0 2px rgba(30,27,75,0.12); }
.ppilot-result-nav-correct { background: var(--ppilot-result-correct-bg); color: var(--ppilot-result-correct); border-color: var(--ppilot-result-correct); }
.ppilot-result-nav-incorrect { background: var(--ppilot-result-incorrect-bg); color: var(--ppilot-result-incorrect); border-color: var(--ppilot-result-incorrect); }
.ppilot-result-nav-unanswered { background: var(--ppilot-result-neutral-bg); color: var(--ppilot-result-neutral); }

.ppilot-result-solution-detail { min-width: 0; }
.ppilot-result-pager { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.ppilot-result-pager-btn { flex: 1; padding: 11px; font-weight: 600; }
.ppilot-result-pager-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.ppilot-result-question { background: #fff; border: 1px solid var(--ppilot-border); border-left: 4px solid var(--ppilot-border); border-radius: 12px; padding: 18px; box-shadow: 0 1px 3px rgba(16,24,40,0.06); }
.ppilot-result-question-correct { border-left-color: var(--ppilot-result-correct); }
.ppilot-result-question-incorrect { border-left-color: var(--ppilot-result-incorrect); }
.ppilot-result-question-unanswered { border-left-color: var(--ppilot-result-neutral); }
.ppilot-result-question-revision { border-left-color: var(--ppilot-border); }

.ppilot-result-question-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.ppilot-result-question-number { font-weight: 700; font-size: 14px; }
.ppilot-result-section-badge { background: var(--ppilot-gold-light); color: var(--ppilot-gold); font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
/* §mobile-result-premium (0.83.5): "next-level interesting" — the plain
   flat-color uppercase pill is now a richer two-tone chip with a small
   status icon in front of the label, plus the correct/incorrect states
   get a subtle colored glow (not just desktop's existing flat bg) so the
   outcome reads at a glance, consistent with the glow treatment already
   shipped on the Navigator's premium number buttons (0.83.4). */
.ppilot-result-outcome-badge {
	display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 4px 11px 4px 9px;
	border-radius: 999px; text-transform: uppercase; letter-spacing: 0.02em;
}
.ppilot-result-outcome-badge::before { font-size: 11px; line-height: 1; }
.ppilot-result-outcome-correct {
	background: linear-gradient(135deg, var(--ppilot-result-correct-bg), #dcfce7); color: var(--ppilot-result-correct);
	box-shadow: 0 0 0 1px rgba(22,163,74,0.18);
}
.ppilot-result-outcome-correct::before { content: '✓'; }
.ppilot-result-outcome-incorrect {
	background: linear-gradient(135deg, var(--ppilot-result-incorrect-bg), #fee2e2); color: var(--ppilot-result-incorrect);
	box-shadow: 0 0 0 1px rgba(220,38,38,0.18);
}
.ppilot-result-outcome-incorrect::before { content: '✕'; }
.ppilot-result-outcome-unanswered { background: var(--ppilot-result-neutral-bg); color: var(--ppilot-result-neutral); }
.ppilot-result-outcome-unanswered::before { content: '○'; }
/* The marks note moves from plain trailing text to its own small pill —
   consistent with the meta-pill language the live question screen's tags
   row already uses (.ppilot-exam-meta-pill). */
.ppilot-result-marks-note {
	margin-left: auto; font-size: 12px; font-weight: 700; color: var(--ppilot-navy); font-variant-numeric: tabular-nums;
	background: var(--ppilot-bg); border: 1px solid var(--ppilot-border); padding: 3px 10px; border-radius: 999px;
}

.ppilot-result-question-text { font-size: 15px; line-height: 1.6; margin-bottom: 6px; white-space: pre-wrap; font-weight: 600; }
.ppilot-result-question-text-secondary { color: var(--ppilot-muted); font-weight: 400; font-size: 14px; }

.ppilot-result-options { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.ppilot-result-option {
	display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1.5px solid var(--ppilot-border);
	border-radius: 11px; transition: box-shadow 0.15s ease;
}
.ppilot-result-option-letter { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--ppilot-border); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex: 0 0 auto; }
.ppilot-result-option-text { flex: 1 1 auto; font-size: 14px; }
.ppilot-result-option-flag { font-size: 11px; font-weight: 700; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; }
/* §mobile-result-premium (0.83.5): the correct option was a flat green
   border+tint before — now a soft gradient card with a genuine colored
   shadow (richer "this is the one" feel) and the letter badge itself
   becomes a small solid gradient disc with a check mark rather than a
   plain filled circle. */
.ppilot-result-option-correct {
	border-color: transparent; background: linear-gradient(135deg, var(--ppilot-result-correct-bg), #dcfce7);
	box-shadow: 0 2px 10px rgba(22,163,74,0.22), 0 0 0 1.5px var(--ppilot-result-correct);
}
.ppilot-result-option-correct .ppilot-result-option-letter {
	border-color: transparent; background: linear-gradient(135deg, #4ade80, var(--ppilot-result-correct)); color: #fff;
	box-shadow: 0 1px 4px rgba(22,163,74,0.4);
}
.ppilot-result-option-correct .ppilot-result-option-flag::before { content: '✓'; }
.ppilot-result-option-correct .ppilot-result-option-flag { color: var(--ppilot-result-correct); }
.ppilot-result-option-student-wrong {
	border-color: transparent; background: linear-gradient(135deg, var(--ppilot-result-incorrect-bg), #fee2e2);
	box-shadow: 0 2px 10px rgba(220,38,38,0.2), 0 0 0 1.5px var(--ppilot-result-incorrect);
}
.ppilot-result-option-student-wrong .ppilot-result-option-letter {
	border-color: transparent; background: linear-gradient(135deg, #f87171, var(--ppilot-result-incorrect)); color: #fff;
	box-shadow: 0 1px 4px rgba(220,38,38,0.4);
}
.ppilot-result-option-student-wrong .ppilot-result-option-flag::before { content: '✕'; }
.ppilot-result-option-student-wrong .ppilot-result-option-flag { color: var(--ppilot-result-incorrect); }
.ppilot-result-option-student-correct .ppilot-result-option-flag { color: var(--ppilot-result-correct); }
.ppilot-result-option-student-correct .ppilot-result-option-flag::before { content: '✓'; }

.ppilot-result-numerical-answers { font-size: 14px; margin: 12px 0; }
.ppilot-result-numerical-answers p { margin: 4px 0; }

/* §mobile-result-premium (0.83.5): the Solution/Explanation <details> was
   a plain top-border + text link before — now its own soft, tinted
   sub-card (so it visually reads as "supporting content" nested inside
   the question card, not just a trailing paragraph), with an icon +
   custom chevron (the browser's own default triangle marker is hidden —
   ::marker/::-webkit-details-marker — in favour of one that smoothly
   rotates via a plain CSS transition instead of just snapping open). */
.ppilot-result-explanation {
	margin-top: 14px; border: 1px solid var(--ppilot-border); border-radius: 12px; background: var(--ppilot-bg); overflow: hidden;
}
.ppilot-result-explanation summary {
	cursor: pointer; font-weight: 700; font-size: 13px; color: var(--ppilot-navy); list-style: none;
	display: flex; align-items: center; gap: 8px; padding: 12px 14px;
}
.ppilot-result-explanation summary::-webkit-details-marker { display: none; }
.ppilot-result-explanation-icon { font-size: 14px; flex: 0 0 auto; }
.ppilot-result-explanation-title { flex: 1 1 auto; }
.ppilot-result-explanation-chevron {
	flex: 0 0 auto; width: 8px; height: 8px; border-right: 2px solid var(--ppilot-muted); border-bottom: 2px solid var(--ppilot-muted);
	transform: rotate(-45deg); transition: transform 0.18s ease; margin-top: -2px;
}
.ppilot-result-explanation[open] .ppilot-result-explanation-chevron { transform: rotate(45deg); margin-top: 0; }
.ppilot-result-explanation-text { font-size: 13.5px; color: var(--ppilot-ink); line-height: 1.6; white-space: pre-wrap; padding: 0 14px 14px 36px; }
.ppilot-result-explanation-text:first-of-type { padding-top: 0; }
.ppilot-result-explanation-secondary { color: var(--ppilot-muted); font-weight: 400; }

/* ---------- Mobile — purpose-built, not a squeezed desktop sidebar ---------- */
@media (max-width: 900px) {
	.ppilot-result-app { max-width: 100%; }
	.ppilot-result-metrics-row { grid-template-columns: repeat(2, 1fr); }
	.ppilot-result-breakdown-row { grid-template-columns: 1fr; text-align: center; }
	.ppilot-result-section-row { grid-template-columns: 1fr; gap: 3px; text-align: left; }
	.ppilot-result-section-accuracy { text-align: left; }

	.ppilot-result-solutions { grid-template-columns: 1fr; gap: 14px; }
	.ppilot-result-navigator { position: sticky; top: 0; z-index: 5; max-height: 40vh; overflow-y: auto; padding: 14px 10px; }
	.ppilot-result-nav-grid { max-height: none; grid-template-columns: repeat(6, 1fr); gap: 8px; }
	/* §mobile-width-tighten (0.83.5): same fix as the live question screen
	   (0.83.4) — .ppilot-exam-submitted-state's own 20px side padding
	   stacked with this card's unreduced 18px desktop padding (38px/side,
	   ~76px of a narrow phone's width spent on margin before any real
	   content). Tightened both layers; the question card keeps a genuine
	   gutter (not edge-to-edge), just a noticeably narrower one. */
	.ppilot-result-question { padding: 14px; }
	.ppilot-result-option { padding: 13px; min-height: 46px; }
	.ppilot-result-pager-btn { min-height: 46px; }
	/* §mobile-navigator-premium (0.83.5): the Solutions/Revision navigator
	   is the same kind of question-number grid as the live Exam Player's
	   Navigator drawer (0.83.4's §mobile-navigator-premium) — rounder
	   corners, a genuine gradient + colored glow on correct/incorrect
	   instead of a flat tint, and real :active press feedback, so the two
	   screens feel like one consistent system rather than two different
	   number grids with two different polish levels. */
	.ppilot-result-nav-btn {
		border-radius: 10px; position: relative; box-shadow: 0 1px 2px rgba(16,24,40,0.05);
		transition: transform 0.12s ease, box-shadow 0.12s ease;
	}
	.ppilot-result-nav-btn:active { transform: scale(0.92); }
	.ppilot-result-nav-correct {
		background: linear-gradient(145deg, #4ade80, var(--ppilot-result-correct)); color: #fff; border-color: transparent;
		box-shadow: 0 3px 8px rgba(22,163,74,0.32), inset 0 1px 0 rgba(255,255,255,0.3);
	}
	.ppilot-result-nav-incorrect {
		background: linear-gradient(145deg, #f87171, var(--ppilot-result-incorrect)); color: #fff; border-color: transparent;
		box-shadow: 0 3px 8px rgba(220,38,38,0.32), inset 0 1px 0 rgba(255,255,255,0.3);
	}
	.ppilot-result-nav-btn.is-current { box-shadow: 0 0 0 2.5px var(--ppilot-navy), 0 3px 10px rgba(30,27,75,0.3); }
}

@media (max-width: 420px) {
	.ppilot-result-metrics-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
	.ppilot-result-nav-grid { grid-template-columns: repeat(5, 1fr); }
}
