/* Course page quiz (ADR-083 A1). Plain CSS on top of site.css; both themes via .dark. */
.theme-toggle { position: relative; width: 50px; height: 26px; background: #cbd5e1; border-radius: 9999px; cursor: pointer; }
.toggle-dot { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #f59e0b; transition: transform .3s; }
.dark .theme-toggle { background: #3d3450; }
.dark .toggle-dot { transform: translateX(24px); background: #1a1625; color: #9b59b6; }

.quiz-item { background: #fff; border: 1px solid #e5e7eb; border-radius: 1.5rem; padding: 1.25rem 1.25rem 1.1rem; scroll-margin-top: 6rem; }
.dark .quiz-item { background: #2c243b; border-color: rgba(255,255,255,.08); }
.quiz-num { flex: none; width: 2rem; height: 2rem; border-radius: 9999px; display: grid; place-items: center; font-weight: 800; font-size: .9rem; background: #fff1e6; color: #c2410c; }
.dark .quiz-num { background: rgba(255,255,255,.08); color: #ff9f43; }
.quiz-hint { margin-top: .35rem; color: #4b5563; }
.dark .quiz-hint { color: #9ca3af; }
.quiz-gap { display: inline-block; min-width: 4.5rem; border-bottom: 2px solid #9ca3af; margin: 0 .3rem; vertical-align: -2px; }

.quiz-options { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.quiz-option input { position: absolute; opacity: 0; pointer-events: none; }
.quiz-option span { display: inline-block; padding: .55rem 1rem; border-radius: 9999px; border: 2px solid #e5e7eb; font-weight: 700; cursor: pointer; user-select: none; }
.dark .quiz-option span { border-color: rgba(255,255,255,.15); }
.quiz-option input:checked + span { border-color: #1f2937; background: #1f2937; color: #fff; }
.dark .quiz-option input:checked + span { border-color: #fff; background: #fff; color: #1a1625; }
.quiz-option input:focus-visible + span { outline: 3px solid #ff9f43; outline-offset: 2px; }

.quiz-input, .quiz-match-row select { font: inherit; padding: .45rem .8rem; border-radius: .75rem; border: 2px solid #d1d5db; background: #fff; color: #1f2937; min-width: 9rem; }
.dark .quiz-input, .dark .quiz-match-row select { background: #1a1625; border-color: rgba(255,255,255,.2); color: #fff; }
.quiz-input:focus, .quiz-match-row select:focus { outline: 3px solid #ff9f43; outline-offset: 1px; border-color: #1f2937; }

.quiz-built { min-height: 2.6rem; margin-top: .8rem; padding: .45rem .8rem; border-radius: .75rem; border: 2px dashed #d1d5db; font-weight: 700; font-size: 1.1rem; }
.quiz-built-inline { display: inline-block; min-width: 6rem; min-height: 0; margin: 0 .3rem; padding: .1rem .6rem; vertical-align: middle; }
.dark .quiz-built { border-color: rgba(255,255,255,.2); }
.quiz-tiles { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .8rem; }
.quiz-tile { min-width: 2.4rem; padding: .45rem .75rem; border-radius: .75rem; border: 2px solid #e5e7eb; background: #f9f7f2; font-weight: 700; cursor: pointer; }
.dark .quiz-tile { background: #1a1625; border-color: rgba(255,255,255,.15); color: #fff; }
.quiz-tile[disabled] { opacity: .25; cursor: default; }
.quiz-tile:focus-visible, .quiz-clear:focus-visible { outline: 3px solid #ff9f43; outline-offset: 2px; }
.quiz-clear { margin-top: .6rem; font-size: .85rem; font-weight: 700; color: #4b5563; text-decoration: underline; text-underline-offset: 3px; }
.dark .quiz-clear { color: #9ca3af; }

.quiz-matching { display: grid; gap: .6rem; margin-top: .4rem; }
.quiz-match-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding: .4rem 0; border-bottom: 1px solid #f3f4f6; }
.dark .quiz-match-row { border-color: rgba(255,255,255,.06); }

.quiz-check { background: #ff9f43; color: #1f2937; font-weight: 800; padding: .85rem 1.6rem; border-radius: 9999px; font-size: 1.05rem; }
.quiz-check:hover { background: #fdba74; }
.quiz-retry { border: 2px solid currentColor; font-weight: 800; padding: .75rem 1.4rem; border-radius: 9999px; }

.quiz-item.is-right { border-color: #16a34a; box-shadow: 0 0 0 1px #16a34a inset; }
.quiz-item.is-wrong { border-color: #dc2626; box-shadow: 0 0 0 1px #dc2626 inset; }
.quiz-item.is-empty { border-color: #d97706; box-shadow: 0 0 0 1px #d97706 inset; }
.quiz-feedback { margin-top: .8rem; font-weight: 700; }
.quiz-item.is-right .quiz-feedback { color: #15803d; }
.quiz-item.is-wrong .quiz-feedback, .quiz-item.is-empty .quiz-feedback { color: #b91c1c; }
.dark .quiz-item.is-right .quiz-feedback { color: #86efac; }
.dark .quiz-item.is-wrong .quiz-feedback, .dark .quiz-item.is-empty .quiz-feedback { color: #fca5a5; }
.quiz-match-row.is-wrong select { border-color: #dc2626; }
.quiz-match-row.is-right select { border-color: #16a34a; }

.quiz-result { padding: 1.25rem 1.5rem; border-radius: 1.5rem; background: #fff1e6; font-size: 1.25rem; font-weight: 800; }
.dark .quiz-result { background: rgba(255,159,67,.12); }
.quiz-result small { display: block; margin-top: .25rem; font-size: .95rem; font-weight: 600; }

/* Two-gap sentences (ADR-074): numbered gaps, one option row per gap. */
.quiz-gap-num { min-width: 3.2rem; text-align: center; font-weight: 800; font-size: .85rem; color: #c2410c; border-bottom-color: #f59e0b; }
.dark .quiz-gap-num { color: #ff9f43; }
.quiz-slot { display: flex; align-items: flex-start; gap: .6rem; margin-top: .7rem; }
.quiz-slot .quiz-options { margin-top: 0; }
.quiz-slot-num { flex: none; margin-top: .45rem; width: 1.6rem; height: 1.6rem; border-radius: 9999px; display: grid; place-items: center; font-size: .8rem; font-weight: 800; background: #fff1e6; color: #c2410c; }
.dark .quiz-slot-num { background: rgba(255,255,255,.08); color: #ff9f43; }
.quiz-input-sm { min-width: 6rem; width: auto; max-width: 100%; margin: 0 .25rem; padding: .25rem .6rem; }
.quiz-slot.is-wrong .quiz-slot-num, .quiz-input.is-wrong { box-shadow: 0 0 0 2px #dc2626; }
.quiz-slot.is-right .quiz-slot-num, .quiz-input.is-right { box-shadow: 0 0 0 2px #16a34a; }
