/* Daily quiz: subject picker, "topics in this quiz" and subject topics grid. Uses the site colour variables (light + dark). */

/* ---- Subject picker ---- */
.dq-picker { margin: 0 0 18px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.dq-pick-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 14px; }
.dq-pick-title { margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.dq-pick-title i, .dq-topics-title i { color: var(--brand-600); }
.dq-pick-sub { margin: 4px 0 0; color: var(--muted); font-size: .88rem; }
.dq-pick-sub strong { color: var(--brand); }
.dq-search { position: relative; flex: 0 1 260px; min-width: 200px; margin: 0; }
.dq-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .9rem; pointer-events: none; }
.dq-search input { width: 100%; height: 40px; padding: 0 12px 0 34px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink); font-size: .9rem; }
.dq-search input:focus { outline: none; border-color: var(--brand-600); box-shadow: 0 0 0 3px rgba(22, 163, 74, .18); background: var(--surface); }

.dq-subjects { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.dq-subj { display: flex; align-items: center; gap: 10px; height: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); transition: border-color .15s, background .15s, transform .15s, box-shadow .15s; }
.dq-subj:hover { border-color: var(--brand-600); background: var(--brand-50); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.dq-ic { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--brand-50); color: var(--brand-600); font-size: 1.05rem; }
.dq-subj-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.dq-subj-name { font-weight: 700; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dq-subj-meta { color: var(--muted); font-size: .78rem; margin-top: 2px; }
.dq-subj.active { border-color: transparent; background: var(--grad, linear-gradient(135deg, #15803d, #65a30d)); color: #fff; box-shadow: 0 6px 18px rgba(21, 128, 61, .25); }
.dq-subj.active .dq-ic { background: rgba(255, 255, 255, .2); color: #fff; }
.dq-subj.active .dq-subj-meta { color: rgba(255, 255, 255, .85); }
.dq-subj.is-mixed:not(.active) .dq-ic { background: var(--brand-600); color: #fff; }

/* Collapsed list (JavaScript only): extra subjects hidden until "Show all" or a search. */
.is-collapsed [data-dq-list] > li.is-extra:not(.is-active) { display: none; }
[data-dq-list] > li.is-hidden { display: none !important; }
.dq-more { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 12px; padding: 9px 12px; border: 1px dashed var(--line); border-radius: var(--radius-sm); background: transparent; color: var(--brand); font-weight: 700; font-size: .9rem; }
.dq-more:hover { border-color: var(--brand-600); background: var(--brand-50); }
.dq-more i { transition: transform .2s; }
.dq-more[aria-expanded="true"] i { transform: rotate(180deg); }
.dq-none { margin: 10px 0 0; color: var(--muted); font-size: .9rem; text-align: center; }

/* ---- Topics in this quiz ---- */
.dq-topics { margin: 0 0 14px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.dq-topics::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: linear-gradient(180deg, var(--brand-600), #84cc16); }
.dq-topics-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.dq-topics-title { margin: 0; font-size: 1rem; font-weight: 800; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.dq-count { padding: 3px 10px; border-radius: 999px; background: var(--brand-50); color: var(--brand); font-size: .78rem; font-weight: 700; }
.dq-topic-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.dq-topic { --dq-c: #16a34a; --dq-bg: rgba(22, 163, 74, .08); display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-left: 4px solid var(--dq-c); border-radius: var(--radius-sm); background: var(--dq-bg); }
.dq-c1 { --dq-c: #0d9488; --dq-bg: rgba(13, 148, 136, .08); }
.dq-c2 { --dq-c: #65a30d; --dq-bg: rgba(101, 163, 13, .09); }
.dq-c3 { --dq-c: #0891b2; --dq-bg: rgba(8, 145, 178, .08); }
.dq-c4 { --dq-c: #d97706; --dq-bg: rgba(217, 119, 6, .08); }
.dq-c5 { --dq-c: #047857; --dq-bg: rgba(4, 120, 87, .1); }
.dq-topic-link { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 1px; color: var(--ink); line-height: 1.3; }
.dq-topic-link:hover { text-decoration: none; }
.dq-topic-link:hover .dq-topic-name { color: var(--dq-c); text-decoration: underline; }
.dq-topic-subj { font-size: .68rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--dq-c); }
.dq-topic-name { font-weight: 700; font-size: .9rem; }
.dq-qnums { order: -1; flex: none; display: flex; flex-wrap: wrap; gap: 4px; max-width: 96px; }
.dq-qn { min-width: 38px; height: 30px; padding: 0 7px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: .8rem; font-weight: 700; }
.dq-qn::before { content: "Q"; font-weight: 600; color: var(--muted); font-size: .7rem; margin-right: 1px; }
.dq-qn:hover { border-color: var(--dq-c); color: var(--dq-c); text-decoration: none; }
.dq-qn.is-right { background: var(--ok, #047857); border-color: var(--ok, #047857); color: #fff; }
.dq-qn.is-wrong { background: var(--bad, #b91c1c); border-color: var(--bad, #b91c1c); color: #fff; }
.dq-qn.is-right::before, .dq-qn.is-wrong::before { color: rgba(255, 255, 255, .8); }

/* Jump target from the question numbers above */
.quiz-list .mcq-card { scroll-margin-top: calc(var(--header-h, 64px) + 12px); }
.quiz-list .mcq-card:target { box-shadow: 0 0 0 3px rgba(22, 163, 74, .35); }

/* ---- Subject topics grid ---- */
.dq-alltopics .dq-pick-head { margin-bottom: 12px; }
.dq-topic-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.dq-tcard { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); transition: border-color .15s, background .15s; }
.dq-tcard:hover { border-color: var(--brand-600); background: var(--brand-50); text-decoration: none; }
.dq-tcard-name { font-weight: 700; font-size: .9rem; line-height: 1.3; }
.dq-tcard-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: .8rem; }
.dq-tag { padding: 1px 8px; border-radius: 999px; background: var(--brand-600); color: #fff; font-size: .7rem; font-weight: 700; }
.dq-tcard.in-quiz { border-color: var(--brand-600); }
.dq-bar { display: block; height: 4px; margin-top: auto; border-radius: 4px; background: var(--line); overflow: hidden; }
.dq-bar span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--brand-600), #84cc16); }

@media (max-width: 575.98px) {
  .dq-picker, .dq-topics { padding: 14px; }
  .dq-search { flex: 1 1 100%; }
  .dq-subjects { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .dq-subj { padding: 8px; gap: 8px; }
  .dq-ic { width: 30px; height: 30px; font-size: .9rem; }
  .dq-topic-list, .dq-topic-grid { grid-template-columns: 1fr; }
}

/* ---- Dark mode ---- */
html[data-theme="dark"] .dq-subj.active { background: linear-gradient(135deg, #15803d, #4d7c0f); }
html[data-theme="dark"] .dq-subj.is-mixed:not(.active) .dq-ic, html[data-theme="dark"] .dq-tag { background: #15803d; }
html[data-theme="dark"] .dq-pick-sub strong, html[data-theme="dark"] .dq-count, html[data-theme="dark"] .dq-more { color: #4ade80; }
html[data-theme="dark"] .dq-topic { --dq-c: #4ade80; --dq-bg: rgba(74, 222, 128, .07); }
html[data-theme="dark"] .dq-c1 { --dq-c: #2dd4bf; --dq-bg: rgba(45, 212, 191, .07); }
html[data-theme="dark"] .dq-c2 { --dq-c: #a3e635; --dq-bg: rgba(163, 230, 53, .07); }
html[data-theme="dark"] .dq-c3 { --dq-c: #22d3ee; --dq-bg: rgba(34, 211, 238, .07); }
html[data-theme="dark"] .dq-c4 { --dq-c: #fbbf24; --dq-bg: rgba(251, 191, 36, .07); }
html[data-theme="dark"] .dq-c5 { --dq-c: #34d399; --dq-bg: rgba(52, 211, 153, .08); }
html[data-theme="dark"] .dq-qn.is-right { background: #15803d; border-color: #22c55e; }
html[data-theme="dark"] .dq-qn.is-wrong { background: #b91c1c; border-color: #ef4444; }
