.tk-nv-results {
  min-width: 0;
  container: tk-nv-results / inline-size;
}

.tk-nv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 228px), 1fr));
  gap: 12px;
}

/* Fit labels before adding columns; cap density even when browser zoom is low. */
@container tk-nv-results (width >= 1200px) {
  .tk-nv-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
}

@container tk-nv-results (width >= 1500px) {
  .tk-nv-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@container tk-nv-results (width >= 1980px) {
  .tk-nv-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; max-width: 2500px; margin-inline: auto; }
}

.tk-nv-card {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  align-content: start;
  border: 1px solid #dbe4ee;
  border-radius: 12px;
  background: white;
  color: #172b45;
  box-shadow: 0 2px 4px #142b4412;
  container: tk-nv-card / inline-size;
}

.tk-nv-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 11px 11px 0 0;
  background: #142436;
  cursor: pointer;
}

.tk-nv-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tk-nv-duration {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 2px 4px;
  border-radius: 4px;
  background: #101827ea;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tk-nv-info { display: grid; grid-template-rows: auto auto 1fr; align-items: start; gap: 5px; min-width: 0; padding: 8px; }
.tk-nv-title { margin: 0; min-width: 0; font-size: 13px; font-weight: 700; line-height: 1.25; }
.tk-nv-title button {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  max-width: 100%;
  overflow: hidden;
  text-align: start;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.tk-nv-channel { display: flex; align-items: center; min-width: 0; gap: 5px; color: #23558d; font-size: 11px; line-height: 1.2; }
.tk-nv-channel img, .tk-nv-initial { width: 17px; height: 17px; flex: 0 0 17px; border-radius: 50%; object-fit: cover; }
.tk-nv-initial { display: grid; place-items: center; background: #e8f1fc; color: #214e85; font-size: 10px; font-weight: 700; }
.tk-nv-channel-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-nv-title button:hover, .tk-nv-channel:hover { color: #155db8; text-decoration: underline; }
.tk-nv-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; align-self: end; }
.tk-nv-action {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 32px;
  gap: 4px;
  padding: 3px 4px;
  border-radius: 7px;
  color: white;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.tk-nv-action svg, .tk-nv-stat svg { flex: 0 0 auto; }
.tk-nv-analyze { background: #b74404; }
.tk-nv-play { background: #145bc3; }
.tk-nv-spy { background: #2c3e50; }
.tk-nv-action:hover { filter: brightness(1.12); }
.tk-nv-card :is(button, a):focus-visible { outline: 2px solid #176fd1; outline-offset: 2px; z-index: 1; }

.tk-nv-stats {
  display: grid;
  grid-template-columns: minmax(80px, 1.15fr) repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin: 0 8px 8px;
  padding-top: 5px;
  border-top: 1px solid #e5edf5;
}

.tk-nv-stat {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 5px;
  background: #f2f6fa;
  font-size: 10px;
  line-height: 1.15;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tk-nv-stat svg { color: #60758c; width: 12px; height: 12px; }
.tk-nv-stat-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}
.tk-nv-stat-compact { display: none; }
@container tk-nv-card (width < 370px) {
  .tk-nv-stat-value.has-compact .tk-nv-stat-full { display: none; }
  .tk-nv-stat-value.has-compact .tk-nv-stat-compact { display: inline; }
}
.tk-nv-likes, .tk-nv-score-low { color: #a32735; }
.tk-nv-comments, .tk-nv-score-good { color: #05724b; }
.tk-nv-score-mid { color: #994805; }
.tk-nv-vph { color: #155db8; }
.tk-nv-sr { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@container tk-nv-card (width < 270px) {
  .tk-nv-action-label { display: none; }
  .tk-nv-action svg { width: 17px; height: 17px; }
}

@container tk-nv-results (width < 520px) {
  .tk-nv-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .tk-nv-card {
    grid-template-columns: clamp(76px, 29cqi, 124px) minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: start;
    column-gap: 8px;
    padding: 7px;
  }
  .tk-nv-thumb { border-radius: 7px; }
  .tk-nv-info { padding: 0; }
  .tk-nv-action-label { display: none; }
  .tk-nv-action svg { width: 17px; height: 17px; }
  .tk-nv-stats { grid-column: 1 / -1; margin: 6px 0 0; }
}

@media (pointer: coarse) {
  .tk-nv-action { min-height: 44px; }
  .tk-nv-actions { gap: 5px; }
}

/* Compact icon controls for the mobile, horizontal card layout only. */
@container tk-nv-results (width < 520px) {
  .tk-nv-actions {
    grid-template-columns: repeat(3, 34px);
    width: max-content;
    justify-self: start;
    justify-content: start;
    align-self: start;
    gap: 6px;
  }
  .tk-nv-action {
    width: 34px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    border-radius: 6px;
  }
  .tk-nv-action svg { width: 15px; height: 15px; }
}
