/* Only the18 reviewed page IDs receive this stylesheet and the matching data hook. */
/* Vocabulary columns retain their original order; multiple paragraphs flow vertically. */
:is(.grammar-details-cnt[data-rlc-reader-table-page="28644"], .grammar-details-cnt[data-rlc-reader-table-page="28663"]) .words-table-title,
:is(.grammar-details-cnt[data-rlc-reader-table-page="28644"], .grammar-details-cnt[data-rlc-reader-table-page="28663"]) .word-bold-item,
:is(.grammar-details-cnt[data-rlc-reader-table-page="28644"], .grammar-details-cnt[data-rlc-reader-table-page="28663"]) .word-item {
  min-width: 0;
  width: auto;
  flex: 1 1 0;
  overflow-wrap: anywhere;
}
:is(.grammar-details-cnt[data-rlc-reader-table-page="28644"], .grammar-details-cnt[data-rlc-reader-table-page="28663"]) .word-bold-item,
:is(.grammar-details-cnt[data-rlc-reader-table-page="28644"], .grammar-details-cnt[data-rlc-reader-table-page="28663"]) .word-item {
  flex-direction: column;
  row-gap: 0.25em;
}
:is(.grammar-details-cnt[data-rlc-reader-table-page="28644"], .grammar-details-cnt[data-rlc-reader-table-page="28663"]) .word-bold-item > p,
:is(.grammar-details-cnt[data-rlc-reader-table-page="28644"], .grammar-details-cnt[data-rlc-reader-table-page="28663"]) .word-item > p {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 767px) {
  .grammar-details-cnt[data-rlc-reader-table-page="41395"] .dz-table th,
  .grammar-details-cnt[data-rlc-reader-table-page="41395"] .dz-table td {
    overflow-wrap: anywhere;
  }
}

/* Only heading-bearing two-column tables; separate bilingual example tables stay as before. */
@media (max-width: 768px) {
  :is(
    .grammar-details-cnt[data-rlc-reader-table-page="21622"] .grammar-description > .grammar-table:nth-of-type(1),
    .grammar-details-cnt[data-rlc-reader-table-page="21625"] .grammar-description > .grammar-table:nth-of-type(2),
    .grammar-details-cnt[data-rlc-reader-table-page="21634"] .grammar-description > .grammar-table:nth-of-type(1),
    .grammar-details-cnt[data-rlc-reader-table-page="21634"] .grammar-description > .grammar-table:nth-of-type(3),
    .grammar-details-cnt[data-rlc-reader-table-page="21777"] .grammar-description > .grammar-table:nth-of-type(1),
    .grammar-details-cnt[data-rlc-reader-table-page="21798"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21806"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21814"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21817"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21821"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21824"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21842"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21853"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21856"] .grammar-description > .grammar-table
  ) > .grammar-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  :is(
    .grammar-details-cnt[data-rlc-reader-table-page="21622"] .grammar-description > .grammar-table:nth-of-type(1),
    .grammar-details-cnt[data-rlc-reader-table-page="21625"] .grammar-description > .grammar-table:nth-of-type(2),
    .grammar-details-cnt[data-rlc-reader-table-page="21634"] .grammar-description > .grammar-table:nth-of-type(1),
    .grammar-details-cnt[data-rlc-reader-table-page="21634"] .grammar-description > .grammar-table:nth-of-type(3),
    .grammar-details-cnt[data-rlc-reader-table-page="21777"] .grammar-description > .grammar-table:nth-of-type(1),
    .grammar-details-cnt[data-rlc-reader-table-page="21798"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21806"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21814"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21817"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21821"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21824"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21842"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21853"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21856"] .grammar-description > .grammar-table
  ) > .grammar-row > .grammar-col {
    min-width: 0;
    padding: 12px 10px;
    overflow-wrap: anywhere;
  }
  :is(
    .grammar-details-cnt[data-rlc-reader-table-page="21622"] .grammar-description > .grammar-table:nth-of-type(1),
    .grammar-details-cnt[data-rlc-reader-table-page="21625"] .grammar-description > .grammar-table:nth-of-type(2),
    .grammar-details-cnt[data-rlc-reader-table-page="21634"] .grammar-description > .grammar-table:nth-of-type(1),
    .grammar-details-cnt[data-rlc-reader-table-page="21634"] .grammar-description > .grammar-table:nth-of-type(3),
    .grammar-details-cnt[data-rlc-reader-table-page="21777"] .grammar-description > .grammar-table:nth-of-type(1),
    .grammar-details-cnt[data-rlc-reader-table-page="21798"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21806"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21814"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21817"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21821"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21824"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21842"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21853"] .grammar-description > .grammar-table,
    .grammar-details-cnt[data-rlc-reader-table-page="21856"] .grammar-description > .grammar-table
  ) > .grammar-row > .grammar-col:first-child {
    border-right: 1px solid #d9d9d9;
    border-bottom: none;
  }
}

/*21774 first table: person / singular / plural; its later example table is untouched. */
.grammar-details-cnt[data-rlc-reader-table-page="21774"] .grammar-description > .grammar-table:first-of-type > .grammar-row {
  grid-template-columns: minmax(64px, 0.35fr) repeat(2, minmax(0, 1fr));
}
.grammar-details-cnt[data-rlc-reader-table-page="21774"] .grammar-description > .grammar-table:first-of-type > .grammar-row > .grammar-col {
  min-width: 0;
  overflow-wrap: anywhere;
}
.grammar-details-cnt[data-rlc-reader-table-page="21774"] .grammar-description > .grammar-table:first-of-type > .grammar-row > .grammar-col:first-child {
  border-right: none;
  border-bottom: none;
}
.grammar-details-cnt[data-rlc-reader-table-page="21774"] .grammar-description > .grammar-table:first-of-type > .grammar-row > .grammar-col + .grammar-col {
  border-left: 1px solid #d9d9d9;
}
/* Keep both long column headings whole at the narrowest reviewed widths. */
@media (max-width: 390px) {
  .grammar-details-cnt[data-rlc-reader-table-page="21774"] .grammar-description > .grammar-table:first-of-type > .grammar-row {
    grid-template-columns: minmax(64px, 0.35fr) minmax(0, 1fr) minmax(0, 1.1fr);
  }
}
@media (max-width: 768px) {
  .grammar-details-cnt[data-rlc-reader-table-page="21774"] .grammar-description > .grammar-table:first-of-type > .grammar-row > .grammar-col {
    padding: 12px 8px;
  }
}

/* Two further candidate-content findings: numeric tokens and a long medical lemma. */
@media (max-width: 767px) {
  .grammar-details-cnt[data-rlc-reader-table-page="41395"] .dz-wrap > .dz-card:is(:nth-of-type(2), :nth-of-type(3)) > .dz-table-box > .dz-table td {
    padding-left: 8px;
    padding-right: 8px;
  }
  .grammar-details-cnt[data-rlc-reader-table-page="41395"] .dz-wrap > .dz-card:is(:nth-of-type(2), :nth-of-type(3)) > .dz-table-box > .dz-table td:first-child {
    overflow-wrap: normal;
  }
  .grammar-details-cnt[data-rlc-reader-table-page="41395"] .dz-wrap > .dz-card:nth-of-type(2) > .dz-table-box > .dz-table td:first-child {
    white-space: nowrap;
  }
  .grammar-details-cnt[data-rlc-reader-table-page="41395"] .dz-wrap > .dz-card:is(:nth-of-type(2), :nth-of-type(3)) > .dz-table-box > .dz-table td:nth-child(2) {
    width: 40%;
  }
  .grammar-details-cnt[data-rlc-reader-table-page="41395"] .dz-wrap > .dz-card:is(:nth-of-type(2), :nth-of-type(3)) > .dz-table-box > .dz-table td:nth-child(2) > p {
    word-break: break-all;
    overflow-wrap: normal;
    text-wrap: balance;
  }
}
.grammar-details-cnt[data-rlc-reader-table-page="28740"] > .words-table > .words-row > .word-bold-item > p {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}


/* Accepted final content: keep avere/essere and Indicativo pairs aligned. */
@media (max-width: 768px) {
  :is(
    .grammar-details-cnt[data-rlc-reader-table-page="22507"] .grammar-description > .grammar-table:first-of-type,
    .grammar-details-cnt[data-rlc-reader-table-page="21826"] .grammar-description > .grammar-table:first-of-type
  ) > .grammar-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  :is(
    .grammar-details-cnt[data-rlc-reader-table-page="22507"] .grammar-description > .grammar-table:first-of-type,
    .grammar-details-cnt[data-rlc-reader-table-page="21826"] .grammar-description > .grammar-table:first-of-type
  ) > .grammar-row > .grammar-col {
    min-width: 0;
    padding: 12px 10px;
    overflow-wrap: anywhere;
  }
  :is(
    .grammar-details-cnt[data-rlc-reader-table-page="22507"] .grammar-description > .grammar-table:first-of-type,
    .grammar-details-cnt[data-rlc-reader-table-page="21826"] .grammar-description > .grammar-table:first-of-type
  ) > .grammar-row > .grammar-col:first-child {
    border-right: 1px solid #d9d9d9;
    border-bottom: none;
  }
}

/*21781 changes its three headings within each table; keep every row in order. */
.grammar-details-cnt[data-rlc-reader-table-page="21781"] .grammar-description > .grammar-table:is(:nth-of-type(3), :nth-of-type(4), :nth-of-type(5), :nth-of-type(7)) > .grammar-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grammar-details-cnt[data-rlc-reader-table-page="21781"] .grammar-description > .grammar-table:is(:nth-of-type(3), :nth-of-type(4), :nth-of-type(5), :nth-of-type(7)) > .grammar-row > .grammar-col {
  min-width: 0;
  overflow-wrap: anywhere;
  border-right: none;
  border-bottom: none;
}
.grammar-details-cnt[data-rlc-reader-table-page="21781"] .grammar-description > .grammar-table:is(:nth-of-type(3), :nth-of-type(4), :nth-of-type(5), :nth-of-type(7)) > .grammar-row > .grammar-col + .grammar-col {
  border-left: 1px solid #d9d9d9;
}
@media (max-width: 768px) {
  .grammar-details-cnt[data-rlc-reader-table-page="21781"] .grammar-description > .grammar-table:is(:nth-of-type(3), :nth-of-type(4), :nth-of-type(5), :nth-of-type(7)) > .grammar-row > .grammar-col {
    padding: 12px 8px;
  }
}

/* Complete single-cell examples/group labels span their existing row. */
:is(
  .grammar-details-cnt[data-rlc-reader-table-page="21601"] .grammar-description > .grammar-table:nth-of-type(4) > .grammar-row:first-child,
  .grammar-details-cnt[data-rlc-reader-table-page="21781"] .grammar-description > .grammar-table:is(:nth-of-type(3), :nth-of-type(4), :nth-of-type(5)) > .grammar-row:last-child,
  .grammar-details-cnt[data-rlc-reader-table-page="21826"] .grammar-description > .grammar-table:first-of-type > .grammar-row:first-child
) > .grammar-col:only-child {
  grid-column: 1 / -1;
  border-right: none;
  border-left: none;
  border-bottom: none;
}
