.theory-browser-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; padding: 18px; }
.theory-browser-controls label { display: grid; gap: 7px; color: var(--ink); font-weight: 700; min-width: 0; }
.theory-search-label { flex: 1 1 280px; }
.theory-browser-controls input, .theory-browser-controls select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--control-line); border-radius: 4px; background: var(--paper, #fff); color: var(--ink); font: inherit; font-weight: 400; }
.theory-result-count { margin: 14px 0; }
.theory-topic { padding: 0; min-width: 0; }
.theory-topic-summary { display: flex; align-items: center; gap: 14px; padding: 18px 20px; cursor: pointer; list-style: none; border-radius: inherit; }
.theory-topic-summary::-webkit-details-marker { display: none; }
.theory-topic-copy { margin: 0; font: inherit; display: grid; gap: 5px; min-width: 0; flex: 1; }
.theory-topic-title { font-size: 20px; font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.theory-topic-subtitle { font-weight: 400; color: var(--muted); font-size: 14px; line-height: 1.45; }
.theory-topic-chevron { flex: 0 0 20px; transition: transform .15s ease; }
.theory-topic[open] > summary .theory-topic-chevron { transform: rotate(90deg); }
.theory-topic-body { padding: 0 20px 20px; }
.theory-lesson-link { margin-top: 16px; }
.theory-lesson-link .button { text-align: left; white-space: normal; max-width: 100%; }
.theory-empty { padding: 20px; }
.theory-topic[hidden], .theory-empty[hidden], #theory-reset[hidden] { display: none; }
@media (max-width: 560px) {
  .theory-browser-controls { padding: 16px; gap: 12px; }
  .theory-search-label { flex-basis: 100%; }
  .theory-browser-controls > label:not(.theory-search-label) { flex: 1; }
  .theory-topic-summary { padding: 16px; }
  .theory-topic-body { padding: 0 16px 16px; }
  .theory-topic-title { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) { .theory-topic-chevron { transition: none; } }

/* Shared reading layout for notes, lesson introductions and the reference dialog. */
.theory-sections { gap: 28px; }
.theory-section { min-width: 0; }
.theory-section h4 { margin-bottom: 14px; font-size: 1.05rem; line-height: 1.4; }
.theory-section p { max-width: 70ch; line-height: 1.7; color: var(--ink); }
.theory-section p + p { margin-top: 16px; }
.theory-rule { padding: 20px 24px; border-inline-start: 3px solid var(--blue); background: var(--blue-soft); border-radius: 0 4px 4px 0; }
.theory-section + .theory-rule { border-top: 0; padding-top: 20px; }
.theory-example { padding: 14px 0; align-items: flex-start; }
.theory-example small { margin-top: 5px; line-height: 1.55; }
.theory-table th { background: var(--blue-soft); color: var(--ink); }
.theory-table td { line-height: 1.6; }
@media (max-width: 600px) {
  .theory-rule { padding: 16px; }
  .theory-section + .theory-rule { padding-top: 16px; }
}
