/* Quizzes (Story 3507) -- shared by quizzes.html (the list) and quiz.html (one quiz).
   Pinned chrome: the shell is a full-height flex column that never scrolls; exactly one child
   (.qz-body) scrolls. Both heights are written -- 100vh alone lets the tool bar strip slide off on a phone. */

body { background: #EEF0F4; margin: 0; }
[hidden] { display: none !important; }
.qz-shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }

.ct-header { background: #1F2937; color: #fff; padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.ct-header h1 { margin: 0; font-size: 15pt; font-weight: 650; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-header button { color: #fff; background: transparent; border: 1px solid #4B5563; border-radius: 4px; padding: 4px 12px; font: inherit; cursor: pointer; }

#lwIconBand, .ct-header, .qz-tabs, .qz-toolbar, .qz-status { flex: 0 0 auto; }

.qz-tabs { background: #111827; display: flex; flex-wrap: nowrap; overflow-x: auto; }
.qz-tab { color: #9CA3AF; background: transparent; border: none; border-bottom: 3px solid transparent; padding: 10px 16px;
          font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.qz-tab.active { color: #fff; border-bottom-color: #60A5FA; background: #1F2937; }

.qz-toolbar { background: #fff; border-bottom: 1px solid #D9DCE3; padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.qz-toolbar .grow { flex: 1 1 180px; min-width: 0; }
.qz-toolbar .fld { flex: 0 1 180px; min-width: 130px; }
.qz-toolbar label { display: block; font-size: 11px; color: #6B7280; margin-bottom: 2px; }
.qz-toolbar .check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #374151; padding-bottom: 6px; }
.qz-toolbar input[type="search"] { display: block; width: 100%; box-sizing: border-box; padding: 7px 9px; border: 1px solid #C9CDD6; border-radius: 4px; font: inherit; font-size: 13px; }

.qz-body { flex: 1; overflow: auto; padding: 8px; -webkit-overflow-scrolling: touch; }
.qz-status { background: #111827; color: #9CA3AF; padding: 4px 12px; font-size: 11px; }
.qz-empty { text-align: center; color: #6B7280; padding: 36px 12px; font-size: 13px; }
.qz-muted { color: #6B7280; font-size: 12px; }

/* buttons */
.qz-btn { background: #E5E7EB; color: #111827; border: none; border-radius: 5px; padding: 8px 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.qz-btn.primary { background: #2563EB; color: #fff; }
.qz-btn.good { background: #15803D; color: #fff; }
.qz-btn.danger { background: #FEE2E2; color: #991B1B; }
.qz-btn.small { padding: 4px 10px; font-size: 12px; }
.qz-btn:disabled { opacity: .5; cursor: default; }

/* chips */
.qz-chip { display: inline-block; padding: 1px 8px; border-radius: 9px; font-size: 11px; font-weight: 600; background: #E5E7EB; color: #374151; white-space: nowrap; }
.qz-chip.work { background: #DBEAFE; color: #1E40AF; }
.qz-chip.good { background: #DCFCE7; color: #166534; }
.qz-chip.bad { background: #FEE2E2; color: #991B1B; }
.qz-chip.new { background: #FEF3C7; color: #92400E; }

/* the quiz cards on the list page */
.qz-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.qz-card { background: #fff; border: 1px solid #D9DCE3; border-radius: 8px; padding: 12px 14px; cursor: pointer; min-width: 0; }
.qz-card.archived { opacity: .7; }
.qz-card h2 { margin: 0 0 6px; font-size: 15px; color: #111827; overflow-wrap: anywhere; }
.qz-card .row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.qz-card .summary { font-size: 13px; color: #374151; margin: 4px 0 8px; overflow-wrap: anywhere; }
.qz-card .foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.qz-card .foot .grow { flex: 1; }
.qz-more { text-align: center; margin: 12px 0; }

/* a score meter: green share of a grey bar */
.qz-meter { height: 8px; background: #E5E7EB; border-radius: 4px; overflow: hidden; }
.qz-meter > span { display: block; height: 100%; background: #16A34A; }
.qz-meter.mid > span { background: #D97706; }
.qz-meter.low > span { background: #DC2626; }

/* the Take tab */
.qz-panel { background: #fff; border: 1px solid #D9DCE3; border-radius: 8px; padding: 14px; margin-bottom: 8px; }
.qz-panel h3 { margin: 0 0 8px; font-size: 14px; color: #111827; }
.qz-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-bottom: 4px; }
.qz-stat { background: #F9FAFB; border: 1px solid #E5E7EB; border-radius: 6px; padding: 8px 10px; }
.qz-stat .n { font-size: 20px; font-weight: 700; color: #111827; }
.qz-stat .l { font-size: 11px; color: #6B7280; }
.qz-modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.qz-mode { text-align: left; background: #F3F4F6; border: 1px solid #D1D5DB; border-radius: 8px; padding: 10px 12px; font: inherit; cursor: pointer; }
.qz-mode strong { display: block; font-size: 14px; color: #111827; }
.qz-mode span { font-size: 12px; color: #6B7280; }
.qz-mode:disabled { opacity: .45; cursor: default; }

.qz-question { background: #fff; border: 1px solid #D9DCE3; border-radius: 8px; padding: 14px; }
.qz-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12px; color: #6B7280; }
.qz-progress .qz-meter { flex: 1; }
.qz-prompt { font-size: 16px; line-height: 1.45; color: #111827; white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 12px; }
.qz-choices { display: flex; flex-direction: column; gap: 8px; }
.qz-choice { text-align: left; background: #F9FAFB; border: 2px solid #D1D5DB; border-radius: 8px; padding: 11px 12px; font: inherit; font-size: 14px;
             color: #111827; cursor: pointer; overflow-wrap: anywhere; }
.qz-choice:disabled { cursor: default; }
.qz-choice.right { border-color: #16A34A; background: #DCFCE7; }
.qz-choice.wrong { border-color: #DC2626; background: #FEE2E2; }
.qz-typed { display: flex; gap: 8px; }
.qz-typed input { flex: 1; min-width: 0; box-sizing: border-box; padding: 10px; border: 1px solid #C9CDD6; border-radius: 6px; font: inherit; font-size: 15px; }
.qz-feedback { margin-top: 12px; padding: 10px 12px; border-radius: 6px; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.qz-feedback.right { background: #DCFCE7; color: #14532D; }
.qz-feedback.wrong { background: #FEE2E2; color: #7F1D1D; }
.qz-feedback a { color: inherit; font-weight: 600; }
.qz-next { display: flex; justify-content: flex-end; margin-top: 12px; }

/* answer lists (results, history, question track records) */
.qz-answer { border-top: 1px solid #E5E7EB; padding: 8px 0; font-size: 13px; display: flex; gap: 8px; }
.qz-answer:first-child { border-top: none; }
.qz-answer .mark { flex: 0 0 22px; font-weight: 700; text-align: center; }
.qz-answer .mark.right { color: #15803D; }
.qz-answer .mark.wrong { color: #B91C1C; }
.qz-answer .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.qz-answer .txt div { margin-top: 2px; }

/* the Questions tab */
.qz-q { background: #fff; border: 1px solid #D9DCE3; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.qz-q.inactive { opacity: .6; }
.qz-q .head { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.qz-q .head .n { flex: 0 0 auto; font-weight: 700; color: #6B7280; font-size: 13px; }
.qz-q .head .p { flex: 1; min-width: 0; font-size: 14px; color: #111827; white-space: pre-wrap; overflow-wrap: anywhere; }
.qz-q .meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0 22px; }
.qz-q .more { margin: 8px 0 0 22px; font-size: 13px; }
.qz-q .more ul { margin: 4px 0; padding-left: 18px; }
.qz-q .more li.right { color: #15803D; font-weight: 600; }
.qz-q .acts { display: flex; gap: 6px; margin-top: 8px; }

/* the History tab */
.qz-attempt { background: #fff; border: 1px solid #D9DCE3; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.qz-attempt .head { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.qz-attempt .head .score { flex: 0 0 52px; font-size: 18px; font-weight: 700; color: #111827; }
.qz-attempt .head .what { flex: 1; min-width: 0; font-size: 13px; color: #374151; }

/* the About tab */
.qz-about dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 13px; }
.qz-about dt { color: #6B7280; }
.qz-about dd { margin: 0; color: #111827; overflow-wrap: anywhere; white-space: pre-wrap; }
.qz-source { display: flex; gap: 8px; align-items: center; border-top: 1px solid #E5E7EB; padding: 8px 0; font-size: 13px; }
.qz-source:first-of-type { border-top: none; }
.qz-source .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.qz-source a { color: #1D4ED8; }

/* modals */
.qz-overlay { position: fixed; inset: 0; background: rgba(17, 24, 39, .55); display: none; align-items: flex-start; justify-content: center;
              z-index: 2000; overflow-y: auto; padding: 24px 10px; }
.qz-overlay.open { display: flex; }
.qz-modal { background: #fff; border-radius: 10px; width: 100%; max-width: 560px; padding: 16px 18px; box-sizing: border-box; }
.qz-modal h2 { margin: 0 0 10px; font-size: 16px; color: #111827; }
.qz-modal .fld { margin-bottom: 10px; }
.qz-modal label { display: block; font-size: 12px; color: #4B5563; margin-bottom: 3px; font-weight: 600; }
.qz-modal input[type="text"], .qz-modal input[type="url"], .qz-modal input[type="number"], .qz-modal textarea {
    display: block; width: 100%; box-sizing: border-box; padding: 8px 9px; border: 1px solid #C9CDD6; border-radius: 5px; font: inherit; font-size: 14px; }
.qz-modal textarea { min-height: 70px; resize: vertical; }
.qz-modal .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qz-modal .row2 > * { min-width: 0; }
.qz-modal .check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #374151; }
.qz-modal .hint { font-size: 11px; color: #6B7280; margin-top: 3px; }
.qz-modal .warn { display: none; background: #FEF2F2; color: #991B1B; border-radius: 5px; padding: 7px 9px; font-size: 13px; margin-bottom: 10px; }
.qz-modal .warn.show { display: block; }
.qz-modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.qz-modal .voice-mic-wrap { display: block; }
.qz-choice-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.qz-choice-row input[type="text"] { flex: 1; min-width: 0; }
.qz-choice-row .check { flex: 0 0 auto; }
.qz-confirm-text { font-size: 14px; color: #111827; white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 12px; }

@media (max-width: 520px) {
    .qz-modal .row2 { grid-template-columns: 1fr; }
}

/* print: everything shows, nothing interactive */
@media print {
    .qz-choice, .qz-mode { border-width: 1px; }
}
