/* Matrix Layer (Background) */

.bb-matrix-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 1;

  /* Full brightness */
}

/* Stats & Controls Panel */

.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--theme-learning-success-197);
}

.bb-pill {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--theme-component-border-15);
  background: var(--theme-component-page-50);
  color: var(--bb-text-muted);
  font-size: 14px;
  font-family: var(--font-code);
}

.bb-pill strong {
  color: var(--bb-kelly);
}

.bb-pill.bad strong {
  color: var(--bb-error);
}

/* Filter Buttons */

.filter-group {
  display: flex;
  gap: 5px;
  align-items: center;
  background: var(--theme-catalog-surface-70);
  padding: 4px;
  border-radius: 20px;
}

.filter-label {
  font-size: 14px;
  margin: 0 8px;
  color: var(--bb-text-muted);
  text-transform: uppercase;
}

.bb-fbtn {
  background: transparent;
  border: none;
  color: var(--bb-text-muted);
  padding: 5px 12px;
  border-radius: 15px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: 0.2s;
}

.bb-fbtn:hover {
  color: var(--theme-component-ink-5);
}

.bb-fbtn.active {
  background: var(--bb-kelly);
  color: var(--theme-component-on-primary-3);
  box-shadow: 0 0 10px var(--theme-learning-success-2);
}

.cert-mode .bb-explain {
  display: none !important;
}

.cert-mode .cert-hide {
  display: none !important;
}

.cert-mode #byDiffPill,
        .cert-mode #byDiffPillBottom,
        .cert-mode #answeredPillBottom,
        .cert-mode #correctPillBottom,
        .cert-mode #scorePillBottom,
        .cert-mode #focusList,
        .cert-mode #focusListBottom {
  display: none !important;
}

.cert-mode .bb-opt.is-correct,
        .cert-mode .bb-opt.is-wrong {
  border-color: var(--theme-component-border-15) !important;
  background: var(--theme-component-page-50) !important;
}

.cert-mode .bb-opt.is-correct .bb-radio,
        .cert-mode .bb-opt.is-wrong .bb-radio {
  border-color: var(--bb-text-muted) !important;
}

.cert-mode .bb-opt.is-correct .bb-radio::after,
        .cert-mode .bb-opt.is-wrong .bb-radio::after {
  background: var(--bb-kelly) !important;
}

.cert-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--theme-learning-page-241);
  padding: 20px;
}

.cert-modal.open {
  display: flex;
}

.cert-modal-card {
  max-width: 640px;
  width: 100%;
  background: var(--theme-learning-page-242);
  border: 1px solid var(--theme-learning-success-33);
  border-radius: 10px;
  padding: 22px;
  box-shadow: 0 0 24px var(--theme-learning-success-197);
}

.cert-modal-card h3 {
  margin-bottom: 10px;
}

.cert-modal-card p {
  color: var(--bb-text-muted);
  margin-bottom: 8px;
  line-height: 1.55;
}

.cert-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

.exam-action-modal {
  position: fixed;
  inset: 0;
  z-index: 12100;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--theme-learning-page-241);
  padding: 20px;
}

.exam-action-modal.open {
  display: flex;
}

.exam-action-card {
  max-width: 640px;
  width: 100%;
  background: var(--theme-learning-page-242);
  border: 1px solid var(--theme-learning-success-33);
  border-radius: 10px;
  padding: 22px;
  box-shadow: 0 0 24px var(--theme-learning-success-197);
}

.exam-action-card h3 {
  margin-bottom: 10px;
}

.exam-action-card p {
  color: var(--bb-text-muted);
  margin-bottom: 8px;
  line-height: 1.55;
  white-space: pre-line;
}

.exam-action-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* Info Grids */

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

@media (max-width: 768px) {

  .info-grid {
    grid-template-columns: 1fr;
  }
}

.info-box {
  background: var(--theme-component-page-50);
  padding: 15px;
  border-radius: 8px;
  border: 1px solid var(--theme-component-border-14);
}

.info-box h3 {
  font-size: max(14px, 0.9rem);
  color: var(--bb-text-main);
  margin-bottom: 10px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--theme-component-border-15);
  padding-bottom: 5px;
}

.step-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  font-size: max(14px, 0.9rem);
  color: var(--bb-text-muted);
}

.step-dot {
  width: 8px;
  height: 8px;
  background: var(--bb-kelly);
  border-radius: 50%;
  margin-top: 6px;
  box-shadow: 0 0 5px var(--bb-kelly);
}

.focus-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: max(14px, 0.9rem);
  color: var(--bb-text-muted);
}

.focus-list li {
  margin-bottom: 6px;
}

.focus-list b {
  color: var(--bb-text-main);
}

/* QUIZ CARDS */

.bb-quiz {
  display: grid;
  gap: 25px;
  margin-top: 30px;
}

.bb-qcard {
  background: var(--bb-bg-surface);
  border: 1px solid var(--theme-learning-success-197);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  transition: 0.3s;
}

.bb-qcard::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--bb-text-dim);
}

/* Difficulty Accents */

.bb-qcard.diff-easy::before {
  background: var(--bb-kelly);
  box-shadow: 0 0 10px var(--bb-kelly);
}

.bb-qcard.diff-medium::before {
  background: var(--bb-gold);
  box-shadow: 0 0 10px var(--bb-gold);
}

.bb-qcard.diff-hard::before {
  background: var(--bb-error);
  box-shadow: 0 0 10px var(--bb-error);
}

.bb-qhead {
  padding: 12px 20px;
  background: var(--theme-component-page-64);
  border-bottom: 1px solid var(--theme-component-border-14);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.bb-tag {
  font-family: var(--font-code);
  font-size: 14px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--theme-catalog-surface-70);
  color: var(--bb-text-muted);
  border: 1px solid var(--theme-component-border-15);
}

.bb-tag.obj {
  border-color: var(--bb-cyan);
  color: var(--bb-cyan);
  background: var(--theme-learning-info-bg-244);
}

.bb-qbody {
  padding: 25px;
}

.bb-qtext {
  font-size: 1.1rem;
  margin-bottom: 20px;
  line-height: 1.6;
  color: var(--theme-component-ink-5);
}

.bb-options {
  display: grid;
  gap: 12px;
}

.bb-opt {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  border-radius: 8px;
  background: var(--theme-component-page-50);
  border: 1px solid var(--theme-component-border-15);
  cursor: pointer;
  transition: 0.2s;
}

.bb-opt:hover {
  border-color: var(--bb-kelly);
  background: var(--theme-learning-success-bg-21);
}

.bb-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--bb-text-muted);
  position: relative;
  flex-shrink: 0;
}

.bb-radio::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--bb-kelly);
  transform: scale(0);
  transition: 0.2s;
}

/* States */

.bb-opt.is-selected {
  border-color: var(--bb-kelly);
  background: var(--theme-catalog-success-bg-132);
}

.bb-opt.is-selected .bb-radio {
  border-color: var(--bb-kelly);
}

.bb-opt.is-selected .bb-radio::after {
  transform: scale(1);
}

.bb-qcard.is-locked .bb-opt {
  cursor: default;
  pointer-events: none;
}

.bb-opt.is-correct {
  border-color: var(--bb-kelly);
  background: var(--theme-learning-success-bg-198);
}

.bb-opt.is-correct .bb-radio {
  border-color: var(--bb-kelly);
}

.bb-opt.is-correct .bb-radio::after {
  background: var(--bb-kelly);
  transform: scale(1);
}

.bb-opt.is-wrong {
  border-color: var(--bb-error);
  background: var(--theme-catalog-error-bg-133);
}

.bb-opt.is-wrong .bb-radio {
  border-color: var(--bb-error);
}

.bb-opt.is-wrong .bb-radio::after {
  background: var(--bb-error);
  transform: scale(1);
}

/* Explanation */

.bb-explain {
  margin-top: 20px;
  padding: 20px;
  border-radius: 8px;
  background: var(--theme-component-page-47);
  border-left: 3px solid var(--bb-text-muted);
  display: none;
  animation: fadeIn 0.3s ease;
}

.bb-qcard.is-locked .bb-explain {
  display: block;
}

@keyframes fadeIn {

  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Make breakdown text keep newlines from the template string */

.bb-breakdown {
  white-space: pre-line;

  /* respects \n */
  font-size: max(14px, 0.9rem);
  color: var(--bb-text-muted);
  line-height: 1.6;
}

/* --- TACTICAL RETICLE HUD --- */

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 55px;
  height: 55px;
  border: 1px solid var(--bb-kelly);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 2147483646;
  transition: width 0.3s, height 0.3s, border-color 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px var(--theme-learning-success-111);
  background-image: linear-gradient(90deg, var(--bb-kelly) 20%, transparent 20%, transparent 80%, var(--bb-kelly) 80%),
                        linear-gradient(180deg, var(--bb-kelly) 20%, transparent 20%, transparent 80%, var(--bb-kelly) 80%);
  background-position: center;
  background-size: 100% 1px, 1px 100%;
  background-repeat: no-repeat;
}

.cursor::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 1px;
  border-top: 1px dotted var(--bb-kelly);
  opacity: 0.4;
}

.cursor::after {
  content: '';
  position: absolute;
  height: 100%;
  width: 1px;
  border-left: 1px dotted var(--bb-kelly);
  opacity: 0.4;
}

.cursor-coords {
  position: absolute;
  right: -85px;
  top: -15px;
  font-family: var(--font-code);
  font-size: 14px;
  color: var(--bb-kelly);
  line-height: 1.4;
  text-transform: uppercase;
  text-shadow: 0 0 5px var(--theme-learning-success-246);
}

.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 4px;
  height: 4px;
  background: var(--theme-catalog-surface-31);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 2147483647;
  pointer-events: none;
  box-shadow: 0 0 12px var(--theme-component-border-7);
}

.cursor.active {
  width: 85px;
  height: 85px;
  background: var(--theme-learning-success-bg-198);
  border-color: var(--theme-component-border-7);
}
