.substitution-drill-item {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e0e0e0;
}

.substitution-drill-item:last-child {
  border-bottom: none;
}

.substitution-drill-template {
  font-weight: 600;
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.substitution-drill-sentence-row {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
}

.substitution-drill-number {
  color: #555;
  flex-shrink: 0;
}

.substitution-drill-table {
  width: 100%;
  border-collapse: collapse;
}

.substitution-drill-table tr {
  vertical-align: top;
}

.substitution-drill-table td {
  padding: 0.2rem 0.5rem 0.2rem 0;
}

.sub-label {
  width: 1.75rem;
  font-weight: 600;
  color: #555;
  white-space: nowrap;
  flex-shrink: 0;
}

.sub-hints {
  width: 45%;
}

.sub-answers {
  width: 55%;
  color: #333;
}

.sub-hint-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}

.sub-hint-btn:hover {
  color: #1976d2;
  text-decoration-style: solid;
}

.sub-hint-btn.active {
  color: #1976d2;
  font-weight: 600;
  text-decoration-style: solid;
}

.sub-sep {
  color: #999;
}

.sub-ans-sep {
  color: #999;
}

.sub-answer-alt {
  color: #888;
  font-style: italic;
  font-size: 0.92em;
}

.sub-alt-sep {
  color: #ccc;
  font-size: 0.85em;
  margin: 0 1px;
}

.sub-answer-group {
  border-radius: 3px;
  transition: background 0.15s ease;
}

.sub-answer-group.highlighted {
  background: #e3f2fd;
  outline: 3px solid #e3f2fd;
}


@media (max-width: 600px) {
  .substitution-drill-table,
  .substitution-drill-table tbody {
    display: block;
  }

  /* Stack hints and answers: label+hints on row 1, answers on row 2 */
  .substitution-drill-table tr {
    display: grid;
    grid-template-columns: 1.75rem 1fr;
    grid-template-areas:
      "label hints"
      ".     answers";
    padding: 0.3rem 0;
  }

  .substitution-drill-table td {
    display: block;
    padding: 0.1rem 0;
  }

  .sub-label   { grid-area: label;   width: auto; }
  .sub-hints   { grid-area: hints;   width: auto; }
  .sub-answers { grid-area: answers; width: auto; padding-top: 0.25rem; }
}
