/* Quiz log simulator widget (assets/quiz-log-sim.js). Every rule is scoped
   to .qls, the class QuizLogSim puts on its root. The page supplies the
   site tokens (--surface, --border, --text, --red...); the mock quiz page
   borrows Canvas's light look with its own --cv-* tokens. */
.qls {
  --cv-text: #2d3b45;
  --cv-muted: #6b7780;
  --cv-border: #c7cdd1;
  --cv-head: #f5f5f5;
  --cv-blue: #0374b5;
  --cv-blue-dark: #02598b;
}

.qls [hidden] {
  display: none !important;
}

.qls .tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}

.qls .quiz-pane,
.qls .log-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.qls .quiz-pane .quiz,
.qls .log-pane .log {
  flex: 1 1 auto;
}

.qls .pane-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.qls .pane-label .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4a4a4a;
  flex-shrink: 0;
}

.qls.is-live .pane-label .dot {
  background: var(--red);
  box-shadow: 0 0 0 4px var(--red-tint);
}

/* Mock Canvas quiz page (light, like Canvas). */
.qls .quiz {
  background: #fff;
  color: var(--cv-text);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.qls .quiz-top {
  padding: 18px 20px 14px;
  border-bottom: 1px solid #e3e6e8;
}

.qls .quiz-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--cv-text);
  outline: none;
}

.qls .quiz-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--cv-muted);
}

.qls .quiz-meta strong {
  color: var(--cv-text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.qls .quiz-body {
  padding: 18px 20px 20px;
  display: grid;
  gap: 16px;
}

.qls .quiz-intro {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--cv-text);
}

.qls .quiz-intro ul {
  margin: 10px 0 0 20px;
  display: grid;
  gap: 4px;
}

.qls .cv-btn {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--cv-blue);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 18px;
  border: 1px solid var(--cv-blue-dark);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.qls .cv-btn:hover {
  background: var(--cv-blue-dark);
}

.qls .cv-btn.secondary {
  background: #f5f5f5;
  color: var(--cv-text);
  border-color: var(--cv-border);
}

.qls .cv-btn.secondary:hover {
  background: #e8eaec;
}

.qls .cv-btn:focus-visible {
  outline: 3px solid rgba(3, 116, 181, 0.45);
  outline-offset: 2px;
}

.qls .quiz-questions {
  display: grid;
  gap: 16px;
}

.qls .question {
  border: 1px solid var(--cv-border);
  border-radius: 6px;
  overflow: hidden;
}

.qls .question legend {
  display: flex;
  justify-content: space-between;
  width: 100%;
  background: var(--cv-head);
  border-bottom: 1px solid var(--cv-border);
  padding: 9px 14px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--cv-text);
  float: left;
}

.qls .question legend span {
  font-weight: 500;
  color: var(--cv-muted);
}

.qls .question fieldset {
  border: none;
  min-width: 0;
}

.qls .question-text {
  display: block;
  clear: both;
  padding: 14px 14px 6px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.qls .options {
  list-style: none;
  padding: 4px 14px 12px;
  display: grid;
  gap: 2px;
}

.qls .options label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 4px;
  font-size: 0.93rem;
  cursor: pointer;
}

.qls .options label:hover {
  background: #f2f4f5;
}

.qls .options input {
  width: 16px;
  height: 16px;
  accent-color: var(--cv-blue);
  flex-shrink: 0;
}

.qls .short-answer {
  padding: 6px 14px 14px;
}

.qls .short-answer input {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--cv-text);
  padding: 9px 11px;
  border: 1px solid var(--cv-border);
  border-radius: 4px;
  background: #fff;
}

.qls .short-answer input:focus {
  outline: none;
  border-color: var(--cv-blue);
  box-shadow: 0 0 0 2px rgba(3, 116, 181, 0.25);
}

.qls .try-box {
  background: #eef6fb;
  border: 1px solid #b8d8ec;
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--cv-text);
}

.qls .try-box a {
  color: var(--cv-blue-dark);
  font-weight: 600;
}

.qls .try-box strong {
  font-weight: 700;
}

.qls .quiz-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.qls .quiz-note {
  font-size: 0.8rem;
  color: var(--cv-muted);
  line-height: 1.45;
}

/* Teacher's View Log (dark, like the guides' sample log). */
.qls .log {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  scroll-margin-top: 110px;
}

.qls .log-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: #111111;
  border-bottom: 1px solid var(--border);
}

.qls .log-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.qls .tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid #333;
  color: var(--text-secondary);
  border-radius: 100px;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.qls.is-live .log-bar .tag {
  border-color: var(--red-border);
  color: #ffb3c0;
  background: var(--red-tint);
}

.qls .log-session {
  padding: 11px 18px;
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.55;
  border-bottom: 1px solid var(--border);
}

.qls .log-session strong {
  color: var(--text);
}

.qls .log-rows {
  list-style: none;
  padding: 4px 0;
  flex: 1 1 0px;
  min-height: 150px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.qls .log-rows li {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 10px 18px;
  border-bottom: 1px solid #1d1d1d;
  font-size: 0.9rem;
  line-height: 1.45;
}

.qls .log-rows li.log-away {
  background: var(--red-tint);
}

.qls .log-rows li.log-new {
  animation: qls-row-in 1.2s ease-out;
}

@keyframes qls-row-in {
  from { box-shadow: inset 3px 0 0 var(--red); }
  to { box-shadow: inset 3px 0 0 transparent; }
}

.qls .log-rows li.log-empty {
  display: block;
  border-bottom: none;
  padding: 26px 18px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

.qls .log-time {
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.qls .log-status {
  color: var(--text);
}

.qls .log-q {
  color: var(--red-light);
  font-weight: 700;
  white-space: nowrap;
}

.qls .log-note {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.qls .log-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 11px 18px;
  border-top: 1px solid var(--border);
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.qls .log-foot strong {
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.qls .log-caption {
  padding: 0 18px 13px;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Counters: what the page saw, and whether the log has a line for it. */
.qls .unseen {
  margin-top: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 22px 18px;
}

.qls .unseen-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 4px;
}

.qls .unseen h2 {
  font-size: 1.15rem;
  margin-bottom: 0;
}

.qls .unseen-sub {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 16px;
}

.qls .unseen-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.qls .unseen-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: baseline;
  align-content: start;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}

.qls .unseen-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
}

.qls .unseen-count {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.qls .unseen-count.hit {
  color: #ffb3c0;
}

.qls .unseen-why {
  grid-column: 1 / -1;
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.qls .unseen-why code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  color: var(--text);
  background: #1a1a1a;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0 4px;
}

.qls .privacy-line {
  margin-top: 14px;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.qls .privacy-line a {
  color: var(--red-light);
}

/* Compact embed inside a guide: one card with a heading, the quiz and the
   log side by side, then a row of counters. */
.qls.qls-embed {
  max-width: 760px;
  margin: 24px 0 0;
  padding: 22px 24px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  scroll-margin-top: 80px;
}

.qls .qls-eyebrow {
  display: block;
  color: #ffb3c0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.qls .qls-embed-title {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--text);
  margin: 0 0 8px;
}

.qls .qls-embed-sub {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0 0 18px;
  max-width: none;
}

.qls.qls-embed .unseen-grid {
  margin-top: 16px;
}

.qls .unseen-grid.qls-counters {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.qls.qls-embed .log-rows {
  min-height: 180px;
}

/* A short "works best on a computer" note, shown only on narrow screens. */
.qls .qls-narrow-note {
  display: none;
  margin: -6px 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.5;
}

@media (max-width: 860px) {
  .qls .tool-grid {
    grid-template-columns: 1fr;
  }

  .qls .log-rows {
    flex: none;
    height: 300px;
    min-height: 0;
  }
}

@media (max-width: 768px) {
  .qls .unseen {
    padding: 18px 16px 14px;
  }

  .qls .unseen-grid,
  .qls .unseen-grid.qls-counters {
    grid-template-columns: 1fr;
  }

  .qls.qls-embed {
    padding: 18px 16px 16px;
  }

  .qls .log-rows li {
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 10px;
    padding: 10px 14px;
  }

  .qls .log-bar,
  .qls .log-session,
  .qls .log-foot {
    padding-left: 14px;
    padding-right: 14px;
  }

  .qls .log-caption {
    padding: 0 14px 13px;
  }

  .qls .quiz-top,
  .qls .quiz-body {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 767px) {
  .qls .qls-narrow-note {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  .qls *,
  .qls *::before,
  .qls *::after {
    animation: none !important;
    transition: none !important;
  }
}
