/* =========================================================
   Chemistry@BGS — GCSE Test Me topic selector
   Compact cards + CS/TA course presets + course grouping
   No topic colour-coding added.
   ========================================================= */

#topicChoices.topic-choice-grid {
  display: block;
}

/* ----- course preset controls ----- */

/* Quick select sits on the same row as Select all / Clear selection,
   pushed into the spare space on the right. */
.topic-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.gcse-course-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.gcse-course-tools__label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
  white-space: nowrap;
}

.gcse-course-preset {
  appearance: none;
  min-width: 48px;
  border: 1px solid #dedede;
  border-radius: 999px;
  background: #fafafa;
  color: var(--charcoal);
  padding: 6px 11px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.gcse-course-preset:hover {
  background: #fff8df;
  border-color: #ead799;
  color: var(--red-dark);
}

.gcse-course-preset[aria-pressed="true"] {
  background: #fff3f3;
  border-color: rgba(215, 25, 32, 0.55);
  color: var(--red-dark);
  box-shadow: inset 0 0 0 1px rgba(215, 25, 32, 0.08);
}

/* ----- course groups ----- */

.gcse-topic-group + .gcse-topic-group {
  margin-top: 20px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.gcse-topic-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 10px;
}

.gcse-topic-heading h4 {
  margin: 0;
  color: var(--charcoal);
  font-size: 1rem;
  font-weight: 850;
  letter-spacing: -0.01em;
}

.gcse-topic-heading small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.gcse-topic-heading::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  margin-left: 3px;
  background: #ececef;
}

.gcse-topic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

/* Slight shave from the current 17px cards without making them cramped. */
#topicChoices .topic-choice {
  align-items: center;
  gap: 10px;
  min-height: 56px;
  box-sizing: border-box;
  padding: 12px 14px;
  border-radius: 15px;
}

#topicChoices .topic-choice input {
  width: 18px;
  height: 18px;
  margin-top: 0;
}

#topicChoices .topic-choice strong {
  font-size: 0.95rem;
  line-height: 1.2;
}

/* The four additional Triple Award topics read better as a compact block.
   Keep the same visual treatment as all other GCSE topic cards. */
.gcse-topic-group--triple .gcse-topic-grid {
  max-width: none;
}

@media (max-width: 760px) {
  .gcse-topic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .gcse-topic-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  #topicChoices .topic-choice {
    min-height: 52px;
    padding: 11px 13px;
  }

  .gcse-course-tools {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }
}
