/* Grammar exercises ("Bài tập ngữ pháp") */
.ng-book { margin-bottom: 22px; }
.ng-book h2 { font-size: 1.05em; margin: 0 0 10px; }
.ng-book h2 small { font-weight: 400; margin-left: 6px; }
.ng-unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.ng-unit { display: grid; grid-template-columns: 2.4em 1fr; grid-template-rows: auto auto; column-gap: 10px; row-gap: 2px;
           align-items: center; text-align: left; padding: 10px 12px; }
.ng-unit-no { grid-row: span 2; display: grid; place-items: center; height: 2.4em; border-radius: var(--radius);
              background: var(--surface-2, var(--primary-soft)); font-weight: 700; }
.ng-unit.started .ng-unit-no { background: var(--success-soft); color: var(--success); }
.ng-unit-title { font-weight: 600; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical;
                 -webkit-line-clamp: 2; line-clamp: 2; }

.ng-head, .ng-page { max-width: 760px; margin-inline: auto; }   /* as wide as the exercises (.tr-card) */
.ng-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 6px auto 12px; }
.ng-head h2 { margin: 4px 0 0; }
.ng-page { margin-bottom: 14px; text-align: center; }
.ng-page img { max-width: 100%; border: 1px solid var(--border); border-radius: var(--radius); }

.ng-exercise { margin-bottom: 14px; }
.ng-ex-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 10px; }
.ng-ex-no { flex: none; padding: 2px 8px; border-radius: var(--radius); background: var(--primary-soft); color: var(--primary);
            font-weight: 700; font-size: .9em; }
.ng-words { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ng-words span { padding: 2px 10px; border: 1px solid var(--border); border-radius: 999px; font-weight: 600; }
.ng-context { white-space: pre-wrap; font: inherit; font-size: .92em; background: var(--surface-2, transparent);
              border: 1px dashed var(--border); border-radius: var(--radius); padding: 8px 12px; margin: 0 0 10px; }
.ng-example { color: var(--text-2); margin: 0 0 8px; }
.ng-example span { font-size: .8em; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.ng-items { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ng-items li { display: grid; grid-template-columns: 1.8em 1fr; column-gap: 6px; padding: 6px 8px; border-radius: var(--radius); }
.ng-items li.right { background: var(--success-soft); }
.ng-items li.wrong { background: var(--danger-soft); }
.ng-n { color: var(--muted); font-weight: 700; }
.ng-prompt { line-height: 2.2; }
.ng-line { display: inline-block; }
.ng-line.wide { display: block; }
.ng-line.wide .ng-gap { width: 100%; }
.ng-gap { width: 11em; max-width: 100%; padding: 2px 6px; margin: 0 4px; }
.ng-feedback { grid-column: 2; font-size: .92em; }
.ng-items li.right .ng-feedback { display: none; }   /* the green row says it */
.ng-feedback:empty { display: none; }
@media (max-width: 600px) {
  .ng-unit-grid { grid-template-columns: 1fr; }
  .ng-gap { width: 8em; }
}
