/* TOA Core — front-end test player styles. Uses theme CSS vars with fallbacks. */
.toa-quiz {
	--p: var(--toa-primary, #E2640F);
	--a: var(--toa-accent, #F8B400);
	--d: var(--toa-dark, #2A1A0D);
	--line: #ece6df;
	--muted: #6b5d50;
	font-family: inherit;
}
.toa-quiz * { box-sizing: border-box; }

.toa-quiz-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 30px; box-shadow: 0 10px 30px rgba(11,31,58,.06); max-width: 760px; margin: 0 auto; }
.toa-quiz-card h2 { color: var(--p); margin-top: 0; }

.toa-quiz-facts { display: flex; gap: 14px; flex-wrap: wrap; margin: 18px 0; }
.toa-quiz-facts > div { flex: 1 1 120px; background: #f6f8fb; border-radius: 12px; padding: 16px; text-align: center; }
.toa-quiz-facts strong { display: block; font-size: 26px; color: var(--p); }
.toa-quiz-facts span { font-size: 13px; color: var(--muted); }

.toa-quiz-instructions { background: #fff7e6; border: 1px solid #f0d28a; border-radius: 12px; padding: 16px 18px; margin: 18px 0; }
.toa-quiz-instructions h4 { margin: 0 0 6px; color: #8a6d1a; }
.toa-quiz-guest { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.toa-quiz-guest input { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; width: 100%; }

.toa-btn-lg { padding: 15px 34px; font-size: 17px; }

/* Run screen */
.toa-quiz-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 14px; background: var(--d); color: #fff; padding: 12px 18px; border-radius: 12px; margin-bottom: 18px; }
.toa-quiz-progress { font-weight: 600; }
.toa-quiz-timer { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; background: rgba(255,255,255,.12); padding: 4px 14px; border-radius: 999px; }
.toa-quiz-timer.is-urgent { background: #c0392b; animation: toaPulse 1s infinite; }
@keyframes toaPulse { 50% { opacity: .55; } }

.toa-quiz-body { display: grid; grid-template-columns: 1fr 240px; gap: 22px; align-items: start; }
.toa-q { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 26px; }
.toa-q-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.toa-q-num { font-weight: 700; color: var(--p); }
.toa-q-subject { background: #eef2f8; color: var(--p); font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.toa-q-marks { font-size: 12px; color: var(--muted); margin-left: auto; }
.toa-q-text { font-size: 18px; line-height: 1.6; color: #1a2433; }
.toa-q-img { max-width: 100%; height: auto; border-radius: 10px; margin: 12px 0; }

.toa-q-options { display: flex; flex-direction: column; gap: 12px; margin: 18px 0; }
.toa-opt { display: flex; align-items: center; gap: 14px; border: 2px solid var(--line); border-radius: 12px; padding: 14px 16px; cursor: pointer; transition: all .15s; }
.toa-opt:hover { border-color: var(--a); background: #fffaf0; }
.toa-opt input { accent-color: var(--a); width: 18px; height: 18px; }
.toa-opt-letter { width: 30px; height: 30px; border-radius: 50%; background: var(--p); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.toa-opt-text { flex: 1; }
.toa-opt-text img { max-width: 200px; display: block; margin-top: 6px; border-radius: 8px; }
.toa-opt input:checked ~ .toa-opt-letter { background: var(--a); color: #1a1206; }

.toa-q-nav { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* Palette */
.toa-quiz-palette { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px; position: sticky; top: 78px; }
.toa-quiz-palette h4 { margin: 0 0 12px; color: var(--p); }
.toa-palette-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 14px; }
.toa-palette-btn { aspect-ratio: 1; border: 1px solid var(--line); background: #fff; border-radius: 8px; font-weight: 700; cursor: pointer; color: var(--muted); }
.toa-palette-btn.is-answered { background: #1a9c5b; color: #fff; border-color: #1a9c5b; }
.toa-palette-btn.is-current { outline: 3px solid var(--a); outline-offset: 1px; color: var(--p); }
.toa-palette-legend { list-style: none; padding: 0; margin: 0 0 14px; font-size: 12px; color: var(--muted); }
.toa-palette-legend li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.toa-palette-legend .dot { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line); display: inline-block; }
.toa-palette-legend .dot.is-answered { background: #1a9c5b; border-color: #1a9c5b; }
.toa-palette-legend .dot.is-current { outline: 2px solid var(--a); }

/* Result */
.toa-result-head { text-align: center; }
.toa-result-score { margin-bottom: 18px; }
.toa-result-pct { display: block; font-size: 56px; font-weight: 800; color: var(--a); line-height: 1; }
.toa-result-score span:last-child { color: var(--muted); }
.toa-result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.toa-result-stats > div { background: #f6f8fb; border-radius: 12px; padding: 14px; }
.toa-result-stats strong { display: block; font-size: 24px; color: var(--p); }
.toa-result-stats span { font-size: 12px; color: var(--muted); }
.toa-result-stats .ok strong { color: #1a9c5b; }
.toa-result-stats .bad strong { color: #c0392b; }
.toa-result-stats .rank strong { color: var(--a); }
.toa-result-actions { display: flex; gap: 12px; justify-content: center; }

.toa-review { max-width: 820px; margin: 24px auto 0; }
.toa-review-list { display: flex; flex-direction: column; gap: 16px; }
.toa-review-filters { position: sticky; top: 8px; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; background: rgba(255,255,255,.92); backdrop-filter: blur(4px); padding: 12px; border-radius: 14px; margin-bottom: 18px; box-shadow: 0 4px 14px rgba(11,31,58,.07); }
.toa-rf { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: 8px 16px; font-weight: 600; font-size: 14px; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 6px; }
.toa-rf b { background: #eef2f8; color: var(--p); border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.toa-rf:hover { border-color: var(--a); color: var(--p); }
.toa-rf.is-active { background: var(--p); color: #fff; border-color: var(--p); }
.toa-rf.is-active b { background: var(--a); color: #1a1206; }
.toa-rf[data-filter="correct"].is-active { background: #1a9c5b; border-color: #1a9c5b; }
.toa-rf[data-filter="wrong"].is-active { background: #c0392b; border-color: #c0392b; }
.toa-review-empty { text-align: center; color: var(--muted); padding: 30px; }
.toa-review-q { background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--muted); border-radius: 12px; padding: 18px 20px; }
.toa-review-q.is-correct { border-left-color: #1a9c5b; }
.toa-review-q.is-wrong { border-left-color: #c0392b; }
.toa-review-q.is-skipped { border-left-color: #c9a227; }
.toa-review-num { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.toa-review-text { font-size: 16px; margin: 6px 0 12px; color: #1a2433; }
.toa-review-opts { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 6px; }
.toa-review-opts li { padding: 8px 12px; border-radius: 8px; background: #f6f8fb; }
.toa-review-opts li.correct { background: #e6f7ee; color: #14613b; font-weight: 600; }
.toa-review-opts li.chosen-wrong { background: #fdecea; color: #a32219; font-weight: 600; }
.toa-review-ans { font-size: 14px; color: var(--muted); }
.toa-review-sol { margin-top: 8px; background: #fff7e6; border-radius: 8px; padding: 10px 12px; font-size: 14px; }

@media (max-width: 860px) {
	.toa-quiz-body { grid-template-columns: 1fr; }
	.toa-quiz-palette { position: static; order: -1; }
	.toa-result-stats { grid-template-columns: repeat(2, 1fr); }
	.toa-quiz-guest { grid-template-columns: 1fr; }
}
